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 !
Add search UI with menu
Caged (author)
Thu Jun 12 20:46:11 -0700 2008
commit  6040395dc9ee34a36fd1ad92802bef9a956b8831
tree    486b421d49cc8535504ef5dbcdbdaaaaaf3a453c
parent  191bb02b09cb4e140b600e7fb9073d3fa23dc7cb
...
36
37
38
 
39
40
41
...
58
59
60
 
61
62
63
...
81
82
83
 
 
 
 
 
 
 
 
84
85
86
...
101
102
103
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
104
105
...
36
37
38
39
40
41
42
...
59
60
61
62
63
64
65
...
83
84
85
86
87
88
89
90
91
92
93
94
95
96
...
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
0
@@ -36,6 +36,7 @@ class ApplicationController < OSX::NSObject
0
   ib_outlet :local_branches_menu
0
   ib_outlet :remote_branches_menu
0
   ib_outlet :tags_menu
0
+  ib_outlet :search_field
0
   
0
   def applicationDidFinishLaunching(sender)
0
     @window.makeKeyAndOrderFront(self)
0
@@ -58,6 +59,7 @@ class ApplicationController < OSX::NSObject
0
       @branch_field.cell.setBackgroundStyle(NSBackgroundStyleRaised)
0
       
0
       setup_refs_view_menu
0
+      setup_search_field
0
     end
0
   end
0
   
0
@@ -81,6 +83,14 @@ class ApplicationController < OSX::NSObject
0
     @tab_panel.selectTabViewItemWithIdentifier(tag)
0
   end
0
   
0
+  def set_search_category(sender)
0
+    menu = @search_field.cell.searchMenuTemplate
0
+    menu.itemWithTitle(@current_search_item).setState(NSOffState)
0
+    menu.itemWithTitle(sender.title).setState(NSOnState)
0
+    @search_field.cell.setSearchMenuTemplate(menu)
0
+    @current_search_item = sender.title
0
+  end
0
+  
0
   private
0
     def setup_refs_view_menu
0
       [@local_branches_menu, @remote_branches_menu, @tags_menu].each { |m| m.submenu.setAutoenablesItems(false) }
0
@@ -101,5 +111,29 @@ class ApplicationController < OSX::NSObject
0
       add_menu_item.call(heads, @local_branches_menu)
0
       add_menu_item.call(repo.remotes, @remote_branches_menu)
0
       add_menu_item.call(repo.tags, @tags_menu)
0
+    end  
0
+    
0
+    def setup_search_field
0
+      @search_menu = NSMenu.alloc.initWithTitle("Search Menu")
0
+      @search_field.cell.setSearchMenuTemplate(@search_menu)
0
+      @search_menu.setAutoenablesItems(false)
0
+      
0
+      add_menu_item = lambda do |title, tooltip, state|
0
+        item = NSMenuItem.alloc.initWithTitle_action_keyEquivalent(title, :set_search_category, "")
0
+        @search_menu.addItem(item)
0
+        item.setToolTip(tooltip)
0
+        item.setEnabled(true)
0
+        item.setTarget(self)
0
+        if state
0
+          item.setState(NSOnState)
0
+          @current_search_item =  title
0
+        end
0
+      end
0
+      
0
+      add_menu_item.call("Commits", "Search commit messages", true)
0
+      add_menu_item.call("SHA1", "Find a commit by its SHA1 hash", false)
0
+      add_menu_item.call("Author", "Find all all commits by a particular author", false)
0
+      add_menu_item.call("Path", "Find commits based on a path", false)
0
+
0
     end
0
 end
...
519
520
521
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
522
523
524
...
1459
1460
1461
 
 
 
 
 
 
 
 
1462
1463
1464
...
1504
1505
1506
 
1507
1508
1509
...
2131
2132
2133
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2134
2135
2136
...
2265
2266
2267
 
 
2268
2269
2270
...
2303
2304
2305
2306
 
2307
2308
 
2309
2310
2311
...
2439
2440
2441
 
 
2442
2443
2444
...
2468
2469
2470
2471
 
2472
2473
2474
...
2501
2502
2503
 
2504
2505
2506
...
2518
2519
2520
 
2521
2522
2523
...
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
...
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
...
1581
1582
1583
1584
1585
1586
1587
...
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
...
2357
2358
2359
2360
2361
2362
2363
2364
...
2397
2398
2399
 
2400
2401
 
2402
2403
2404
2405
...
2533
2534
2535
2536
2537
2538
2539
2540
...
2564
2565
2566
 
2567
2568
2569
2570
...
2597
2598
2599
2600
2601
2602
2603
...
2615
2616
2617
2618
2619
2620
2621
0
@@ -519,6 +519,75 @@
0
                 <int key="NSSegmentStyle">2</int>
0
               </object>
0
             </object>
0
+            <object class="NSSearchField" id="444059892">
0
+              <reference key="NSNextResponder" ref="831824449"/>
0
+              <int key="NSvFlags">292</int>
0
+              <string key="NSFrame">{{292, 11}, {154, 22}}</string>
0
+              <reference key="NSSuperview" ref="831824449"/>
0
+              <bool key="NSEnabled">YES</bool>
0
+              <object class="NSSearchFieldCell" key="NSCell" id="534219204">
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="444059892"/>
0
+                <bool key="NSDrawsBackground">YES</bool>
0
+                <int key="NSTextBezelStyle">1</int>
0
+                <object class="NSColor" key="NSBackgroundColor">
0
+                  <int key="NSColorSpace">6</int>
0
+                  <string key="NSCatalogName">System</string>
0
+                  <string key="NSColorName">textBackgroundColor</string>
0
+                  <object class="NSColor" key="NSColor">
0
+                    <int key="NSColorSpace">3</int>
0
+                    <bytes key="NSWhite">MQA</bytes>
0
+                  </object>
0
+                </object>
0
+                <reference key="NSTextColor" ref="394328784"/>
0
+                <object class="NSButtonCell" key="NSSearchButtonCell">
0
+                  <int key="NSCellFlags">130560</int>
0
+                  <int key="NSCellFlags2">0</int>
0
+                  <string key="NSContents">search</string>
0
+                  <string key="NSAction">_searchFieldSearch:</string>
0
+                  <reference key="NSTarget" ref="534219204"/>
0
+                  <reference key="NSControlView" ref="444059892"/>
0
+                  <int key="NSButtonFlags">138690815</int>
0
+                  <int key="NSButtonFlags2">0</int>
0
+                  <string key="NSKeyEquivalent"/>
0
+                  <int key="NSPeriodicDelay">400</int>
0
+                  <int key="NSPeriodicInterval">75</int>
0
+                </object>
0
+                <object class="NSButtonCell" key="NSCancelButtonCell">
0
+                  <int key="NSCellFlags">130560</int>
0
+                  <int key="NSCellFlags2">0</int>
0
+                  <string key="NSContents">clear</string>
0
+                  <object class="NSMutableArray" key="NSAccessibilityOverriddenAttributes">
0
+                    <bool key="EncodedWithXMLCoder">YES</bool>
0
+                    <object class="NSMutableDictionary">
0
+                      <bool key="EncodedWithXMLCoder">YES</bool>
0
+                      <object class="NSMutableArray" key="dict.sortedKeys">
0
+                        <bool key="EncodedWithXMLCoder">YES</bool>
0
+                        <string>AXDescription</string>
0
+                        <string>NSAccessibilityEncodedAttributesValueType</string>
0
+                      </object>
0
+                      <object class="NSMutableArray" key="dict.values">
0
+                        <bool key="EncodedWithXMLCoder">YES</bool>
0
+                        <string>cancel</string>
0
+                        <reference ref="9"/>
0
+                      </object>
0
+                    </object>
0
+                  </object>
0
+                  <string key="NSAction">_searchFieldCancel:</string>
0
+                  <reference key="NSTarget" ref="534219204"/>
0
+                  <reference key="NSControlView" ref="444059892"/>
0
+                  <int key="NSButtonFlags">138690815</int>
0
+                  <int key="NSButtonFlags2">0</int>
0
+                  <string key="NSKeyEquivalent"/>
0
+                  <int key="NSPeriodicDelay">400</int>
0
+                  <int key="NSPeriodicInterval">75</int>
0
+                </object>
0
+                <int key="NSMaximumRecents">255</int>
0
+              </object>
0
+            </object>
0
           </object>
0
           <string key="NSFrameSize">{990, 682}</string>
0
           <reference key="NSSuperview"/>
0
@@ -1459,6 +1528,14 @@
0
           </object>
0
           <int key="connectionID">529</int>
0
         </object>
0
+        <object class="IBConnectionRecord">
0
+          <object class="IBOutletConnection" key="connection">
0
+            <string key="label">search_field</string>
0
+            <reference key="source" ref="620275248"/>
0
+            <reference key="destination" ref="444059892"/>
0
+          </object>
0
+          <int key="connectionID">555</int>
0
+        </object>
0
       </object>
0
       <object class="IBMutableOrderedSet" key="objectRecords">
0
         <object class="NSArray" key="orderedObjects">
0
@@ -1504,6 +1581,7 @@
0
               <reference ref="869639466"/>
0
               <reference ref="1049027428"/>
0
               <reference ref="637722390"/>
0
+              <reference ref="444059892"/>
0
             </object>
0
             <reference key="parent" ref="469667931"/>
0
           </object>
0
@@ -2131,6 +2209,20 @@
0
             <reference key="parent" ref="269908025"/>
0
             <string key="objectName">NetorkController</string>
0
           </object>
0
+          <object class="IBObjectRecord">
0
+            <int key="objectID">553</int>
0
+            <reference key="object" ref="444059892"/>
0
+            <object class="NSMutableArray" key="children">
0
+              <bool key="EncodedWithXMLCoder">YES</bool>
0
+              <reference ref="534219204"/>
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="534219204"/>
0
+            <reference key="parent" ref="444059892"/>
0
+          </object>
0
         </object>
0
       </object>
0
       <object class="NSMutableDictionary" key="flattenedProperties">
0
@@ -2265,6 +2357,8 @@
0
           <string>520.IBPluginDependency</string>
0
           <string>525.IBPluginDependency</string>
0
           <string>526.IBPluginDependency</string>
0
+          <string>553.IBPluginDependency</string>
0
+          <string>554.IBPluginDependency</string>
0
           <string>56.IBPluginDependency</string>
0
           <string>56.ImportedFromIB2</string>
0
           <string>57.IBEditorWindowLastContentRect</string>
0
@@ -2303,9 +2397,9 @@
0
           <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
0
           <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
0
           <reference ref="9"/>
0
-          <string>{{44, 112}, {990, 682}}</string>
0
+          <string>{{52, 157}, {990, 682}}</string>
0
           <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
0
-          <string>{{44, 112}, {990, 682}}</string>
0
+          <string>{{52, 157}, {990, 682}}</string>
0
           <reference ref="9"/>
0
           <reference ref="9"/>
0
           <string>{{146, 174}, {990, 682}}</string>
0
@@ -2439,6 +2533,8 @@
0
           <string>com.apple.WebKitIBPlugin</string>
0
           <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
0
           <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
0
+          <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
0
+          <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
0
           <reference ref="9"/>
0
           <string>{{488, 641}, {218, 193}}</string>
0
           <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
0
@@ -2468,7 +2564,7 @@
0
         </object>
0
       </object>
0
       <nil key="sourceID"/>
0
-      <int key="maxID">552</int>
0
+      <int key="maxID">555</int>
0
     </object>
0
     <object class="IBClassDescriber" key="IBDocument.Classes">
0
       <object class="NSMutableArray" key="referencedPartialClassDescriptions">
0
@@ -2501,6 +2597,7 @@
0
               <string>main_canvas</string>
0
               <string>main_view</string>
0
               <string>remote_branches_menu</string>
0
+              <string>search_field</string>
0
               <string>tab_panel</string>
0
               <string>tags_menu</string>
0
               <string>window</string>
0
@@ -2518,6 +2615,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