00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #include "cmd_change_skin.hpp"
00026 #include "cmd_quit.hpp"
00027 #include "../src/os_factory.hpp"
00028 #include "../src/os_loop.hpp"
00029 #include "../src/theme.hpp"
00030 #include "../src/theme_loader.hpp"
00031 #include "../src/window_manager.hpp"
00032
00033
00034 void CmdChangeSkin::execute()
00035 {
00036
00037 Theme *pOldTheme = getIntf()->p_sys->p_theme;
00038
00039 if( pOldTheme )
00040 {
00041 pOldTheme->getWindowManager().hideAll();
00042 }
00043
00044 ThemeLoader loader( getIntf() );
00045 if( loader.load( m_file ) )
00046 {
00047
00048 msg_Dbg( getIntf(), "New theme successfully loaded (%s)",
00049 m_file.c_str() );
00050 if( pOldTheme )
00051 {
00052 delete pOldTheme;
00053 }
00054 }
00055 else if( pOldTheme )
00056 {
00057 msg_Err( getIntf(), "A problem occurred when loading the new theme,"
00058 " restoring the previous one" );
00059 getIntf()->p_sys->p_theme = pOldTheme;
00060 pOldTheme->getWindowManager().showAll();
00061 }
00062 else
00063 {
00064 msg_Err( getIntf(), "Cannot load the theme, aborting" );
00065
00066 CmdQuit cmd( getIntf() );
00067 cmd.execute();
00068 }
00069 }
00070