mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-11-29 09:52:03 +00:00
SmartFoldersDemo: Call framework API directly instead of probing for it
Guarding framework calls with -respondsToSelector: let absent API pass unnoticed and disabled the dependent features silently instead of failing. - MainWindowController: Set the main split view's button bar and autosave name directly. - PeopleViewController: Set the split view and table view autosave settings and the button bar resize control directly. - SourceListViewController: Set the button bar resize control and its alignment directly. - SmartFolderEditorController: Test the expression type of each left pop-up item directly, since every item represents an expression.
This commit is contained in:
1 parent
3702d682eb
commit
9f76d9146f
4 files changed
+9
-22
No files matched your search
@@ -110,11 +110,8 @@ var ToolbarSidebarIdentifier = @"SidebarItem",
|
||||
[_splitView addSubview:people];
|
||||
[contentView addSubview:_splitView];
|
||||
|
||||
if ([_splitView respondsToSelector:@selector(setButtonBar:forDividerAtIndex:)])
|
||||
[_splitView setButtonBar:[_sourceListController buttonBar] forDividerAtIndex:0];
|
||||
|
||||
if ([_splitView respondsToSelector:@selector(setAutosaveName:)])
|
||||
[_splitView setAutosaveName:@"SmartFoldersDemo.MainSplit"];
|
||||
[_splitView setButtonBar:[_sourceListController buttonBar] forDividerAtIndex:0];
|
||||
[_splitView setAutosaveName:@"SmartFoldersDemo.MainSplit"];
|
||||
}
|
||||
|
||||
- (void)_buildToolbar
|
||||
|
||||
@@ -90,8 +90,7 @@
|
||||
[view addSubview:_splitView];
|
||||
[self setView:view];
|
||||
|
||||
if ([_splitView respondsToSelector:@selector(setAutosaveName:)])
|
||||
[_splitView setAutosaveName:@"SmartFoldersDemo.PeopleSplit"];
|
||||
[_splitView setAutosaveName:@"SmartFoldersDemo.PeopleSplit"];
|
||||
|
||||
[self _updateStatus];
|
||||
}
|
||||
@@ -157,13 +156,8 @@
|
||||
[_tableView setDraggingSourceOperationMask:CPDragOperationCopy | CPDragOperationMove forLocal:YES];
|
||||
[_tableView setDraggingSourceOperationMask:CPDragOperationCopy forLocal:NO];
|
||||
|
||||
if ([_tableView respondsToSelector:@selector(setAutosaveName:)])
|
||||
{
|
||||
[_tableView setAutosaveName:@"SmartFoldersDemo.PeopleTable"];
|
||||
|
||||
if ([_tableView respondsToSelector:@selector(setAutosaveTableColumns:)])
|
||||
[_tableView setAutosaveTableColumns:YES];
|
||||
}
|
||||
[_tableView setAutosaveName:@"SmartFoldersDemo.PeopleTable"];
|
||||
[_tableView setAutosaveTableColumns:YES];
|
||||
|
||||
[scrollView setDocumentView:_tableView];
|
||||
[pane addSubview:scrollView];
|
||||
@@ -172,8 +166,7 @@
|
||||
var buttonBar = [[CPButtonBar alloc] initWithFrame:CGRectMake(0, CGRectGetHeight(aFrame) - barHeight, CGRectGetWidth(aFrame), barHeight)];
|
||||
[buttonBar setAutoresizingMask:CPViewWidthSizable | CPViewMinYMargin];
|
||||
|
||||
if ([buttonBar respondsToSelector:@selector(setHasResizeControl:)])
|
||||
[buttonBar setHasResizeControl:NO];
|
||||
[buttonBar setHasResizeControl:NO];
|
||||
|
||||
var plusButton = [CPButtonBar plusButton];
|
||||
[plusButton setTarget:nil];
|
||||
|
||||
@@ -55,7 +55,7 @@ var EditorWidth = 680.0,
|
||||
{
|
||||
var expression = [items[i] representedObject];
|
||||
|
||||
if ([expression respondsToSelector:@selector(expressionType)] && [expression expressionType] === CPKeyPathExpressionType)
|
||||
if ([expression expressionType] === CPKeyPathExpressionType)
|
||||
{
|
||||
var title = EditorTitles[[expression keyPath]];
|
||||
|
||||
|
||||
@@ -424,11 +424,8 @@ var BadgeFont = nil,
|
||||
_buttonBar = [[CPButtonBar alloc] initWithFrame:CGRectMake(0, CGRectGetHeight(frame) - barHeight, CGRectGetWidth(frame), barHeight)];
|
||||
[_buttonBar setAutoresizingMask:CPViewWidthSizable | CPViewMinYMargin];
|
||||
|
||||
if ([_buttonBar respondsToSelector:@selector(setHasResizeControl:)])
|
||||
[_buttonBar setHasResizeControl:YES];
|
||||
|
||||
if ([_buttonBar respondsToSelector:@selector(setResizeControlIsLeftAligned:)])
|
||||
[_buttonBar setResizeControlIsLeftAligned:NO];
|
||||
[_buttonBar setHasResizeControl:YES];
|
||||
[_buttonBar setResizeControlIsLeftAligned:NO];
|
||||
|
||||
var plusButton = [CPButtonBar plusButton];
|
||||
[plusButton setTarget:self];
|
||||
|
||||
Reference in new issue
Block a user