From d2852f957172c6530845e323ebb970de3252cb59 Mon Sep 17 00:00:00 2001 From: Sergii Stoian Date: Wed, 16 Jan 2008 23:16:24 +0000 Subject: [PATCH] * Framework/PCProjectBrowser.m: (doubleClick:): open file with external application only if NSWorkspace doesn't return "ProjectCenter.app" appliction name. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/apps/projectcenter/trunk@25958 72102866-910b-0410-8b05-ffd578937521 --- Documentation/ChangeLog | 6 ++++++ Framework/PCProjectBrowser.m | 39 ++++++++++++++++++++++++------------ 2 files changed, 32 insertions(+), 13 deletions(-) diff --git a/Documentation/ChangeLog b/Documentation/ChangeLog index 48e666d..0f4f9d0 100644 --- a/Documentation/ChangeLog +++ b/Documentation/ChangeLog @@ -1,3 +1,9 @@ +2008-01-17 Sergii Stoian + + * Framework/PCProjectBrowser.m: (doubleClick:): open file with + external application only if NSWorkspace doesn't return + "ProjectCenter.app" appliction name. + 2008-01-16 Sergii Stoian * GNUmakefile: Remove FileRTF.tiff from resoures. diff --git a/Framework/PCProjectBrowser.m b/Framework/PCProjectBrowser.m index bb6f05d..dcfe2a7 100644 --- a/Framework/PCProjectBrowser.m +++ b/Framework/PCProjectBrowser.m @@ -395,14 +395,17 @@ NSString *PCBrowserDidSetPathNotification = @"PCBrowserDidSetPathNotification"; - (void)doubleClick:(id)sender { - id selectedCell; - NSString *category; - NSString *fileName; - PCProject *activeProject; - NSString *key; - NSString *filePath; + id selectedCell; + NSString *category; + NSString *fileName; + PCProject *activeProject; + NSString *key; + NSString *filePath; + NSWorkspace *workspace; + NSString *appName, *type; - if (sender != browser) + if ((sender != browser) || + [[self nameOfSelectedCategory] isEqualToString:@"Libraries"]) { return; } @@ -418,13 +421,23 @@ NSString *PCBrowserDidSetPathNotification = @"PCBrowserDidSetPathNotification"; { /* PCLogInfo(self, @"{doubleClick} filePath: %@", filePath);*/ - if (![[self nameOfSelectedCategory] isEqualToString:@"Libraries"]) + workspace = [NSWorkspace sharedWorkspace]; + [workspace getInfoForFile:filePath application:&appName type:&type]; +// NSLog (@"Open file: %@ with app: %@", filePath, appName); + + // If 'Editor' role was set in .GNUstepExtPrefs application + // name will be returned according that setting. Otherwise + // 'ProjectCenter.app' will be returned accoring to NSTypes + // from Info-gnustep.plist file of PC. + if (appName == nil || + [appName isEqualToString:@"ProjectCenter.app"]) { - if ([[NSWorkspace sharedWorkspace] openFile:filePath] == NO) - { - [[project projectEditor] openEditorForCategoryPath:[browser path] - windowed:YES]; - } + [[project projectEditor] openEditorForCategoryPath:[browser path] + windowed:YES]; + } + else + { + [workspace openFile:filePath]; } } else