]> git.sesse.net Git - vlc/blobdiff - modules/gui/skins2/src/skin_main.cpp
* wxwidgets/menus.cpp: Added "Open Directory" in the wx popup menu
[vlc] / modules / gui / skins2 / src / skin_main.cpp
index 8cb85008362a241ae1d4f514b730732f02b80282..520e16914e6454723baf47500c71614e4a757de4 100644 (file)
@@ -1,7 +1,7 @@
 /*****************************************************************************
  * skin_main.cpp
  *****************************************************************************
- * Copyright (C) 2003 VideoLAN
+ * Copyright (C) 2003 the VideoLAN team
  * $Id$
  *
  * Authors: Cyril Deguet     <asmax@via.ecp.fr>
@@ -35,6 +35,7 @@
 #include "../parser/interpreter.hpp"
 #include "../commands/async_queue.hpp"
 #include "../commands/cmd_quit.hpp"
+#include "../commands/cmd_dialogs.hpp"
 
 
 //---------------------------------------------------------------------------
@@ -84,6 +85,7 @@ static int Open( vlc_object_t *p_this )
     if( p_intf->p_sys->p_playlist == NULL )
     {
         msg_Err( p_intf, "No playlist object found" );
+       msg_Unsubscribe( p_intf, p_intf->p_sys->p_sub );
         return VLC_EGENERIC;
     }
 
@@ -108,26 +110,36 @@ static int Open( vlc_object_t *p_this )
     if( OSFactory::instance( p_intf ) == NULL )
     {
         msg_Err( p_intf, "Cannot initialize OSFactory" );
+       vlc_object_release( p_intf->p_sys->p_playlist );
+       msg_Unsubscribe( p_intf, p_intf->p_sys->p_sub );
         return VLC_EGENERIC;
     }
     if( AsyncQueue::instance( p_intf ) == NULL )
     {
         msg_Err( p_intf, "Cannot initialize AsyncQueue" );
+       vlc_object_release( p_intf->p_sys->p_playlist );
+       msg_Unsubscribe( p_intf, p_intf->p_sys->p_sub );
         return VLC_EGENERIC;
     }
     if( Interpreter::instance( p_intf ) == NULL )
     {
         msg_Err( p_intf, "Cannot instanciate Interpreter" );
+       vlc_object_release( p_intf->p_sys->p_playlist );
+       msg_Unsubscribe( p_intf, p_intf->p_sys->p_sub );
         return VLC_EGENERIC;
     }
     if( VarManager::instance( p_intf ) == NULL )
     {
         msg_Err( p_intf, "Cannot instanciate VarManager" );
+       vlc_object_release( p_intf->p_sys->p_playlist );
+       msg_Unsubscribe( p_intf, p_intf->p_sys->p_sub );
         return VLC_EGENERIC;
     }
     if( VlcProc::instance( p_intf ) == NULL )
     {
         msg_Err( p_intf, "Cannot initialize VLCProc" );
+       vlc_object_release( p_intf->p_sys->p_playlist );
+       msg_Unsubscribe( p_intf, p_intf->p_sys->p_sub );
         return VLC_EGENERIC;
     }
     Dialogs::instance( p_intf );
@@ -161,7 +173,7 @@ static void Close( vlc_object_t *p_this )
         vlc_object_release( p_intf->p_sys->p_playlist );
     }
 
-   // Unsubscribe from messages bank
+    // Unsubscribe from messages bank
     msg_Unsubscribe( p_intf, p_intf->p_sys->p_sub );
 
     // Destroy structure
@@ -188,7 +200,7 @@ static void Run( intf_thread_t *p_intf )
         list<string>::const_iterator it;
         for( it = resPath.begin(); it != resPath.end(); it++ )
         {
-            string path = (*it) + sep + "default" + sep + "theme.xml";
+            string path = (*it) + sep + "default.vlt";
             if( pLoader->load( path ) )
             {
                 // Theme loaded successfully
@@ -198,10 +210,11 @@ static void Run( intf_thread_t *p_intf )
         if( it == resPath.end() )
         {
             // Last chance: the user can select a new theme file
-            Dialogs *pDialogs = Dialogs::instance( p_intf );
-            if( pDialogs )
+            if( Dialogs::instance( p_intf ) )
             {
-                pDialogs->showChangeSkin();
+                CmdDlgChangeSkin *pCmd = new CmdDlgChangeSkin( p_intf );
+                AsyncQueue *pQueue = AsyncQueue::instance( p_intf );
+                pQueue->push( CmdGenericPtr( pCmd ) );
             }
             else
             {
@@ -232,7 +245,8 @@ static void Run( intf_thread_t *p_intf )
                                            FIND_ANYWHERE );
         if( p_playlist )
         {
-            playlist_Play( p_playlist );
+            p_playlist->status.i_view = -1;
+            playlist_Control( p_playlist, PLAYLIST_AUTOPLAY );
             vlc_object_release( p_playlist );
         }
     }
@@ -337,17 +351,23 @@ static int DemuxControl( demux_t *p_demux, int i_query, va_list args )
     " correctly.")
 
 vlc_module_begin();
+    set_category( CAT_INTERFACE );
+    set_subcategory( SUBCAT_INTERFACE_GENERAL );
     add_string( "skins2-last", "", NULL, SKINS2_LAST, SKINS2_LAST_LONG,
                 VLC_TRUE );
+        change_autosave();
     add_string( "skins2-config", "", NULL, SKINS2_CONFIG, SKINS2_CONFIG_LONG,
                 VLC_TRUE );
+        change_autosave();
 #ifdef WIN32
     add_bool( "skins2-transparency", VLC_FALSE, NULL, SKINS2_TRANSPARENCY,
               SKINS2_TRANSPARENCY_LONG, VLC_FALSE );
 #endif
+    set_shortname( _("Skins"));
     set_description( _("Skinnable Interface") );
     set_capability( "interface", 30 );
     set_callbacks( Open, Close );
+    add_shortcut( "skins" );
     set_program( "svlc" );
 
     add_submodule();