Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fix previous merge commit.

  • Loading branch information...
commit ef14d9747d7a27cd198f2f6e4ab428e7ca28bb15 1 parent 320849b
@codler authored
View
8 Battery Time Remaining/AppDelegate.h
@@ -19,10 +19,10 @@
#define kBTRMenuSetting 6
#define kBTRMenuAdvanced 7
#define kBTRMenuParenthesis 8
-#define kBTRMenuEnergySaverSetting 9
-#define kBTRMenuUpdater 10
-#define kBTRMenuQuitKey 11
-#define kBTRMenuFahrenheit 12
+#define kBTRMenuFahrenheit 9
+#define kBTRMenuEnergySaverSetting 10
+#define kBTRMenuUpdater 11
+#define kBTRMenuQuitKey 12
#endif
View
32 Battery Time Remaining/AppDelegate.m
@@ -42,7 +42,7 @@ @interface AppDelegate ()
BOOL isOptionKeyPressed;
BOOL isCapacityWarning;
BOOL showParenthesis;
- BOOL displayFahrenheit;
+ BOOL showFahrenheit;
}
- (void)cacheBatteryIcon;
@@ -130,17 +130,17 @@ - (void)applicationDidFinishLaunching:(NSNotification *)aNotification
parenthesisSubmenuItem.state = (showParenthesis) ? NSOnState : NSOffState;
// Display in Fahrenheit menu item
- NSMenuItem *displayFahrenheitSubmenuItem = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"Display temperature in degrees Fahrenheit", @"Display temperature in Fahrenheit setting") action:@selector(toggleFahrenheit:) keyEquivalent:@""];
- [displayFahrenheitSubmenuItem setTag:kBTRMenuFahrenheit];
- displayFahrenheitSubmenuItem.target = self;
- displayFahrenheit = [[NSUserDefaults standardUserDefaults] boolForKey:@"fahrenheit"];
- displayFahrenheitSubmenuItem.state = (displayFahrenheit) ? NSOnState : NSOffState;
+ NSMenuItem *fahrenheitSubmenuItem = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"Display temperature in Fahrenheit", @"Display temperature in Fahrenheit setting") action:@selector(toggleFahrenheit:) keyEquivalent:@""];
+ [fahrenheitSubmenuItem setTag:kBTRMenuFahrenheit];
+ fahrenheitSubmenuItem.target = self;
+ showFahrenheit = [[NSUserDefaults standardUserDefaults] boolForKey:@"fahrenheit"];
+ fahrenheitSubmenuItem.state = (showFahrenheit) ? NSOnState : NSOffState;
// Build the setting submenu
NSMenu *settingSubmenu = [[NSMenu alloc] initWithTitle:@"Setting Menu"];
[settingSubmenu addItem:advancedSubmenuItem];
[settingSubmenu addItem:parenthesisSubmenuItem];
- [settingSubmenu addItem:displayFahrenheitSubmenuItem];
+ [settingSubmenu addItem:fahrenheitSubmenuItem];
// Settings menu item
NSMenuItem *settingMenu = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"Settings", @"Settings menuitem") action:nil keyEquivalent:@""];
@@ -387,12 +387,22 @@ - (void)updateStatusItemMenu
unpluggedTimerCount / 3600,
unpluggedTimerCount % 3600 / 60];
+ // Temperature
+ NSString *fahrenheitTranslated;
+ if (showFahrenheit) {
+ fahrenheitTranslated = [NSString stringWithFormat:NSLocalizedString(@"Temperature: %.1f°F", @"Advanced battery info menuitem"), [self convertCelsiusToFahrenheit:[temperature doubleValue]]];
+ }
+ else
+ {
+ fahrenheitTranslated = [NSString stringWithFormat:NSLocalizedString(@"Temperature: %.1f°C", @"Advanced battery info menuitem"), [temperature doubleValue]];
+ }
+
// Each item in array will be a row in menu
NSArray *advancedBatteryInfoTexts = [NSArray arrayWithObjects:
[NSString stringWithFormat:NSLocalizedString(@"Cycle count: %ld", @"Advanced battery info menuitem"), [cycleCount integerValue]],
[NSString stringWithFormat:NSLocalizedString(@"Power usage: %.2f Watt", @"Advanced battery info menuitem"), [watt doubleValue]],
timeSinceUnpluggedTranslated,
- (displayFahrenheit) ? [NSString stringWithFormat:NSLocalizedString(@"Temperature: %.1f°F", @"Advanced battery info menuitem"), [self convertCelsiusToFahrenheit:[temperature doubleValue]]] : [NSString stringWithFormat:NSLocalizedString(@"Temperature: %.1f°C", @"Advanced battery info menuitem"), [temperature doubleValue]],
+ fahrenheitTranslated,
nil];
NSDictionary *advancedAttributedStyle = [NSDictionary dictionaryWithObjectsAndKeys:
@@ -640,13 +650,13 @@ - (void)toggleFahrenheit:(id)sender
if ([defaults boolForKey:@"fahrenheit"])
{
item.state = NSOffState;
- displayFahrenheit = NO;
+ showFahrenheit = NO;
[defaults setBool:NO forKey:@"fahrenheit"];
}
else
{
item.state = NSOnState;
- displayFahrenheit = YES;
+ showFahrenheit = YES;
[defaults setBool:YES forKey:@"fahrenheit"];
}
[defaults synchronize];
@@ -829,4 +839,4 @@ - (void)menuDidClose:(NSMenu *)menu
optionKeyPressedTimer = nil;
}
-@end
+@end
View
BIN  Battery Time Remaining/de.lproj/Localizable.strings
Binary file not shown
View
BIN  Battery Time Remaining/en.lproj/Localizable.strings
Binary file not shown
View
BIN  Battery Time Remaining/es.lproj/Localizable.strings
Binary file not shown
View
BIN  Battery Time Remaining/fr.lproj/Localizable.strings
Binary file not shown
View
BIN  Battery Time Remaining/it.lproj/Localizable.strings
Binary file not shown
View
BIN  Battery Time Remaining/ko.lproj/Localizable.strings
Binary file not shown
View
BIN  Battery Time Remaining/nl.lproj/Localizable.strings
Binary file not shown
View
BIN  Battery Time Remaining/pl.lproj/Localizable.strings
Binary file not shown
View
BIN  Battery Time Remaining/pt.lproj/Localizable.strings
Binary file not shown
View
BIN  Battery Time Remaining/ru.lproj/Localizable.strings
Binary file not shown
View
BIN  Battery Time Remaining/sk.lproj/Localizable.strings
Binary file not shown
View
BIN  Battery Time Remaining/sv.lproj/Localizable.strings
Binary file not shown
View
BIN  Battery Time Remaining/zh-Hans.lproj/Localizable.strings
Binary file not shown
Please sign in to comment.
Something went wrong with that request. Please try again.