]> git.sesse.net Git - vlc/blobdiff - modules/gui/pda/pda.c
Make Zorglub less unhappy
[vlc] / modules / gui / pda / pda.c
index ec6472dd6a625b5686a4f02c454c9ce72468e17d..a9960762c8e8635e95545057c4d220cedcc2845d 100644 (file)
@@ -1,8 +1,8 @@
 /*****************************************************************************
  * pda.c : PDA Gtk2 plugin for vlc
  *****************************************************************************
- * Copyright (C) 2002 VideoLAN
- * $Id: pda.c,v 1.11 2003/11/25 20:41:35 jpsaman Exp $
+ * Copyright (C) 2002 the VideoLAN team
+ * $Id$
  *
  * Authors: Jean-Paul Saman <jpsaman@wxs.nl>
  *          Marc Ariberti <marcari@videolan.org>
@@ -49,7 +49,7 @@ static void Run          ( intf_thread_t * );
 
 void GtkAutoPlayFile     ( vlc_object_t * );
 static int Manage        ( intf_thread_t *p_intf );
-void E_(GtkDisplayDate)  ( GtkAdjustment *p_adj );
+void E_(GtkDisplayDate)  ( GtkAdjustment *p_adj, gpointer userdata );
 gint E_(GtkModeManage)   ( intf_thread_t * p_intf );
 
 /*****************************************************************************
@@ -63,9 +63,10 @@ gint E_(GtkModeManage)   ( intf_thread_t * p_intf );
  * Module descriptor
  *****************************************************************************/
 vlc_module_begin();
-    add_category_hint( N_("Miscellaneous"), NULL, VLC_TRUE );
+    set_description( N_("PDA Linux Gtk2+ interface") );
+    set_category( CAT_INTERFACE );
+    set_subcategory( SUBCAT_INTERFACE_GENERAL );
 //    add_bool( "pda-autoplayfile", 1, GtkAutoPlayFile, AUTOPLAYFILE_TEXT, AUTOPLAYFILE_LONGTEXT, VLC_TRUE );
-    set_description( _("PDA Linux Gtk2+ interface") );
     set_capability( "interface", 70 );
     set_callbacks( Open, Close );
     add_shortcut( "pda" );
@@ -88,7 +89,8 @@ static int Open( vlc_object_t *p_this )
 
 #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" );
+    p_intf->p_sys->p_gtk_main =
+        module_Need( p_this, "gui-helper", "gtk2", VLC_TRUE );
     if( p_intf->p_sys->p_gtk_main == NULL )
     {
         free( p_intf->p_sys );
@@ -145,10 +147,11 @@ static void Run( intf_thread_t *p_intf )
     int    i_args   = 1;
     int    i_dummy;
 #endif
-    GtkCellRenderer   *renderer = NULL;
-    GtkTreeViewColumn *column   = NULL;
-    GtkListStore      *filelist = NULL;
-    GtkListStore      *playlist = NULL;
+    playlist_t        *p_playlist;
+    GtkCellRenderer   *p_renderer = NULL;
+    GtkTreeViewColumn *p_column   = NULL;
+    GtkListStore      *p_filelist = NULL;
+    GtkListStore      *p_playlist_store = NULL;
 
 #ifndef NEED_GTK2_MAIN
     gtk_set_locale ();
@@ -161,13 +164,12 @@ static void Run( intf_thread_t *p_intf )
 #endif
 
     /* Create some useful widgets that will certainly be used */
-// FIXME: magic path
+/* FIXME: magic path */
     add_pixmap_directory("share");
     add_pixmap_directory("/usr/share/vlc");
 
     /* Path for pixmaps under linupy 1.4 */
     add_pixmap_directory("/usr/local/share/pixmaps/vlc");
-
     /* Path for pixmaps under linupy 2.0 */
     add_pixmap_directory("/usr/share/pixmaps/vlc");
 
@@ -178,10 +180,8 @@ static void Run( intf_thread_t *p_intf )
     }
 
     /* Store p_intf to keep an eye on it */
-    msg_Dbg( p_intf, "trying to store p_intf pointer ... " );
     gtk_object_set_data( GTK_OBJECT(p_intf->p_sys->p_window),
                          "p_intf", p_intf );
-    msg_Dbg( p_intf, "trying to store p_intf pointer ... done" );
 
     /* Set the title of the main window */
     gtk_window_set_title( GTK_WINDOW(p_intf->p_sys->p_window),
@@ -190,30 +190,25 @@ static void Run( intf_thread_t *p_intf )
     /* Get the notebook object */
     p_intf->p_sys->p_notebook = GTK_NOTEBOOK( gtk_object_get_data(
         GTK_OBJECT( p_intf->p_sys->p_window ), "notebook" ) );
-    
+
     /* Get the slider object */
-    p_intf->p_sys->p_slider = GTK_HSCALE( gtk_object_get_data(
-        GTK_OBJECT( p_intf->p_sys->p_window ), "slider" ) );
-    p_intf->p_sys->p_slider_label = GTK_LABEL( gtk_object_get_data(
-        GTK_OBJECT( p_intf->p_sys->p_window ), "slider_label" ) );
+    p_intf->p_sys->p_slider = (GtkHScale*) lookup_widget( p_intf->p_sys->p_window, "timeSlider" );
+    p_intf->p_sys->p_slider_label = (GtkLabel*) lookup_widget( p_intf->p_sys->p_window, "timeLabel" );
+    if (p_intf->p_sys->p_slider == NULL)
+        msg_Err( p_intf, "Time slider widget not found." );
+    if (p_intf->p_sys->p_slider_label == NULL)
+        msg_Err( p_intf, "Time label widget not found." );
 
-#if 0
     /* Connect the date display to the slider */
-    msg_Dbg( p_intf, "setting slider adjustment ... " );
-#define P_SLIDER GTK_RANGE( gtk_object_get_data( \
-                         GTK_OBJECT( p_intf->p_sys->p_window ), "slider" ) )
-    p_intf->p_sys->p_adj = gtk_range_get_adjustment( P_SLIDER );
-
-    gtk_signal_connect ( GTK_OBJECT( p_intf->p_sys->p_adj ), "value_changed",
-                         GTK_SIGNAL_FUNC( E_(GtkDisplayDate) ), NULL );
+    p_intf->p_sys->p_adj = gtk_range_get_adjustment( GTK_RANGE(p_intf->p_sys->p_slider) );
+    if (p_intf->p_sys->p_adj == NULL)
+        msg_Err( p_intf, "Adjustment range not found." );
+    g_signal_connect( GTK_OBJECT( p_intf->p_sys->p_adj ), "value_changed",
+                         G_CALLBACK( E_(GtkDisplayDate) ), p_intf );
     p_intf->p_sys->f_adj_oldvalue = 0;
     p_intf->p_sys->i_adj_oldvalue = 0;
-#undef P_SLIDER
-    msg_Dbg( p_intf, "setting slider adjustment ... done" );
-#endif
 
     /* BEGIN OF FILEVIEW GTK_TREE_VIEW */
-    msg_Dbg(p_intf, "Getting GtkTreeView FileList" );
     p_intf->p_sys->p_tvfile = NULL;
     p_intf->p_sys->p_tvfile = (GtkTreeView *) lookup_widget( p_intf->p_sys->p_window,
                                                              "tvFileList");
@@ -221,48 +216,46 @@ static void Run( intf_thread_t *p_intf )
        msg_Err(p_intf, "Error obtaining pointer to File List");
 
     /* Insert columns 0 */
-    renderer = gtk_cell_renderer_text_new ();
-    gtk_tree_view_insert_column_with_attributes(p_intf->p_sys->p_tvfile, 0, _("Filename"), renderer, NULL);
-    column = gtk_tree_view_get_column(p_intf->p_sys->p_tvfile, 0 );
-    gtk_tree_view_column_add_attribute(column, renderer, "text", 0 );
-    gtk_tree_view_column_set_sort_column_id(column, 0);
+    p_renderer = gtk_cell_renderer_text_new ();
+    gtk_tree_view_insert_column_with_attributes(p_intf->p_sys->p_tvfile, 0, (gchar *) N_("Filename"), p_renderer, NULL);
+    p_column = gtk_tree_view_get_column(p_intf->p_sys->p_tvfile, 0 );
+    gtk_tree_view_column_add_attribute(p_column, p_renderer, "text", 0 );
+    gtk_tree_view_column_set_sort_column_id(p_column, 0);
     /* Insert columns 1 */
-    renderer = gtk_cell_renderer_text_new ();
-    gtk_tree_view_insert_column_with_attributes(p_intf->p_sys->p_tvfile, 1, _("Permissions"), renderer, NULL);
-    column = gtk_tree_view_get_column(p_intf->p_sys->p_tvfile, 1 );
-    gtk_tree_view_column_add_attribute(column, renderer, "text", 1 );
-    gtk_tree_view_column_set_sort_column_id(column, 1);
+    p_renderer = gtk_cell_renderer_text_new ();
+    gtk_tree_view_insert_column_with_attributes(p_intf->p_sys->p_tvfile, 1, (gchar *) N_("Permissions"), p_renderer, NULL);
+    p_column = gtk_tree_view_get_column(p_intf->p_sys->p_tvfile, 1 );
+    gtk_tree_view_column_add_attribute(p_column, p_renderer, "text", 1 );
+    gtk_tree_view_column_set_sort_column_id(p_column, 1);
     /* Insert columns 2 */
-    renderer = gtk_cell_renderer_text_new ();
-    gtk_tree_view_insert_column_with_attributes(p_intf->p_sys->p_tvfile, 2, _("Size"), renderer, NULL);
-    column = gtk_tree_view_get_column(p_intf->p_sys->p_tvfile, 2 );
-    gtk_tree_view_column_add_attribute(column, renderer, "text", 2 );
-    gtk_tree_view_column_set_sort_column_id(column, 2);
+    p_renderer = gtk_cell_renderer_text_new ();
+    gtk_tree_view_insert_column_with_attributes(p_intf->p_sys->p_tvfile, 2, (gchar *) N_("Size"), p_renderer, NULL);
+    p_column = gtk_tree_view_get_column(p_intf->p_sys->p_tvfile, 2 );
+    gtk_tree_view_column_add_attribute(p_column, p_renderer, "text", 2 );
+    gtk_tree_view_column_set_sort_column_id(p_column, 2);
     /* Insert columns 3 */
-    renderer = gtk_cell_renderer_text_new ();
-    gtk_tree_view_insert_column_with_attributes(p_intf->p_sys->p_tvfile, 3, _("Owner"), renderer, NULL);
-    column = gtk_tree_view_get_column(p_intf->p_sys->p_tvfile, 3 );
-    gtk_tree_view_column_add_attribute(column, renderer, "text", 3 );
-    gtk_tree_view_column_set_sort_column_id(column, 3);
+    p_renderer = gtk_cell_renderer_text_new ();
+    gtk_tree_view_insert_column_with_attributes(p_intf->p_sys->p_tvfile, 3, (gchar *) N_("Owner"), p_renderer, NULL);
+    p_column = gtk_tree_view_get_column(p_intf->p_sys->p_tvfile, 3 );
+    gtk_tree_view_column_add_attribute(p_column, p_renderer, "text", 3 );
+    gtk_tree_view_column_set_sort_column_id(p_column, 3);
     /* Insert columns 4 */
-    renderer = gtk_cell_renderer_text_new ();
-    gtk_tree_view_insert_column_with_attributes(p_intf->p_sys->p_tvfile, 4, _("Group"), renderer, NULL);
-    column = gtk_tree_view_get_column(p_intf->p_sys->p_tvfile, 4 );
-    gtk_tree_view_column_add_attribute(column, renderer, "text", 4 );
-    gtk_tree_view_column_set_sort_column_id(column, 4);
+    p_renderer = gtk_cell_renderer_text_new ();
+    gtk_tree_view_insert_column_with_attributes(p_intf->p_sys->p_tvfile, 4, (gchar *) N_("Group"), p_renderer, NULL);
+    p_column = gtk_tree_view_get_column(p_intf->p_sys->p_tvfile, 4 );
+    gtk_tree_view_column_add_attribute(p_column, p_renderer, "text", 4 );
+    gtk_tree_view_column_set_sort_column_id(p_column, 4);
 
     /* Get new directory listing */
-    msg_Dbg(p_intf, "Populating GtkTreeView FileList" );
-    filelist = gtk_list_store_new (5,
+    p_filelist = gtk_list_store_new (5,
                 G_TYPE_STRING, /* Filename */
                 G_TYPE_STRING, /* permissions */
                 G_TYPE_UINT64, /* File size */
                 G_TYPE_STRING, /* Owner */
                 G_TYPE_STRING);/* Group */
-    ReadDirectory(p_intf, filelist, ".");
-    msg_Dbg(p_intf, "Showing GtkTreeView FileList" );
-    gtk_tree_view_set_model(GTK_TREE_VIEW(p_intf->p_sys->p_tvfile), GTK_TREE_MODEL(filelist));
-    g_object_unref(filelist);     /* Model will be released by GtkTreeView */
+    ReadDirectory(p_intf, p_filelist, ".");
+    gtk_tree_view_set_model(GTK_TREE_VIEW(p_intf->p_sys->p_tvfile), GTK_TREE_MODEL(p_filelist));
+    g_object_unref(p_filelist);     /* Model will be released by GtkTreeView */
     gtk_tree_selection_set_mode(gtk_tree_view_get_selection(GTK_TREE_VIEW(p_intf->p_sys->p_tvfile)),GTK_SELECTION_MULTIPLE);
 
     /* Column properties */
@@ -272,34 +265,41 @@ static void Run( intf_thread_t *p_intf )
     /* END OF FILEVIEW GTK_TREE_VIEW */
 
     /* BEGIN OF PLAYLIST GTK_TREE_VIEW */
-    msg_Dbg(p_intf, "Getting GtkTreeView PlayList" );
     p_intf->p_sys->p_tvplaylist = NULL;
-    p_intf->p_sys->p_tvplaylist = (GtkTreeView *) lookup_widget( p_intf->p_sys->p_window, "tvPlaylist");   
+    p_intf->p_sys->p_tvplaylist = (GtkTreeView *) lookup_widget( p_intf->p_sys->p_window, "tvPlaylist");
     if (NULL == p_intf->p_sys->p_tvplaylist)
        msg_Err(p_intf, "Error obtaining pointer to Play List");
 
     /* Columns 1 */
-    renderer = gtk_cell_renderer_text_new ();
-    gtk_tree_view_insert_column_with_attributes(p_intf->p_sys->p_tvplaylist, 0, _("Filename"), renderer, NULL);
-    column = gtk_tree_view_get_column(p_intf->p_sys->p_tvplaylist, 0 );
-    gtk_tree_view_column_add_attribute(column, renderer, "text", 0 );
-    gtk_tree_view_column_set_sort_column_id(column, 0);
+    p_renderer = gtk_cell_renderer_text_new ();
+    gtk_tree_view_insert_column_with_attributes(p_intf->p_sys->p_tvplaylist, 0, (gchar *) N_("Filename"), p_renderer, NULL);
+    p_column = gtk_tree_view_get_column(p_intf->p_sys->p_tvplaylist, 0 );
+    gtk_tree_view_column_add_attribute(p_column, p_renderer, "text", 0 );
+    gtk_tree_view_column_set_sort_column_id(p_column, 0);
     /* Column 2 */
-    renderer = gtk_cell_renderer_text_new ();
-    gtk_tree_view_insert_column_with_attributes(p_intf->p_sys->p_tvplaylist, 1, _("Time"), renderer, NULL);
-    column = gtk_tree_view_get_column(p_intf->p_sys->p_tvplaylist, 1 );
-    gtk_tree_view_column_add_attribute(column, renderer, "text", 1 );
-    gtk_tree_view_column_set_sort_column_id(column, 1);
-
+    p_renderer = gtk_cell_renderer_text_new ();
+    gtk_tree_view_insert_column_with_attributes(p_intf->p_sys->p_tvplaylist, 1, (gchar *) N_("Time"), p_renderer, NULL);
+    p_column = gtk_tree_view_get_column(p_intf->p_sys->p_tvplaylist, 1 );
+    gtk_tree_view_column_add_attribute(p_column, p_renderer, "text", 1 );
+    gtk_tree_view_column_set_sort_column_id(p_column, 1);
+#if 0
+    /* Column 3 - is a hidden column used for reliable deleting items from the underlying playlist */
+    p_renderer = gtk_cell_renderer_text_new ();
+    gtk_tree_view_insert_column_with_attributes(p_intf->p_sys->p_tvplaylist, 2, (gchar *) N_("Index"), p_renderer, NULL);
+    p_column = gtk_tree_view_get_column(p_intf->p_sys->p_tvplaylist, 2 );
+    gtk_tree_view_column_add_attribute(p_column, p_renderer, "text", 2 );
+    gtk_tree_view_column_set_sort_column_id(p_column, 2);
+#endif
     /* update the playlist */
-    msg_Dbg(p_intf, "Populating GtkTreeView Playlist" );
-    playlist = gtk_list_store_new (2,
+    p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, FIND_ANYWHERE );
+    p_playlist_store = gtk_list_store_new (3,
                 G_TYPE_STRING, /* Filename */
-                G_TYPE_STRING);/* Time */
-    PlaylistRebuildListStore( playlist, vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, FIND_ANYWHERE ));
-    msg_Dbg(p_intf, "Showing GtkTreeView Playlist" );
-    gtk_tree_view_set_model(GTK_TREE_VIEW(p_intf->p_sys->p_tvplaylist), GTK_TREE_MODEL(playlist));
-    g_object_unref(playlist);
+                G_TYPE_STRING, /* Time */
+                G_TYPE_UINT);  /* Hidden index */
+    PlaylistRebuildListStore(p_playlist_store, p_playlist);
+    gtk_tree_view_set_model(GTK_TREE_VIEW(p_intf->p_sys->p_tvplaylist), GTK_TREE_MODEL(p_playlist_store));
+    g_object_unref(p_playlist_store);
+    vlc_object_release(p_playlist); /* Free the playlist */
     gtk_tree_selection_set_mode(gtk_tree_view_get_selection(GTK_TREE_VIEW(p_intf->p_sys->p_tvplaylist)),GTK_SELECTION_MULTIPLE);
 
     /* Column properties */
@@ -308,6 +308,12 @@ static void Run( intf_thread_t *p_intf )
     gtk_tree_view_set_headers_clickable(p_intf->p_sys->p_tvplaylist, TRUE);
     /* END OF PLAYLIST GTK_TREE_VIEW */
 
+    /* Hide the Preference TAB for now. */
+    GtkWidget *p_preference_tab = NULL;
+    p_preference_tab = gtk_notebook_get_nth_page(p_intf->p_sys->p_notebook,5);
+    if (p_preference_tab != NULL)
+      gtk_widget_hide(p_preference_tab);
+
     /* Show the control window */
     gtk_widget_show( p_intf->p_sys->p_window );
 
@@ -413,11 +419,9 @@ static int Manage( intf_thread_t *p_intf )
     {
         input_thread_t *p_input = p_intf->p_sys->p_input;
 
-        vlc_mutex_lock( &p_input->stream.stream_lock );
+        vlc_mutex_lock( &p_input->object_lock );
         if( !p_input->b_die )
         {
-            /* New input or stream map change */
-            if( p_input->stream.b_changed )
             {
                 playlist_t *p_playlist;
 
@@ -425,30 +429,31 @@ static int Manage( intf_thread_t *p_intf )
                 p_intf->p_sys->b_playing = 1;
 
                 /* update playlist interface */
-                p_playlist = (playlist_t *) vlc_object_find( 
+                p_playlist = (playlist_t *) vlc_object_find(
                         p_intf, VLC_OBJECT_PLAYLIST, FIND_ANYWHERE );
                 if (p_playlist != NULL)
                 {
-                    msg_Dbg(p_intf, "Manage: Populating GtkTreeView Playlist" );
-                    p_liststore = gtk_list_store_new (2,
+                    p_liststore = gtk_list_store_new (3,
                                                G_TYPE_STRING,
-                                               G_TYPE_STRING);
+                                               G_TYPE_STRING,
+                                               G_TYPE_UINT);  /* Hidden index */
                     PlaylistRebuildListStore(p_liststore, p_playlist);
-                    msg_Dbg(p_intf, "Manage: Updating GtkTreeView Playlist" );
                     gtk_tree_view_set_model(p_intf->p_sys->p_tvplaylist, (GtkTreeModel*) p_liststore);
+                    g_object_unref(p_liststore);
                     vlc_object_release( p_playlist );
                 }
             }
 
             /* Manage the slider */
+#if 0
+#define p_area p_input->p_selected_area
             if (p_intf->p_libvlc->i_cpu & CPU_CAPABILITY_FPU)
             {
-                /* Manage the slider for CPU_CAPABILITY_FPU hardware */        
-                if( p_input->stream.b_seekable && p_intf->p_sys->b_playing )
+                /* Manage the slider for CPU_CAPABILITY_FPU hardware */
+                if( p_intf->p_sys->b_playing )
                 {
                     float newvalue = p_intf->p_sys->p_adj->value;
 
-#define p_area p_input->stream.p_selected_area
                     /* If the user hasn't touched the slider since the last time,
                      * then the input can safely change it */
                     if( newvalue == p_intf->p_sys->f_adj_oldvalue )
@@ -457,34 +462,32 @@ static int Manage( intf_thread_t *p_intf )
                         p_intf->p_sys->p_adj->value =
                         p_intf->p_sys->f_adj_oldvalue =
                             ( 100. * p_area->i_tell ) / p_area->i_size;
-                        gtk_signal_emit_by_name( GTK_OBJECT( p_intf->p_sys->p_adj ),
+                        g_signal_emit_by_name( GTK_OBJECT( p_intf->p_sys->p_adj ),
                                                  "value_changed" );
                     }
                     /* Otherwise, send message to the input if the user has
                      * finished dragging the slider */
                     else if( p_intf->p_sys->b_slider_free )
                     {
-                        off_t i_seek = ( newvalue * p_area->i_size ) / 100;
+                        double f_pos = (double)newvalue / 100.0;
 
                         /* release the lock to be able to seek */
-                        vlc_mutex_unlock( &p_input->stream.stream_lock );
-                        input_Seek( p_input, i_seek, INPUT_SEEK_SET );
-                        vlc_mutex_lock( &p_input->stream.stream_lock );
+                        vlc_mutex_unlock( &p_input->object_lock );
+                        var_SetFloat( p_input, "position", f_pos );
+                        vlc_mutex_lock( &p_input->object_lock );
 
                         /* Update the old value */
                         p_intf->p_sys->f_adj_oldvalue = newvalue;
                     }
-#undef p_area
                 }
             }
             else
             {
                 /* Manage the slider without CPU_CAPABILITY_FPU hardware */
-                if( p_input->stream.b_seekable && p_intf->p_sys->b_playing )
+                if( p_intf->p_sys->b_playing )
                 {
                     off_t newvalue = p_intf->p_sys->p_adj->value;
 
-#define p_area p_input->stream.p_selected_area
                     /* If the user hasn't touched the slider since the last time,
                      * then the input can safely change it */
                     if( newvalue == p_intf->p_sys->i_adj_oldvalue )
@@ -493,28 +496,29 @@ static int Manage( intf_thread_t *p_intf )
                         p_intf->p_sys->p_adj->value =
                         p_intf->p_sys->i_adj_oldvalue =
                             ( 100 * p_area->i_tell ) / p_area->i_size;
-                        gtk_signal_emit_by_name( GTK_OBJECT( p_intf->p_sys->p_adj ),
+                        g_signal_emit_by_name( GTK_OBJECT( p_intf->p_sys->p_adj ),
                                                  "value_changed" );
                     }
                     /* Otherwise, send message to the input if the user has
                      * finished dragging the slider */
                     else if( p_intf->p_sys->b_slider_free )
                     {
-                        off_t i_seek = ( newvalue * p_area->i_size ) / 100;
+                        double f_pos = (double)newvalue / 100.0;
 
                         /* release the lock to be able to seek */
-                        vlc_mutex_unlock( &p_input->stream.stream_lock );
-                        input_Seek( p_input, i_seek, INPUT_SEEK_SET );
-                        vlc_mutex_lock( &p_input->stream.stream_lock );
+                        vlc_mutex_unlock( &p_input->object_lock );
+                        var_SetFloat( p_input, "position", f_pos );
+                        vlc_mutex_lock( &p_input->object_lock );
 
                         /* Update the old value */
                         p_intf->p_sys->i_adj_oldvalue = newvalue;
                     }
-#undef p_area
                 }
             }
+#undef p_area
+#endif
         }
-        vlc_mutex_unlock( &p_input->stream.stream_lock );
+        vlc_mutex_unlock( &p_input->object_lock );
     }
     else if( p_intf->p_sys->b_playing && !p_intf->b_die )
     {
@@ -546,21 +550,24 @@ static int Manage( intf_thread_t *p_intf )
  * the stream. It is called whenever the slider changes its value.
  * The lock has to be taken before you call the function.
  *****************************************************************************/
-void E_(GtkDisplayDate)( GtkAdjustment *p_adj )
+void E_(GtkDisplayDate)( GtkAdjustment *p_adj, gpointer userdata )
 {
     intf_thread_t *p_intf;
 
-    p_intf = gtk_object_get_data( GTK_OBJECT( p_adj ), "p_intf" );
+    p_intf = (intf_thread_t*) userdata;
+    if (p_intf == NULL)
+        return;
 
     if( p_intf->p_sys->p_input )
     {
-#define p_area p_intf->p_sys->p_input->stream.p_selected_area
-        char psz_time[ OFFSETTOTIME_MAX_SIZE ];
+        char psz_time[ MSTRTIME_MAX_SIZE ];
+        int64_t i_seconds;
+
+        i_seconds = var_GetTime( p_intf->p_sys->p_input, "time" ) / I64C(1000000 );
+        secstotimestr( psz_time, i_seconds );
 
         gtk_label_set_text( GTK_LABEL( p_intf->p_sys->p_slider_label ),
-                        input_OffsetToTime( p_intf->p_sys->p_input, psz_time,
-                                   ( p_area->i_size * p_adj->value ) / 100 ) );
-#undef p_area
+                            psz_time );
      }
 }
 
@@ -572,15 +579,15 @@ void E_(GtkDisplayDate)( GtkAdjustment *p_adj )
  *****************************************************************************/
 gint E_(GtkModeManage)( intf_thread_t * p_intf )
 {
-    GtkWidget *     p_slider;
+    GtkWidget *     p_slider = NULL;
     vlc_bool_t      b_control;
 
-#define GETWIDGET( ptr, name ) GTK_WIDGET( gtk_object_get_data( GTK_OBJECT( \
-                           p_intf->p_sys->ptr ) , ( name ) ) )
-    /* hide slider */
-    p_slider = GTK_WIDGET( gtk_object_get_data( GTK_OBJECT(
-                           p_intf->p_sys->p_window ), "slider" ) );
-    gtk_widget_hide( GTK_WIDGET( p_slider ) );
+    if ( p_intf->p_sys->p_window == NULL )
+        msg_Err( p_intf, "Main widget not found" );
+
+    p_slider = lookup_widget( p_intf->p_sys->p_window, "timeSlider");
+    if (p_slider == NULL)
+        msg_Err( p_intf, "Slider widget not found" );
 
     /* controls unavailable */
     b_control = 0;
@@ -589,30 +596,20 @@ gint E_(GtkModeManage)( intf_thread_t * p_intf )
     if( p_intf->p_sys->p_input )
     {
         /* initialize and show slider for seekable streams */
-        if( p_intf->p_sys->p_input->stream.b_seekable )
         {
-            if (p_intf->p_libvlc->i_cpu & CPU_CAPABILITY_FPU)
-                p_intf->p_sys->p_adj->value = p_intf->p_sys->f_adj_oldvalue = 0;
-            else
-                p_intf->p_sys->p_adj->value = p_intf->p_sys->i_adj_oldvalue = 0;
-            gtk_signal_emit_by_name( GTK_OBJECT( p_intf->p_sys->p_adj ),
-                                     "value_changed" );
             gtk_widget_show( GTK_WIDGET( p_slider ) );
         }
 
         /* control buttons for free pace streams */
-        b_control = p_intf->p_sys->p_input->stream.b_pace_control;
+        b_control = p_intf->p_sys->p_input->b_can_pace_control;
 
-        p_intf->p_sys->p_input->stream.b_changed = 0;
         msg_Dbg( p_intf, "stream has changed, refreshing interface" );
     }
 
     /* set control items */
-    gtk_widget_set_sensitive( GETWIDGET(p_window, "tbRewind"), b_control );
-    gtk_widget_set_sensitive( GETWIDGET(p_window, "tbPause"), b_control );
-    gtk_widget_set_sensitive( GETWIDGET(p_window, "tbForward"), b_control );
-
-#undef GETWIDGET
+    gtk_widget_set_sensitive( lookup_widget( p_intf->p_sys->p_window, "tbRewind"), b_control );
+    gtk_widget_set_sensitive( lookup_widget( p_intf->p_sys->p_window, "tbPause"), b_control );
+    gtk_widget_set_sensitive( lookup_widget( p_intf->p_sys->p_window, "tbForward"), b_control );
     return TRUE;
 }