public
Description: A Gitk-like application written in RubyCocoa that looks like it belongs on a Mac. See the wiki for downloads and screenshots.
Homepage: http://alternateidea.com
Clone URL: git://github.com/Caged/gitnub.git
Click here to lend your support to: gitnub and make a donation at www.pledgie.com !
Toggle controls when swapping from network view to commits view
Caged (author)
Fri Jun 13 15:32:21 -0700 2008
commit  74cd84c5dc65def307b9f8043e0abff9ebdf3862
tree    828ea69936964e5d5d1c079d59a43a5cadf3ced5
parent  fb7a785963ed20fdcd2fc067c016e1c17a198d84
...
14
15
16
 
17
18
19
...
37
38
39
 
40
41
42
...
57
58
59
 
60
61
62
 
 
 
 
 
 
 
 
 
 
63
64
65
...
95
96
97
 
 
 
98
99
100
...
14
15
16
17
18
19
20
...
38
39
40
41
42
43
44
...
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
...
108
109
110
111
112
113
114
115
116
0
@@ -14,6 +14,7 @@ $:.unshift(libdir, "#{libdir}/grit/lib", "#{libdir}/mime-types/lib")
0
 require 'grit'
0
 require 'time_extensions'
0
 require 'string_extensions'
0
+require 'osx_notify'
0
 require 'InfoWindowController'
0
 
0
 OSX.ns_import 'CommitSummaryCell'
0
@@ -37,6 +38,7 @@ class ApplicationController < OSX::NSObject
0
   ib_outlet :remote_branches_menu
0
   ib_outlet :tags_menu
0
   ib_outlet :search_field
0
+  ib_outlet :paging_segment
0
   
0
   def applicationDidFinishLaunching(sender)
0
     @window.makeKeyAndOrderFront(self)
0
@@ -57,9 +59,20 @@ class ApplicationController < OSX::NSObject
0
       @main_canvas.addSubview(@main_view)    
0
     
0
       @branch_field.cell.setBackgroundStyle(NSBackgroundStyleRaised)
0
+      @tab_panel.setDelegate(self)
0
       
0
       setup_refs_view_menu
0
       setup_search_field
0
+      
0
+      Notify.on "tab_view_changed" do |opts|
0
+        if(opts[:tab_item] != "commits")
0
+          @paging_segment.setEnabled(false)
0
+          @search_field.setEnabled(false)
0
+        else
0
+          @paging_segment.setEnabled(true)
0
+          @search_field.setEnabled(true)
0
+        end
0
+      end
0
     end
0
   end
0
   
0
@@ -95,6 +108,9 @@ class ApplicationController < OSX::NSObject
0
     @commits_controller.search_commits(@current_search_item, sender.stringValue)
0
   end
0
   
0
+  def tabView_didSelectTabViewItem(tab_view, tab_item)
0
+    Notify.send "tab_view_changed", { :tab_item => tab_item.identifier }
0
+  end
0
   
0
   private
0
     def setup_refs_view_menu
...
24
25
26
 
27
28
29
...
70
71
72
73
74
75
 
 
 
 
76
77
 
 
78
79
80
...
226
227
228
 
229
230
231
...
24
25
26
27
28
29
30
...
71
72
73
 
 
 
74
75
76
77
78
 
79
80
81
82
83
...
229
230
231
232
233
234
235
0
@@ -24,6 +24,7 @@ class CommitsController < OSX::NSObject
0
   ib_outlet :application_controller
0
   
0
   def awakeFromNib  
0
+    @searching = false
0
     @current_commit_offset = 0
0
     @offset = 50
0
     @active_commit = nil
0
@@ -70,11 +71,13 @@ class CommitsController < OSX::NSObject
0
       when 2 then @current_commit_offset += @offset
0
     end
0
     
0
-    @current_commit_offset = 0 if @current_commit_offset == -(@offset)
0
-    fetch_commits_for(@branch, @offset, @current_commit_offset)
0
-    @commits_table.reloadData
0
+    unless @searching
0
+      @current_commit_offset = 0 if @current_commit_offset == -(@offset)
0
+      fetch_commits_for(@branch, @offset, @current_commit_offset)
0
+      @commits_table.reloadData
0
     
0
-    select_latest_commit  
0
+      select_latest_commit
0
+    end
0
     
0
     if @commits.size == 0 || @current_commit_offset == 0
0
       @paging_segment.setEnabled_forSegment(false, 0)
0
@@ -226,6 +229,7 @@ class CommitsController < OSX::NSObject
0
   
0
   def search_commits(category, query)
0
     unless query == ""
0
+      @searching = true
0
       repo = @application_controller.repo
0
       case category.downcase.to_sym
0
         when :message
...
519
520
521
522
 
523
524
525
526
527
528
 
529
530
531
532
533
 
534
535
536
...
548
549
550
551
552
 
 
553
554
555
...
577
578
579
580
581
 
 
582
583
584
...
1532
1533
1534
1535
 
1536
1537
1538
 
 
 
 
 
 
 
 
1539
1540
1541
...
1581
1582
1583
1584
 
1585
1586
1587
...
2211
2212
2213
2214
 
2215
2216
2217
 
2218
2219
2220
2221
2222
2223
2224
 
 
2225
2226
2227
...
2564
2565
2566
2567
 
2568
2569
2570
...
2596
2597
2598
 
2599
2600
2601
...
2616
2617
2618
 
2619
2620
2621
...
519
520
521
 
522
523
524
525
526
527
 
528
529
530
531
532
 
533
534
535
536
...
548
549
550
 
 
551
552
553
554
555
...
577
578
579
 
 
580
581
582
583
584
...
1532
1533
1534
 
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
...
1589
1590
1591
 
1592
1593
1594
1595
...
2219
2220
2221
 
2222
2223
2224
 
2225
2226
2227
2228
2229
2230
 
 
2231
2232
2233
2234
2235
...
2572
2573
2574
 
2575
2576
2577
2578
...
2604
2605
2606
2607
2608
2609
2610
...
2625
2626
2627
2628
2629
2630
2631
0
@@ -519,18 +519,18 @@
0
                 <int key="NSSegmentStyle">2</int>
0
               </object>
0
             </object>
0
-            <object class="NSSearchField" id="349599463">
0
+            <object class="NSSearchField" id="829811974">
0
               <reference key="NSNextResponder" ref="831824449"/>
0
               <int key="NSvFlags">292</int>
0
               <string key="NSFrame">{{347, 11}, {189, 22}}</string>
0
               <reference key="NSSuperview" ref="831824449"/>
0
               <bool key="NSEnabled">YES</bool>
0
-              <object class="NSSearchFieldCell" key="NSCell" id="508547132">
0
+              <object class="NSSearchFieldCell" key="NSCell" id="183119731">
0
                 <int key="NSCellFlags">343014976</int>
0
                 <int key="NSCellFlags2">268436480</int>
0
                 <string key="NSContents"/>
0
                 <reference key="NSSupport" ref="98627494"/>
0
-                <reference key="NSControlView" ref="349599463"/>
0
+                <reference key="NSControlView" ref="829811974"/>
0
                 <bool key="NSDrawsBackground">YES</bool>
0
                 <int key="NSTextBezelStyle">1</int>
0
                 <object class="NSColor" key="NSBackgroundColor">
0
@@ -548,8 +548,8 @@
0
                   <int key="NSCellFlags2">0</int>
0
                   <string key="NSContents">search</string>
0
                   <string key="NSAction">_searchFieldSearch:</string>
0
-                  <reference key="NSTarget" ref="508547132"/>
0
-                  <reference key="NSControlView" ref="349599463"/>
0
+                  <reference key="NSTarget" ref="183119731"/>
0
+                  <reference key="NSControlView" ref="829811974"/>
0
                   <int key="NSButtonFlags">138690815</int>
0
                   <int key="NSButtonFlags2">0</int>
0
                   <string key="NSKeyEquivalent"/>
0
@@ -577,8 +577,8 @@
0
                     </object>
0
                   </object>
0
                   <string key="NSAction">_searchFieldCancel:</string>
0
-                  <reference key="NSTarget" ref="508547132"/>
0
-                  <reference key="NSControlView" ref="349599463"/>
0
+                  <reference key="NSTarget" ref="183119731"/>
0
+                  <reference key="NSControlView" ref="829811974"/>
0
                   <int key="NSButtonFlags">138690815</int>
0
                   <int key="NSButtonFlags2">0</int>
0
                   <string key="NSKeyEquivalent"/>
0
@@ -1532,10 +1532,18 @@
0
           <object class="IBOutletConnection" key="connection">
0
             <string key="label">search_field</string>
0
             <reference key="source" ref="620275248"/>
0
-            <reference key="destination" ref="349599463"/>
0
+            <reference key="destination" ref="829811974"/>
0
           </object>
0
           <int key="connectionID">555</int>
0
         </object>
0
+        <object class="IBConnectionRecord">
0
+          <object class="IBOutletConnection" key="connection">
0
+            <string key="label">paging_segment</string>
0
+            <reference key="source" ref="620275248"/>
0
+            <reference key="destination" ref="421922180"/>
0
+          </object>
0
+          <int key="connectionID">556</int>
0
+        </object>
0
       </object>
0
       <object class="IBMutableOrderedSet" key="objectRecords">
0
         <object class="NSArray" key="orderedObjects">
0
@@ -1581,7 +1589,7 @@
0
               <reference ref="869639466"/>
0
               <reference ref="1049027428"/>
0
               <reference ref="637722390"/>
0
-              <reference ref="349599463"/>
0
+              <reference ref="829811974"/>
0
             </object>
0
             <reference key="parent" ref="469667931"/>
0
           </object>
0
@@ -2211,17 +2219,17 @@
0
           </object>
0
           <object class="IBObjectRecord">
0
             <int key="objectID">553</int>
0
-            <reference key="object" ref="349599463"/>
0
+            <reference key="object" ref="829811974"/>
0
             <object class="NSMutableArray" key="children">
0
               <bool key="EncodedWithXMLCoder">YES</bool>
0
-              <reference ref="508547132"/>
0
+              <reference ref="183119731"/>
0
             </object>
0
             <reference key="parent" ref="831824449"/>
0
           </object>
0
           <object class="IBObjectRecord">
0
             <int key="objectID">554</int>
0
-            <reference key="object" ref="508547132"/>
0
-            <reference key="parent" ref="349599463"/>
0
+            <reference key="object" ref="183119731"/>
0
+            <reference key="parent" ref="829811974"/>
0
           </object>
0
         </object>
0
       </object>
0
@@ -2564,7 +2572,7 @@
0
         </object>
0
       </object>
0
       <nil key="sourceID"/>
0
-      <int key="maxID">555</int>
0
+      <int key="maxID">556</int>
0
     </object>
0
     <object class="IBClassDescriber" key="IBDocument.Classes">
0
       <object class="NSMutableArray" key="referencedPartialClassDescriptions">
0
@@ -2596,6 +2604,7 @@
0
               <string>local_branches_menu</string>
0
               <string>main_canvas</string>
0
               <string>main_view</string>
0
+              <string>paging_segment</string>
0
               <string>remote_branches_menu</string>
0
               <string>search_field</string>
0
               <string>tab_panel</string>
0
@@ -2616,6 +2625,7 @@
0
               <string>id</string>
0
               <string>id</string>
0
               <string>id</string>
0
+              <string>id</string>
0
             </object>
0
           </object>
0
           <object class="IBClassDescriptionSource" key="sourceIdentifier">

Comments