From e7be4177bcf124a3dca7c75050b148b6328b20d4 Mon Sep 17 00:00:00 2001 From: hsoft Date: Mon, 15 Jun 2009 12:53:47 +0000 Subject: [PATCH] pe cocoa: moved the details panel refreshing mechanism down to dgbase, and refactored the Consts unit. --HG-- extra : convert_revision : svn%3Ac306627e-7827-47d3-bdf0-9a457c9553a1/trunk%4057 --- base/cocoa/DetailsPanel.h | 3 +++ base/cocoa/DetailsPanel.m | 9 +++++++++ pe/cocoa/Consts.h | 4 ++-- pe/cocoa/Consts.m | 5 ----- pe/cocoa/DetailsPanel.m | 4 +--- pe/cocoa/dupeguru.xcodeproj/project.pbxproj | 4 ---- 6 files changed, 15 insertions(+), 14 deletions(-) delete mode 100644 pe/cocoa/Consts.m diff --git a/base/cocoa/DetailsPanel.h b/base/cocoa/DetailsPanel.h index 8bbd0f52..ca66455a 100644 --- a/base/cocoa/DetailsPanel.h +++ b/base/cocoa/DetailsPanel.h @@ -10,4 +10,7 @@ - (id)initWithPy:(PyApp *)aPy; - (void)refresh; + +/* Notifications */ +- (void)duplicateSelectionChanged:(NSNotification *)aNotification; @end \ No newline at end of file diff --git a/base/cocoa/DetailsPanel.m b/base/cocoa/DetailsPanel.m index 7cca6ede..2c45ef45 100644 --- a/base/cocoa/DetailsPanel.m +++ b/base/cocoa/DetailsPanel.m @@ -1,4 +1,5 @@ #import "DetailsPanel.h" +#import "Consts.h" @implementation DetailsPanelBase - (id)initWithPy:(PyApp *)aPy @@ -6,6 +7,7 @@ self = [super initWithWindowNibName:@"Details"]; [self window]; //So the detailsTable is initialized. [detailsTable setPy:aPy]; + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(duplicateSelectionChanged:) name:DuplicateSelectionChangedNotification object:nil]; return self; } @@ -13,4 +15,11 @@ { [detailsTable reloadData]; } + +/* Notifications */ +- (void)duplicateSelectionChanged:(NSNotification *)aNotification +{ + if ([[self window] isVisible]) + [self refresh]; +} @end diff --git a/pe/cocoa/Consts.h b/pe/cocoa/Consts.h index c8aea9fa..f8f8bc8a 100644 --- a/pe/cocoa/Consts.h +++ b/pe/cocoa/Consts.h @@ -1,4 +1,4 @@ #import "dgbase/Consts.h" -extern NSString *ImageLoadedNotification; -extern NSString *APPNAME; \ No newline at end of file +#define APPNAME @"dupeGuru PE" +#define ImageLoadedNotification @"ImageLoadedNotification" diff --git a/pe/cocoa/Consts.m b/pe/cocoa/Consts.m deleted file mode 100644 index b7c57178..00000000 --- a/pe/cocoa/Consts.m +++ /dev/null @@ -1,5 +0,0 @@ -#import "Consts.h" - -NSString *ImageLoadedNotification = @"ImageLoadedNotification"; -NSString *APPNAME = @"dupeGuru PE"; - diff --git a/pe/cocoa/DetailsPanel.m b/pe/cocoa/DetailsPanel.m index acfd608f..809c565c 100644 --- a/pe/cocoa/DetailsPanel.m +++ b/pe/cocoa/DetailsPanel.m @@ -11,7 +11,6 @@ self = [super initWithPy:aPy]; py = aPy; _needsRefresh = YES; - [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(duplicateSelectionChanged:) name:DuplicateSelectionChangedNotification object:nil]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(imageLoaded:) name:ImageLoadedNotification object:self]; return self; } @@ -55,8 +54,7 @@ - (void)duplicateSelectionChanged:(NSNotification *)aNotification { _needsRefresh = YES; - if ([[self window] isVisible]) - [self refresh]; + [super duplicateSelectionChanged:aNotification]; } - (void)imageLoaded:(NSNotification *)aNotification diff --git a/pe/cocoa/dupeguru.xcodeproj/project.pbxproj b/pe/cocoa/dupeguru.xcodeproj/project.pbxproj index 05f0139d..703c7c9d 100644 --- a/pe/cocoa/dupeguru.xcodeproj/project.pbxproj +++ b/pe/cocoa/dupeguru.xcodeproj/project.pbxproj @@ -47,7 +47,6 @@ CEDA432E0B07C6E600B3091A /* dg.xsl in Resources */ = {isa = PBXBuildFile; fileRef = CEDA432C0B07C6E600B3091A /* dg.xsl */; }; CEDA432F0B07C6E600B3091A /* hardcoded.css in Resources */ = {isa = PBXBuildFile; fileRef = CEDA432D0B07C6E600B3091A /* hardcoded.css */; }; CEEB135209C837A2004D2330 /* dupeguru.icns in Resources */ = {isa = PBXBuildFile; fileRef = CEEB135109C837A2004D2330 /* dupeguru.icns */; }; - CEF4112B0A11069600E7F110 /* Consts.m in Sources */ = {isa = PBXBuildFile; fileRef = CEF4112A0A11069600E7F110 /* Consts.m */; }; CEF7823809C8AA0200EF38FF /* gear.png in Resources */ = {isa = PBXBuildFile; fileRef = CEF7823709C8AA0200EF38FF /* gear.png */; }; CEFC294609C89E3D00D9F998 /* folder32.png in Resources */ = {isa = PBXBuildFile; fileRef = CEFC294509C89E3D00D9F998 /* folder32.png */; }; CEFC295509C89FF200D9F998 /* details32.png in Resources */ = {isa = PBXBuildFile; fileRef = CEFC295309C89FF200D9F998 /* details32.png */; }; @@ -139,7 +138,6 @@ CEDA432C0B07C6E600B3091A /* dg.xsl */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = text.xml; name = dg.xsl; path = w3/dg.xsl; sourceTree = SOURCE_ROOT; }; CEDA432D0B07C6E600B3091A /* hardcoded.css */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = text; name = hardcoded.css; path = w3/hardcoded.css; sourceTree = SOURCE_ROOT; }; CEEB135109C837A2004D2330 /* dupeguru.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = dupeguru.icns; sourceTree = ""; }; - CEF4112A0A11069600E7F110 /* Consts.m */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.objc; path = Consts.m; sourceTree = SOURCE_ROOT; }; CEF7823709C8AA0200EF38FF /* gear.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = gear.png; path = images/gear.png; sourceTree = ""; }; CEFC294509C89E3D00D9F998 /* folder32.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = folder32.png; path = images/folder32.png; sourceTree = SOURCE_ROOT; }; CEFC295309C89FF200D9F998 /* details32.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = details32.png; path = images/details32.png; sourceTree = SOURCE_ROOT; }; @@ -169,7 +167,6 @@ CE381C9509914ACE003581CE /* AppDelegate.h */, CE381C9409914ACE003581CE /* AppDelegate.m */, CE848A1809DD85810004CB44 /* Consts.h */, - CEF4112A0A11069600E7F110 /* Consts.m */, CECA899A09DB132E00A3D774 /* DetailsPanel.h */, CECA899B09DB132E00A3D774 /* DetailsPanel.m */, CE68EE6509ABC48000971085 /* DirectoryPanel.h */, @@ -416,7 +413,6 @@ CE381C9C09914ADF003581CE /* ResultWindow.m in Sources */, CE68EE6809ABC48000971085 /* DirectoryPanel.m in Sources */, CECA899D09DB132E00A3D774 /* DetailsPanel.m in Sources */, - CEF4112B0A11069600E7F110 /* Consts.m in Sources */, CE0C46AA0FA0647E000BE99B /* PictureBlocks.m in Sources */, CE80DB2E0FC192D60086DCA6 /* Dialogs.m in Sources */, CE80DB2F0FC192D60086DCA6 /* HSErrorReportWindow.m in Sources */,