]> git.sesse.net Git - vlc/commitdiff
Corrected playlist update on file opening.
authorPierre Baillet <octplane@videolan.org>
Sun, 8 Apr 2001 13:09:32 +0000 (13:09 +0000)
committerPierre Baillet <octplane@videolan.org>
Sun, 8 Apr 2001 13:09:32 +0000 (13:09 +0000)
plugins/gtk/gtk_callbacks.c
plugins/gtk/gtk_playlist.c

index e0bc5b8cb8c968eaecd0be2cad8d1c8af9e43870..9e94b11b4954f46ede0f1ef564e9ff6d0f7e5708 100644 (file)
@@ -2,7 +2,7 @@
  * gtk_callbacks.c : Callbacks for the Gtk+ plugin.
  *****************************************************************************
  * Copyright (C) 2000, 2001 VideoLAN
- * $Id: gtk_callbacks.c,v 1.12 2001/03/21 13:42:34 sam Exp $
+ * $Id: gtk_callbacks.c,v 1.13 2001/04/08 13:09:32 octplane Exp $
  *
  * Authors: Samuel Hocevar <sam@zoy.org>
  *          Stéphane Borel <stef@via.ecp.fr>
 #include "gtk_callbacks.h"
 #include "gtk_interface.h"
 #include "gtk_support.h"
+#include "gtk_playlist.h"
 #include "intf_gtk.h"
 
 #include "main.h"
 
-/****************************************************************************
- * External function
- */
-void on_generic_drop_data_received( intf_thread_t * p_intf,
-                        GtkSelectionData *data, guint info, int position);
-
-
-
 /*****************************************************************************
  * Callbacks
  ******************************************************************************/
@@ -132,7 +125,7 @@ on_toolbar_open_clicked                (GtkButton       *button,
     {
         p_intf->p_sys->p_fileopen = create_intf_fileopen();
         gtk_object_set_data( GTK_OBJECT( p_intf->p_sys->p_fileopen ),
-                             "p_intf", p_intf );
+                             "p_intf", p_intf  );
     }
 
     gtk_widget_show( p_intf->p_sys->p_fileopen );
@@ -252,14 +245,30 @@ void
 on_fileopen_ok_clicked                 (GtkButton       *button,
                                         gpointer         user_data)
 {
-    GtkWidget *filesel;
+    GtkCList *playlist_clist;
     gchar *filename;
 
-    filesel = gtk_widget_get_toplevel (GTK_WIDGET (button));
+    GtkWidget *filesel = gtk_widget_get_toplevel ( GTK_WIDGET (button) );
+    
+    /* retrieve the interface */
+    intf_thread_t *p_intf = GetIntf( GTK_WIDGET(filesel), "intf_fileopen" );
+    
+    /* hide the widget */
     gtk_widget_hide (filesel);
     filename = gtk_file_selection_get_filename (GTK_FILE_SELECTION (filesel));
-
-    intf_PlaylistAdd( p_main->p_playlist, PLAYLIST_END, (char*)filename );
+    
+    /* catch the GTK CList */
+    playlist_clist = GTK_CLIST( 
+            lookup_widget(p_intf->p_sys->p_playlist,"playlist_clist"));
+    
+    intf_PlaylistAdd( p_main->p_playlist, 
+            PLAYLIST_END, 
+            (char*)filename );
+    
+    /* update the display */
+    rebuildCList( playlist_clist , 
+            p_main->p_playlist );
+   
 }
 
 
index f37821ab5d275b104489dc94f450cd1bd5591d2d..9b3b6c04f5bbb3ec1bc3e7fb089f544caedcff19 100644 (file)
@@ -2,7 +2,7 @@
  * gtk_playlist.c : Interface for the playlist dialog
  *****************************************************************************
  * Copyright (C) 2001 VideoLAN
- * $Id: gtk_playlist.c,v 1.8 2001/03/21 13:42:34 sam Exp $
+ * $Id: gtk_playlist.c,v 1.9 2001/04/08 13:09:32 octplane Exp $
  *
  * Authors: Pierre Baillet <oct@zoy.org>
  *      
 #include "gtk_callbacks.h"
 #include "gtk_interface.h"
 #include "gtk_support.h"
+#include "gtk_playlist.h"
 #include "intf_gtk.h"
 
-#include "main.h"
 
-/* Playlist specific functions */
-void rebuildCList(GtkCList * clist, playlist_t * playlist_p);
-gint compareItems(gconstpointer a, gconstpointer b);
-int hasValidExtension(gchar * filename);
-GList * intf_readFiles(gchar * fsname );
-int intf_AppendList( playlist_t * p_playlist, int i_pos, GList * list );
-void GtkPlayListManage( gpointer p_data );
-void on_generic_drop_data_received( intf_thread_t * p_intf,
-                GtkSelectionData *data, guint info, int position);
+#include "main.h"
 
 void
 on_menubar_playlist_activate           (GtkMenuItem     *menuitem,
@@ -110,7 +102,7 @@ on_toolbar_playlist_clicked            (GtkButton       *button,
 
     if( !GTK_IS_WIDGET( p_intf->p_sys->p_playlist ) )
     {
-        /* this shoud never happen */
+        /* this should never happen */
         intf_ErrMsgImm("intf_playlist is not a widget !");
 
         p_intf->p_sys->p_playlist = create_intf_playlist();
@@ -273,7 +265,7 @@ on_delete_clicked                      (GtkMenuItem       *item,
         g_list_foreach( selection,
                         deleteGListItem, 
                         p_intf );
-        
+        /* rebuild the CList */
         rebuildCList( clist, playlist_p );
     }