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.
model = [[PyDetailsPanel alloc] initWithModel:aPyRef];
[model bindCallback:createCallback(@"DetailsPanelView", self)];
[model connect];
return self;
}
- (void)dealloc
{
[model disconnect];
[model release];
[super dealloc];
}

View File

@ -17,16 +17,9 @@ http://www.hardcoded.net/licenses/bsd_license
[model bindCallback:createCallback(@"DirectoryOutlineView", self)];
[model release];
[outlineView registerForDraggedTypes:[NSArray arrayWithObject:NSFilenamesPboardType]];
[[self py] connect];
return self;
}
- (void)dealloc
{
[[self py] disconnect];
[super dealloc];
}
- (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];
criteriaList = [[HSSelectableList alloc] initWithPyRef:[[self model] criteriaList] tableView:criteriaTableView];
prioritizationList = [[PrioritizeList alloc] initWithPyRef:[[self model] prioritizationList] tableView:prioritizationTableView];
[model connect];
return self;
}
- (void)dealloc
{
[model disconnect];
[categoryPopUp release];
[criteriaList release];
[prioritizationList release];

View File

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

View File

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

View File

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

View File

@ -112,7 +112,12 @@ class DupeGuru(RegistrableApplication, Broadcaster):
self.prioritize_dialog = PrioritizeDialog(self)
self.problem_dialog = ProblemDialog(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
def _get_display_info(self, dupe, group, delta):
@ -127,6 +132,9 @@ class DupeGuru(RegistrableApplication, Broadcaster):
def _prioritization_categories(self):
raise NotImplementedError()
def _create_result_table(self):
raise NotImplementedError()
#--- Private
def _do_delete(self, j, replace_with_hardlinks):
def op(dupe):

View File

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

View File

@ -17,10 +17,6 @@ class DupeGuru(DupeGuruBase):
NAME = __appname__
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):
size = dupe.size
mtime = dupe.mtime
@ -67,3 +63,6 @@ class DupeGuru(DupeGuruBase):
def _prioritization_categories(self):
return prioritize.all_categories()
def _create_result_table(self):
return ResultTable(self)