Skip to content

Commit dbd3b83

Browse files
committed
Merge branch 'integration'
2 parents be65ac7 + 1820973 commit dbd3b83

File tree

403 files changed

+66955
-4328
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

403 files changed

+66955
-4328
lines changed

.gitignore

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
build
22
build/revision
3-
*.xcodeproj/*.pbxuser
4-
*.xcodeproj/*.perspectivev3
5-
*.xcodeproj/*.mode1v3
6-
*.xcodeproj/*.tm_build_errors
7-
*.tmproj
3+
*.xcodeproj/
4+
!*.xcodeproj/project.pbxproj
85
Nightly.app.zip

.gitmodules

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
[submodule "libgit2"]
2-
path = libgit2
3-
url = git://github.com/pieter/libgit2.git
2+
path = libgit2
3+
url = git://repo.or.cz/libgit2.git

ApplicationController.h

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
#import <Cocoa/Cocoa.h>
1010
#import "PBGitRepository.h"
1111

12-
@class PBCLIProxy;
12+
@class PBCloneRepositoryPanel;
1313

1414
@interface ApplicationController : NSObject
1515
{
@@ -19,9 +19,8 @@
1919
NSManagedObjectModel *managedObjectModel;
2020
NSManagedObjectContext *managedObjectContext;
2121

22-
PBCLIProxy *cliProxy;
22+
PBCloneRepositoryPanel *cloneRepositoryPanel;
2323
}
24-
@property (retain) PBCLIProxy* cliProxy;
2524

2625
- (NSPersistentStoreCoordinator *)persistentStoreCoordinator;
2726
- (NSManagedObjectModel *)managedObjectModel;
@@ -33,6 +32,8 @@
3332
- (IBAction)installCliTool:(id)sender;
3433

3534
- (IBAction)saveAction:sender;
36-
- (IBAction) showHelp:(id) sender;
35+
- (IBAction)showHelp:(id)sender;
36+
- (IBAction)reportAProblem:(id)sender;
3737

38+
- (IBAction)showCloneRepository:(id)sender;
3839
@end

ApplicationController.m

Lines changed: 101 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -10,30 +10,29 @@
1010
#import "PBGitRevisionCell.h"
1111
#import "PBGitWindowController.h"
1212
#import "PBRepositoryDocumentController.h"
13-
#import "PBCLIProxy.h"
1413
#import "PBServicesController.h"
1514
#import "PBGitXProtocol.h"
1615
#import "PBPrefsWindowController.h"
1716
#import "PBNSURLPathUserDefaultsTransfomer.h"
1817
#import "PBGitDefaults.h"
18+
#import "PBCloneRepositoryPanel.h"
1919
#import "Sparkle/SUUpdater.h"
2020

2121
@implementation ApplicationController
22-
@synthesize cliProxy;
2322

2423
- (ApplicationController*)init
2524
{
2625
#ifdef DEBUG_BUILD
2726
[NSApp activateIgnoringOtherApps:YES];
2827
#endif
2928

30-
if(self = [super init]) {
29+
if(!(self = [super init]))
30+
return nil;
31+
32+
if(![[NSBundle bundleWithPath:@"/System/Library/Frameworks/Quartz.framework/Frameworks/QuickLookUI.framework"] load])
3133
if(![[NSBundle bundleWithPath:@"/System/Library/PrivateFrameworks/QuickLookUI.framework"] load])
3234
NSLog(@"Could not load QuickLook");
3335

34-
self.cliProxy = [PBCLIProxy new];
35-
}
36-
3736
/* Value Transformers */
3837
NSValueTransformer *transformer = [[PBNSURLPathUserDefaultsTransfomer alloc] init];
3938
[NSValueTransformer setValueTransformer:transformer forName:@"PBNSURLPathUserDefaultsTransfomer"];
@@ -65,34 +64,55 @@ - (void)registerServices
6564
- (void)applicationDidFinishLaunching:(NSNotification*)notification
6665
{
6766
[[SUUpdater sharedUpdater] setSendsSystemProfile:YES];
67+
[[SUUpdater sharedUpdater] setDelegate:self];
68+
69+
// Make sure Git's SSH password requests get forwarded to our little UI tool:
70+
setenv( "SSH_ASKPASS", [[[NSBundle mainBundle] pathForResource: @"gitx_askpasswd" ofType: @""] UTF8String], 1 );
71+
setenv( "DISPLAY", "localhost:0", 1 );
72+
6873
[self registerServices];
6974

75+
BOOL hasOpenedDocuments = NO;
76+
NSArray *launchedDocuments = [[[PBRepositoryDocumentController sharedDocumentController] documents] copy];
77+
7078
// Only try to open a default document if there are no documents open already.
7179
// For example, the application might have been launched by double-clicking a .git repository,
7280
// or by dragging a folder to the app icon
73-
if ([[[PBRepositoryDocumentController sharedDocumentController] documents] count])
74-
return;
75-
76-
if (![[NSApplication sharedApplication] isActive])
77-
return;
78-
79-
NSURL *url = nil;
81+
if ([launchedDocuments count])
82+
hasOpenedDocuments = YES;
83+
84+
// open any documents that were open the last time the app quit
85+
if ([PBGitDefaults openPreviousDocumentsOnLaunch]) {
86+
for (NSString *path in [PBGitDefaults previousDocumentPaths]) {
87+
NSURL *url = [NSURL fileURLWithPath:path isDirectory:YES];
88+
NSError *error = nil;
89+
if (url && [[PBRepositoryDocumentController sharedDocumentController] openDocumentWithContentsOfURL:url display:YES error:&error])
90+
hasOpenedDocuments = YES;
91+
}
92+
}
8093

8194
// Try to find the current directory, to open that as a repository
82-
if ([PBGitDefaults openCurDirOnLaunch]) {
95+
if ([PBGitDefaults openCurDirOnLaunch] && !hasOpenedDocuments) {
8396
NSString *curPath = [[[NSProcessInfo processInfo] environment] objectForKey:@"PWD"];
97+
NSURL *url = nil;
8498
if (curPath)
8599
url = [NSURL fileURLWithPath:curPath];
100+
// Try to open the found URL
101+
NSError *error = nil;
102+
if (url && [[PBRepositoryDocumentController sharedDocumentController] openDocumentWithContentsOfURL:url display:YES error:&error])
103+
hasOpenedDocuments = YES;
86104
}
87105

88-
// Try to open the found URL
89-
NSError *error = nil;
90-
if (url && [[PBRepositoryDocumentController sharedDocumentController] openDocumentWithContentsOfURL:url display:YES error:&error])
106+
// to bring the launched documents to the front
107+
for (PBGitRepository *document in launchedDocuments)
108+
[document showWindows];
109+
110+
if (![[NSApplication sharedApplication] isActive])
91111
return;
92112

93113
// The current directory was not enabled or could not be opened (most likely it’s not a git repository).
94114
// show an open panel for the user to select a repository to view
95-
if ([PBGitDefaults showOpenPanelOnLaunch])
115+
if ([PBGitDefaults showOpenPanelOnLaunch] && !hasOpenedDocuments)
96116
[[PBRepositoryDocumentController sharedDocumentController] openDocument:self];
97117
}
98118

@@ -120,6 +140,14 @@ - (IBAction)showAboutPanel:(id)sender
120140
[NSApp orderFrontStandardAboutPanelWithOptions:dict];
121141
}
122142

143+
- (IBAction) showCloneRepository:(id)sender
144+
{
145+
if (!cloneRepositoryPanel)
146+
cloneRepositoryPanel = [PBCloneRepositoryPanel panel];
147+
148+
[cloneRepositoryPanel showWindow:self];
149+
}
150+
123151
- (IBAction)installCliTool:(id)sender;
124152
{
125153
BOOL success = NO;
@@ -169,11 +197,6 @@ - (IBAction)installCliTool:(id)sender;
169197
former cannot be found), the system's temporary directory.
170198
*/
171199

172-
- (IBAction) showHelp:(id) sender
173-
{
174-
[[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:@"http://gitx.frim.nl/user_manual.html"]];
175-
}
176-
177200
- (NSString *)applicationSupportFolder {
178201

179202
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory, NSUserDomainMask, YES);
@@ -326,6 +349,21 @@ - (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication *)sende
326349
return reply;
327350
}
328351

352+
- (void)applicationWillTerminate:(NSNotification *)aNotification
353+
{
354+
[PBGitDefaults removePreviousDocumentPaths];
355+
356+
if ([PBGitDefaults openPreviousDocumentsOnLaunch]) {
357+
NSArray *documents = [[PBRepositoryDocumentController sharedDocumentController] documents];
358+
if ([documents count] > 0) {
359+
NSMutableArray *paths = [NSMutableArray array];
360+
for (PBGitRepository *repository in documents)
361+
[paths addObject:[repository workingDirectory]];
362+
363+
[PBGitDefaults setPreviousDocumentPaths:paths];
364+
}
365+
}
366+
}
329367

330368
/**
331369
Implementation of dealloc, to release the retained variables.
@@ -338,4 +376,44 @@ - (void) dealloc {
338376
[managedObjectModel release], managedObjectModel = nil;
339377
[super dealloc];
340378
}
379+
380+
381+
#pragma mark Sparkle delegate methods
382+
383+
- (NSArray *)feedParametersForUpdater:(SUUpdater *)updater sendingSystemProfile:(BOOL)sendingProfile
384+
{
385+
NSArray *keys = [NSArray arrayWithObjects:@"key", @"displayKey", @"value", @"displayValue", nil];
386+
NSMutableArray *feedParameters = [NSMutableArray array];
387+
388+
// only add parameters if the profile is being sent this time
389+
if (sendingProfile) {
390+
NSString *CFBundleGitVersion = [[[NSBundle mainBundle] infoDictionary] valueForKey:@"CFBundleGitVersion"];
391+
if (CFBundleGitVersion)
392+
[feedParameters addObject:[NSDictionary dictionaryWithObjects:[NSArray arrayWithObjects:@"CFBundleGitVersion", @"Full Version", CFBundleGitVersion, CFBundleGitVersion, nil]
393+
forKeys:keys]];
394+
395+
NSString *gitVersion = [PBGitBinary version];
396+
if (gitVersion)
397+
[feedParameters addObject:[NSDictionary dictionaryWithObjects:[NSArray arrayWithObjects:@"gitVersion", @"git Version", gitVersion, gitVersion, nil]
398+
forKeys:keys]];
399+
}
400+
401+
return feedParameters;
402+
}
403+
404+
405+
#pragma mark Help menu
406+
407+
- (IBAction)showHelp:(id)sender
408+
{
409+
[[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:@"http://gitx.frim.nl/user_manual.html"]];
410+
}
411+
412+
- (IBAction)reportAProblem:(id)sender
413+
{
414+
[[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:@"http://gitx.lighthouseapp.com/tickets"]];
415+
}
416+
417+
418+
341419
@end

0 commit comments

Comments
 (0)