Move Remote segmented controls from Sidebar to Repository window's top gradient bar.

Now, I know conceptually the Remotes segmented control was down there because it is
related to the repository and the current branch, but I really grew tired having to 
travel all the way down the monitor real estate just to click a button. 
And you can't just fast travel down, you need be quite specific with the click.
This commit is contained in:
André Berg
2010-04-05 15:52:01 +02:00
parent 93483cb9a9
commit 69d23e9e08
6 changed files with 163 additions and 144 deletions
+9 -16
View File
@@ -12,7 +12,7 @@
</object>
<object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
<bool key="EncodedWithXMLCoder">YES</bool>
<integer value="3"/>
<integer value="351"/>
</object>
<object class="NSArray" key="IBDocument.PluginDependencies">
<bool key="EncodedWithXMLCoder">YES</bool>
@@ -816,6 +816,13 @@
<object class="IBClassDescriber" key="IBDocument.Classes">
<object class="NSMutableArray" key="referencedPartialClassDescriptions">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBProjectSource</string>
<string key="minorKey">BMScript.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">PBGitWindowController</string>
<string key="superclassName">NSWindowController</string>
@@ -1231,13 +1238,6 @@
<string key="minorKey">ImageKit.framework/Headers/IKImageBrowserView.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">ImageKit.framework/Headers/IKSaveOptions.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
@@ -1280,13 +1280,6 @@
<string key="minorKey">QuartzFilters.framework/Headers/QuartzFilterManager.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">QuickLookUI.framework/Headers/QLPreviewPanel.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
@@ -1500,7 +1493,7 @@
</object>
<object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDependencyDefaults">
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin.macosx</string>
<integer value="1060" key="NS.object.0"/>
<integer value="1050" key="NS.object.0"/>
</object>
<object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDevelopmentDependencies">
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin.InterfaceBuilder3</string>
+16
View File
@@ -17,6 +17,8 @@
@class PBGitGradientBarView;
@class PBRefController;
@class QLPreviewPanel;
@class PBCommitList;
@class PBSourceViewItem;
@interface PBGitHistoryController : PBViewController {
IBOutlet PBRefController *refController;
@@ -40,12 +42,19 @@
IBOutlet NSButton *selectedBranchFilterItem;
IBOutlet id webView;
// moved from PBGitSidebarController
IBOutlet NSSegmentedControl * remoteControls;
int selectedCommitDetailsIndex;
BOOL forceSelectionUpdate;
PBGitTree *gitTree;
PBGitCommit *webCommit;
PBGitCommit *selectedCommit;
PBSourceViewItem * sidebarRemotes;
NSOutlineView * sidebarSourceView;
}
@property (assign) int selectedCommitDetailsIndex;
@@ -53,6 +62,8 @@
@property (retain) PBGitTree* gitTree;
@property (readonly) NSArrayController *commitController;
@property (readonly) PBRefController *refController;
@property (assign) NSOutlineView * sidebarSourceView;
@property (assign) PBSourceViewItem * sidebarRemotes;
- (IBAction) setDetailedView:(id)sender;
- (IBAction) setTreeView:(id)sender;
@@ -64,6 +75,11 @@
- (IBAction) openSelectedFile:(id)sender;
- (void) updateQuicklookForce: (BOOL) force;
// Moved over Sidebar methods
- (IBAction) fetchPullPushAction:(id)sender;
- (void) updateRemoteControls:(PBGitRef *)forRef;
// Context menu methods
- (NSMenu *)contextMenuForTreeView;
- (NSArray *)menuItemsForPaths:(NSArray *)paths;
+65
View File
@@ -21,6 +21,9 @@
#import "PBDiffWindowController.h"
#import "PBGitDefaults.h"
#import "PBGitRevList.h"
#import "PBCommitList.h"
#import "PBSourceViewItem.h"
#import "PBRefController.h"
#define QLPreviewPanel NSClassFromString(@"QLPreviewPanel")
#define kHistorySelectedDetailIndexKey @"PBHistorySelectedDetailIndex"
@@ -38,6 +41,7 @@
@implementation PBGitHistoryController
@synthesize selectedCommitDetailsIndex, webCommit, gitTree, commitController, refController;
@synthesize sidebarSourceView, sidebarRemotes;
#pragma mark NSToolbarItemValidation Methods
@@ -623,6 +627,67 @@
}
}
#pragma mark Remote controls
// !!! Andre Berg 20100330: moved these over from the PBGitSidebarController
// since I grew tired of having to go all the way down with the mouse just
// to do some basic actions I need to frequently (YMMV) =)
enum {
kAddRemoteSegment = 0,
kFetchSegment,
kPullSegment,
kPushSegment
};
- (void) updateRemoteControls:(PBGitRef *)forRef
{
BOOL hasRemote = NO;
PBGitRef *ref = forRef;
if ([ref isRemote] || ([ref isBranch] && [[repository remoteRefForBranch:ref error:NULL] remoteName]))
hasRemote = YES;
[remoteControls setEnabled:hasRemote forSegment:kFetchSegment];
[remoteControls setEnabled:hasRemote forSegment:kPullSegment];
[remoteControls setEnabled:hasRemote forSegment:kPushSegment];
}
- (IBAction) fetchPullPushAction:(id)sender
{
NSInteger selectedSegment = [sender selectedSegment];
if (selectedSegment == kAddRemoteSegment) {
[PBAddRemoteSheet beginAddRemoteSheetForRepository:repository];
return;
}
NSOutlineView * sourceView = sidebarSourceView;
NSInteger index = [sourceView selectedRow];
PBSourceViewItem *item = [sourceView itemAtRow:index];
PBGitRef *ref = [[item revSpecifier] ref];
if (!ref && (item.parent == sidebarRemotes))
ref = [PBGitRef refFromString:[kGitXRemoteRefPrefix stringByAppendingString:[item title]]];
if (![ref isRemote] && ![ref isBranch])
return;
PBGitRef *remoteRef = [repository remoteRefForBranch:ref error:NULL];
if (!remoteRef)
return;
if (selectedSegment == kFetchSegment)
[repository beginFetchFromRemoteForRef:ref];
else if (selectedSegment == kPullSegment)
[repository beginPullFromRemote:remoteRef forRef:ref];
else if (selectedSegment == kPushSegment) {
if ([ref isRemote])
[refController showConfirmPushRefSheet:nil remote:remoteRef];
else if ([ref isBranch])
[refController showConfirmPushRefSheet:ref remote:remoteRef];
}
}
#pragma mark -
#pragma mark Quick Look Public API support
+2 -1
View File
@@ -18,7 +18,6 @@
IBOutlet NSOutlineView *sourceView;
IBOutlet NSView *sourceListControlsView;
IBOutlet NSPopUpButton *actionButton;
IBOutlet NSSegmentedControl *remoteControls;
NSMutableArray *items;
@@ -40,4 +39,6 @@
@property(readonly) NSMutableArray *items;
@property(readonly) NSView *sourceListControlsView;
@property(readonly) PBSourceViewItem * remotes;
@property(readonly) NSOutlineView * sourceView;
@end
+3 -3
View File
@@ -23,12 +23,12 @@
- (PBSourceViewItem *) itemForRev:(PBGitRevSpecifier *)rev;
- (void) removeRevSpec:(PBGitRevSpecifier *)rev;
- (void) updateActionMenu;
- (void) updateRemoteControls;
@end
@implementation PBGitSidebarController
@synthesize items;
@synthesize sourceListControlsView;
@synthesize sourceListControlsView, sourceView, remotes;
- (id)initWithRepository:(PBGitRepository *)theRepository superController:(PBGitWindowController *)controller
{
@@ -193,7 +193,7 @@
}
[self updateActionMenu];
[self updateRemoteControls];
[historyViewController updateRemoteControls:[[self selectedItem] ref]];
}
#pragma mark NSOutlineView delegate methods
+68 -124
View File
@@ -3,16 +3,15 @@
<data>
<int key="IBDocument.SystemTarget">1050</int>
<string key="IBDocument.SystemVersion">10C540</string>
<string key="IBDocument.InterfaceBuilderVersion">759</string>
<string key="IBDocument.InterfaceBuilderVersion">740</string>
<string key="IBDocument.AppKitVersion">1038.25</string>
<string key="IBDocument.HIToolboxVersion">458.00</string>
<object class="NSMutableDictionary" key="IBDocument.PluginVersions">
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="NS.object.0">759</string>
<string key="NS.object.0">740</string>
</object>
<object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
<bool key="EncodedWithXMLCoder">YES</bool>
<integer value="38"/>
<integer value="36"/>
</object>
<object class="NSArray" key="IBDocument.PluginDependencies">
@@ -82,7 +81,7 @@
</object>
<object class="NSColor" key="NSBackgroundColor">
<int key="NSColorSpace">3</int>
<bytes key="NSWhite">MC4zMzMzMzI5OQA</bytes>
<bytes key="NSWhite">MC4zMzMzMzI5ODU2AA</bytes>
</object>
<object class="NSColor" key="NSTextColor">
<int key="NSColorSpace">6</int>
@@ -110,7 +109,7 @@
<string key="NSColorName">controlBackgroundColor</string>
<object class="NSColor" key="NSColor">
<int key="NSColorSpace">3</int>
<bytes key="NSWhite">MC42NjY2NjY2NjY3AA</bytes>
<bytes key="NSWhite">MC42NjY2NjY2ODY1AA</bytes>
</object>
</object>
<object class="NSColor" key="NSTextColor">
@@ -173,7 +172,7 @@
<reference key="NSSuperview" ref="631607481"/>
<reference key="NSTarget" ref="631607481"/>
<string key="NSAction">_doScroller:</string>
<double key="NSPercent">0.99698790000000004</double>
<double key="NSPercent">0.99698787927627563</double>
</object>
<object class="NSScroller" id="46429660">
<reference key="NSNextResponder" ref="631607481"/>
@@ -183,7 +182,7 @@
<int key="NSsFlags">1</int>
<reference key="NSTarget" ref="631607481"/>
<string key="NSAction">_doScroller:</string>
<double key="NSPercent">0.57142859999999995</double>
<double key="NSPercent">0.57142859697341919</double>
</object>
</object>
<string key="NSFrameSize">{153, 354}</string>
@@ -201,74 +200,10 @@
<string key="NSClassName">NSView</string>
</object>
<object class="NSCustomView" id="790712736">
<reference key="NSNextResponder"/>
<nil key="NSNextResponder"/>
<int key="NSvFlags">268</int>
<object class="NSMutableArray" key="NSSubviews">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSSegmentedControl" id="200965348">
<reference key="NSNextResponder" ref="790712736"/>
<int key="NSvFlags">268</int>
<string key="NSFrame">{{52, 2}, {141, 25}}</string>
<reference key="NSSuperview" ref="790712736"/>
<bool key="NSEnabled">YES</bool>
<object class="NSSegmentedCell" key="NSCell" id="431684212">
<int key="NSCellFlags">67239424</int>
<int key="NSCellFlags2">0</int>
<object class="NSFont" key="NSSupport">
<string key="NSName">LucidaGrande</string>
<double key="NSSize">13</double>
<int key="NSfFlags">16</int>
</object>
<reference key="NSControlView" ref="200965348"/>
<object class="NSMutableArray" key="NSSegmentImages">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSSegmentItem">
<double key="NSSegmentItemWidth">33</double>
<object class="NSCustomResource" key="NSSegmentItemImage">
<string key="NSClassName">NSImage</string>
<string key="NSResourceName">AddRemote</string>
</object>
<string key="NSSegmentItemLabel"/>
<string key="NSSegmentItemTooltip">Add remote</string>
<int key="NSSegmentItemImageScaling">0</int>
</object>
<object class="NSSegmentItem">
<double key="NSSegmentItemWidth">33</double>
<object class="NSCustomResource" key="NSSegmentItemImage">
<string key="NSClassName">NSImage</string>
<string key="NSResourceName">FetchTemplate</string>
</object>
<string key="NSSegmentItemLabel"/>
<string key="NSSegmentItemTooltip">Fetch from default remote</string>
<int key="NSSegmentItemTag">1</int>
<int key="NSSegmentItemImageScaling">0</int>
</object>
<object class="NSSegmentItem">
<double key="NSSegmentItemWidth">33</double>
<object class="NSCustomResource" key="NSSegmentItemImage">
<string key="NSClassName">NSImage</string>
<string key="NSResourceName">PullTemplate</string>
</object>
<string key="NSSegmentItemTooltip">Pull from default remote</string>
<int key="NSSegmentItemTag">2</int>
<int key="NSSegmentItemImageScaling">0</int>
</object>
<object class="NSSegmentItem">
<double key="NSSegmentItemWidth">33</double>
<object class="NSCustomResource" key="NSSegmentItemImage">
<string key="NSClassName">NSImage</string>
<string key="NSResourceName">PushTemplate</string>
</object>
<string key="NSSegmentItemTooltip">Push to default remote</string>
<int key="NSSegmentItemTag">3</int>
<int key="NSSegmentItemImageScaling">0</int>
</object>
</object>
<int key="NSSelectedSegment">1</int>
<int key="NSTrackingMode">2</int>
<int key="NSSegmentStyle">2</int>
</object>
</object>
<object class="NSPopUpButton" id="962175484">
<reference key="NSNextResponder" ref="790712736"/>
<int key="NSvFlags">268</int>
@@ -354,7 +289,6 @@
</object>
</object>
<string key="NSFrameSize">{200, 31}</string>
<reference key="NSSuperview"/>
<string key="NSClassName">NSView</string>
</object>
</object>
@@ -409,22 +343,6 @@
</object>
<int key="connectionID">46</int>
</object>
<object class="IBConnectionRecord">
<object class="IBOutletConnection" key="connection">
<string key="label">remoteControls</string>
<reference key="source" ref="1001"/>
<reference key="destination" ref="200965348"/>
</object>
<int key="connectionID">49</int>
</object>
<object class="IBConnectionRecord">
<object class="IBActionConnection" key="connection">
<string key="label">fetchPullPushAction:</string>
<reference key="source" ref="1001"/>
<reference key="destination" ref="200965348"/>
</object>
<int key="connectionID">50</int>
</object>
<object class="IBConnectionRecord">
<object class="IBOutletConnection" key="connection">
<string key="label">delegate</string>
@@ -521,7 +439,6 @@
<object class="NSMutableArray" key="children">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference ref="962175484"/>
<reference ref="200965348"/>
</object>
<reference key="parent" ref="0"/>
<string key="objectName">Source List Controls View</string>
@@ -570,20 +487,6 @@
<reference key="object" ref="84422544"/>
<reference key="parent" ref="137688401"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">47</int>
<reference key="object" ref="200965348"/>
<object class="NSMutableArray" key="children">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference ref="431684212"/>
</object>
<reference key="parent" ref="790712736"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">48</int>
<reference key="object" ref="431684212"/>
<reference key="parent" ref="200965348"/>
</object>
</object>
</object>
<object class="NSMutableDictionary" key="flattenedProperties">
@@ -606,9 +509,6 @@
<string>42.IBPluginDependency</string>
<string>43.IBPluginDependency</string>
<string>44.IBPluginDependency</string>
<string>47.IBPluginDependency</string>
<string>48.IBPluginDependency</string>
<string>48.IBSegmentedControlInspectorSelectedSegmentMetadataKey</string>
<string>8.IBEditorWindowLastContentRect</string>
<string>8.IBPluginDependency</string>
<string>9.IBPluginDependency</string>
@@ -623,7 +523,7 @@
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>{{482, 590}, {153, 354}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>{{626, 507}, {200, 31}}</string>
<string>{{695, 521}, {200, 31}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
@@ -631,9 +531,6 @@
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="0"/>
<string>{{105, 545}, {153, 354}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
@@ -660,6 +557,13 @@
<object class="IBClassDescriber" key="IBDocument.Classes">
<object class="NSMutableArray" key="referencedPartialClassDescriptions">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBProjectSource</string>
<string key="minorKey">BMScript.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSOutlineView</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
@@ -717,6 +621,10 @@
<object class="IBPartialClassDescription">
<string key="className">PBViewController</string>
<string key="superclassName">NSViewController</string>
<object class="NSMutableDictionary" key="actions">
<string key="NS.key.0">refresh:</string>
<string key="NS.object.0">id</string>
</object>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBProjectSource</string>
<string key="minorKey">PBViewController.h</string>
@@ -1084,6 +992,55 @@
<string key="minorKey">Foundation.framework/Headers/NSURLDownload.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">ImageKit.framework/Headers/IKImageBrowserView.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">ImageKit.framework/Headers/ImageKitDeprecated.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">PDFKit.framework/Headers/PDFDocument.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">PDFKit.framework/Headers/PDFView.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">QuartzComposer.framework/Headers/QCCompositionParameterView.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">QuartzComposer.framework/Headers/QCCompositionPickerView.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">QuartzFilters.framework/Headers/QuartzFilterManager.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
@@ -1220,14 +1177,6 @@
<string key="minorKey">AppKit.framework/Headers/NSScroller.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSSegmentedCell</string>
<string key="superclassName">NSActionCell</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">AppKit.framework/Headers/NSSegmentedCell.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSSegmentedControl</string>
<string key="superclassName">NSControl</string>
@@ -1317,7 +1266,6 @@
</object>
</object>
<int key="IBDocument.localizationMode">0</int>
<string key="IBDocument.TargetRuntimeIdentifier">IBCocoaFramework</string>
<object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDependencies">
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin.macosx</string>
<integer value="1050" key="NS.object.0"/>
@@ -1333,9 +1281,5 @@
<bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool>
<string key="IBDocument.LastKnownRelativeProjectPath">GitX.xcodeproj</string>
<int key="IBDocument.defaultPropertyAccessControl">3</int>
<object class="NSMutableDictionary" key="IBDocument.LastKnownImageSizes">
<string key="NS.key.0">NSActionTemplate</string>
<string key="NS.object.0">{15, 15}</string>
</object>
</data>
</archive>