From fe5dddc681974a01ed01aacedb8f0a33e96e2670 Mon Sep 17 00:00:00 2001 From: Nathan Kinsinger Date: Sat, 13 Feb 2010 09:28:54 -0700 Subject: [PATCH] Add Add Remote - Add Remote in the Repository menu - an Add Remote Sheet --- English.lproj/MainMenu.xib | 51 +- English.lproj/PBAddRemoteSheet.xib | 1272 ++++++++++++++++++++++++++++ GitX.xcodeproj/project.pbxproj | 18 + PBAddRemoteSheet.h | 42 + PBAddRemoteSheet.m | 142 ++++ PBGitHistoryController.h | 1 + PBGitHistoryController.m | 6 + PBGitRepository.h | 1 + PBGitRepository.m | 9 + 9 files changed, 1539 insertions(+), 3 deletions(-) create mode 100644 English.lproj/PBAddRemoteSheet.xib create mode 100644 PBAddRemoteSheet.h create mode 100644 PBAddRemoteSheet.m diff --git a/English.lproj/MainMenu.xib b/English.lproj/MainMenu.xib index 34b4033de..5f85dac39 100644 --- a/English.lproj/MainMenu.xib +++ b/English.lproj/MainMenu.xib @@ -666,6 +666,15 @@ + + + Add Remote + r + 1572864 + 2147483647 + + + YES @@ -1315,6 +1324,14 @@ 950 + + + showAddRemoteSheet: + + + + 953 + @@ -1978,6 +1995,7 @@ + @@ -2006,6 +2024,11 @@ + + 951 + + + @@ -2204,6 +2227,7 @@ 943.IBPluginDependency 947.IBPluginDependency 949.IBPluginDependency + 951.IBPluginDependency YES @@ -2392,7 +2416,8 @@ com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin - {{668, 643}, {192, 93}} + {{668, 623}, {206, 113}} + com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin @@ -2417,7 +2442,7 @@ - 950 + 953 @@ -2650,13 +2675,13 @@ YES createBranch: - createTag: openFilesAction: openSelectedFile: refresh: setDetailedView: setRawView: setTreeView: + showAddRemoteSheet: showCommitsFromTree: showInFinderAction: toggleQuickView: @@ -2835,10 +2860,20 @@ YES changeBranch: + checkout: + cherryPick: copyPatch: copySHA: createBranch: createTag: + fetchRemote: + merge: + pullRemote: + pushDefaultRemoteForRef: + pushToRemote: + pushUpdatesToRemote: + rebaseActiveBranch: + rebaseHeadBranch: showTagInfoSheet: @@ -2849,6 +2884,16 @@ PBRefMenuItem PBRefMenuItem PBRefMenuItem + PBRefMenuItem + PBRefMenuItem + PBRefMenuItem + PBRefMenuItem + PBRefMenuItem + PBRefMenuItem + PBRefMenuItem + PBRefMenuItem + PBRefMenuItem + PBRefMenuItem diff --git a/English.lproj/PBAddRemoteSheet.xib b/English.lproj/PBAddRemoteSheet.xib new file mode 100644 index 000000000..03ecd452a --- /dev/null +++ b/English.lproj/PBAddRemoteSheet.xib @@ -0,0 +1,1272 @@ + + + + 1050 + 10C540 + 759 + 1038.25 + 458.00 + + com.apple.InterfaceBuilder.CocoaPlugin + 759 + + + YES + + + + + YES + com.apple.InterfaceBuilder.CocoaPlugin + + + YES + + YES + + + YES + + + + YES + + PBAddRemoteSheet + + + FirstResponder + + + NSApplication + + + 1 + 2 + {{196, 317}, {480, 193}} + 544736256 + Add Remote Sheet + NSWindow + + {1.79769e+308, 1.79769e+308} + {480, 156} + + + 256 + + YES + + + 266 + {{117, 114}, {343, 22}} + + YES + + -1804468671 + 272630784 + + + LucidaGrande + 13 + 1044 + + name + + YES + + 6 + System + textBackgroundColor + + 3 + MQA + + + + 6 + System + textColor + + 3 + MAA + + + + + + + 268 + {{17, 116}, {95, 17}} + + YES + + 68288064 + 71304192 + Remote name: + + + + 6 + System + controlColor + + 3 + MC42NjY2NjY2NjY3AA + + + + 6 + System + controlTextColor + + + + + + + 266 + {{117, 83}, {343, 22}} + + YES + + -1804468671 + 272630784 + + + URL + + YES + + + + + + + 268 + {{27, 85}, {85, 17}} + + YES + + 68288064 + 71304192 + Remote URL: + + + + + + + + + 289 + {{370, 12}, {96, 32}} + + YES + + 67239424 + 134217728 + Add + + + -2038284033 + 129 + + DQ + 200 + 25 + + + + + 289 + {{274, 12}, {96, 32}} + + YES + + 67239424 + 134217728 + Cancel + + + -2038284033 + 129 + + Gw + 200 + 25 + + + + + 292 + {{17, 22}, {258, 17}} + + YES + + 68288064 + 272634880 + Invalid name + + + + + 1 + MSAwIDAAA + + + + + + 268 + {{384, 58}, {76, 17}} + + YES + + -2080244224 + 134479872 + Browse... + + LucidaGrande + 9 + 3614 + + + -2038152961 + 164 + + + 400 + 75 + + + + + 268 + {{17, 156}, {86, 17}} + + YES + + 68288064 + 272630784 + Add Remote + + LucidaGrande-Bold + 13 + 16 + + + + + + + + {480, 193} + + + {{0, 0}, {1680, 1028}} + {480, 178} + {1.79769e+308, 1.79769e+308} + + + + 268 + + YES + + + 268 + {{53, 18}, {133, 18}} + + YES + + 67239424 + 0 + Show hidden files + + + 1211912703 + 2 + + NSImage + NSSwitch + + + NSSwitch + + + + 200 + 25 + + + + {239, 54} + + NSView + + + + + YES + + + errorMessage + + + + 27 + + + + addRemote: + + + + 29 + + + + browseFolders: + + + + 30 + + + + window + + + + 31 + + + + orderOutAddRemoteSheet: + + + + 41 + + + + browseAccessoryView + + + + 48 + + + + showHideHiddenFiles: + + + + 49 + + + + remoteURL + + + + 50 + + + + remoteName + + + + 51 + + + + + YES + + 0 + + + + + + -2 + + + File's Owner + + + -1 + + + First Responder + + + -3 + + + Application + + + 1 + + + YES + + + + Add Remote Sheet + + + 2 + + + YES + + + + + + + + + + + + + + 3 + + + YES + + + + Text Field (Name) + + + 4 + + + YES + + + + + + 5 + + + YES + + + + Text Field (URL) + + + 6 + + + YES + + + + + + 7 + + + YES + + + + + + 8 + + + YES + + + + + + 9 + + + YES + + + + + + 10 + + + + + 11 + + + + + 12 + + + + + 13 + + + + + 14 + + + + + 15 + + + + + 16 + + + + + 17 + + + YES + + + + + + 18 + + + + + 38 + + + YES + + + + Open Panel Accessory + + + 39 + + + YES + + + + + + 40 + + + + + 54 + + + YES + + + + + + 55 + + + + + + + YES + + YES + 1.IBEditorWindowLastContentRect + 1.IBPluginDependency + 1.IBWindowTemplateEditedContentRect + 1.NSWindowTemplate.visibleAtLaunch + 1.WindowOrigin + 1.editorWindowContentRectSynchronizationRect + 1.windowTemplate.hasMinSize + 1.windowTemplate.minSize + 10.IBPluginDependency + 11.IBPluginDependency + 12.IBPluginDependency + 13.IBPluginDependency + 14.IBPluginDependency + 15.IBPluginDependency + 16.IBPluginDependency + 17.IBPluginDependency + 18.IBPluginDependency + 2.IBPluginDependency + 3.IBPluginDependency + 38.IBEditorWindowLastContentRect + 38.IBPluginDependency + 39.IBPluginDependency + 4.IBPluginDependency + 40.IBPluginDependency + 5.IBAttributePlaceholdersKey + 5.IBPluginDependency + 54.IBPluginDependency + 55.IBPluginDependency + 6.IBPluginDependency + 7.IBPluginDependency + 8.IBPluginDependency + 9.IBPluginDependency + + + YES + {{509, 781}, {480, 193}} + com.apple.InterfaceBuilder.CocoaPlugin + {{509, 781}, {480, 193}} + + {196, 240} + {{202, 428}, {480, 270}} + + {480, 156} + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + {{632, 734}, {239, 54}} + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + + ToolTip + + ToolTip + + RXhhbXBsZXM6Ci9Vc2Vycy91c2VybmFtZS9wYXRoL3RvL3JlcG8uZ2l0LwpnaXQ6Ly9ob3N0Lnh6L3Bh +dGgvdG8vcmVwby5naXQvCnNzaDovL1t1c2VyQF1ob3N0Lnh6L3BhdGgvdG8vcmVwby5naXQvA + + + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + + + + YES + + + YES + + + + + YES + + + YES + + + + 55 + + + + YES + + PBAddRemoteSheet + NSWindowController + + YES + + YES + addRemote: + browseFolders: + orderOutAddRemoteSheet: + showHideHiddenFiles: + + + YES + id + id + id + id + + + + YES + + YES + browseAccessoryView + errorMessage + remoteName + remoteURL + + + YES + NSView + NSTextField + NSTextField + NSTextField + + + + IBProjectSource + PBAddRemoteSheet.h + + + + + YES + + NSActionCell + NSCell + + IBFrameworkSource + AppKit.framework/Headers/NSActionCell.h + + + + NSApplication + NSResponder + + IBFrameworkSource + AppKit.framework/Headers/NSApplication.h + + + + NSApplication + + IBFrameworkSource + AppKit.framework/Headers/NSApplicationScripting.h + + + + NSApplication + + IBFrameworkSource + AppKit.framework/Headers/NSColorPanel.h + + + + NSApplication + + IBFrameworkSource + AppKit.framework/Headers/NSHelpManager.h + + + + NSApplication + + IBFrameworkSource + AppKit.framework/Headers/NSPageLayout.h + + + + NSApplication + + IBFrameworkSource + AppKit.framework/Headers/NSUserInterfaceItemSearching.h + + + + NSButton + NSControl + + IBFrameworkSource + AppKit.framework/Headers/NSButton.h + + + + NSButtonCell + NSActionCell + + IBFrameworkSource + AppKit.framework/Headers/NSButtonCell.h + + + + NSCell + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSCell.h + + + + NSControl + NSView + + IBFrameworkSource + AppKit.framework/Headers/NSControl.h + + + + NSFormatter + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSFormatter.h + + + + NSMenu + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSMenu.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSAccessibility.h + + + + NSObject + + + + NSObject + + + + NSObject + + + + NSObject + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSDictionaryController.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSDragging.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSFontManager.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSFontPanel.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSKeyValueBinding.h + + + + NSObject + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSNibLoading.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSOutlineView.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSPasteboard.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSSavePanel.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSTableView.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSToolbarItem.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSView.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSArchiver.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSClassDescription.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSError.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSFileManager.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSKeyValueCoding.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSKeyValueObserving.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSKeyedArchiver.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSObject.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSObjectScripting.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSPortCoder.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSRunLoop.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSScriptClassDescription.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSScriptKeyValueCoding.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSScriptObjectSpecifiers.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSScriptWhoseTests.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSThread.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSURL.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSURLConnection.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSURLDownload.h + + + + NSObject + + IBFrameworkSource + Sparkle.framework/Headers/SUAppcast.h + + + + NSObject + + IBFrameworkSource + Sparkle.framework/Headers/SUUpdater.h + + + + NSObject + + IBFrameworkSource + WebKit.framework/Headers/WebDownload.h + + + + NSObject + + IBFrameworkSource + WebKit.framework/Headers/WebEditingDelegate.h + + + + NSObject + + IBFrameworkSource + WebKit.framework/Headers/WebFrameLoadDelegate.h + + + + NSObject + + IBFrameworkSource + WebKit.framework/Headers/WebJavaPlugIn.h + + + + NSObject + + IBFrameworkSource + WebKit.framework/Headers/WebPlugin.h + + + + NSObject + + IBFrameworkSource + WebKit.framework/Headers/WebPluginContainer.h + + + + NSObject + + IBFrameworkSource + WebKit.framework/Headers/WebPolicyDelegate.h + + + + NSObject + + IBFrameworkSource + WebKit.framework/Headers/WebResourceLoadDelegate.h + + + + NSObject + + IBFrameworkSource + WebKit.framework/Headers/WebScriptObject.h + + + + NSObject + + IBFrameworkSource + WebKit.framework/Headers/WebUIDelegate.h + + + + NSResponder + + IBFrameworkSource + AppKit.framework/Headers/NSInterfaceStyle.h + + + + NSResponder + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSResponder.h + + + + NSTextField + NSControl + + IBFrameworkSource + AppKit.framework/Headers/NSTextField.h + + + + NSTextFieldCell + NSActionCell + + IBFrameworkSource + AppKit.framework/Headers/NSTextFieldCell.h + + + + NSView + + IBFrameworkSource + AppKit.framework/Headers/NSClipView.h + + + + NSView + + IBFrameworkSource + AppKit.framework/Headers/NSMenuItem.h + + + + NSView + + IBFrameworkSource + AppKit.framework/Headers/NSRulerView.h + + + + NSView + NSResponder + + + + NSWindow + + IBFrameworkSource + AppKit.framework/Headers/NSDrawer.h + + + + NSWindow + NSResponder + + IBFrameworkSource + AppKit.framework/Headers/NSWindow.h + + + + NSWindow + + IBFrameworkSource + AppKit.framework/Headers/NSWindowScripting.h + + + + NSWindowController + NSResponder + + showWindow: + id + + + IBFrameworkSource + AppKit.framework/Headers/NSWindowController.h + + + + + 0 + IBCocoaFramework + + com.apple.InterfaceBuilder.CocoaPlugin.macosx + + + + com.apple.InterfaceBuilder.CocoaPlugin.InterfaceBuilder3 + + + YES + ../GitX.xcodeproj + 3 + + diff --git a/GitX.xcodeproj/project.pbxproj b/GitX.xcodeproj/project.pbxproj index f8ee3bb68..a5ef6ddb3 100644 --- a/GitX.xcodeproj/project.pbxproj +++ b/GitX.xcodeproj/project.pbxproj @@ -45,6 +45,8 @@ 93F7857F0EA3ABF100C1F443 /* PBCommitMessageView.m in Sources */ = {isa = PBXBuildFile; fileRef = 93F7857E0EA3ABF100C1F443 /* PBCommitMessageView.m */; }; D26DC6450E782C9000C777B2 /* gitx.icns in Resources */ = {isa = PBXBuildFile; fileRef = D26DC6440E782C9000C777B2 /* gitx.icns */; }; D8083A43111E045D00337480 /* PBRemoteProgressSheet.m in Sources */ = {isa = PBXBuildFile; fileRef = D8083A42111E045D00337480 /* PBRemoteProgressSheet.m */; }; + D8083C44111F106800337480 /* PBAddRemoteSheet.m in Sources */ = {isa = PBXBuildFile; fileRef = D8083C43111F106800337480 /* PBAddRemoteSheet.m */; }; + D8083C47111F136400337480 /* PBAddRemoteSheet.xib in Resources */ = {isa = PBXBuildFile; fileRef = D8083C45111F136400337480 /* PBAddRemoteSheet.xib */; }; D8357535112640F100DE249D /* PBRemoteProgressSheet.xib in Resources */ = {isa = PBXBuildFile; fileRef = D8C1B77110E875CF009B7F8B /* PBRemoteProgressSheet.xib */; }; D854948610D5C01B0083B917 /* PBCreateBranchSheet.m in Sources */ = {isa = PBXBuildFile; fileRef = D854948510D5C01B0083B917 /* PBCreateBranchSheet.m */; }; D85B939310E3D8B4007F3C28 /* PBCreateBranchSheet.xib in Resources */ = {isa = PBXBuildFile; fileRef = D85B939210E3D8B4007F3C28 /* PBCreateBranchSheet.xib */; }; @@ -217,6 +219,9 @@ D26DC6440E782C9000C777B2 /* gitx.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = gitx.icns; sourceTree = ""; }; D8083A2D111E045300337480 /* PBRemoteProgressSheet.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PBRemoteProgressSheet.h; sourceTree = ""; }; D8083A42111E045D00337480 /* PBRemoteProgressSheet.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PBRemoteProgressSheet.m; sourceTree = ""; }; + D8083C42111F106800337480 /* PBAddRemoteSheet.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PBAddRemoteSheet.h; sourceTree = ""; }; + D8083C43111F106800337480 /* PBAddRemoteSheet.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PBAddRemoteSheet.m; sourceTree = ""; }; + D8083C46111F136400337480 /* English */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = English; path = English.lproj/PBAddRemoteSheet.xib; sourceTree = ""; }; D823487410CB382C00944BDE /* Terminal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Terminal.h; sourceTree = ""; }; D854948410D5C01B0083B917 /* PBCreateBranchSheet.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PBCreateBranchSheet.h; sourceTree = ""; }; D854948510D5C01B0083B917 /* PBCreateBranchSheet.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PBCreateBranchSheet.m; sourceTree = ""; }; @@ -468,6 +473,7 @@ D85B939210E3D8B4007F3C28 /* PBCreateBranchSheet.xib */, D889EB3010E6BCBB00F08413 /* PBCreateTagSheet.xib */, D8C1B77110E875CF009B7F8B /* PBRemoteProgressSheet.xib */, + D8083C45111F136400337480 /* PBAddRemoteSheet.xib */, 47DBDB680E94EF6500671A1E /* Preferences.xib */, F569AE920F2CBD7C00C2FFA7 /* Credits.html */, ); @@ -519,6 +525,8 @@ D8E3B34C10DCA958001096A3 /* PBCreateTagSheet.m */, D8083A2D111E045300337480 /* PBRemoteProgressSheet.h */, D8083A42111E045D00337480 /* PBRemoteProgressSheet.m */, + D8083C42111F106800337480 /* PBAddRemoteSheet.h */, + D8083C43111F106800337480 /* PBAddRemoteSheet.m */, ); name = Sheets; sourceTree = ""; @@ -862,6 +870,7 @@ D85B939310E3D8B4007F3C28 /* PBCreateBranchSheet.xib in Resources */, D889EB3110E6BCBB00F08413 /* PBCreateTagSheet.xib in Resources */, D8357535112640F100DE249D /* PBRemoteProgressSheet.xib in Resources */, + D8083C47111F136400337480 /* PBAddRemoteSheet.xib in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -984,6 +993,7 @@ D854948610D5C01B0083B917 /* PBCreateBranchSheet.m in Sources */, D8E3B34D10DCA958001096A3 /* PBCreateTagSheet.m in Sources */, D8083A43111E045D00337480 /* PBRemoteProgressSheet.m in Sources */, + D8083C44111F106800337480 /* PBAddRemoteSheet.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1076,6 +1086,14 @@ name = RepositoryWindow.xib; sourceTree = ""; }; + D8083C45111F136400337480 /* PBAddRemoteSheet.xib */ = { + isa = PBXVariantGroup; + children = ( + D8083C46111F136400337480 /* English */, + ); + name = PBAddRemoteSheet.xib; + sourceTree = ""; + }; D85B939210E3D8B4007F3C28 /* PBCreateBranchSheet.xib */ = { isa = PBXVariantGroup; children = ( diff --git a/PBAddRemoteSheet.h b/PBAddRemoteSheet.h new file mode 100644 index 000000000..529fbce7b --- /dev/null +++ b/PBAddRemoteSheet.h @@ -0,0 +1,42 @@ +// +// PBAddRemoteSheet.h +// GitX +// +// Created by Nathan Kinsinger on 12/8/09. +// Copyright 2009 Nathan Kinsinger. All rights reserved. +// + +#import + + +@class PBGitRepository; + +@interface PBAddRemoteSheet : NSWindowController { + PBGitRepository *repository; + + NSTextField *remoteName; + NSTextField *remoteURL; + NSTextField *errorMessage; + + NSOpenPanel *browseSheet; + NSView *browseAccessoryView; +} + ++ (void) beginAddRemoteSheetForRepository:(PBGitRepository *)repo; + +- (IBAction) browseFolders:(id)sender; +- (IBAction) addRemote:(id)sender; +- (IBAction) orderOutAddRemoteSheet:(id)sender; +- (IBAction) showHideHiddenFiles:(id)sender; + + +@property (readwrite) PBGitRepository *repository; + +@property (readwrite) IBOutlet NSTextField *remoteName; +@property (readwrite) IBOutlet NSTextField *remoteURL; +@property (readwrite) IBOutlet NSTextField *errorMessage; + +@property (readwrite) NSOpenPanel *browseSheet; +@property (readwrite) IBOutlet NSView *browseAccessoryView; + +@end diff --git a/PBAddRemoteSheet.m b/PBAddRemoteSheet.m new file mode 100644 index 000000000..2d6a33227 --- /dev/null +++ b/PBAddRemoteSheet.m @@ -0,0 +1,142 @@ +// +// PBAddRemoteSheet.m +// GitX +// +// Created by Nathan Kinsinger on 12/8/09. +// Copyright 2009 Nathan Kinsinger. All rights reserved. +// + +#import "PBAddRemoteSheet.h" +#import "PBGitWindowController.h" +#import "PBGitRepository.h" + + + +@interface PBAddRemoteSheet () + +- (void) beginAddRemoteSheetForRepository:(PBGitRepository *)repo; +- (void) openAddRemoteSheet; + +@end + + +@implementation PBAddRemoteSheet + + +@synthesize repository; + +@synthesize remoteName; +@synthesize remoteURL; +@synthesize errorMessage; + +@synthesize browseSheet; +@synthesize browseAccessoryView; + + + +#pragma mark - +#pragma mark PBAddRemoteSheet + ++ (void) beginAddRemoteSheetForRepository:(PBGitRepository *)repo +{ + PBAddRemoteSheet *sheet = [[self alloc] initWithWindowNibName:@"PBAddRemoteSheet"]; + [sheet beginAddRemoteSheetForRepository:repo]; +} + + +- (void) beginAddRemoteSheetForRepository:(PBGitRepository *)repo +{ + self.repository = repo; + + [self window]; + [self openAddRemoteSheet]; +} + + +- (void) openAddRemoteSheet +{ + [self.errorMessage setStringValue:@""]; + + [NSApp beginSheet:[self window] modalForWindow:[self.repository.windowController window] modalDelegate:self didEndSelector:nil contextInfo:NULL]; +} + + +- (void) browseSheetDidEnd:(NSWindow *)sheet returnCode:(NSInteger)code contextInfo:(void *)info +{ + [sheet orderOut:self]; + + if (code == NSOKButton) + [self.remoteURL setStringValue:[(NSOpenPanel *)sheet filename]]; + + [self openAddRemoteSheet]; +} + + + +#pragma mark IBActions + +- (IBAction) browseFolders:(id)sender +{ + [self orderOutAddRemoteSheet:nil]; + + self.browseSheet = [NSOpenPanel openPanel]; + + [browseSheet setTitle:@"Add remote"]; + [browseSheet setMessage:@"Select a folder with a git repository"]; + [browseSheet setCanChooseFiles:NO]; + [browseSheet setCanChooseDirectories:YES]; + [browseSheet setAllowsMultipleSelection:NO]; + [browseSheet setCanCreateDirectories:NO]; + [browseSheet setAccessoryView:browseAccessoryView]; + + [browseSheet beginSheetForDirectory:nil file:nil types:nil + modalForWindow:[self.repository.windowController window] + modalDelegate:self + didEndSelector:@selector(browseSheetDidEnd:returnCode:contextInfo:) + contextInfo:NULL]; +} + + +- (IBAction) addRemote:(id)sender +{ + [self.errorMessage setStringValue:@""]; + + NSString *name = [[self.remoteName stringValue] copy]; + + if ([name isEqualToString:@""]) { + [self.errorMessage setStringValue:@"Remote name is required"]; + return; + } + + if (![self.repository checkRefFormat:[@"refs/remotes/" stringByAppendingString:name]]) { + [self.errorMessage setStringValue:@"Invalid remote name"]; + return; + } + + NSString *url = [[self.remoteURL stringValue] copy]; + if ([url isEqualToString:@""]) { + [self.errorMessage setStringValue:@"Remote URL is required"]; + return; + } + + [self orderOutAddRemoteSheet:self]; + [self.repository beginAddRemote:name forURL:url]; +} + + +- (IBAction) orderOutAddRemoteSheet:(id)sender +{ + [NSApp endSheet:[self window]]; + [[self window] orderOut:self]; +} + + +- (IBAction) showHideHiddenFiles:(id)sender +{ + // This uses undocumented OpenPanel features to show hidden files (required for 10.5 support) + NSNumber *showHidden = [NSNumber numberWithBool:[sender state] == NSOnState]; + [[self.browseSheet valueForKey:@"_navView"] setValue:showHidden forKey:@"showsHiddenFiles"]; +} + + +@end diff --git a/PBGitHistoryController.h b/PBGitHistoryController.h index 2be198b2e..bd0635ef9 100644 --- a/PBGitHistoryController.h +++ b/PBGitHistoryController.h @@ -54,6 +54,7 @@ // Repository Methods - (IBAction) createBranch:(id)sender; - (IBAction) createTag:(id)sender; +- (IBAction) showAddRemoteSheet:(id)sender; - (void) copyCommitInfo; diff --git a/PBGitHistoryController.m b/PBGitHistoryController.m index 0f6f578d0..d28c9b20a 100644 --- a/PBGitHistoryController.m +++ b/PBGitHistoryController.m @@ -13,6 +13,7 @@ #import "PBCommitList.h" #import "PBCreateBranchSheet.h" #import "PBCreateTagSheet.h" +#import "PBAddRemoteSheet.h" #define QLPreviewPanel NSClassFromString(@"QLPreviewPanel") @@ -360,4 +361,9 @@ - (IBAction) createTag:(id)sender [PBCreateTagSheet beginCreateTagSheetAtRefish:realCommit inRepository:repository]; } +- (IBAction) showAddRemoteSheet:(id)sender +{ + [PBAddRemoteSheet beginAddRemoteSheetForRepository:self.repository]; +} + @end diff --git a/PBGitRepository.h b/PBGitRepository.h index f40ec92ce..166aaa0f0 100644 --- a/PBGitRepository.h +++ b/PBGitRepository.h @@ -29,6 +29,7 @@ extern NSString* PBGitRepositoryErrorDomain; PBGitRevSpecifier *_headRef; // Caching } +- (void) beginAddRemote:(NSString *)remoteName forURL:(NSString *)remoteURL; - (void) beginFetchFromRemoteForRef:(PBGitRef *)ref; - (void) beginPullFromRemote:(PBGitRef *)remoteRef forRef:(PBGitRef *)ref; - (void) beginPushRef:(PBGitRef *)ref toRemote:(PBGitRef *)remoteRef; diff --git a/PBGitRepository.m b/PBGitRepository.m index acbcf3588..e5fd9a97b 100644 --- a/PBGitRepository.m +++ b/PBGitRepository.m @@ -483,6 +483,15 @@ - (NSString *) infoForRemote:(NSString *)remoteName #pragma mark Repository commands +- (void) beginAddRemote:(NSString *)remoteName forURL:(NSString *)remoteURL +{ + NSArray *arguments = [NSArray arrayWithObjects:@"remote", @"add", @"-f", remoteName, remoteURL, nil]; + + NSString *description = [NSString stringWithFormat:@"Adding the remote %@ and fetching tracking branches", remoteName]; + NSString *title = @"Adding a remote"; + [PBRemoteProgressSheet beginRemoteProgressSheetForArguments:arguments title:title description:description inRepository:self]; +} + - (void) beginFetchFromRemoteForRef:(PBGitRef *)ref { NSMutableArray *arguments = [NSMutableArray arrayWithObject:@"fetch"];