mirror of
https://github.com/textmate/textmate.git
synced 2026-04-28 03:00:34 -04:00
Drop non-singleton support for the file chooser
The main problem was restoring the data source in showWindow: since that would lose state such as selected item.
This commit is contained in:
@@ -251,7 +251,7 @@ static path::glob_list_t globs_for_path (std::string const& path)
|
||||
_openDocumentsMap.clear();
|
||||
_records.clear();
|
||||
|
||||
[super windowWillClose:aNotification];
|
||||
self.items = @[ ];
|
||||
}
|
||||
|
||||
- (void)updateWindowTitle
|
||||
|
||||
@@ -22,6 +22,5 @@ PUBLIC @interface OakChooser : NSObject
|
||||
@property (nonatomic) NSTextField* statusTextField;
|
||||
@property (nonatomic) NSTextField* itemCountTextField;
|
||||
|
||||
- (void)windowWillClose:(NSNotification*)aNotification;
|
||||
- (void)accept:(id)sender;
|
||||
@end
|
||||
|
||||
@@ -27,7 +27,6 @@ NSMutableAttributedString* CreateAttributedStringWithMarkedUpRanges (std::string
|
||||
}
|
||||
|
||||
@interface OakChooser () <NSWindowDelegate, NSTableViewDataSource, NSTableViewDelegate>
|
||||
@property (nonatomic) OakChooser* retainedSelf;
|
||||
@end
|
||||
|
||||
@implementation OakChooser
|
||||
@@ -99,8 +98,6 @@ NSMutableAttributedString* CreateAttributedStringWithMarkedUpRanges (std::string
|
||||
_window.delegate = self;
|
||||
_window.level = NSFloatingWindowLevel;
|
||||
_window.releasedWhenClosed = NO;
|
||||
|
||||
_retainedSelf = self;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
@@ -122,12 +119,6 @@ NSMutableAttributedString* CreateAttributedStringWithMarkedUpRanges (std::string
|
||||
|
||||
- (void)showWindow:(id)sender
|
||||
{
|
||||
_retainedSelf = self;
|
||||
|
||||
_tableView.target = self;
|
||||
_tableView.dataSource = self;
|
||||
_tableView.delegate = self;
|
||||
|
||||
[_window makeKeyAndOrderFront:self];
|
||||
[_window makeFirstResponder:_searchField];
|
||||
}
|
||||
@@ -137,15 +128,6 @@ NSMutableAttributedString* CreateAttributedStringWithMarkedUpRanges (std::string
|
||||
[_window performClose:self];
|
||||
}
|
||||
|
||||
- (void)windowWillClose:(NSNotification*)aNotification
|
||||
{
|
||||
_tableView.target = nil;
|
||||
_tableView.dataSource = nil;
|
||||
_tableView.delegate = nil;
|
||||
|
||||
_retainedSelf = nil;
|
||||
}
|
||||
|
||||
// ==============
|
||||
// = Properties =
|
||||
// ==============
|
||||
@@ -190,8 +172,7 @@ NSMutableAttributedString* CreateAttributedStringWithMarkedUpRanges (std::string
|
||||
[_window orderOut:self];
|
||||
if(_action)
|
||||
[NSApp sendAction:_action to:_target from:self];
|
||||
|
||||
[_window close]; // Should be last as it gives up ‘retainedSelf’
|
||||
[_window close];
|
||||
}
|
||||
|
||||
- (void)cancel:(id)sender
|
||||
|
||||
Reference in New Issue
Block a user