Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Actually preserve saved volume on startup

  • Loading branch information...
commit 877dfbefadc5254e8de7223b2e81a2fc047e33d8 1 parent a1e8198
@alexcrichton alexcrichton authored
View
1  Classes/HermesAppDelegate.m
@@ -178,6 +178,7 @@ - (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
[defaults registerDefaults:app_defaults];
[self migrateDefaults:defaults];
+ [playback prepareFirst];
}
- (NSMenu *)applicationDockMenu:(NSApplication *)sender {
View
1  Classes/PlaybackController.h
@@ -38,6 +38,7 @@
- (void) playStation: (Station*) station;
- (BOOL) saveState;
- (void) show;
+- (void) prepareFirst;
- (BOOL) play;
- (BOOL) pause;
View
7 Classes/PlaybackController.m
@@ -87,15 +87,16 @@ - (id) init {
selector:@selector(songPlayed:)
name:@"song.playing"
object:nil];
+ return self;
+}
+- (void) prepareFirst {
int saved = [[NSUserDefaults standardUserDefaults]
integerForKey:@"hermes.volume"];
if (saved == 0) {
saved = 100;
}
[self setIntVolume:saved];
-
- return self;
}
- (Pandora*) pandora {
@@ -110,7 +111,6 @@ - (void) reset {
}
playing = nil;
lastImgSrc = nil;
- [[NSUserDefaults standardUserDefaults] removeObjectForKey:@"hermes.volume"];
NSString *path = [[NSApp delegate] stateDirectory:@"station.savestate"];
[[NSFileManager defaultManager] removeItemAtPath:path error:nil];
}
@@ -285,6 +285,7 @@ - (void) playStation: (Station*) station {
} else {
playOnStart = 1;
}
+ [playing setVolume:[volume intValue]/100.0];
}
- (BOOL) play {
Please sign in to comment.
Something went wrong with that request. Please try again.