diff --git a/cocoa/base/AppDelegate.h b/cocoa/base/AppDelegate.h index 41ee5c05..f31d2b66 100644 --- a/cocoa/base/AppDelegate.h +++ b/cocoa/base/AppDelegate.h @@ -49,7 +49,6 @@ http://www.hardcoded.net/licenses/bsd_license - (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication *)sender; - (void)applicationWillTerminate:(NSNotification *)aNotification; - (void)recentFileClicked:(NSString *)path; -- (void)showExtraFairwareReminder:(NSNotification *)aNotification; /* Actions */ - (IBAction)loadResults:(id)sender; @@ -60,4 +59,7 @@ http://www.hardcoded.net/licenses/bsd_license - (IBAction)showPreferencesPanel:(id)sender; - (IBAction)showResultWindow:(id)sender; - (IBAction)startScanning:(id)sender; + +/* model --> view */ +- (void)showExtraFairwareReminder; @end diff --git a/cocoa/base/AppDelegate.m b/cocoa/base/AppDelegate.m index f7b9a582..dcfb75f8 100644 --- a/cocoa/base/AppDelegate.m +++ b/cocoa/base/AppDelegate.m @@ -18,6 +18,7 @@ http://www.hardcoded.net/licenses/bsd_license @implementation AppDelegateBase - (void)awakeFromNib { + [py bindCocoa:self]; NSUserDefaults *ud = [NSUserDefaults standardUserDefaults]; /* Because the pref pane is lazily loaded, we have to manually do the update check if the preference is set. @@ -33,8 +34,6 @@ http://www.hardcoded.net/licenses/bsd_license _aboutBox = nil; // Lazily loaded _preferencesPanel = nil; // Lazily loaded [[[self directoryPanel] window] makeKeyAndOrderFront:self]; - [[NSNotificationCenter defaultCenter] addObserver:self - selector:@selector(showExtraFairwareReminder:) name:ShowExtraFairwareReminder object:nil]; } /* Virtual */ @@ -207,7 +206,9 @@ http://www.hardcoded.net/licenses/bsd_license [py loadResultsFrom:path]; } -- (void)showExtraFairwareReminder:(NSNotification *)aNotification + +/* model --> view */ +- (void)showExtraFairwareReminder { ExtraFairwareReminder *dialog = [[ExtraFairwareReminder alloc] initWithPy:py]; [dialog start]; diff --git a/cocoa/base/Consts.h b/cocoa/base/Consts.h index 8c3e5301..66eb6ec7 100644 --- a/cocoa/base/Consts.h +++ b/cocoa/base/Consts.h @@ -10,7 +10,6 @@ http://www.hardcoded.net/licenses/bsd_license #define JobStarted @"JobStarted" #define JobInProgress @"JobInProgress" -#define ShowExtraFairwareReminder @"ShowExtraFairwareReminder" #define jobLoad @"job_load" #define jobScan @"job_scan" diff --git a/cocoa/base/PyDupeGuru.h b/cocoa/base/PyDupeGuru.h index 1ac8f6d4..7a25a438 100644 --- a/cocoa/base/PyDupeGuru.h +++ b/cocoa/base/PyDupeGuru.h @@ -10,6 +10,7 @@ http://www.hardcoded.net/licenses/bsd_license #import "PyApp.h" @interface PyDupeGuruBase : PyApp +- (void)bindCocoa:(id)cocoa; //Actions - (NSNumber *)addDirectory:(NSString *)name; - (void)removeDirectory:(NSNumber *)index; diff --git a/core/app_cocoa.py b/core/app_cocoa.py index 9377297d..6384856d 100644 --- a/core/app_cocoa.py +++ b/core/app_cocoa.py @@ -44,6 +44,9 @@ class PyDupeGuruBase(PyFairware): self.py = modelclass(self, appdata) self.progress = cocoa.ThreadedJobPerformer() + def bindCocoa_(self, cocoa): + self.cocoa = cocoa + #---Directories def addDirectory_(self, directory): return self.py.add_directory(directory) @@ -211,7 +214,7 @@ class PyDupeGuruBase(PyFairware): NSUserDefaults.standardUserDefaults().setObject_forKey_(value, key_name) def show_extra_fairware_reminder(self): - NSNotificationCenter.defaultCenter().postNotificationName_object_userInfo_('ShowExtraFairwareReminder', self, None) + self.cocoa.showExtraFairwareReminder() class PyDetailsPanel(PyGUIObject): py_class = DetailsPanel