diff --git a/Classes/MenubarController.m b/Classes/MenubarController.m index 0c7ebc3..bc6f17a 100644 --- a/Classes/MenubarController.m +++ b/Classes/MenubarController.m @@ -1,5 +1,6 @@ #import "MenubarController.h" #import "StatusItemView.h" +#import "Utilities.h" @implementation MenubarController @@ -12,11 +13,20 @@ - (id)init self = [super init]; if (self != nil) { + NSImage *icon = [NSImage imageNamed:@"Status"]; + NSImage *iconHighlighted = [NSImage imageNamed:@"StatusHighlighted"]; + if (yosemiteOrGreater()) { + icon = iconHighlighted; + [icon setTemplate:YES]; + iconHighlighted = icon; + } + // Install status item into the menu bar NSStatusItem *statusItem = [[NSStatusBar systemStatusBar] statusItemWithLength:STATUS_ITEM_VIEW_WIDTH]; _statusItemView = [[StatusItemView alloc] initWithStatusItem:statusItem]; - _statusItemView.image = [NSImage imageNamed:@"Status"]; - _statusItemView.alternateImage = [NSImage imageNamed:@"StatusHighlighted"]; + _statusItemView.image = icon; + _statusItemView.alternateImage = icon; + _statusItemView.alternateImage = iconHighlighted; _statusItemView.action = NSSelectorFromString(@"togglePanel:"); } return self; diff --git a/Classes/PutIOSync-Info.plist b/Classes/PutIOSync-Info.plist index a3f4215..9b53776 100644 --- a/Classes/PutIOSync-Info.plist +++ b/Classes/PutIOSync-Info.plist @@ -30,11 +30,7 @@ CFBundleVersion -<<<<<<< HEAD - 330 -======= - 326 ->>>>>>> release/0.8.2_beta + 354 LSApplicationCategoryType public.app-category.utilities LSMinimumSystemVersion diff --git a/Classes/Utilities.h b/Classes/Utilities.h index 9e8845b..652756c 100644 --- a/Classes/Utilities.h +++ b/Classes/Utilities.h @@ -5,8 +5,11 @@ NSString* unitStringFromSeconds(NSTimeInterval interval); NSString* unitStringFromBytes(double bytes); NSString* unitStringFromBytes2(double bytes, uint8_t flags); +BOOL leopardOrGreater(void); +BOOL yosemiteOrGreater(void); + enum { kUnitStringBinaryUnits = 1 << 0, kUnitStringOSNativeUnits = 1 << 1, kUnitStringLocalizedFormat = 1 << 2 -}; \ No newline at end of file +}; diff --git a/Classes/Utilities.m b/Classes/Utilities.m index fd14933..d880c07 100644 --- a/Classes/Utilities.m +++ b/Classes/Utilities.m @@ -2,17 +2,34 @@ #include #import "Utilities.h" -static BOOL leopardOrGreater(){ - static BOOL alreadyComputedOS = NO; - static BOOL leopardOrGreater = NO; - if (!alreadyComputedOS) { - SInt32 majorVersion, minorVersion; - Gestalt(gestaltSystemVersionMajor, &majorVersion); - Gestalt(gestaltSystemVersionMinor, &minorVersion); - leopardOrGreater = ((majorVersion == 10 && minorVersion >= 5) || majorVersion > 10); - alreadyComputedOS = YES; +static BOOL _alreadyComputedOS = NO; +static BOOL _leopardOrGreater = NO; +static BOOL _yosemiteOrGreater = NO; + +static void computeOS() +{ + SInt32 majorVersion, minorVersion; + Gestalt(gestaltSystemVersionMajor, &majorVersion); + Gestalt(gestaltSystemVersionMinor, &minorVersion); + _leopardOrGreater = ((majorVersion == 10 && minorVersion >= 5) || majorVersion > 10); + _yosemiteOrGreater = ((majorVersion == 10 && minorVersion >= 10) || majorVersion > 10); + _alreadyComputedOS = YES; +} + +BOOL leopardOrGreater(void) +{ + if (!_alreadyComputedOS) { + computeOS(); } - return leopardOrGreater; + return _leopardOrGreater; +} + +BOOL yosemiteOrGreater(void) +{ + if (!_alreadyComputedOS) { + computeOS(); + } + return _yosemiteOrGreater; } NSString* unitStringFromBytes(double bytes) @@ -78,4 +95,4 @@ static BOOL leopardOrGreater(){ } } return result; -} \ No newline at end of file +} diff --git a/PutIOSync.xcodeproj/xcuserdata/rdougan.xcuserdatad/xcschemes/PutIOSync.xcscheme b/PutIOSync.xcodeproj/xcuserdata/rdougan.xcuserdatad/xcschemes/PutIOSync.xcscheme new file mode 100644 index 0000000..e80f6d1 --- /dev/null +++ b/PutIOSync.xcodeproj/xcuserdata/rdougan.xcuserdatad/xcschemes/PutIOSync.xcscheme @@ -0,0 +1,86 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/PutIOSync.xcodeproj/xcuserdata/rdougan.xcuserdatad/xcschemes/Release.xcscheme b/PutIOSync.xcodeproj/xcuserdata/rdougan.xcuserdatad/xcschemes/Release.xcscheme new file mode 100644 index 0000000..bd55eca --- /dev/null +++ b/PutIOSync.xcodeproj/xcuserdata/rdougan.xcuserdatad/xcschemes/Release.xcscheme @@ -0,0 +1,77 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/PutIOSync.xcodeproj/xcuserdata/rdougan.xcuserdatad/xcschemes/xcschememanagement.plist b/PutIOSync.xcodeproj/xcuserdata/rdougan.xcuserdatad/xcschemes/xcschememanagement.plist new file mode 100644 index 0000000..2c99bd1 --- /dev/null +++ b/PutIOSync.xcodeproj/xcuserdata/rdougan.xcuserdatad/xcschemes/xcschememanagement.plist @@ -0,0 +1,32 @@ + + + + + SchemeUserState + + PutIOSync.xcscheme + + orderHint + 0 + + Release.xcscheme + + orderHint + 1 + + + SuppressBuildableAutocreation + + 399C9546195BE52B003E773D + + primary + + + DD4F7C0313C30F9F00825C6E + + primary + + + + +