Skip to content
Snippets Groups Projects
Commit 86f20ce3 authored by George Nachman's avatar George Nachman
Browse files

Remove silly diff file

parent 7e1cfada
No related branches found
No related tags found
No related merge requests found
Index: source/PSMTabBarControl.h
===================================================================
--- source/PSMTabBarControl.h (revision 255)
+++ source/PSMTabBarControl.h (working copy)
@@ -154,6 +154,7 @@
- (void)setAutomaticallyAnimates:(BOOL)value;
- (int)tabLocation;
- (void)setTabLocation:(int)value;
+- (void)changeIdentifier:(id)newIdentifier atIndex:(int)theIndex;
// accessors
- (NSTabView *)tabView;
@@ -177,6 +178,7 @@
// internal bindings methods also used by the tab drag assistant
- (void)bindPropertiesForCell:(PSMTabBarCell *)cell andTabViewItem:(NSTabViewItem *)item;
+- (void)disconnectItem:(NSObjectController*)item fromCell:(PSMTabBarCell*)cell;
- (void)removeTabForCell:(PSMTabBarCell *)cell;
@end
Index: source/PSMTabBarControl.m
===================================================================
--- source/PSMTabBarControl.m (revision 255)
+++ source/PSMTabBarControl.m (working copy)
@@ -519,6 +519,19 @@
//[self update];
}
+- (void)disconnectItem:(NSObjectController*)item fromCell:(PSMTabBarCell*)cell
+{
+ if ([item respondsToSelector:@selector(isProcessing)]) {
+ [item removeObserver:cell forKeyPath:@"isProcessing"];
+ }
+ if ([item respondsToSelector:@selector(icon)]) {
+ [item removeObserver:cell forKeyPath:@"icon"];
+ }
+ if ([item respondsToSelector:@selector(objectCount)]) {
+ [item removeObserver:cell forKeyPath:@"objectCount"];
+ }
+}
+
- (void)removeTabForCell:(PSMTabBarCell *)cell
{
NSObjectController *item = [[cell representedObject] identifier];
@@ -531,16 +544,7 @@
[cell unbind:@"count"];
if (item != nil) {
-
- if ([item respondsToSelector:@selector(isProcessing)]) {
- [item removeObserver:cell forKeyPath:@"isProcessing"];
- }
- if ([item respondsToSelector:@selector(icon)]) {
- [item removeObserver:cell forKeyPath:@"icon"];
- }
- if ([item respondsToSelector:@selector(objectCount)]) {
- [item removeObserver:cell forKeyPath:@"objectCount"];
- }
+ [self disconnectItem:item fromCell:cell];
}
// stop watching identifier
@@ -1985,6 +1989,24 @@
[self update];
}
+- (void)changeIdentifier:(id)newIdentifier atIndex:(int)theIndex
+{
+ PSMTabBarCell *cell;
+ NSTabViewItem* tabViewItem = [tabView tabViewItemAtIndex:theIndex];
+ assert(tabViewItem);
+ NSEnumerator *e = [_cells objectEnumerator];
+ while ( (cell = [e nextObject])) {
+ if ([cell representedObject] == tabViewItem) {
+ [self disconnectItem:[tabViewItem identifier] fromCell:cell];
+ [[cell representedObject] removeObserver:self forKeyPath:@"identifier"];
+ [tabViewItem setIdentifier:newIdentifier];
+ [self bindPropertiesForCell:cell andTabViewItem:tabViewItem];
+ return;
+ }
+ }
+ assert(false);
+}
+
#pragma mark -
#pragma mark Convenience
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment