. drop in the 'blank' part of the list in the playlist adds at the end of the list
. drop on the main window adds at the end of the playlist
gpointer user_data)
{
intf_thread_t * p_intf = GetIntf( GTK_WIDGET(widget), "intf_window" );
- on_generic_drop_data_received( p_intf, data, info, 0);
+ int end = p_main->p_playlist->i_size;
+ on_generic_drop_data_received( p_intf, data, info, PLAYLIST_END);
if( p_intf->p_input != NULL )
{
p_intf->p_input->b_eof = 1;
}
- intf_PlstJumpto( p_main->p_playlist, -1 );
+ intf_PlstJumpto( p_main->p_playlist, end-1 );
}
gpointer user_data)
{
intf_thread_t *p_intf = GetIntf( GTK_WIDGET(widget), "intf_window" );
- /* is there an output thread ? */
- if(p_main->b_video == 1)
- {
- gtk_widget_hide(widget);
- } else {
- p_intf->b_die = 1;
- }
- return TRUE;
+ p_intf->b_die = 1;
+ return TRUE;
}
gpointer user_data);
gboolean
-on_clist1_event (GtkWidget *widget,
+on_playlist_clist_event (GtkWidget *widget,
GdkEvent *event,
gpointer user_data);
gpointer user_data);
gboolean
-on_clist1_event (GtkWidget *widget,
+on_playlist_clist_event (GtkWidget *widget,
GdkEvent *event,
gpointer user_data);
GtkWidget *selection;
GtkWidget *selection1;
GtkWidget *scrolledwindow1;
- GtkWidget *clist1;
+ GtkWidget *playlist_clist;
GtkWidget *label22;
GtkWidget *label23;
gtk_box_pack_start (GTK_BOX (vbox6), scrolledwindow1, TRUE, TRUE, 0);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolledwindow1), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
- clist1 = gtk_clist_new (2);
- gtk_widget_ref (clist1);
- gtk_object_set_data_full (GTK_OBJECT (intf_playlist), "clist1", clist1,
+ playlist_clist = gtk_clist_new (2);
+ gtk_widget_ref (playlist_clist);
+ gtk_object_set_data_full (GTK_OBJECT (intf_playlist), "playlist_clist", playlist_clist,
(GtkDestroyNotify) gtk_widget_unref);
- gtk_widget_show (clist1);
- gtk_container_add (GTK_CONTAINER (scrolledwindow1), clist1);
- gtk_clist_set_column_width (GTK_CLIST (clist1), 0, 257);
- gtk_clist_set_column_width (GTK_CLIST (clist1), 1, 80);
- gtk_clist_set_selection_mode (GTK_CLIST (clist1), GTK_SELECTION_EXTENDED);
- gtk_clist_column_titles_hide (GTK_CLIST (clist1));
+ gtk_widget_show (playlist_clist);
+ gtk_container_add (GTK_CONTAINER (scrolledwindow1), playlist_clist);
+ gtk_clist_set_column_width (GTK_CLIST (playlist_clist), 0, 257);
+ gtk_clist_set_column_width (GTK_CLIST (playlist_clist), 1, 80);
+ gtk_clist_set_selection_mode (GTK_CLIST (playlist_clist), GTK_SELECTION_EXTENDED);
+ gtk_clist_column_titles_hide (GTK_CLIST (playlist_clist));
label22 = gtk_label_new (_("File"));
gtk_widget_ref (label22);
gtk_object_set_data_full (GTK_OBJECT (intf_playlist), "label22", label22,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (label22);
- gtk_clist_set_column_widget (GTK_CLIST (clist1), 0, label22);
+ gtk_clist_set_column_widget (GTK_CLIST (playlist_clist), 0, label22);
label23 = gtk_label_new (_("Duration"));
gtk_widget_ref (label23);
gtk_object_set_data_full (GTK_OBJECT (intf_playlist), "label23", label23,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (label23);
- gtk_clist_set_column_widget (GTK_CLIST (clist1), 1, label23);
+ gtk_clist_set_column_widget (GTK_CLIST (playlist_clist), 1, label23);
gtk_signal_connect (GTK_OBJECT (intf_playlist), "delete_event",
GTK_SIGNAL_FUNC (on_intf_playlist_destroy_event),
gtk_signal_connect (GTK_OBJECT (selection), "activate",
GTK_SIGNAL_FUNC (on_delete_clicked),
NULL);
- gtk_signal_connect (GTK_OBJECT (clist1), "event",
- GTK_SIGNAL_FUNC (on_clist1_event),
+ gtk_signal_connect (GTK_OBJECT (playlist_clist), "event",
+ GTK_SIGNAL_FUNC (on_playlist_clist_event),
NULL);
- gtk_signal_connect (GTK_OBJECT (clist1), "drag_data_received",
+ gtk_signal_connect (GTK_OBJECT (playlist_clist), "drag_data_received",
GTK_SIGNAL_FUNC (on_intf_playlist_drag_data_received),
NULL);
{
p_playlist = p_main->p_playlist;
- list = GTK_CLIST(lookup_widget( p_intf->p_sys->p_playlist, "clist1" )) ;
+ list = GTK_CLIST(lookup_widget( p_intf->p_sys->p_playlist, "playlist_clist" )) ;
rebuildCList( list, p_playlist );
} else {
GtkCList * clist;
gtk_widget_show( p_intf->p_sys->p_playlist );
- clist = GTK_CLIST(lookup_widget( p_intf->p_sys->p_playlist,"clist1" ));
+ clist = GTK_CLIST(lookup_widget( p_intf->p_sys->p_playlist,"playlist_clist" ));
gdk_window_raise( p_intf->p_sys->p_playlist->window );
rebuildCList( clist , p_main->p_playlist );
}
/* lock the struct */
vlc_mutex_lock( &p_intf->p_sys->change_lock );
- clist = GTK_CLIST( lookup_widget(p_intf->p_sys->p_playlist,"clist1") );
+ clist = GTK_CLIST( lookup_widget(p_intf->p_sys->p_playlist,"playlist_clist") );
+
+ /* have to copy the selection to an int *
+ I wasn't able to copy the g_list to another g_list
+ glib only does pointer copies, not real copies :( */
+
selected = malloc(sizeof(int)* g_list_length(clist->selection));
-
sel_l = g_list_length(clist->selection);
-
for(dummy=0; dummy < sel_l; dummy++)
{
selected[dummy] = (int)g_list_nth_data(clist->selection,dummy);
}
+
gtk_clist_freeze( clist );
gtk_clist_select_all( clist );
for(dummy=0; dummy < sel_l; dummy++)
on_crop_activate (GtkMenuItem *menuitem,
gpointer user_data)
{
+ /* Ok, this is a really small thing, but, hey, it works and
+ might be useful, who knows ? */
+
on_invertselection_clicked (menuitem, user_data);
on_delete_clicked(menuitem, user_data);
}
/* lock the struct */
vlc_mutex_lock( &p_intf->p_sys->change_lock );
- clist = GTK_CLIST( lookup_widget(p_intf->p_sys->p_playlist,"clist1") );
+ clist = GTK_CLIST( lookup_widget(p_intf->p_sys->p_playlist,"playlist_clist") );
/* I use UNDOCUMENTED features to retrieve the selection... */
selection = clist->selection;
GtkCList * clist;
gint row, col;
- clist = GTK_CLIST(lookup_widget( p_intf->p_sys->p_playlist,"clist1" ));
+ clist = GTK_CLIST(lookup_widget( p_intf->p_sys->p_playlist,"playlist_clist" ));
if( gtk_clist_get_selection_info( clist,
x,
{
on_generic_drop_data_received( p_intf, data, info, row);
} else {
- on_generic_drop_data_received( p_intf, data, info, 0);
+ on_generic_drop_data_received( p_intf, data, info, PLAYLIST_END);
}
}
intf_WarnMsg(1, "List has %d elements",g_list_length(files));
intf_AppendList( p_playlist, position, files );
/* get the CList and rebuild it. */
- clist = GTK_CLIST(lookup_widget( p_intf->p_sys->p_playlist,"clist1" ));
+ clist = GTK_CLIST(lookup_widget( p_intf->p_sys->p_playlist,"playlist_clist" ));
rebuildCList( clist , p_playlist );
/* unlock the interface */
return NULL;
}
-/* add items in a playlist */
+/* add items in a playlist
+ when i_pos==-1 add to the end of the list...
+ */
int intf_AppendList( playlist_t * p_playlist, int i_pos, GList * list )
{
guint length, dummy;
length = g_list_length( list );
for(dummy=0; dummy<length; dummy++)
{
- intf_WarnMsg(1,"Adding: %s@%d",g_list_nth_data(list, dummy), i_pos + dummy);
- intf_PlstAdd( p_playlist, i_pos + dummy, g_list_nth_data(list, dummy));
+ intf_PlstAdd( p_playlist,
+ i_pos==PLAYLIST_END?PLAYLIST_END:(i_pos + dummy),
+ g_list_nth_data(list, dummy));
}
return 0;
}
gboolean
-on_clist1_event (GtkWidget *widget,
+on_playlist_clist_event (GtkWidget *widget,
GdkEvent *event,
gpointer user_data)
{
GtkCList * clist;
gint row, col;
- clist = GTK_CLIST(lookup_widget( p_intf->p_sys->p_playlist,"clist1" ));
+ clist = GTK_CLIST(lookup_widget( p_intf->p_sys->p_playlist,"playlist_clist" ));
if( gtk_clist_get_selection_info( clist,
(event->button).x,
(event->button).y,
color.blue = 0;
gtk_clist_set_background (
- GTK_CLIST(lookup_widget( p_intf->p_sys->p_playlist, "clist1" ) ),
+ GTK_CLIST(lookup_widget( p_intf->p_sys->p_playlist, "playlist_clist" ) ),
p_playlist->i_index,
&color);
if( p_intf->p_sys->i_playing != -1 )
color.green = 65535;
color.blue = 65535;
gtk_clist_set_background (
- GTK_CLIST(lookup_widget( p_intf->p_sys->p_playlist, "clist1" ) ),
+ GTK_CLIST(lookup_widget( p_intf->p_sys->p_playlist, "playlist_clist" ) ),
p_intf->p_sys->i_playing,
&color);
}
* intf_gtk.c: Gtk+ interface
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
- * $Id: intf_gtk.c,v 1.7 2001/03/08 15:48:14 octplane Exp $
+ * $Id: intf_gtk.c,v 1.8 2001/03/08 21:47:02 octplane Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
* Stéphane Borel <stef@via.ecp.fr>
1, GDK_ACTION_COPY );
/* Accept file drops on the playlist window */
- temp = lookup_widget(p_intf->p_sys->p_playlist, "clist1");
+ temp = lookup_widget(p_intf->p_sys->p_playlist, "playlist_clist");
gtk_drag_dest_set( GTK_WIDGET( temp ),
<widget>
<class>GtkCList</class>
- <name>clist1</name>
+ <name>playlist_clist</name>
<can_focus>True</can_focus>
<signal>
<name>event</name>
- <handler>on_clist1_event</handler>
- <last_modification_time>Thu, 08 Mar 2001 10:14:05 GMT</last_modification_time>
+ <handler>on_playlist_clist_event</handler>
+ <last_modification_time>Thu, 08 Mar 2001 22:18:03 GMT</last_modification_time>
</signal>
<signal>
<name>drag_data_received</name>