mirror of
https://github.com/textmate/textmate.git
synced 2026-04-28 03:00:34 -04:00
Going to SCM status has the groups expanded
Previously these would not initially be expanded but the expansion state remembered. Now that we regularly clear cache of expanded URLs, it’s more tedious regularly having to expand these two groups. It also introduce new API for having data sources return what items should be initially expanded, which probably makes sense for some data sources.
This commit is contained in:
@@ -188,6 +188,8 @@ static NSSet* VisibleItems (NSOutlineView* outlineView, FSItem* root, NSMutableS
|
||||
|
||||
if(dataSource = aDataSource)
|
||||
{
|
||||
if(NSArray* expandedByDefault = [dataSource expandedURLs])
|
||||
[expandedURLs addObjectsFromArray:expandedByDefault];
|
||||
[outlineView setDataSource:dataSource];
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(itemDidReload:) name:FSItemDidReloadNotification object:dataSource];
|
||||
[self expandAndSelectChildren:dataSource.rootItem expandAll:NO];
|
||||
|
||||
@@ -11,6 +11,7 @@ extern NSString* const FSItemDidReloadNotification;
|
||||
@property (nonatomic, retain) FSItem* rootItem;
|
||||
- (BOOL)reloadItem:(FSItem*)anItem; // Returns YES if reload happens in the background. An FSItemDidReloadNotification is posted when reload has completed.
|
||||
- (BOOL)unloadItem:(FSItem*)anItem;
|
||||
- (NSArray*)expandedURLs;
|
||||
@end
|
||||
|
||||
static NSUInteger const kFSDataSourceOptionGroupsFirst = (1 << 0);
|
||||
|
||||
@@ -60,6 +60,11 @@ FSDataSource* DataSourceForURL (NSURL* anURL, NSUInteger someOptions)
|
||||
return NO;
|
||||
}
|
||||
|
||||
- (NSArray*)expandedURLs
|
||||
{
|
||||
return nil;
|
||||
}
|
||||
|
||||
// =====================================
|
||||
// = NSOutlineView Data Source Methods =
|
||||
// =====================================
|
||||
|
||||
@@ -148,6 +148,11 @@ _Iter prune_path_children (_Iter it, _Iter last)
|
||||
return self;
|
||||
}
|
||||
|
||||
- (NSArray*)expandedURLs
|
||||
{
|
||||
return @[ URLAppend(self.rootItem.url, @".unstaged/"), URLAppend(self.rootItem.url, @".untracked/") ];
|
||||
}
|
||||
|
||||
- (void)dealloc
|
||||
{
|
||||
if(scmInfo && scmCallback)
|
||||
|
||||
Reference in New Issue
Block a user