mirror of
https://github.com/kennethreitz-archive/gitx.git
synced 2026-06-05 23:40:18 +00:00
Remember selected view (history or commit)
This commit is contained in:
@@ -2,13 +2,13 @@
|
||||
<archive type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="7.02">
|
||||
<data>
|
||||
<int key="IBDocument.SystemTarget">1050</int>
|
||||
<string key="IBDocument.SystemVersion">9F33</string>
|
||||
<string key="IBDocument.SystemVersion">9E17</string>
|
||||
<string key="IBDocument.InterfaceBuilderVersion">670</string>
|
||||
<string key="IBDocument.AppKitVersion">949.34</string>
|
||||
<string key="IBDocument.AppKitVersion">949.33</string>
|
||||
<string key="IBDocument.HIToolboxVersion">352.00</string>
|
||||
<object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<integer value="5"/>
|
||||
<integer value="47"/>
|
||||
</object>
|
||||
<object class="NSArray" key="IBDocument.PluginDependencies">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
@@ -72,9 +72,10 @@
|
||||
<reference key="NSToolbarItemPaletteLabel" ref="904399424"/>
|
||||
<nil key="NSToolbarItemToolTip"/>
|
||||
<object class="NSSearchField" key="NSToolbarItemView" id="212418890">
|
||||
<nil key="NSNextResponder"/>
|
||||
<reference key="NSNextResponder"/>
|
||||
<int key="NSvFlags">265</int>
|
||||
<string key="NSFrame">{{0, 14}, {183, 22}}</string>
|
||||
<reference key="NSSuperview"/>
|
||||
<bool key="NSEnabled">YES</bool>
|
||||
<object class="NSSearchFieldCell" key="NSCell" id="902542524">
|
||||
<int key="NSCellFlags">343014976</int>
|
||||
@@ -170,9 +171,10 @@
|
||||
<string key="NSToolbarItemPaletteLabel">Branch</string>
|
||||
<nil key="NSToolbarItemToolTip"/>
|
||||
<object class="NSPopUpButton" key="NSToolbarItemView" id="147646927">
|
||||
<nil key="NSNextResponder"/>
|
||||
<reference key="NSNextResponder"/>
|
||||
<int key="NSvFlags">268</int>
|
||||
<string key="NSFrame">{{0, 14}, {134, 26}}</string>
|
||||
<reference key="NSSuperview"/>
|
||||
<bool key="NSEnabled">YES</bool>
|
||||
<object class="NSPopUpButtonCell" key="NSCell" id="638300054">
|
||||
<int key="NSCellFlags">-2076049856</int>
|
||||
@@ -280,9 +282,10 @@
|
||||
<string key="NSToolbarItemPaletteLabel">View selector</string>
|
||||
<nil key="NSToolbarItemToolTip"/>
|
||||
<object class="NSSegmentedControl" key="NSToolbarItemView" id="1040507102">
|
||||
<nil key="NSNextResponder"/>
|
||||
<reference key="NSNextResponder"/>
|
||||
<int key="NSvFlags">268</int>
|
||||
<string key="NSFrame">{{6, 14}, {66, 23}}</string>
|
||||
<reference key="NSSuperview"/>
|
||||
<bool key="NSEnabled">YES</bool>
|
||||
<object class="NSSegmentedCell" key="NSCell" id="989754672">
|
||||
<int key="NSCellFlags">67239424</int>
|
||||
@@ -818,6 +821,13 @@ ELIAAAAAAAgACAAIAAgAAQABAAEAAQ</bytes>
|
||||
<bool key="NSFilterRestrictsInsertion">YES</bool>
|
||||
<bool key="NSClearsFilterPredicateOnInsertion">YES</bool>
|
||||
</object>
|
||||
<object class="NSUserDefaultsController" id="8280882">
|
||||
<object class="NSMutableArray" key="NSDeclaredKeys">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<string>selectedViewIndex</string>
|
||||
</object>
|
||||
<bool key="NSSharedInstance">YES</bool>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBObjectContainer" key="IBDocument.Objects">
|
||||
<object class="NSMutableArray" key="connectionRecords">
|
||||
@@ -895,22 +905,6 @@ ELIAAAAAAAgACAAIAAgAAQABAAEAAQ</bytes>
|
||||
</object>
|
||||
<int key="connectionID">245</int>
|
||||
</object>
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBBindingConnection" key="connection">
|
||||
<string key="label">selectedIndex: selectedViewIndex</string>
|
||||
<reference key="source" ref="1040507102"/>
|
||||
<reference key="destination" ref="1001"/>
|
||||
<object class="NSNibBindingConnector" key="connector">
|
||||
<reference key="NSSource" ref="1040507102"/>
|
||||
<reference key="NSDestination" ref="1001"/>
|
||||
<string key="NSLabel">selectedIndex: selectedViewIndex</string>
|
||||
<string key="NSBinding">selectedIndex</string>
|
||||
<string key="NSKeyPath">selectedViewIndex</string>
|
||||
<int key="NSNibBindingConnectorVersion">2</int>
|
||||
</object>
|
||||
</object>
|
||||
<int key="connectionID">275</int>
|
||||
</object>
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBBindingConnection" key="connection">
|
||||
<string key="label">predicate: searchController.filterPredicate</string>
|
||||
@@ -1016,6 +1010,22 @@ ELIAAAAAAAgACAAIAAgAAQABAAEAAQ</bytes>
|
||||
</object>
|
||||
<int key="connectionID">292</int>
|
||||
</object>
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBBindingConnection" key="connection">
|
||||
<string key="label">selectedIndex: values.selectedViewIndex</string>
|
||||
<reference key="source" ref="1040507102"/>
|
||||
<reference key="destination" ref="8280882"/>
|
||||
<object class="NSNibBindingConnector" key="connector">
|
||||
<reference key="NSSource" ref="1040507102"/>
|
||||
<reference key="NSDestination" ref="8280882"/>
|
||||
<string key="NSLabel">selectedIndex: values.selectedViewIndex</string>
|
||||
<string key="NSBinding">selectedIndex</string>
|
||||
<string key="NSKeyPath">values.selectedViewIndex</string>
|
||||
<int key="NSNibBindingConnectorVersion">2</int>
|
||||
</object>
|
||||
</object>
|
||||
<int key="connectionID">298</int>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBMutableOrderedSet" key="objectRecords">
|
||||
<object class="NSArray" key="orderedObjects">
|
||||
@@ -1229,6 +1239,11 @@ ELIAAAAAAAgACAAIAAgAAQABAAEAAQ</bytes>
|
||||
<reference key="parent" ref="1002"/>
|
||||
<string key="objectName">BranchesController</string>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">296</int>
|
||||
<reference key="object" ref="8280882"/>
|
||||
<reference key="parent" ref="1002"/>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<object class="NSMutableDictionary" key="flattenedProperties">
|
||||
@@ -1281,9 +1296,9 @@ ELIAAAAAAAgACAAIAAgAAQABAAEAAQ</bytes>
|
||||
<string>com.apple.InterfaceBuilderKit</string>
|
||||
<string>com.apple.InterfaceBuilderKit</string>
|
||||
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<string>{{368, 321}, {850, 418}}</string>
|
||||
<string>{{43, 321}, {850, 418}}</string>
|
||||
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<string>{{368, 321}, {850, 418}}</string>
|
||||
<string>{{43, 321}, {850, 418}}</string>
|
||||
<reference ref="9"/>
|
||||
<reference ref="9"/>
|
||||
<string>{{15, 196}, {850, 418}}</string>
|
||||
@@ -1291,7 +1306,7 @@ ELIAAAAAAAgACAAIAAgAAQABAAEAAQ</bytes>
|
||||
<reference ref="9"/>
|
||||
<string>{3.40282e+38, 3.40282e+38}</string>
|
||||
<string>{213, 107}</string>
|
||||
<string>{{429, 871}, {616, 0}}</string>
|
||||
<string>{{160, 512}, {616, 227}}</string>
|
||||
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<string>{{132, 614}, {616, 0}}</string>
|
||||
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
@@ -1338,7 +1353,7 @@ ELIAAAAAAAgACAAIAAgAAQABAAEAAQ</bytes>
|
||||
</object>
|
||||
</object>
|
||||
<nil key="sourceID"/>
|
||||
<int key="maxID">295</int>
|
||||
<int key="maxID">298</int>
|
||||
</object>
|
||||
<object class="IBClassDescriber" key="IBDocument.Classes">
|
||||
<object class="NSMutableArray" key="referencedPartialClassDescriptions">
|
||||
|
||||
@@ -14,14 +14,12 @@
|
||||
IBOutlet NSArrayController* searchController;
|
||||
IBOutlet NSArrayController *branchesController;
|
||||
PBGitRepository* repository;
|
||||
int selectedViewIndex;
|
||||
IBOutlet NSView* contentView;
|
||||
NSViewController* viewController;
|
||||
}
|
||||
|
||||
@property (retain) PBGitRepository *repository;
|
||||
@property (readonly) NSViewController *viewController;
|
||||
@property (assign) int selectedViewIndex;
|
||||
@property (retain) NSArrayController *searchController;
|
||||
|
||||
- (id)initWithRepository:(PBGitRepository*)theRepository;
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
@implementation PBGitWindowController
|
||||
|
||||
|
||||
@synthesize repository, viewController, searchController, selectedViewIndex;
|
||||
@synthesize repository, viewController, searchController;
|
||||
|
||||
- (id)initWithRepository:(PBGitRepository*)theRepository;
|
||||
{
|
||||
@@ -22,6 +22,7 @@
|
||||
{
|
||||
self.repository = theRepository;
|
||||
[self showWindow:nil];
|
||||
[[NSUserDefaults standardUserDefaults] addObserver:self forKeyPath:@"selectedViewIndex" options:NULL context:NULL];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
@@ -31,10 +32,10 @@
|
||||
[[self window] makeFirstResponder:searchField];
|
||||
}
|
||||
|
||||
- (void) setSelectedViewIndex: (int) i
|
||||
- (void)observeValueForKeyPath:(NSString*)keyPath ofObject:(id)object change:(NSDictionary*)change context:(void*)context
|
||||
{
|
||||
selectedViewIndex = i;
|
||||
[self changeViewController: i];
|
||||
if ([keyPath isEqualToString:@"selectedViewIndex"])
|
||||
[self changeViewController:[[[NSUserDefaults standardUserDefaults] objectForKey:@"selectedViewIndex"] intValue]];
|
||||
}
|
||||
|
||||
- (void)changeViewController:(NSInteger)whichViewTag
|
||||
@@ -74,7 +75,7 @@
|
||||
{
|
||||
// We bind this ourselves because otherwise we would lose our selection
|
||||
[branchesController bind:@"selectionIndexes" toObject:repository withKeyPath:@"currentBranch" options:nil]; NSLog(@"CurrentBranch: %@", repository.currentBranch);
|
||||
[self changeViewController:0];
|
||||
[self changeViewController:[[[NSUserDefaults standardUserDefaults] objectForKey:@"selectedViewIndex"] intValue]];
|
||||
[[self window] setAutorecalculatesContentBorderThickness:NO forEdge:NSMinYEdge];
|
||||
[[self window] setContentBorderThickness:35.0f forEdge:NSMinYEdge];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user