]> git.sesse.net Git - vlc/blobdiff - modules/gui/skins2/src/skin_main.cpp
Replaced a certain amount of vlc_object_find by pl_Yield
[vlc] / modules / gui / skins2 / src / skin_main.cpp
index aaff854c62cc0eed489e7d98c335cd194f40a3e6..cbc8a64b369020ac293122a1fc6308f875276256 100644 (file)
@@ -26,7 +26,8 @@
 # include "config.h"
 #endif
 
-#include <vlc/vlc.h>
+#include <vlc_common.h>
+#include <vlc_plugin.h>
 #include <vlc_input.h>
 #include <vlc_demux.h>
 #include <vlc_playlist.h>
@@ -94,17 +95,10 @@ static int Open( vlc_object_t *p_this )
     p_intf->pf_run = Run;
 
     // Suscribe to messages bank
-    p_intf->p_sys->p_sub = msg_Subscribe( p_intf, MSG_QUEUE_NORMAL );
+    p_intf->p_sys->p_sub = msg_Subscribe( p_intf );
 
     p_intf->p_sys->p_input = NULL;
-    p_intf->p_sys->p_playlist = (playlist_t *)vlc_object_find( p_intf,
-        VLC_OBJECT_PLAYLIST, FIND_ANYWHERE );
-    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;
-    }
+    p_intf->p_sys->p_playlist = pl_Yield( p_intf );
 
     // Initialize "singleton" objects
     p_intf->p_sys->p_logger = NULL;
@@ -162,9 +156,6 @@ static int Open( vlc_object_t *p_this )
     Dialogs::instance( p_intf );
     ThemeRepository::instance( p_intf );
 
-    // We support play on start
-    p_intf->b_play = true;
-
     return( VLC_SUCCESS );
 }
 
@@ -251,19 +242,6 @@ static void Run( intf_thread_t *p_intf )
     // Get the instance of OSLoop
     OSLoop *loop = OSFactory::instance( p_intf )->getOSLoop();
 
-    // Check if we need to start playing
-    if( p_intf->b_play )
-    {
-        playlist_t *p_playlist =
-            (playlist_t *)vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
-                                           FIND_ANYWHERE );
-        if( p_playlist )
-        {
-            playlist_Control( p_playlist, PLAYLIST_PLAY, false );
-            vlc_object_release( p_playlist );
-        }
-    }
-
     // Enter the main event loop
     loop->run();
 
@@ -305,16 +283,11 @@ static int DemuxOpen( vlc_object_t *p_this )
         // Do nothing is skins2 is not the main interface
         if( var_Type( p_intf, "skin-to-load" ) == VLC_VAR_STRING )
         {
-            playlist_t *p_playlist =
-                (playlist_t *) vlc_object_find( p_this, VLC_OBJECT_PLAYLIST,
-                                                FIND_ANYWHERE );
-            if( p_playlist != NULL )
-            {
-                // Make sure the item is deleted afterwards
-                /// \bug does not always work
-                p_playlist->status.p_item->i_flags |= PLAYLIST_REMOVE_FLAG;
-                vlc_object_release( p_playlist );
-            }
+            playlist_t *p_playlist = pl_Yield( p_this );
+            // Make sure the item is deleted afterwards
+            /// \bug does not always work
+            p_playlist->status.p_item->i_flags |= PLAYLIST_REMOVE_FLAG;
+            vlc_object_release( p_playlist );
 
             vlc_value_t val;
             val.psz_string = p_demux->psz_path;
@@ -463,14 +436,14 @@ vlc_module_begin();
 
     add_bool( "skinned-playlist", true, NULL, SKINS2_PLAYLIST,
               SKINS2_PLAYLIST_LONG, false );
-    set_shortname( _("Skins"));
-    set_description( _("Skinnable Interface") );
+    set_shortname( N_("Skins"));
+    set_description( N_("Skinnable Interface") );
     set_capability( "interface", 30 );
     set_callbacks( Open, Close );
     add_shortcut( "skins" );
 
     add_submodule();
-        set_description( _("Skins loader demux") );
+        set_description( N_("Skins loader demux") );
         set_capability( "demux", 5 );
         set_callbacks( DemuxOpen, NULL );