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 @@
* vlc_playlist.h : Playlist functions
*****************************************************************************
* 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>
*
......@@ -57,7 +57,7 @@ struct playlist_s
#define PLAYLIST_APPEND 0x0004
#define PLAYLIST_GO 0x0008
#define PLAYLIST_END -1
#define PLAYLIST_END -666
/* Playlist parsing mode */
#define PLAYLIST_REPEAT_CURRENT 0 /* Keep playing current item */
......
......@@ -2554,7 +2554,7 @@ http://www.videolan.org/
</signal>
<columns>2</columns>
<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>
<shadow_type>GTK_SHADOW_IN</shadow_type>
......@@ -2652,7 +2652,7 @@ http://www.videolan.org/
<name>playlist_add_url</name>
<signal>
<name>activate</name>
<handler>GtkPlaylistAddUrl</handler>
<handler>GtkPlaylistAddUrl_GLADE_SUX_intf_playlist</handler>
<data>&quot;intf_playlist&quot;</data>
<last_modification_time>Sat, 19 May 2001 16:24:27 GMT</last_modification_time>
</signal>
......@@ -2677,7 +2677,7 @@ http://www.videolan.org/
<name>playlist_delete_all</name>
<signal>
<name>activate</name>
<handler>GtkPlaylistDeleteAll</handler>
<handler>GtkPlaylistDeleteAll_GLADE_SUX_intf_playlist</handler>
<data>&quot;intf_playlist&quot;</data>
<last_modification_time>Sat, 19 May 2001 03:08:11 GMT</last_modification_time>
</signal>
......@@ -2690,7 +2690,7 @@ http://www.videolan.org/
<name>playlist_delete_item</name>
<signal>
<name>activate</name>
<handler>GtkPlaylistDeleteSelected</handler>
<handler>GtkPlaylistDeleteSelected_GLADE_SUX_intf_playlist</handler>
<data>&quot;intf_playlist&quot;</data>
<last_modification_time>Sat, 19 May 2001 03:08:05 GMT</last_modification_time>
</signal>
......@@ -2715,7 +2715,7 @@ http://www.videolan.org/
<name>playlist_selection_crop</name>
<signal>
<name>activate</name>
<handler>GtkPlaylistCrop</handler>
<handler>GtkPlaylistCrop_GLADE_SUX_intf_playlist</handler>
<data>&quot;intf_playlist&quot;</data>
<last_modification_time>Sat, 19 May 2001 03:07:56 GMT</last_modification_time>
</signal>
......@@ -2728,7 +2728,7 @@ http://www.videolan.org/
<name>playlist_selection_invert</name>
<signal>
<name>activate</name>
<handler>GtkPlaylistInvert</handler>
<handler>GtkPlaylistInvert_GLADE_SUX_intf_playlist</handler>
<data>&quot;intf_playlist&quot;</data>
<last_modification_time>Sat, 19 May 2001 03:07:51 GMT</last_modification_time>
</signal>
......@@ -2741,7 +2741,7 @@ http://www.videolan.org/
<name>playlist_selection_select</name>
<signal>
<name>activate</name>
<handler>GtkPlaylistSelect</handler>
<handler>GtkPlaylistSelect_GLADE_SUX_intf_playlist</handler>
<data>&quot;intf_playlist&quot;</data>
<last_modification_time>Sat, 19 May 2001 03:07:45 GMT</last_modification_time>
</signal>
......
......@@ -1727,7 +1727,7 @@ static GnomeUIInfo playlist_add_menu_uiinfo[] =
{
GNOME_APP_UI_ITEM, N_("Url"),
NULL,
(gpointer) GtkPlaylistAddUrl, NULL, NULL,
(gpointer) GtkPlaylistAddUrl, "intf_playlist", NULL,
GNOME_APP_PIXMAP_NONE, NULL,
0, (GdkModifierType) 0, NULL
},
......@@ -1739,14 +1739,14 @@ static GnomeUIInfo playlist_delete_menu_uiinfo[] =
{
GNOME_APP_UI_ITEM, N_("All"),
NULL,
(gpointer) GtkPlaylistDeleteAll, NULL, NULL,
(gpointer) GtkPlaylistDeleteAll, "intf_playlist", NULL,
GNOME_APP_PIXMAP_NONE, NULL,
0, (GdkModifierType) 0, NULL
},
{
GNOME_APP_UI_ITEM, N_("Item"),
NULL,
(gpointer) GtkPlaylistDeleteSelected, NULL, NULL,
(gpointer) GtkPlaylistDeleteSelected, "intf_playlist", NULL,
GNOME_APP_PIXMAP_NONE, NULL,
0, (GdkModifierType) 0, NULL
},
......@@ -1758,21 +1758,21 @@ static GnomeUIInfo playlist_selection_menu_uiinfo[] =
{
GNOME_APP_UI_ITEM, N_("Crop"),
NULL,
(gpointer) GtkPlaylistCrop, NULL, NULL,
(gpointer) GtkPlaylistCrop, "intf_playlist", NULL,
GNOME_APP_PIXMAP_NONE, NULL,
0, (GdkModifierType) 0, NULL
},
{
GNOME_APP_UI_ITEM, N_("Invert"),
NULL,
(gpointer) GtkPlaylistInvert, NULL, NULL,
(gpointer) GtkPlaylistInvert, "intf_playlist", NULL,
GNOME_APP_PIXMAP_NONE, NULL,
0, (GdkModifierType) 0, NULL
},
{
GNOME_APP_UI_ITEM, N_("Select"),
NULL,
(gpointer) GtkPlaylistSelect, NULL, NULL,
(gpointer) GtkPlaylistSelect, "intf_playlist", NULL,
GNOME_APP_PIXMAP_NONE, NULL,
0, (GdkModifierType) 0, NULL
},
......@@ -1862,6 +1862,7 @@ create_intf_playlist (void)
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), 1, 70);
gtk_clist_set_selection_mode (GTK_CLIST (playlist_clist), GTK_SELECTION_EXTENDED);
gtk_clist_column_titles_show (GTK_CLIST (playlist_clist));
playlist_label_url = gtk_label_new (_("Url"));
......
......@@ -2,7 +2,7 @@
* gtk_callbacks.c : Callbacks for the Gtk+ plugin.
*****************************************************************************
* 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>
* Stphane Borel <stef@via.ecp.fr>
......@@ -384,12 +384,20 @@ void GtkJumpCancel( GtkButton *button,
****************************************************************************/
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_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
......@@ -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 )
{
return TRUE;
......@@ -462,7 +473,7 @@ gboolean GtkDiscEject ( GtkWidget *widget, gpointer user_data )
}
free(psz_device);
#endif
return TRUE;
}
......
This diff is collapsed.
......@@ -2,7 +2,7 @@
* gtk_playlist.h : Playlist functions for the Gtk plugin.
*****************************************************************************
* 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>
* Stphane Borel <stef@via.ecp.fr>
......@@ -33,7 +33,6 @@ void GtkPlaylistAddUrl ( GtkMenuItem *, gpointer );
gint GtkCompareItems ( gconstpointer, gconstpointer );
int GtkHasValidExtension ( gchar * );
GList * GtkReadFiles ( gchar * );
gboolean GtkPlaylistShow ( GtkWidget *, gpointer );
gboolean GtkPlaylistPrev ( GtkWidget *, gpointer );
......
......@@ -2,7 +2,7 @@
* playlist.c : Playlist management functions
*****************************************************************************
* 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>
*
......@@ -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 );
vlc_mutex_lock( &p_playlist->object_lock );
/* Create the new playlist item */
p_item = malloc( sizeof( playlist_item_t ) );
if( p_item == NULL )
{
msg_Err( p_playlist, "out of memory" );
vlc_mutex_unlock( &p_playlist->object_lock );
}
p_item->psz_name = strdup( psz_target );
p_item->i_type = 0;
p_item->i_status = 0;
vlc_mutex_lock( &p_playlist->object_lock );
/* Do a few boundary checks and allocate space for the item */
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;
}
......@@ -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 */
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 )
{
i_index++;
p_playlist->i_index++;
}
}
else
......@@ -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 i_index;
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 );
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