vlc | branch: master | Felix Paul Kühne <[email protected]> | Sun Feb 12 16:45:45 2012 +0100| [20b891eba5bd68353f1a65fb5cae6bed490de827] | committer: Felix Paul Kühne
macosx: save playback modes on quit and recover more gracefully > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=20b891eba5bd68353f1a65fb5cae6bed490de827 --- modules/gui/macosx/MainWindow.m | 1 + modules/gui/macosx/intf.m | 41 ++++++++++++++++++++------------------- 2 files changed, 22 insertions(+), 20 deletions(-) diff --git a/modules/gui/macosx/MainWindow.m b/modules/gui/macosx/MainWindow.m index ada1577..e8c45d7 100644 --- a/modules/gui/macosx/MainWindow.m +++ b/modules/gui/macosx/MainWindow.m @@ -456,6 +456,7 @@ static VLCMainWindow *_o_sharedInstance = nil; [[NSNotificationCenter defaultCenter] addObserver: self selector: @selector(someWindowWillClose:) name: NSWindowWillCloseNotification object: nil]; [[NSNotificationCenter defaultCenter] addObserver: self selector: @selector(someWindowWillMiniaturize:) name: NSWindowWillMiniaturizeNotification object:nil]; [[NSNotificationCenter defaultCenter] addObserver: self selector: @selector(applicationWillTerminate:) name: NSApplicationWillTerminateNotification object: nil]; + [[VLCMain sharedInstance] playbackModeUpdated]; } #pragma mark - diff --git a/modules/gui/macosx/intf.m b/modules/gui/macosx/intf.m index b549ff1..d319b45 100644 --- a/modules/gui/macosx/intf.m +++ b/modules/gui/macosx/intf.m @@ -614,8 +614,6 @@ static VLCMain *_o_sharedMainInstance = nil; var_AddCallback( p_intf, "dialog-progress-bar", DialogCallback, self ); dialog_Register( p_intf ); - [self playbackModeUpdated]; - /* init Apple Remote support */ o_remote = [[AppleRemote alloc] init]; [o_remote setClickCountEnabledButtons: kRemoteButtonPlay]; @@ -636,6 +634,11 @@ static VLCMain *_o_sharedMainInstance = nil; { if( !p_intf ) return; + [o_mainwindow updateWindow]; + [o_mainwindow updateTimeSlider]; + [o_mainwindow updateVolumeSlider]; + [o_mainwindow makeKeyAndOrderFront: self]; + /* init media key support */ b_mediaKeySupport = config_GetInt( VLCIntf, "macosx-mediakeys" ); if( b_mediaKeySupport ) @@ -650,11 +653,6 @@ static VLCMain *_o_sharedMainInstance = nil; [self _removeOldPreferences]; - [o_mainwindow updateWindow]; - [o_mainwindow updateTimeSlider]; - [o_mainwindow updateVolumeSlider]; - [o_mainwindow makeKeyAndOrderFront: self]; - /* Handle sleep notification */ [[[NSWorkspace sharedWorkspace] notificationCenter] addObserver:self selector:@selector(computerWillSleep:) name:NSWorkspaceWillSleepNotification object:nil]; @@ -690,20 +688,11 @@ static VLCMain *_o_sharedMainInstance = nil; - (void)applicationWillTerminate:(NSNotification *)notification { - if (notification == nil) - [[NSNotificationCenter defaultCenter] postNotificationName: NSApplicationWillTerminateNotification object: nil]; - - playlist_t * p_playlist; - int returnedValue = 0; - if( !p_intf ) return; - // save stuff - config_SaveConfigFile( p_intf ); - - // don't allow a double termination call. If the user has - // already invoked the quit then simply return this time. + /* don't allow a double termination call. If the user has + * already invoked the quit then simply return this time. */ int isTerminating = false; [o_appLock lock]; @@ -713,9 +702,21 @@ static VLCMain *_o_sharedMainInstance = nil; if (isTerminating) return; - msg_Dbg( p_intf, "Terminating" ); + if (notification == nil) + [[NSNotificationCenter defaultCenter] postNotificationName: NSApplicationWillTerminateNotification object: nil]; - p_playlist = pl_Get( p_intf ); + playlist_t * p_playlist = pl_Get( p_intf );; + int returnedValue = 0; + + /* Save some interface state in configuration, at module quit */ + config_PutInt( p_intf, "random", var_GetBool( p_playlist, "random" ) ); + config_PutInt( p_intf, "loop", var_GetBool( p_playlist, "loop" ) ); + config_PutInt( p_intf, "repeat", var_GetBool( p_playlist, "repeat" ) ); + + // save stuff + config_SaveConfigFile( p_intf ); + + msg_Dbg( p_intf, "Terminating" ); /* unsubscribe from the interactive dialogues */ dialog_Unregister( p_intf ); _______________________________________________ vlc-commits mailing list [email protected] http://mailman.videolan.org/listinfo/vlc-commits
