зеркало из https://github.com/mozilla/pjs.git
Camino only - Remove 10.2 runtime checks/fallbacks. Patch by smorgan <stuart.morgan@alumni.case.edu> r=josh sr=pink b=356166
This commit is contained in:
Родитель
eb269d7896
Коммит
c69d987412
|
@ -87,11 +87,9 @@ private:
|
|||
|
||||
@end
|
||||
|
||||
// necessary because we're building against the 10.2 SDK and need to use some
|
||||
// private APIs to get at a feature that's hidden in on 10.2
|
||||
// necessary because we're building against the 10.2 SDK
|
||||
@interface NSOpenPanel(NewFolderExtensionsFor102SDK)
|
||||
-(void)setCanCreateDirectories:(BOOL)inInclude; // exists in 10.3 SDK
|
||||
-(void)_setIncludeNewFolderButton:(BOOL)inInclude; // exists on 10.2 as private api
|
||||
@end
|
||||
|
||||
@implementation OrgMozillaChimeraPreferenceDownloads
|
||||
|
@ -234,10 +232,7 @@ private:
|
|||
[panel setCanChooseFiles:NO];
|
||||
[panel setCanChooseDirectories:YES];
|
||||
[panel setAllowsMultipleSelection:NO];
|
||||
if ([panel respondsToSelector:@selector(setCanCreateDirectories:)])
|
||||
[panel setCanCreateDirectories:YES];
|
||||
else if ([panel respondsToSelector:@selector(_setIncludeNewFolderButton:)]) // try private API in 10.2
|
||||
[panel _setIncludeNewFolderButton:YES];
|
||||
[panel setCanCreateDirectories:YES];
|
||||
[panel setPrompt:NSLocalizedString(@"ChooseDirectoryOKButton", @"")];
|
||||
|
||||
[panel beginSheetForDirectory:oldDLFolder file:nil types:nil modalForWindow:[mDownloadFolder window]
|
||||
|
|
|
@ -72,50 +72,6 @@ const int kWarnAboutCookies = 1;
|
|||
// sort order indicators
|
||||
const int kSortReverse = 1;
|
||||
|
||||
//
|
||||
// category on NSTableView for 10.2+ that reveals private api points to
|
||||
// get the sort indicators. These are named images on 10.3 but we can use
|
||||
// these as a good fallback
|
||||
//
|
||||
@interface NSTableView(Undocumented)
|
||||
+ (NSImage*)_defaultTableHeaderSortImage;
|
||||
+ (NSImage*)_defaultTableHeaderReverseSortImage;
|
||||
@end
|
||||
|
||||
@interface NSTableView(Extensions)
|
||||
+ (NSImage*)indicatorImage:(BOOL)inSortAscending;
|
||||
@end
|
||||
|
||||
@implementation NSTableView(Extensions)
|
||||
|
||||
//
|
||||
// +indicatorImage:
|
||||
//
|
||||
// Tries two different methods to get the sort indicator image. First it tries
|
||||
// the named image, which is only available on 10.3+. If that fails, it tries a
|
||||
// private api available on 10.2+. If that fails, setting the indicator to a nil
|
||||
// image is still fine, it just clears it.
|
||||
//
|
||||
+ (NSImage*)indicatorImage:(BOOL)inSortAscending
|
||||
{
|
||||
NSImage* image = nil;
|
||||
if (inSortAscending) {
|
||||
image = [NSImage imageNamed:@"NSAscendingSortIndicator"];
|
||||
if (!image && [NSTableView respondsToSelector:@selector(_defaultTableHeaderSortImage)])
|
||||
image = [NSTableView _defaultTableHeaderSortImage];
|
||||
}
|
||||
else {
|
||||
image = [NSImage imageNamed:@"NSDescendingSortIndicator"];
|
||||
if (!image && [NSTableView respondsToSelector:@selector(_defaultTableHeaderReverseSortImage)])
|
||||
image = [NSTableView _defaultTableHeaderReverseSortImage];
|
||||
}
|
||||
return image;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
#pragma mark -
|
||||
|
||||
@interface OrgMozillaChimeraPreferencePrivacy(Private)
|
||||
|
||||
- (void)addPermission:(int)inPermission forHost:(NSString*)inHost;
|
||||
|
@ -387,22 +343,19 @@ PR_STATIC_CALLBACK(int) compareValues(nsICookie* aCookie1, nsICookie* aCookie2,
|
|||
NSTableColumn* sortedColumn = [mCookiesTable tableColumnWithIdentifier:@"Website"];
|
||||
[mCookiesTable setHighlightedTableColumn:sortedColumn];
|
||||
if ([mCookiesTable respondsToSelector:@selector(setIndicatorImage:inTableColumn:)])
|
||||
[mCookiesTable setIndicatorImage:[NSTableView indicatorImage:YES] inTableColumn:sortedColumn];
|
||||
[mCookiesTable setIndicatorImage:[NSImage imageNamed:@"NSAscendingSortIndicator"] inTableColumn:sortedColumn];
|
||||
mSortedAscending = YES;
|
||||
|
||||
// ensure a row is selected (cocoa doesn't do this for us, but will keep
|
||||
// us from unselecting a row once one is set; go figure).
|
||||
[mCookiesTable selectRow: 0 byExtendingSelection: NO];
|
||||
|
||||
// use alternating row colors on 10.3+
|
||||
if ([mCookiesTable respondsToSelector:@selector(setUsesAlternatingRowBackgroundColors:)]) {
|
||||
[mCookiesTable setUsesAlternatingRowBackgroundColors:YES];
|
||||
NSArray* columns = [mCookiesTable tableColumns];
|
||||
if (columns) {
|
||||
int numColumns = [columns count];
|
||||
for (int i = 0; i < numColumns; ++i)
|
||||
[[[columns objectAtIndex:i] dataCell] setDrawsBackground:NO];
|
||||
}
|
||||
[mCookiesTable setUsesAlternatingRowBackgroundColors:YES];
|
||||
NSArray* columns = [mCookiesTable tableColumns];
|
||||
if (columns) {
|
||||
int numColumns = [columns count];
|
||||
for (int i = 0; i < numColumns; ++i)
|
||||
[[[columns objectAtIndex:i] dataCell] setDrawsBackground:NO];
|
||||
}
|
||||
|
||||
//clear the filter field
|
||||
|
@ -590,16 +543,14 @@ PR_STATIC_CALLBACK(int) compareValues(nsICookie* aCookie1, nsICookie* aCookie2,
|
|||
NSTableColumn* sortedColumn = [mPermissionsTable tableColumnWithIdentifier:@"Website"];
|
||||
[mPermissionsTable setHighlightedTableColumn:sortedColumn];
|
||||
if ([mPermissionsTable respondsToSelector:@selector(setIndicatorImage:inTableColumn:)])
|
||||
[mPermissionsTable setIndicatorImage:[NSTableView indicatorImage:YES] inTableColumn:sortedColumn];
|
||||
[mPermissionsTable setIndicatorImage:[NSImage imageNamed:@"NSAscendingSortIndicator"] inTableColumn:sortedColumn];
|
||||
mSortedAscending = YES;
|
||||
|
||||
// ensure a row is selected (cocoa doesn't do this for us, but will keep
|
||||
// us from unselecting a row once one is set; go figure).
|
||||
[mPermissionsTable selectRow:0 byExtendingSelection:NO];
|
||||
|
||||
// use alternating row colors on 10.3+
|
||||
if ([mPermissionsTable respondsToSelector:@selector(setUsesAlternatingRowBackgroundColors:)])
|
||||
[mPermissionsTable setUsesAlternatingRowBackgroundColors:YES];
|
||||
[mPermissionsTable setUsesAlternatingRowBackgroundColors:YES];
|
||||
|
||||
//clear the filter field
|
||||
[mPermissionFilterField setStringValue: @""];
|
||||
|
@ -910,7 +861,8 @@ PR_STATIC_CALLBACK(int) compareValues(nsICookie* aCookie1, nsICookie* aCookie2,
|
|||
// adjust sort indicator on new column, removing from old column
|
||||
if ([aTableView respondsToSelector:@selector(setIndicatorImage:inTableColumn:)]) {
|
||||
[aTableView setIndicatorImage:nil inTableColumn:[aTableView highlightedTableColumn]];
|
||||
[aTableView setIndicatorImage:[NSTableView indicatorImage:mSortedAscending] inTableColumn:aTableColumn];
|
||||
NSImage *sortIndicator = [NSImage imageNamed:(mSortedAscending ? @"NSAscendingSortIndicator" : @"NSDescendingSortIndicator")];
|
||||
[aTableView setIndicatorImage:sortIndicator inTableColumn:aTableColumn];
|
||||
}
|
||||
|
||||
if (aTableView == mPermissionsTable) {
|
||||
|
|
|
@ -322,11 +322,8 @@ static const unsigned int TableViewSolidVerticalGridLineMask = 1;
|
|||
NSTableColumn* itemNameColumn = [tableView tableColumnWithIdentifier: @"title"];
|
||||
[itemNameColumn setDataCell:imageAndTextCell];
|
||||
|
||||
if ([tableView respondsToSelector:@selector(setUsesAlternatingRowBackgroundColors:)]) {
|
||||
[tableView setUsesAlternatingRowBackgroundColors:YES];
|
||||
// if it responds to the above selector, then it will respond to this too...
|
||||
[tableView setGridStyleMask:TableViewSolidVerticalGridLineMask];
|
||||
}
|
||||
[tableView setUsesAlternatingRowBackgroundColors:YES];
|
||||
[tableView setGridStyleMask:TableViewSolidVerticalGridLineMask];
|
||||
|
||||
// set up the font on the item & search views to be smaller
|
||||
// also don't let the cells draw their backgrounds
|
||||
|
|
|
@ -52,9 +52,6 @@
|
|||
|
||||
NSString* const kTabWillChangeNotifcation = @"kTabWillChangeNotifcation";
|
||||
|
||||
// we cannot use the spinner before 10.2, so don't allow it. This is the
|
||||
// version of appkit in 10.2 (taken from the 10.3 SDK headers which we cannot use).
|
||||
const double kJaguarAppKitVersion = 663;
|
||||
// truncate menuitem title to the same width as the bookmarks menu
|
||||
const int kMenuTruncationChars = 60;
|
||||
|
||||
|
@ -328,15 +325,11 @@ const int kMenuTruncationChars = 60;
|
|||
#if USE_PROGRESS_SPINNER
|
||||
// the progress spinner causes content to shear when scrolling because of
|
||||
// redraw problems on jaguar and panther. Removing until we can fix it. (bug 203349)
|
||||
if (NSAppKitVersionNumber >= kJaguarAppKitVersion) {
|
||||
mProgressWheel = [[NSProgressIndicator alloc] initWithFrame:NSMakeRect(0, 0, 16, 16)];
|
||||
[mProgressWheel setStyle:NSProgressIndicatorSpinningStyle];
|
||||
[mProgressWheel setUsesThreadedAnimation:YES];
|
||||
[mProgressWheel setDisplayedWhenStopped:NO];
|
||||
[mProgressWheel setAutoresizingMask:NSViewMaxXMargin];
|
||||
}
|
||||
else
|
||||
mProgressWheel = nil;
|
||||
mProgressWheel = [[NSProgressIndicator alloc] initWithFrame:NSMakeRect(0, 0, 16, 16)];
|
||||
[mProgressWheel setStyle:NSProgressIndicatorSpinningStyle];
|
||||
[mProgressWheel setUsesThreadedAnimation:YES];
|
||||
[mProgressWheel setDisplayedWhenStopped:NO];
|
||||
[mProgressWheel setAutoresizingMask:NSViewMaxXMargin];
|
||||
#endif
|
||||
|
||||
// create close button. keep a strong ref as view goes in and out of view hierarchy
|
||||
|
|
|
@ -373,8 +373,7 @@ static void FileSystemNotificationProc(FNMessage message, OptionBits flags, void
|
|||
mDownloadTime = -[mStartTime timeIntervalSinceNow];
|
||||
[mProgressBar stopAnimation:self];
|
||||
|
||||
// get the Finder to update - doesn't work on some earlier version of Mac OS X
|
||||
// (I think it was fixed by 10.2.2 or so)
|
||||
// get the Finder to update
|
||||
[[NSWorkspace sharedWorkspace] noteFileSystemChanged:mDestPath];
|
||||
|
||||
mRefreshIcon = YES; // let the icon know to update
|
||||
|
|
|
@ -331,24 +331,12 @@ const long NSFindPanelActionSetFindString = 7;
|
|||
{
|
||||
[[NSColor whiteColor] set];
|
||||
|
||||
#if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_3
|
||||
// if we're on panther, only draw the rects that need drawing
|
||||
if ([self respondsToSelector:@selector(getRectsBeingDrawn:count:)])
|
||||
#endif
|
||||
{
|
||||
const NSRect *rects;
|
||||
int numRects;
|
||||
[self getRectsBeingDrawn:&rects count:&numRects];
|
||||
const NSRect *rects;
|
||||
int numRects;
|
||||
[self getRectsBeingDrawn:&rects count:&numRects];
|
||||
|
||||
for (int i = 0; i < numRects; ++i)
|
||||
NSRectFill(rects[i]);
|
||||
}
|
||||
#if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_3
|
||||
else
|
||||
{
|
||||
NSRectFill(inRect);
|
||||
}
|
||||
#endif
|
||||
for (int i = 0; i < numRects; ++i)
|
||||
NSRectFill(rects[i]);
|
||||
}
|
||||
|
||||
- (void)addListener:(id <CHBrowserListener>)listener
|
||||
|
|
|
@ -226,8 +226,7 @@ static NSString* const CacheInfoPaneSeenKey = @"MVPreferencePaneSeen"; // N
|
|||
mPendingPaneIdentifier = [identifier retain];
|
||||
|
||||
// set the selected toolbar item back
|
||||
if ([NSToolbar instancesRespondToSelector:@selector(setSelectedItemIdentifier:)])
|
||||
[[mWindow toolbar] setSelectedItemIdentifier:mCurrentPaneIdentifier];
|
||||
[[mWindow toolbar] setSelectedItemIdentifier:mCurrentPaneIdentifier];
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -273,8 +272,7 @@ static NSString* const CacheInfoPaneSeenKey = @"MVPreferencePaneSeen"; // N
|
|||
|
||||
[mWindow setInitialFirstResponder:[pane initialKeyView]];
|
||||
[mWindow makeFirstResponder:[pane initialKeyView]];
|
||||
if ([NSToolbar instancesRespondToSelector:@selector(setSelectedItemIdentifier:)])
|
||||
[[mWindow toolbar] setSelectedItemIdentifier:mCurrentPaneIdentifier];
|
||||
[[mWindow toolbar] setSelectedItemIdentifier:mCurrentPaneIdentifier];
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -360,8 +358,8 @@ static NSString* const CacheInfoPaneSeenKey = @"MVPreferencePaneSeen"; // N
|
|||
return mToolbarItemIdentifiers;
|
||||
}
|
||||
|
||||
// For OS X 10.3, set the selectable toolbar items (draws a gray rect around the active icon in the toolbar)
|
||||
- (NSArray *) toolbarSelectableItemIdentifiers:(NSToolbar *)toolbar
|
||||
// set the selectable toolbar items (draws a gray rect around the active icon in the toolbar)
|
||||
- (NSArray *)toolbarSelectableItemIdentifiers:(NSToolbar *)toolbar
|
||||
{
|
||||
NSMutableArray* items = [NSMutableArray array];
|
||||
NSEnumerator* enumerator = [mPaneBundles objectEnumerator];
|
||||
|
|
Загрузка…
Ссылка в новой задаче