1
0
mirror of https://github.com/arsenetar/dupeguru.git synced 2024-10-31 22:05:58 +00:00

Pushed connect() calls in objc into the core.

--HG--
branch : objp
This commit is contained in:
Virgil Dupras 2012-01-13 16:34:21 -05:00
parent 58347bc36f
commit 9392f818cc
9 changed files with 13 additions and 31 deletions

View File

@ -16,13 +16,11 @@ http://www.hardcoded.net/licenses/bsd_license
[self window]; //So the detailsTable is initialized. [self window]; //So the detailsTable is initialized.
model = [[PyDetailsPanel alloc] initWithModel:aPyRef]; model = [[PyDetailsPanel alloc] initWithModel:aPyRef];
[model bindCallback:createCallback(@"DetailsPanelView", self)]; [model bindCallback:createCallback(@"DetailsPanelView", self)];
[model connect];
return self; return self;
} }
- (void)dealloc - (void)dealloc
{ {
[model disconnect];
[model release]; [model release];
[super dealloc]; [super dealloc];
} }

View File

@ -17,16 +17,9 @@ http://www.hardcoded.net/licenses/bsd_license
[model bindCallback:createCallback(@"DirectoryOutlineView", self)]; [model bindCallback:createCallback(@"DirectoryOutlineView", self)];
[model release]; [model release];
[outlineView registerForDraggedTypes:[NSArray arrayWithObject:NSFilenamesPboardType]]; [outlineView registerForDraggedTypes:[NSArray arrayWithObject:NSFilenamesPboardType]];
[[self py] connect];
return self; return self;
} }
- (void)dealloc
{
[[self py] disconnect];
[super dealloc];
}
- (PyDirectoryOutline *)py - (PyDirectoryOutline *)py
{ {
return (PyDirectoryOutline *)py; return (PyDirectoryOutline *)py;

View File

@ -19,13 +19,11 @@ http://www.hardcoded.net/licenses/bsd_license
categoryPopUp = [[HSPopUpList alloc] initWithPyRef:[[self model] categoryList] popupView:categoryPopUpView]; categoryPopUp = [[HSPopUpList alloc] initWithPyRef:[[self model] categoryList] popupView:categoryPopUpView];
criteriaList = [[HSSelectableList alloc] initWithPyRef:[[self model] criteriaList] tableView:criteriaTableView]; criteriaList = [[HSSelectableList alloc] initWithPyRef:[[self model] criteriaList] tableView:criteriaTableView];
prioritizationList = [[PrioritizeList alloc] initWithPyRef:[[self model] prioritizationList] tableView:prioritizationTableView]; prioritizationList = [[PrioritizeList alloc] initWithPyRef:[[self model] prioritizationList] tableView:prioritizationTableView];
[model connect];
return self; return self;
} }
- (void)dealloc - (void)dealloc
{ {
[model disconnect];
[categoryPopUp release]; [categoryPopUp release];
[criteriaList release]; [criteriaList release];
[prioritizationList release]; [prioritizationList release];

View File

@ -17,15 +17,11 @@ http://www.hardcoded.net/licenses/bsd_license
model = [[PyProblemDialog alloc] initWithModel:aPyRef]; model = [[PyProblemDialog alloc] initWithModel:aPyRef];
problemTable = [[HSTable alloc] initWithPyRef:[model problemTable] tableView:problemTableView]; problemTable = [[HSTable alloc] initWithPyRef:[model problemTable] tableView:problemTableView];
[self initializeColumns]; [self initializeColumns];
[model connect];
[[problemTable model] connect];
return self; return self;
} }
- (void)dealloc - (void)dealloc
{ {
[[problemTable model] disconnect];
[model disconnect];
[problemTable release]; [problemTable release];
[model release]; [model release];
[super dealloc]; [super dealloc];

View File

@ -25,13 +25,11 @@ http://www.hardcoded.net/licenses/bsd_license
[m bindCallback:createCallback(@"ResultTableView", self)]; [m bindCallback:createCallback(@"ResultTableView", self)];
[m release]; [m release];
_deltaColumns = [[NSSet setWithArray:[[self model] deltaColumns]] retain]; _deltaColumns = [[NSSet setWithArray:[[self model] deltaColumns]] retain];
[model connect];
return self; return self;
} }
- (void)dealloc - (void)dealloc
{ {
[model disconnect];
[_deltaColumns release]; [_deltaColumns release];
[super dealloc]; [super dealloc];
} }

View File

@ -15,19 +15,10 @@ http://www.hardcoded.net/licenses/bsd_license
PyStatsLabel *m = [[PyStatsLabel alloc] initWithModel:aPyRef]; PyStatsLabel *m = [[PyStatsLabel alloc] initWithModel:aPyRef];
self = [self initWithModel:m view:aLabelView]; self = [self initWithModel:m view:aLabelView];
[m bindCallback:createCallback(@"StatsLabelView", self)]; [m bindCallback:createCallback(@"StatsLabelView", self)];
[m connect];
[m release]; [m release];
return self; return self;
} }
- (void)dealloc
{
[[self model] disconnect];
[model release];
[view release];
[super dealloc];
}
- (PyStatsLabel *)model - (PyStatsLabel *)model
{ {
return (PyStatsLabel *)model; return (PyStatsLabel *)model;

View File

@ -112,7 +112,12 @@ class DupeGuru(RegistrableApplication, Broadcaster):
self.prioritize_dialog = PrioritizeDialog(self) self.prioritize_dialog = PrioritizeDialog(self)
self.problem_dialog = ProblemDialog(self) self.problem_dialog = ProblemDialog(self)
self.stats_label = StatsLabel(self) self.stats_label = StatsLabel(self)
# subclasses must create self.result_table self.result_table = self._create_result_table()
children = [self.result_table, self.directory_tree, self.problem_dialog, self.stats_label,
self.details_panel]
for child in children:
child.connect()
# subclasses must create and connect self.result_table
#--- Virtual #--- Virtual
def _get_display_info(self, dupe, group, delta): def _get_display_info(self, dupe, group, delta):
@ -127,6 +132,9 @@ class DupeGuru(RegistrableApplication, Broadcaster):
def _prioritization_categories(self): def _prioritization_categories(self):
raise NotImplementedError() raise NotImplementedError()
def _create_result_table(self):
raise NotImplementedError()
#--- Private #--- Private
def _do_delete(self, j, replace_with_hardlinks): def _do_delete(self, j, replace_with_hardlinks):
def op(dupe): def op(dupe):

View File

@ -17,6 +17,7 @@ class ProblemDialog(GUIObject, Broadcaster):
Broadcaster.__init__(self) Broadcaster.__init__(self)
self._selected_dupe = None self._selected_dupe = None
self.problem_table = ProblemTable(self) self.problem_table = ProblemTable(self)
self.problem_table.connect()
def reveal_selected_dupe(self): def reveal_selected_dupe(self):
if self._selected_dupe is not None: if self._selected_dupe is not None:

View File

@ -17,10 +17,6 @@ class DupeGuru(DupeGuruBase):
NAME = __appname__ NAME = __appname__
METADATA_TO_READ = ['size', 'mtime'] METADATA_TO_READ = ['size', 'mtime']
def __init__(self, view, appdata):
DupeGuruBase.__init__(self, view, appdata)
self.result_table = ResultTable(self)
def _get_display_info(self, dupe, group, delta): def _get_display_info(self, dupe, group, delta):
size = dupe.size size = dupe.size
mtime = dupe.mtime mtime = dupe.mtime
@ -67,3 +63,6 @@ class DupeGuru(DupeGuruBase):
def _prioritization_categories(self): def _prioritization_categories(self):
return prioritize.all_categories() return prioritize.all_categories()
def _create_result_table(self):
return ResultTable(self)