Commit b8a59e7f authored by Sam Hocevar's avatar Sam Hocevar

* ./plugins/gtk/*: the Gnome/Gtk+ interfaces have all their features back.

  * ./src/playlist/playlist.c: fixed an off-by-one loop error.
parent bd0a8b89
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* vlc_playlist.h : Playlist functions * vlc_playlist.h : Playlist functions
***************************************************************************** *****************************************************************************
* Copyright (C) 1999, 2000, 2001, 2002 VideoLAN * Copyright (C) 1999, 2000, 2001, 2002 VideoLAN
* $Id: playlist.h,v 1.6 2002/06/07 14:30:40 sam Exp $ * $Id: playlist.h,v 1.7 2002/06/07 19:54:37 sam Exp $
* *
* Authors: Samuel Hocevar <sam@zoy.org> * Authors: Samuel Hocevar <sam@zoy.org>
* *
...@@ -57,7 +57,7 @@ struct playlist_s ...@@ -57,7 +57,7 @@ struct playlist_s
#define PLAYLIST_APPEND 0x0004 #define PLAYLIST_APPEND 0x0004
#define PLAYLIST_GO 0x0008 #define PLAYLIST_GO 0x0008
#define PLAYLIST_END -1 #define PLAYLIST_END -666
/* Playlist parsing mode */ /* Playlist parsing mode */
#define PLAYLIST_REPEAT_CURRENT 0 /* Keep playing current item */ #define PLAYLIST_REPEAT_CURRENT 0 /* Keep playing current item */
......
...@@ -2554,7 +2554,7 @@ http://www.videolan.org/ ...@@ -2554,7 +2554,7 @@ http://www.videolan.org/
</signal> </signal>
<columns>2</columns> <columns>2</columns>
<column_widths>287,70</column_widths> <column_widths>287,70</column_widths>
<selection_mode>GTK_SELECTION_SINGLE</selection_mode> <selection_mode>GTK_SELECTION_EXTENDED</selection_mode>
<show_titles>True</show_titles> <show_titles>True</show_titles>
<shadow_type>GTK_SHADOW_IN</shadow_type> <shadow_type>GTK_SHADOW_IN</shadow_type>
...@@ -2652,7 +2652,7 @@ http://www.videolan.org/ ...@@ -2652,7 +2652,7 @@ http://www.videolan.org/
<name>playlist_add_url</name> <name>playlist_add_url</name>
<signal> <signal>
<name>activate</name> <name>activate</name>
<handler>GtkPlaylistAddUrl</handler> <handler>GtkPlaylistAddUrl_GLADE_SUX_intf_playlist</handler>
<data>&quot;intf_playlist&quot;</data> <data>&quot;intf_playlist&quot;</data>
<last_modification_time>Sat, 19 May 2001 16:24:27 GMT</last_modification_time> <last_modification_time>Sat, 19 May 2001 16:24:27 GMT</last_modification_time>
</signal> </signal>
...@@ -2677,7 +2677,7 @@ http://www.videolan.org/ ...@@ -2677,7 +2677,7 @@ http://www.videolan.org/
<name>playlist_delete_all</name> <name>playlist_delete_all</name>
<signal> <signal>
<name>activate</name> <name>activate</name>
<handler>GtkPlaylistDeleteAll</handler> <handler>GtkPlaylistDeleteAll_GLADE_SUX_intf_playlist</handler>
<data>&quot;intf_playlist&quot;</data> <data>&quot;intf_playlist&quot;</data>
<last_modification_time>Sat, 19 May 2001 03:08:11 GMT</last_modification_time> <last_modification_time>Sat, 19 May 2001 03:08:11 GMT</last_modification_time>
</signal> </signal>
...@@ -2690,7 +2690,7 @@ http://www.videolan.org/ ...@@ -2690,7 +2690,7 @@ http://www.videolan.org/
<name>playlist_delete_item</name> <name>playlist_delete_item</name>
<signal> <signal>
<name>activate</name> <name>activate</name>
<handler>GtkPlaylistDeleteSelected</handler> <handler>GtkPlaylistDeleteSelected_GLADE_SUX_intf_playlist</handler>
<data>&quot;intf_playlist&quot;</data> <data>&quot;intf_playlist&quot;</data>
<last_modification_time>Sat, 19 May 2001 03:08:05 GMT</last_modification_time> <last_modification_time>Sat, 19 May 2001 03:08:05 GMT</last_modification_time>
</signal> </signal>
...@@ -2715,7 +2715,7 @@ http://www.videolan.org/ ...@@ -2715,7 +2715,7 @@ http://www.videolan.org/
<name>playlist_selection_crop</name> <name>playlist_selection_crop</name>
<signal> <signal>
<name>activate</name> <name>activate</name>
<handler>GtkPlaylistCrop</handler> <handler>GtkPlaylistCrop_GLADE_SUX_intf_playlist</handler>
<data>&quot;intf_playlist&quot;</data> <data>&quot;intf_playlist&quot;</data>
<last_modification_time>Sat, 19 May 2001 03:07:56 GMT</last_modification_time> <last_modification_time>Sat, 19 May 2001 03:07:56 GMT</last_modification_time>
</signal> </signal>
...@@ -2728,7 +2728,7 @@ http://www.videolan.org/ ...@@ -2728,7 +2728,7 @@ http://www.videolan.org/
<name>playlist_selection_invert</name> <name>playlist_selection_invert</name>
<signal> <signal>
<name>activate</name> <name>activate</name>
<handler>GtkPlaylistInvert</handler> <handler>GtkPlaylistInvert_GLADE_SUX_intf_playlist</handler>
<data>&quot;intf_playlist&quot;</data> <data>&quot;intf_playlist&quot;</data>
<last_modification_time>Sat, 19 May 2001 03:07:51 GMT</last_modification_time> <last_modification_time>Sat, 19 May 2001 03:07:51 GMT</last_modification_time>
</signal> </signal>
...@@ -2741,7 +2741,7 @@ http://www.videolan.org/ ...@@ -2741,7 +2741,7 @@ http://www.videolan.org/
<name>playlist_selection_select</name> <name>playlist_selection_select</name>
<signal> <signal>
<name>activate</name> <name>activate</name>
<handler>GtkPlaylistSelect</handler> <handler>GtkPlaylistSelect_GLADE_SUX_intf_playlist</handler>
<data>&quot;intf_playlist&quot;</data> <data>&quot;intf_playlist&quot;</data>
<last_modification_time>Sat, 19 May 2001 03:07:45 GMT</last_modification_time> <last_modification_time>Sat, 19 May 2001 03:07:45 GMT</last_modification_time>
</signal> </signal>
......
...@@ -1727,7 +1727,7 @@ static GnomeUIInfo playlist_add_menu_uiinfo[] = ...@@ -1727,7 +1727,7 @@ static GnomeUIInfo playlist_add_menu_uiinfo[] =
{ {
GNOME_APP_UI_ITEM, N_("Url"), GNOME_APP_UI_ITEM, N_("Url"),
NULL, NULL,
(gpointer) GtkPlaylistAddUrl, NULL, NULL, (gpointer) GtkPlaylistAddUrl, "intf_playlist", NULL,
GNOME_APP_PIXMAP_NONE, NULL, GNOME_APP_PIXMAP_NONE, NULL,
0, (GdkModifierType) 0, NULL 0, (GdkModifierType) 0, NULL
}, },
...@@ -1739,14 +1739,14 @@ static GnomeUIInfo playlist_delete_menu_uiinfo[] = ...@@ -1739,14 +1739,14 @@ static GnomeUIInfo playlist_delete_menu_uiinfo[] =
{ {
GNOME_APP_UI_ITEM, N_("All"), GNOME_APP_UI_ITEM, N_("All"),
NULL, NULL,
(gpointer) GtkPlaylistDeleteAll, NULL, NULL, (gpointer) GtkPlaylistDeleteAll, "intf_playlist", NULL,
GNOME_APP_PIXMAP_NONE, NULL, GNOME_APP_PIXMAP_NONE, NULL,
0, (GdkModifierType) 0, NULL 0, (GdkModifierType) 0, NULL
}, },
{ {
GNOME_APP_UI_ITEM, N_("Item"), GNOME_APP_UI_ITEM, N_("Item"),
NULL, NULL,
(gpointer) GtkPlaylistDeleteSelected, NULL, NULL, (gpointer) GtkPlaylistDeleteSelected, "intf_playlist", NULL,
GNOME_APP_PIXMAP_NONE, NULL, GNOME_APP_PIXMAP_NONE, NULL,
0, (GdkModifierType) 0, NULL 0, (GdkModifierType) 0, NULL
}, },
...@@ -1758,21 +1758,21 @@ static GnomeUIInfo playlist_selection_menu_uiinfo[] = ...@@ -1758,21 +1758,21 @@ static GnomeUIInfo playlist_selection_menu_uiinfo[] =
{ {
GNOME_APP_UI_ITEM, N_("Crop"), GNOME_APP_UI_ITEM, N_("Crop"),
NULL, NULL,
(gpointer) GtkPlaylistCrop, NULL, NULL, (gpointer) GtkPlaylistCrop, "intf_playlist", NULL,
GNOME_APP_PIXMAP_NONE, NULL, GNOME_APP_PIXMAP_NONE, NULL,
0, (GdkModifierType) 0, NULL 0, (GdkModifierType) 0, NULL
}, },
{ {
GNOME_APP_UI_ITEM, N_("Invert"), GNOME_APP_UI_ITEM, N_("Invert"),
NULL, NULL,
(gpointer) GtkPlaylistInvert, NULL, NULL, (gpointer) GtkPlaylistInvert, "intf_playlist", NULL,
GNOME_APP_PIXMAP_NONE, NULL, GNOME_APP_PIXMAP_NONE, NULL,
0, (GdkModifierType) 0, NULL 0, (GdkModifierType) 0, NULL
}, },
{ {
GNOME_APP_UI_ITEM, N_("Select"), GNOME_APP_UI_ITEM, N_("Select"),
NULL, NULL,
(gpointer) GtkPlaylistSelect, NULL, NULL, (gpointer) GtkPlaylistSelect, "intf_playlist", NULL,
GNOME_APP_PIXMAP_NONE, NULL, GNOME_APP_PIXMAP_NONE, NULL,
0, (GdkModifierType) 0, NULL 0, (GdkModifierType) 0, NULL
}, },
...@@ -1862,6 +1862,7 @@ create_intf_playlist (void) ...@@ -1862,6 +1862,7 @@ create_intf_playlist (void)
gtk_container_add (GTK_CONTAINER (playlist_frame), playlist_clist); gtk_container_add (GTK_CONTAINER (playlist_frame), playlist_clist);
gtk_clist_set_column_width (GTK_CLIST (playlist_clist), 0, 287); gtk_clist_set_column_width (GTK_CLIST (playlist_clist), 0, 287);
gtk_clist_set_column_width (GTK_CLIST (playlist_clist), 1, 70); gtk_clist_set_column_width (GTK_CLIST (playlist_clist), 1, 70);
gtk_clist_set_selection_mode (GTK_CLIST (playlist_clist), GTK_SELECTION_EXTENDED);
gtk_clist_column_titles_show (GTK_CLIST (playlist_clist)); gtk_clist_column_titles_show (GTK_CLIST (playlist_clist));
playlist_label_url = gtk_label_new (_("Url")); playlist_label_url = gtk_label_new (_("Url"));
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* gtk_callbacks.c : Callbacks for the Gtk+ plugin. * gtk_callbacks.c : Callbacks for the Gtk+ plugin.
***************************************************************************** *****************************************************************************
* Copyright (C) 2000, 2001 VideoLAN * Copyright (C) 2000, 2001 VideoLAN
* $Id: gtk_callbacks.c,v 1.44 2002/06/07 14:30:40 sam Exp $ * $Id: gtk_callbacks.c,v 1.45 2002/06/07 19:54:37 sam Exp $
* *
* Authors: Samuel Hocevar <sam@zoy.org> * Authors: Samuel Hocevar <sam@zoy.org>
* Stphane Borel <stef@via.ecp.fr> * Stphane Borel <stef@via.ecp.fr>
...@@ -384,12 +384,20 @@ void GtkJumpCancel( GtkButton *button, ...@@ -384,12 +384,20 @@ void GtkJumpCancel( GtkButton *button,
****************************************************************************/ ****************************************************************************/
gboolean GtkDiscEject ( GtkWidget *widget, gpointer user_data ) gboolean GtkDiscEject ( GtkWidget *widget, gpointer user_data )
{ {
#if 0 /* PLAYLIST TARASS */
intf_thread_t *p_intf = GetIntf( GTK_WIDGET(widget), (char*)user_data );
char *psz_device = NULL; char *psz_device = NULL;
char *psz_parser; char *psz_parser;
char *psz_current = p_intf->p_vlc->p_playlist->current.psz_name; char *psz_current;
intf_thread_t *p_intf = GetIntf( GTK_WIDGET(widget), (char*)user_data );
playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
FIND_ANYWHERE );
if( p_playlist == NULL )
{
return FALSE;
}
vlc_mutex_lock( &p_playlist->object_lock );
psz_current = p_playlist->pp_items[ p_playlist->i_index ]->psz_name;
/* /*
* Get the active input * Get the active input
...@@ -437,6 +445,9 @@ gboolean GtkDiscEject ( GtkWidget *widget, gpointer user_data ) ...@@ -437,6 +445,9 @@ gboolean GtkDiscEject ( GtkWidget *widget, gpointer user_data )
} }
} }
vlc_mutex_unlock( &p_playlist->object_lock );
vlc_object_release( p_playlist );
if( psz_device == NULL ) if( psz_device == NULL )
{ {
return TRUE; return TRUE;
...@@ -462,7 +473,7 @@ gboolean GtkDiscEject ( GtkWidget *widget, gpointer user_data ) ...@@ -462,7 +473,7 @@ gboolean GtkDiscEject ( GtkWidget *widget, gpointer user_data )
} }
free(psz_device); free(psz_device);
#endif
return TRUE; return TRUE;
} }
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* gtk_playlist.c : Interface for the playlist dialog * gtk_playlist.c : Interface for the playlist dialog
***************************************************************************** *****************************************************************************
* Copyright (C) 2001 VideoLAN * Copyright (C) 2001 VideoLAN
* $Id: gtk_playlist.c,v 1.34 2002/06/07 16:06:09 sam Exp $ * $Id: gtk_playlist.c,v 1.35 2002/06/07 19:54:37 sam Exp $
* *
* Authors: Pierre Baillet <oct@zoy.org> * Authors: Pierre Baillet <oct@zoy.org>
* Stphane Borel <stef@via.ecp.fr> * Stphane Borel <stef@via.ecp.fr>
...@@ -56,7 +56,8 @@ ...@@ -56,7 +56,8 @@
/**************************************************************************** /****************************************************************************
* Local prototypes * Local prototypes
****************************************************************************/ ****************************************************************************/
static void UrlDecode( char *encoded_path ); static void UrlDecode ( char * );
static GList * GtkReadFiles ( intf_thread_t *, gchar * );
/**************************************************************************** /****************************************************************************
* Playlist window management * Playlist window management
...@@ -158,16 +159,17 @@ void GtkPlaylistDeleteAll( GtkMenuItem * menuitem, gpointer user_data ) ...@@ -158,16 +159,17 @@ void GtkPlaylistDeleteAll( GtkMenuItem * menuitem, gpointer user_data )
void GtkPlaylistDeleteSelected( GtkMenuItem * menuitem, gpointer user_data ) void GtkPlaylistDeleteSelected( GtkMenuItem * menuitem, gpointer user_data )
{ {
#if 0 /* PLAYLIST TARASS */
/* user wants to delete a file in the queue */ /* user wants to delete a file in the queue */
GList * p_selection; GList * p_selection;
GtkCList * p_clist; GtkCList * p_clist;
playlist_t *p_playlist;
/* catch the thread back */ intf_thread_t * p_intf = GetIntf( GTK_WIDGET(menuitem), user_data );
intf_thread_t *p_intf = GetIntf( GTK_WIDGET(menuitem), /*(char*)user_data*/"intf_playlist" ); playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
FIND_ANYWHERE );
p_playlist = p_intf->p_vlc->p_playlist; if( p_playlist == NULL )
{
return;
}
/* lock the struct */ /* lock the struct */
vlc_mutex_lock( &p_intf->change_lock ); vlc_mutex_lock( &p_intf->change_lock );
...@@ -175,22 +177,22 @@ void GtkPlaylistDeleteSelected( GtkMenuItem * menuitem, gpointer user_data ) ...@@ -175,22 +177,22 @@ void GtkPlaylistDeleteSelected( GtkMenuItem * menuitem, gpointer user_data )
p_clist = GTK_CLIST( gtk_object_get_data( GTK_OBJECT( p_clist = GTK_CLIST( gtk_object_get_data( GTK_OBJECT(
p_intf->p_sys->p_playwin ), "playlist_clist" ) ); p_intf->p_sys->p_playwin ), "playlist_clist" ) );
/* I use UNDOCUMENTED features to retrieve the selection... */
p_selection = p_clist->selection; p_selection = p_clist->selection;
if( g_list_length( p_selection ) > 0 ) if( g_list_length( p_selection ) )
{ {
/* reverse-sort so that we can delete from the furthest /* reverse-sort so that we can delete from the furthest
* to the closest item to delete... * to the closest item to delete...
*/ */
p_selection = g_list_sort( p_selection, GtkCompareItems ); p_selection = g_list_sort( p_selection, GtkCompareItems );
g_list_foreach( p_selection, GtkDeleteGListItem, p_intf ); g_list_foreach( p_selection, GtkDeleteGListItem, p_playlist );
/* rebuild the CList */ /* rebuild the CList */
GtkRebuildCList( p_clist, p_playlist ); GtkRebuildCList( p_clist, p_playlist );
} }
vlc_mutex_unlock( &p_intf->change_lock ); vlc_mutex_unlock( &p_intf->change_lock );
#endif
vlc_object_release( p_playlist );
} }
void GtkPlaylistCrop( GtkMenuItem * menuitem, gpointer user_data ) void GtkPlaylistCrop( GtkMenuItem * menuitem, gpointer user_data )
...@@ -203,51 +205,47 @@ void GtkPlaylistCrop( GtkMenuItem * menuitem, gpointer user_data ) ...@@ -203,51 +205,47 @@ void GtkPlaylistCrop( GtkMenuItem * menuitem, gpointer user_data )
void GtkPlaylistInvert( GtkMenuItem * menuitem, gpointer user_data ) void GtkPlaylistInvert( GtkMenuItem * menuitem, gpointer user_data )
{ {
#if 0 /* PLAYLIST TARASS */
playlist_t *p_playlist;
GtkCList * p_clist; GtkCList * p_clist;
int * pi_selected; int * pi_selected;
int i_sel_l; int i_length;
int i_dummy; int i_dummy;
/* catch the thread back */ /* catch the thread back */
intf_thread_t *p_intf = GetIntf( GTK_WIDGET(menuitem), (char*)user_data ); intf_thread_t *p_intf = GetIntf( GTK_WIDGET(menuitem), (char*)user_data );
p_playlist = p_intf->p_vlc->p_playlist;
/* lock the struct */ /* lock the struct */
vlc_mutex_lock( &p_intf->change_lock ); vlc_mutex_lock( &p_intf->change_lock );
p_clist = GTK_CLIST( gtk_object_get_data( GTK_OBJECT( p_clist = GTK_CLIST( gtk_object_get_data( GTK_OBJECT(
p_intf->p_sys->p_playwin ), "playlist_clist" ) ); p_intf->p_sys->p_playwin ), "playlist_clist" ) );
gtk_clist_freeze( p_clist );
/* have to copy the selection to an int * /* have to copy the selection to an int *
I wasn't able to copy the g_list to another g_list I wasn't able to copy the g_list to another g_list
glib only does pointer copies, not real copies :( */ glib only does pointer copies, not real copies :( */
pi_selected = malloc( sizeof(int) *g_list_length( p_clist->selection ) ); i_length = g_list_length( p_clist->selection );
i_sel_l = g_list_length( p_clist->selection ); pi_selected = malloc( sizeof(int) * i_length );
for( i_dummy = 0 ; i_dummy < i_sel_l ; i_dummy++) for( i_dummy = 0 ; i_dummy < i_length ; i_dummy++ )
{ {
pi_selected[i_dummy] = (long)g_list_nth_data( p_clist->selection, pi_selected[i_dummy] =
i_dummy ); GPOINTER_TO_UINT( g_list_nth_data( p_clist->selection, i_dummy ) );
} }
gtk_clist_freeze( p_clist );
gtk_clist_select_all( p_clist ); gtk_clist_select_all( p_clist );
for( i_dummy = 0; i_dummy < i_sel_l; i_dummy++) for( i_dummy = 0; i_dummy < i_length; i_dummy++ )
{ {
gtk_clist_unselect_row( p_clist, pi_selected[i_dummy], 0 ); gtk_clist_unselect_row( p_clist, pi_selected[i_dummy], 0 );
gtk_clist_unselect_row( p_clist, pi_selected[i_dummy], 1 );
} }
free( pi_selected );
gtk_clist_thaw( p_clist ); gtk_clist_thaw( p_clist );
vlc_mutex_unlock( &p_intf->change_lock ); vlc_mutex_unlock( &p_intf->change_lock );
#endif
free( pi_selected );
} }
void GtkPlaylistSelect( GtkMenuItem * menuitem, gpointer user_data) void GtkPlaylistSelect( GtkMenuItem * menuitem, gpointer user_data)
...@@ -299,12 +297,10 @@ void GtkPlaylistDragData( GtkWidget *widget, ...@@ -299,12 +297,10 @@ void GtkPlaylistDragData( GtkWidget *widget,
guint time, guint time,
gpointer user_data ) gpointer user_data )
{ {
#if 0 /* PLAYLIST TARASS */
intf_thread_t * p_intf = GetIntf( GTK_WIDGET(widget), (char*)user_data ); intf_thread_t * p_intf = GetIntf( GTK_WIDGET(widget), (char*)user_data );
GtkCList * p_clist; GtkCList * p_clist;
gint i_row; gint i_row;
gint i_col; gint i_col;
int i_end = p_intf->p_vlc->p_playlist->i_size;
p_clist = GTK_CLIST( gtk_object_get_data( GTK_OBJECT( p_clist = GTK_CLIST( gtk_object_get_data( GTK_OBJECT(
p_intf->p_sys->p_playwin ), "playlist_clist" ) ); p_intf->p_sys->p_playwin ), "playlist_clist" ) );
...@@ -312,16 +308,13 @@ void GtkPlaylistDragData( GtkWidget *widget, ...@@ -312,16 +308,13 @@ void GtkPlaylistDragData( GtkWidget *widget,
if( gtk_clist_get_selection_info( p_clist, x, y, &i_row, &i_col ) == 1 ) if( gtk_clist_get_selection_info( p_clist, x, y, &i_row, &i_col ) == 1 )
{ {
/* we are dropping somewhere into the clist items */ /* we are dropping somewhere into the clist items */
GtkDropDataReceived( p_intf, data, info, i_row ); GtkDropDataReceived( p_intf, data, info, i_row - 1 );
} }
else else
{ {
/* else, put that at the end of the playlist */ /* otherwise, put that at the end of the playlist */
GtkDropDataReceived( p_intf, data, info, PLAYLIST_END ); GtkDropDataReceived( p_intf, data, info, PLAYLIST_END );
} }
intf_PlaylistJumpto( p_intf->p_vlc->p_playlist, i_end - 1 );
#endif
} }
...@@ -332,15 +325,19 @@ gboolean GtkPlaylistDragMotion( GtkWidget *widget, ...@@ -332,15 +325,19 @@ gboolean GtkPlaylistDragMotion( GtkWidget *widget,
guint time, guint time,
gpointer user_data ) gpointer user_data )
{ {
#if 0 /* PLAYLIST TARASS */
intf_thread_t *p_intf;
GtkCList * p_clist; GtkCList * p_clist;
gint i_row; gint i_row;
gint i_col; gint i_col;
int i_dummy; int i_dummy;
GdkColor color; GdkColor color;
p_intf = GetIntf( GTK_WIDGET(widget), (char*)user_data ); intf_thread_t * p_intf = GetIntf( GTK_WIDGET(widget), (char*)user_data );
playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
FIND_ANYWHERE );
if( p_playlist == NULL )
{
return FALSE;
}
p_clist = GTK_CLIST( gtk_object_get_data( GTK_OBJECT( p_clist = GTK_CLIST( gtk_object_get_data( GTK_OBJECT(
p_intf->p_sys->p_playwin ), "playlist_clist" ) ); p_intf->p_sys->p_playwin ), "playlist_clist" ) );
...@@ -358,26 +355,31 @@ gboolean GtkPlaylistDragMotion( GtkWidget *widget, ...@@ -358,26 +355,31 @@ gboolean GtkPlaylistDragMotion( GtkWidget *widget,
for( i_dummy = 0; i_dummy < p_clist->rows; i_dummy++) for( i_dummy = 0; i_dummy < p_clist->rows; i_dummy++)
{ {
gtk_clist_set_background ( p_clist, i_dummy , &color); gtk_clist_set_background( p_clist, i_dummy , &color );
} }
color.red = 0xffff;
color.blue = 0;
color.green = 0;
i_row = p_intf->p_vlc->p_playlist->i_index;
gtk_clist_set_background( p_clist, i_row, &color );
if( gtk_clist_get_selection_info( p_clist, x, y, &i_row, &i_col ) == 1)
{
color.red = 0; color.red = 0;
color.blue = 0xf000; color.blue = 0xf000;
color.green = 0x9000; color.green = 0x9000;
gtk_clist_set_background ( p_clist, i_row - 1, &color); if( gtk_clist_get_selection_info( p_clist, x, y, &i_row, &i_col ) == 1 )
gtk_clist_set_background ( p_clist, i_row, &color); {
gtk_clist_set_background ( p_clist, i_row - 1, &color );
gtk_clist_set_background ( p_clist, i_row, &color );
}
else
{
gtk_clist_set_background ( p_clist, p_clist->rows - 1, &color );
} }
color.red = 0xffff;
color.blue = 0;
color.green = 0;
vlc_mutex_lock( &p_playlist->object_lock );
gtk_clist_set_background( p_clist, p_playlist->i_index, &color );
vlc_mutex_unlock( &p_playlist->object_lock );
vlc_object_release( p_playlist );
gtk_clist_thaw( p_clist ); gtk_clist_thaw( p_clist );
#endif
return TRUE; return TRUE;
} }
...@@ -385,7 +387,6 @@ gboolean GtkPlaylistDragMotion( GtkWidget *widget, ...@@ -385,7 +387,6 @@ gboolean GtkPlaylistDragMotion( GtkWidget *widget,
void GtkDropDataReceived( intf_thread_t * p_intf, void GtkDropDataReceived( intf_thread_t * p_intf,
GtkSelectionData * p_data, guint i_info, int i_position) GtkSelectionData * p_data, guint i_info, int i_position)
{ {
#if 0 /* PLAYLIST TARASS */
/* first we'll have to split against all the '\n' we have */ /* first we'll have to split against all the '\n' we have */
gchar * p_protocol; gchar * p_protocol;
gchar * p_temp; gchar * p_temp;
...@@ -394,10 +395,12 @@ void GtkDropDataReceived( intf_thread_t * p_intf, ...@@ -394,10 +395,12 @@ void GtkDropDataReceived( intf_thread_t * p_intf,
GList * p_files = NULL; GList * p_files = NULL;
GtkCList * p_clist; GtkCList * p_clist;
playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
/* catch the playlist back */ FIND_ANYWHERE );
playlist_t * p_playlist = p_intf->p_vlc->p_playlist; if( p_playlist == NULL )
{
return;
}
/* if this has been URLencoded, decode it /* if this has been URLencoded, decode it
* *
...@@ -456,7 +459,8 @@ void GtkDropDataReceived( intf_thread_t * p_intf, ...@@ -456,7 +459,8 @@ void GtkDropDataReceived( intf_thread_t * p_intf,
if( strcmp( p_protocol, "file:" ) == 0 ) if( strcmp( p_protocol, "file:" ) == 0 )
{ {
p_files = g_list_concat( p_files, GtkReadFiles( p_string ) ); p_files = g_list_concat( p_files,
GtkReadFiles( p_intf, p_string ) );
} }
else else
{ {
...@@ -480,7 +484,7 @@ void GtkDropDataReceived( intf_thread_t * p_intf, ...@@ -480,7 +484,7 @@ void GtkDropDataReceived( intf_thread_t * p_intf,
/* lock the interface */ /* lock the interface */
vlc_mutex_lock( &p_intf->change_lock ); vlc_mutex_lock( &p_intf->change_lock );
msg_Dbg( p_intf, "list has %d elements", g_list_length( p_files ) ); msg_Dbg( p_intf, "adding %d elements", g_list_length( p_files ) );
GtkAppendList( p_playlist, i_position, p_files ); GtkAppendList( p_playlist, i_position, p_files );
/* get the CList and rebuild it. */ /* get the CList and rebuild it. */
...@@ -491,33 +495,17 @@ void GtkDropDataReceived( intf_thread_t * p_intf, ...@@ -491,33 +495,17 @@ void GtkDropDataReceived( intf_thread_t * p_intf,
/* unlock the interface */ /* unlock the interface */
vlc_mutex_unlock( &p_intf->change_lock ); vlc_mutex_unlock( &p_intf->change_lock );
} }
#endif
vlc_object_release( p_playlist );
} }
void GtkDeleteGListItem( gpointer data, gpointer param ) void GtkDeleteGListItem( gpointer data, gpointer param )
{ {
#if 0 /* PLAYLIST TARASS */
int i_cur_row = (long)data; int i_cur_row = (long)data;
intf_thread_t * p_intf = param; playlist_t * p_playlist = param;
intf_PlaylistDelete( p_intf->p_vlc->p_playlist, i_cur_row ); playlist_Delete( p_playlist, i_cur_row );
/* are we deleting the current played stream */
if( p_intf->p_sys->i_playing == i_cur_row )
{
/* next ! */
p_intf->p_sys->p_input->b_eof = 1;
/* this has to set the slider to 0 */
/* step minus one */
p_intf->p_sys->i_playing-- ;
vlc_mutex_lock( &p_intf->p_vlc->p_playlist->change_lock );
p_intf->p_vlc->p_playlist->i_index-- ;
vlc_mutex_unlock( &p_intf->p_vlc->p_playlist->change_lock );
}
#endif
} }
...@@ -549,7 +537,7 @@ int GtkHasValidExtension( gchar * psz_filename ) ...@@ -549,7 +537,7 @@ int GtkHasValidExtension( gchar * psz_filename )
/* recursive function: descend into folders and build a list of /* recursive function: descend into folders and build a list of
* valid filenames */ * valid filenames */
GList * GtkReadFiles( gchar * psz_fsname ) static GList * GtkReadFiles( intf_thread_t * p_intf, gchar * psz_fsname )
{ {
struct stat statbuf; struct stat statbuf;
GList * p_current = NULL; GList * p_current = NULL;
...@@ -562,8 +550,8 @@ GList * GtkReadFiles( gchar * psz_fsname ) ...@@ -562,8 +550,8 @@ GList * GtkReadFiles( gchar * psz_fsname )
{ {
if( GtkHasValidExtension( psz_fsname ) ) if( GtkHasValidExtension( psz_fsname ) )
{ {
//X msg_Warn( "%s is a valid file. Stacking on the playlist", msg_Dbg( p_intf, "%s is a valid file, stacking on the playlist",
//X psz_fsname ); psz_fsname );
return g_list_append( NULL, g_strdup( psz_fsname ) ); return g_list_append( NULL, g_strdup( psz_fsname ) );
} }
else else
...@@ -578,7 +566,7 @@ GList * GtkReadFiles( gchar * psz_fsname ) ...@@ -578,7 +566,7 @@ GList * GtkReadFiles( gchar * psz_fsname )
DIR * p_current_dir = opendir( psz_fsname ); DIR * p_current_dir = opendir( psz_fsname );
struct dirent * p_dir_content; struct dirent * p_dir_content;
//X msg_Warn( "%s is a folder.", psz_fsname ); msg_Dbg( p_intf, "%s is a folder", psz_fsname );
if( p_current_dir == NULL ) if( p_current_dir == NULL )
{ {
...@@ -606,7 +594,7 @@ GList * GtkReadFiles( gchar * psz_fsname ) ...@@ -606,7 +594,7 @@ GList * GtkReadFiles( gchar * psz_fsname )
psz_newfs[strlen( psz_fsname )] = '/'; psz_newfs[strlen( psz_fsname )] = '/';
p_current = g_list_concat( p_current, p_current = g_list_concat( p_current,
GtkReadFiles( psz_newfs ) ); GtkReadFiles( p_intf, psz_newfs ) );
g_free( psz_newfs ); g_free( psz_newfs );
} }
...@@ -622,7 +610,6 @@ GList * GtkReadFiles( gchar * psz_fsname ) ...@@ -622,7 +610,6 @@ GList * GtkReadFiles( gchar * psz_fsname )
*/ */
int GtkAppendList( playlist_t * p_playlist, int i_pos, GList * p_list ) int GtkAppendList( playlist_t * p_playlist, int i_pos, GList * p_list )
{ {
#if 0 /* PLAYLIST TARASS */
guint i_dummy; guint i_dummy;
guint i_length; guint i_length;
...@@ -630,14 +617,15 @@ int GtkAppendList( playlist_t * p_playlist, int i_pos, GList * p_list ) ...@@ -630,14 +617,15 @@ int GtkAppendList( playlist_t * p_playlist, int i_pos, GList * p_list )
for( i_dummy = 0; i_dummy < i_length ; i_dummy++ ) for( i_dummy = 0; i_dummy < i_length ; i_dummy++ )
{ {
intf_PlaylistAdd( p_playlist, playlist_Add( p_playlist,
/* ok; this is a really nasty trick to insert /* ok; this is a really nasty trick to insert
the item where they are suppose to go but, hey the item where they are suppose to go but, hey
this works :P (btw, you are really nasty too) */ this works :P (btw, you are really nasty too) */
i_pos==PLAYLIST_END?PLAYLIST_END:( i_pos + i_dummy ), g_list_nth_data( p_list, i_dummy ),
g_list_nth_data( p_list, i_dummy ) ); i_dummy == 0 ? PLAYLIST_INSERT | PLAYLIST_GO : PLAYLIST_INSERT,
i_pos == PLAYLIST_END ? PLAYLIST_END : ( i_pos + i_dummy ) );
} }
#endif
return 0; return 0;
} }
...@@ -655,7 +643,7 @@ void GtkPlayListManage( intf_thread_t * p_intf ) ...@@ -655,7 +643,7 @@ void GtkPlayListManage( intf_thread_t * p_intf )
/* this thing really sucks for now :( */ /* this thing really sucks for now :( */
/* TODO speak more with interface/intf_playlist.c */ /* TODO speak more with src/playlist/playlist.c */
if( GTK_IS_WIDGET( p_intf->p_sys->p_playwin ) ) if( GTK_IS_WIDGET( p_intf->p_sys->p_playwin ) )
{ {
p_clist = GTK_CLIST( gtk_object_get_data( GTK_OBJECT( p_clist = GTK_CLIST( gtk_object_get_data( GTK_OBJECT(
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* gtk_playlist.h : Playlist functions for the Gtk plugin. * gtk_playlist.h : Playlist functions for the Gtk plugin.
***************************************************************************** *****************************************************************************
* Copyright (C) 2000, 2001 VideoLAN * Copyright (C) 2000, 2001 VideoLAN
* $Id: gtk_playlist.h,v 1.7 2002/06/07 14:30:41 sam Exp $ * $Id: gtk_playlist.h,v 1.8 2002/06/07 19:54:37 sam Exp $
* *
* Authors: Pierre Baillet <oct@zoy.org> * Authors: Pierre Baillet <oct@zoy.org>
* Stphane Borel <stef@via.ecp.fr> * Stphane Borel <stef@via.ecp.fr>
...@@ -33,7 +33,6 @@ void GtkPlaylistAddUrl ( GtkMenuItem *, gpointer ); ...@@ -33,7 +33,6 @@ void GtkPlaylistAddUrl ( GtkMenuItem *, gpointer );
gint GtkCompareItems ( gconstpointer, gconstpointer ); gint GtkCompareItems ( gconstpointer, gconstpointer );
int GtkHasValidExtension ( gchar * ); int GtkHasValidExtension ( gchar * );
GList * GtkReadFiles ( gchar * );
gboolean GtkPlaylistShow ( GtkWidget *, gpointer ); gboolean GtkPlaylistShow ( GtkWidget *, gpointer );
gboolean GtkPlaylistPrev ( GtkWidget *, gpointer ); gboolean GtkPlaylistPrev ( GtkWidget *, gpointer );
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* playlist.c : Playlist management functions * playlist.c : Playlist management functions
***************************************************************************** *****************************************************************************
* Copyright (C) 1999-2001 VideoLAN * Copyright (C) 1999-2001 VideoLAN
* $Id: playlist.c,v 1.7 2002/06/07 16:06:09 sam Exp $ * $Id: playlist.c,v 1.8 2002/06/07 19:54:37 sam Exp $
* *
* Authors: Samuel Hocevar <sam@zoy.org> * Authors: Samuel Hocevar <sam@zoy.org>
* *
...@@ -107,23 +107,28 @@ int playlist_Add( playlist_t *p_playlist, const char * psz_target, ...@@ -107,23 +107,28 @@ int playlist_Add( playlist_t *p_playlist, const char * psz_target,
msg_Warn( p_playlist, "adding playlist item %s ", psz_target ); msg_Warn( p_playlist, "adding playlist item %s ", psz_target );
vlc_mutex_lock( &p_playlist->object_lock );
/* Create the new playlist item */ /* Create the new playlist item */
p_item = malloc( sizeof( playlist_item_t ) ); p_item = malloc( sizeof( playlist_item_t ) );
if( p_item == NULL ) if( p_item == NULL )
{ {
msg_Err( p_playlist, "out of memory" ); msg_Err( p_playlist, "out of memory" );
vlc_mutex_unlock( &p_playlist->object_lock );
} }
p_item->psz_name = strdup( psz_target ); p_item->psz_name = strdup( psz_target );
p_item->i_type = 0; p_item->i_type = 0;
p_item->i_status = 0; p_item->i_status = 0;
vlc_mutex_lock( &p_playlist->object_lock );
/* Do a few boundary checks and allocate space for the item */ /* Do a few boundary checks and allocate space for the item */
if( i_pos == PLAYLIST_END ) if( i_pos == PLAYLIST_END )
{ {
if( i_mode & PLAYLIST_INSERT )
{
i_mode &= ~PLAYLIST_INSERT;
i_mode |= PLAYLIST_APPEND;
}
i_pos = p_playlist->i_size - 1; i_pos = p_playlist->i_size - 1;
} }
...@@ -160,14 +165,14 @@ int playlist_Add( playlist_t *p_playlist, const char * psz_target, ...@@ -160,14 +165,14 @@ int playlist_Add( playlist_t *p_playlist, const char * psz_target,
} }
/* Now we know exactly where it goes. Just renumber the playlist */ /* Now we know exactly where it goes. Just renumber the playlist */
for( i_index = p_playlist->i_size - 2; i_index > i_pos ; i_index-- ) for( i_index = p_playlist->i_size - 1; i_index > i_pos ; i_index-- )
{ {
p_playlist->pp_items[i_index + 1] = p_playlist->pp_items[i_index]; p_playlist->pp_items[i_index] = p_playlist->pp_items[i_index - 1];
} }
if( p_playlist->i_index >= i_pos ) if( p_playlist->i_index >= i_pos )
{ {
i_index++; p_playlist->i_index++;
} }
} }
else else
...@@ -202,8 +207,43 @@ int playlist_Add( playlist_t *p_playlist, const char * psz_target, ...@@ -202,8 +207,43 @@ int playlist_Add( playlist_t *p_playlist, const char * psz_target,
*****************************************************************************/ *****************************************************************************/
int playlist_Delete( playlist_t * p_playlist, int i_pos ) int playlist_Delete( playlist_t * p_playlist, int i_pos )
{ {
int i_index;
vlc_mutex_lock( &p_playlist->object_lock ); vlc_mutex_lock( &p_playlist->object_lock );
if( i_pos >= 0 && i_pos < p_playlist->i_size )
{
msg_Warn( p_playlist, "deleting playlist item %s ",
p_playlist->pp_items[i_pos]->psz_name );
free( p_playlist->pp_items[i_pos]->psz_name );
free( p_playlist->pp_items[i_pos] );
/* XXX: what if the item is still in use? */
if( i_pos < p_playlist->i_index )
{
p_playlist->i_index--;
}
/* Renumber the playlist */
for( i_index = i_pos + 1; i_index < p_playlist->i_size; i_index++ )
{
p_playlist->pp_items[i_index - 1] = p_playlist->pp_items[i_index];
}
p_playlist->i_size--;
if( p_playlist->i_size )
{
p_playlist->pp_items = realloc( p_playlist->pp_items,
p_playlist->i_size * sizeof(void*) );
}
else
{
free( p_playlist->pp_items );
p_playlist->pp_items = NULL;
}
}
vlc_mutex_unlock( &p_playlist->object_lock ); vlc_mutex_unlock( &p_playlist->object_lock );
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment