12
12
#import " PBGitWindowController.h"
13
13
#import " PBServicesController.h"
14
14
#import " PBGitXProtocol.h"
15
- #import " PBPrefsWindowController.h"
16
15
#import " PBNSURLPathUserDefaultsTransfomer.h"
17
16
#import " PBGitDefaults.h"
18
17
#import " PBCloneRepositoryPanel.h"
19
18
#import " OpenRecentController.h"
20
19
#import " PBGitBinary.h"
21
20
22
- #import < Sparkle/SUUpdater.h>
23
- #import < Sparkle/SUUpdaterDelegate.h>
24
-
25
21
static OpenRecentController* recentsDialog = nil ;
26
22
27
- @interface ApplicationController () <SUUpdaterDelegate>
23
+ @interface ApplicationController ()
28
24
@end
29
25
30
26
@implementation ApplicationController
@@ -114,9 +110,6 @@ - (BOOL)applicationOpenUntitledFile:(NSApplication *)theApplication
114
110
115
111
- (void )applicationDidFinishLaunching : (NSNotification *)notification
116
112
{
117
- [[SUUpdater sharedUpdater ] setSendsSystemProfile: YES ];
118
- [[SUUpdater sharedUpdater ] setDelegate: self ];
119
-
120
113
// Make sure Git's SSH password requests get forwarded to our little UI tool:
121
114
setenv ( " SSH_ASKPASS" , [[[NSBundle mainBundle ] pathForResource: @" gitx_askpasswd" ofType: @" " ] UTF8String ], 1 );
122
115
setenv ( " DISPLAY" , " localhost:0" , 1 );
@@ -150,11 +143,6 @@ - (IBAction)openDocument:(id)sender {
150
143
}];
151
144
}
152
145
153
- - (IBAction )openPreferencesWindow : (id )sender
154
- {
155
- [[PBPrefsWindowController sharedPrefsWindowController ] showWindow: nil ];
156
- }
157
-
158
146
- (IBAction )showAboutPanel : (id )sender
159
147
{
160
148
NSString *gitversion = [[[NSBundle mainBundle ] infoDictionary ] objectForKey: @" CFBundleGitVersion" ];
@@ -179,67 +167,6 @@ - (IBAction) showCloneRepository:(id)sender
179
167
[cloneRepositoryPanel showWindow: self ];
180
168
}
181
169
182
- - (IBAction )installCliTool : (id )sender ;
183
- {
184
- BOOL success = NO ;
185
- NSString * installationPath = @" /usr/local/bin/" ;
186
- NSString * installationName = @" gitx" ;
187
- NSString * toolPath = [[NSBundle mainBundle ] pathForResource: @" gitx" ofType: @" " ];
188
- if (toolPath) {
189
- AuthorizationRef auth;
190
- if (AuthorizationCreate (NULL , kAuthorizationEmptyEnvironment , kAuthorizationFlagDefaults , &auth) == errAuthorizationSuccess) {
191
- char const * mkdir_arg[] = { " -p" , [installationPath UTF8String ], NULL };
192
- char const * mkdir = " /bin/mkdir" ;
193
- AuthorizationExecuteWithPrivileges (auth, mkdir, kAuthorizationFlagDefaults , (char **)mkdir_arg, NULL );
194
- char const * arguments[] = { " -f" , " -s" , [toolPath UTF8String ], [[installationPath stringByAppendingString: installationName] UTF8String ], NULL };
195
- char const * helperTool = " /bin/ln" ;
196
- if (AuthorizationExecuteWithPrivileges (auth, helperTool, kAuthorizationFlagDefaults , (char **)arguments, NULL ) == errAuthorizationSuccess) {
197
- int status;
198
- int pid = wait (&status);
199
- if (pid != -1 && WIFEXITED (status) && WEXITSTATUS (status) == 0 )
200
- success = true ;
201
- else
202
- errno = WEXITSTATUS (status);
203
- }
204
-
205
- AuthorizationFree (auth, kAuthorizationFlagDefaults );
206
- }
207
- }
208
-
209
- NSAlert * alert = [[NSAlert alloc ] init ];
210
- if (success) {
211
- alert.messageText = NSLocalizedString(@" Installation Complete" , @" Headline for successfully completed installation of the command line tool" );
212
- alert.informativeText = [NSString stringWithFormat: NSLocalizedString(@" The gitx tool has been installed to %@ ." , @" Informative text for successfully completed installation of the command line tool at the location %@ " ), installationPath];
213
- } else {
214
- alert.messageText = NSLocalizedString(@" Installation Failed" , @" Headline for failed installation of the command line tool" );
215
- alert.informativeText = [NSString stringWithFormat: NSLocalizedString(@" Installation to %@ failed." , @" Informative text for successfully completed installation of the command line tool at the location %@ " ), installationPath];
216
- }
217
- [alert runModal ];
218
- }
219
-
220
- #pragma mark Sparkle delegate methods
221
-
222
- - (NSArray *)feedParametersForUpdater : (SUUpdater *)updater sendingSystemProfile : (BOOL )sendingProfile
223
- {
224
- NSArray *keys = [NSArray arrayWithObjects: @" key" , @" displayKey" , @" value" , @" displayValue" , nil ];
225
- NSMutableArray *feedParameters = [NSMutableArray array ];
226
-
227
- // only add parameters if the profile is being sent this time
228
- if (sendingProfile) {
229
- NSString *CFBundleGitVersion = [[[NSBundle mainBundle ] infoDictionary ] valueForKey: @" CFBundleGitVersion" ];
230
- if (CFBundleGitVersion)
231
- [feedParameters addObject: [NSDictionary dictionaryWithObjects: [NSArray arrayWithObjects: @" CFBundleGitVersion" , @" Full Version" , CFBundleGitVersion, CFBundleGitVersion, nil ]
232
- forKeys: keys]];
233
-
234
- NSString *gitVersion = [PBGitBinary version ];
235
- if (gitVersion)
236
- [feedParameters addObject: [NSDictionary dictionaryWithObjects: [NSArray arrayWithObjects: @" gitVersion" , @" git Version" , gitVersion, gitVersion, nil ]
237
- forKeys: keys]];
238
- }
239
-
240
- return feedParameters;
241
- }
242
-
243
170
244
171
#pragma mark Help menu
245
172
0 commit comments