]> git.sesse.net Git - vlc/blobdiff - modules/gui/pda/pda.c
PDA GTK: remove dummy locking
[vlc] / modules / gui / pda / pda.c
index f378e51f0e4fe67ef1faa464839ada305eb1f757..6b7bb03fed6dd51af02175135bcfb609b8dad744 100644 (file)
@@ -66,15 +66,15 @@ gint GtkModeManage   ( intf_thread_t * p_intf );
 /*****************************************************************************
  * Module descriptor
  *****************************************************************************/
-vlc_module_begin();
-    set_description( N_("PDA Linux Gtk2+ interface") );
-    set_category( CAT_INTERFACE );
-    set_subcategory( SUBCAT_INTERFACE_MAIN );
-//    add_bool( "pda-autoplayfile", 1, GtkAutoPlayFile, AUTOPLAYFILE_TEXT, AUTOPLAYFILE_LONGTEXT, true );
-    set_capability( "interface", 70 );
-    set_callbacks( Open, Close );
-    add_shortcut( "pda" );
-vlc_module_end();
+vlc_module_begin ()
+    set_description( N_("PDA Linux Gtk2+ interface") )
+    set_category( CAT_INTERFACE )
+    set_subcategory( SUBCAT_INTERFACE_MAIN )
+//    add_bool( "pda-autoplayfile", 1, GtkAutoPlayFile, AUTOPLAYFILE_TEXT, AUTOPLAYFILE_LONGTEXT, true )
+    set_capability( "interface", 0 )
+    set_callbacks( Open, Close )
+    add_shortcut( "pda" )
+vlc_module_end ()
 
 /*****************************************************************************
  * Open: initialize and create window
@@ -86,15 +86,12 @@ static int Open( vlc_object_t *p_this )
     /* Allocate instance and initialize some members */
     p_intf->p_sys = malloc( sizeof( intf_sys_t ) );
     if( p_intf->p_sys == NULL )
-    {
-        msg_Err( p_intf, "out of memory" );
         return VLC_ENOMEM;
-    }
 
 #ifdef NEED_GTK2_MAIN
     msg_Dbg( p_intf, "Using gui-helper" );
     p_intf->p_sys->p_gtk_main =
-        module_Need( p_this, "gui-helper", "gtk2", true );
+        module_need( p_this, "gui-helper", "gtk2", true );
     if( p_intf->p_sys->p_gtk_main == NULL )
     {
         free( p_intf->p_sys );
@@ -128,7 +125,7 @@ static void Close( vlc_object_t *p_this )
 
 #ifdef NEED_GTK2_MAIN
     msg_Dbg( p_intf, "Releasing gui-helper" );
-    module_Unneed( p_intf, p_intf->p_sys->p_gtk_main );
+    module_unneed( p_intf, p_intf->p_sys->p_gtk_main );
 #endif
 
     /* Destroy structure */
@@ -156,6 +153,7 @@ static void Run( intf_thread_t *p_intf )
     GtkTreeViewColumn *p_column   = NULL;
     GtkListStore      *p_filelist = NULL;
     GtkListStore      *p_playlist_store = NULL;
+    int canc = vlc_savecancel();
 
 #ifndef NEED_GTK2_MAIN
     gtk_set_locale ();
@@ -288,7 +286,7 @@ static void Run( intf_thread_t *p_intf )
     gtk_tree_view_column_set_sort_column_id(p_column, 2);
 #endif
     /* update the playlist */
-    p_playlist = pl_Yield( p_intf );
+    p_playlist = pl_Hold( p_intf );
     p_playlist_store = gtk_list_store_new (3,
                 G_TYPE_STRING, /* Filename */
                 G_TYPE_STRING, /* Time */
@@ -316,7 +314,7 @@ static void Run( intf_thread_t *p_intf )
 
 #ifdef NEED_GTK2_MAIN
     msg_Dbg( p_intf, "Manage GTK keyboard events using threads" );
-    while( !intf_ShouldDie( p_intf ) )
+    while( vlc_object_alive( p_intf ) )
     {
         Manage( p_intf );
 
@@ -348,6 +346,7 @@ static void Run( intf_thread_t *p_intf )
 #ifdef NEED_GTK2_MAIN
     gdk_threads_leave();
 #endif
+    vlc_restorecancel(canc);
 }
 
 /*****************************************************************************
@@ -365,7 +364,7 @@ void GtkAutoPlayFile( vlc_object_t *p_this )
     {
         p_intf = (intf_thread_t *)p_list->p_values[i_index].p_object ;
 
-        if( strcmp( MODULE_STRING, module_GetObjName(p_intf->p_module) ) )
+        if( strcmp( MODULE_STRING, module_get_object(p_intf->p_module) ) )
         {
             continue;
         }
@@ -398,7 +397,6 @@ void GtkAutoPlayFile( vlc_object_t *p_this )
 static int Manage( intf_thread_t *p_intf )
 {
     GtkListStore *p_liststore;
-    vlc_mutex_lock( &p_intf->change_lock );
 
     /* Update the input */
     if( p_intf->p_sys->p_input == NULL )
@@ -426,7 +424,7 @@ static int Manage( intf_thread_t *p_intf )
             p_intf->p_sys->b_playing = 1;
 
             /* update playlist interface */
-            p_playlist = pl_Yield( p_intf );
+            p_playlist = pl_Hold( p_intf );
             if (p_playlist != NULL)
             {
                 p_liststore = gtk_list_store_new (3,
@@ -514,17 +512,15 @@ static int Manage( intf_thread_t *p_intf )
         }
         vlc_object_unlock( p_input );
     }
-    else if( p_intf->p_sys->b_playing && !intf_ShouldDie( p_intf ) )
+    else if( p_intf->p_sys->b_playing && vlc_object_alive( p_intf ) )
     {
         GtkModeManage( p_intf );
         p_intf->p_sys->b_playing = 0;
     }
 
 #ifndef NEED_GTK2_MAIN
-    if( intf_ShouldDie( p_intf ) )
+    if( !vlc_object_alive( p_intf ) )
     {
-        vlc_mutex_unlock( &p_intf->change_lock );
-
         /* Prepare to die, young Skywalker */
         gtk_main_quit();
 
@@ -532,8 +528,6 @@ static int Manage( intf_thread_t *p_intf )
     }
 #endif
 
-    vlc_mutex_unlock( &p_intf->change_lock );
-
     return TRUE;
 }
 
@@ -597,7 +591,7 @@ gint GtkModeManage( intf_thread_t * p_intf )
         }
 
         /* control buttons for free pace streams */
-        b_control = p_intf->p_sys->p_input->b_can_pace_control;
+        b_control = var_GetBool( p_intf->p_sys->p_input, "can-rate" );
 
         msg_Dbg( p_intf, "stream has changed, refreshing interface" );
     }