Commit 491a85a8 authored by Pierre Baillet's avatar Pierre Baillet

. cosmetic variable name changes

. 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
parent 5525a154
...@@ -477,7 +477,8 @@ on_intf_window_drag_data_received (GtkWidget *widget, ...@@ -477,7 +477,8 @@ on_intf_window_drag_data_received (GtkWidget *widget,
gpointer user_data) gpointer user_data)
{ {
intf_thread_t * p_intf = GetIntf( GTK_WIDGET(widget), "intf_window" ); 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 ) if( p_intf->p_input != NULL )
{ {
...@@ -485,7 +486,7 @@ on_intf_window_drag_data_received (GtkWidget *widget, ...@@ -485,7 +486,7 @@ on_intf_window_drag_data_received (GtkWidget *widget,
p_intf->p_input->b_eof = 1; p_intf->p_input->b_eof = 1;
} }
intf_PlstJumpto( p_main->p_playlist, -1 ); intf_PlstJumpto( p_main->p_playlist, end-1 );
} }
...@@ -739,14 +740,8 @@ on_intf_window_destroy (GtkWidget *widget, ...@@ -739,14 +740,8 @@ on_intf_window_destroy (GtkWidget *widget,
gpointer user_data) gpointer user_data)
{ {
intf_thread_t *p_intf = GetIntf( GTK_WIDGET(widget), "intf_window" ); intf_thread_t *p_intf = GetIntf( GTK_WIDGET(widget), "intf_window" );
/* is there an output thread ? */ p_intf->b_die = 1;
if(p_main->b_video == 1) return TRUE;
{
gtk_widget_hide(widget);
} else {
p_intf->b_die = 1;
}
return TRUE;
} }
......
...@@ -212,7 +212,7 @@ on_menubar_chapter_activate (GtkMenuItem *menuitem, ...@@ -212,7 +212,7 @@ on_menubar_chapter_activate (GtkMenuItem *menuitem,
gpointer user_data); gpointer user_data);
gboolean gboolean
on_clist1_event (GtkWidget *widget, on_playlist_clist_event (GtkWidget *widget,
GdkEvent *event, GdkEvent *event,
gpointer user_data); gpointer user_data);
...@@ -242,7 +242,7 @@ on_intf_playlist_drag_data_received (GtkWidget *widget, ...@@ -242,7 +242,7 @@ on_intf_playlist_drag_data_received (GtkWidget *widget,
gpointer user_data); gpointer user_data);
gboolean gboolean
on_clist1_event (GtkWidget *widget, on_playlist_clist_event (GtkWidget *widget,
GdkEvent *event, GdkEvent *event,
gpointer user_data); gpointer user_data);
......
...@@ -1179,7 +1179,7 @@ create_intf_playlist (void) ...@@ -1179,7 +1179,7 @@ create_intf_playlist (void)
GtkWidget *selection; GtkWidget *selection;
GtkWidget *selection1; GtkWidget *selection1;
GtkWidget *scrolledwindow1; GtkWidget *scrolledwindow1;
GtkWidget *clist1; GtkWidget *playlist_clist;
GtkWidget *label22; GtkWidget *label22;
GtkWidget *label23; GtkWidget *label23;
...@@ -1271,30 +1271,30 @@ create_intf_playlist (void) ...@@ -1271,30 +1271,30 @@ create_intf_playlist (void)
gtk_box_pack_start (GTK_BOX (vbox6), scrolledwindow1, TRUE, TRUE, 0); 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); gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolledwindow1), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
clist1 = gtk_clist_new (2); playlist_clist = gtk_clist_new (2);
gtk_widget_ref (clist1); gtk_widget_ref (playlist_clist);
gtk_object_set_data_full (GTK_OBJECT (intf_playlist), "clist1", clist1, gtk_object_set_data_full (GTK_OBJECT (intf_playlist), "playlist_clist", playlist_clist,
(GtkDestroyNotify) gtk_widget_unref); (GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (clist1); gtk_widget_show (playlist_clist);
gtk_container_add (GTK_CONTAINER (scrolledwindow1), clist1); gtk_container_add (GTK_CONTAINER (scrolledwindow1), playlist_clist);
gtk_clist_set_column_width (GTK_CLIST (clist1), 0, 257); gtk_clist_set_column_width (GTK_CLIST (playlist_clist), 0, 257);
gtk_clist_set_column_width (GTK_CLIST (clist1), 1, 80); gtk_clist_set_column_width (GTK_CLIST (playlist_clist), 1, 80);
gtk_clist_set_selection_mode (GTK_CLIST (clist1), GTK_SELECTION_EXTENDED); gtk_clist_set_selection_mode (GTK_CLIST (playlist_clist), GTK_SELECTION_EXTENDED);
gtk_clist_column_titles_hide (GTK_CLIST (clist1)); gtk_clist_column_titles_hide (GTK_CLIST (playlist_clist));
label22 = gtk_label_new (_("File")); label22 = gtk_label_new (_("File"));
gtk_widget_ref (label22); gtk_widget_ref (label22);
gtk_object_set_data_full (GTK_OBJECT (intf_playlist), "label22", label22, gtk_object_set_data_full (GTK_OBJECT (intf_playlist), "label22", label22,
(GtkDestroyNotify) gtk_widget_unref); (GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (label22); 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")); label23 = gtk_label_new (_("Duration"));
gtk_widget_ref (label23); gtk_widget_ref (label23);
gtk_object_set_data_full (GTK_OBJECT (intf_playlist), "label23", label23, gtk_object_set_data_full (GTK_OBJECT (intf_playlist), "label23", label23,
(GtkDestroyNotify) gtk_widget_unref); (GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (label23); 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_connect (GTK_OBJECT (intf_playlist), "delete_event",
GTK_SIGNAL_FUNC (on_intf_playlist_destroy_event), GTK_SIGNAL_FUNC (on_intf_playlist_destroy_event),
...@@ -1308,10 +1308,10 @@ create_intf_playlist (void) ...@@ -1308,10 +1308,10 @@ create_intf_playlist (void)
gtk_signal_connect (GTK_OBJECT (selection), "activate", gtk_signal_connect (GTK_OBJECT (selection), "activate",
GTK_SIGNAL_FUNC (on_delete_clicked), GTK_SIGNAL_FUNC (on_delete_clicked),
NULL); NULL);
gtk_signal_connect (GTK_OBJECT (clist1), "event", gtk_signal_connect (GTK_OBJECT (playlist_clist), "event",
GTK_SIGNAL_FUNC (on_clist1_event), GTK_SIGNAL_FUNC (on_playlist_clist_event),
NULL); 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), GTK_SIGNAL_FUNC (on_intf_playlist_drag_data_received),
NULL); NULL);
......
...@@ -99,7 +99,7 @@ on_menubar_playlist_activate (GtkMenuItem *menuitem, ...@@ -99,7 +99,7 @@ on_menubar_playlist_activate (GtkMenuItem *menuitem,
{ {
p_playlist = p_main->p_playlist; 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 ); rebuildCList( list, p_playlist );
...@@ -128,7 +128,7 @@ on_toolbar_playlist_clicked (GtkButton *button, ...@@ -128,7 +128,7 @@ on_toolbar_playlist_clicked (GtkButton *button,
} else { } else {
GtkCList * clist; GtkCList * clist;
gtk_widget_show( p_intf->p_sys->p_playlist ); 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 ); gdk_window_raise( p_intf->p_sys->p_playlist->window );
rebuildCList( clist , p_main->p_playlist ); rebuildCList( clist , p_main->p_playlist );
} }
...@@ -211,15 +211,19 @@ on_invertselection_clicked (GtkMenuItem *item, gpointer user_data) ...@@ -211,15 +211,19 @@ on_invertselection_clicked (GtkMenuItem *item, gpointer user_data)
/* lock the struct */ /* lock the struct */
vlc_mutex_lock( &p_intf->p_sys->change_lock ); 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)); selected = malloc(sizeof(int)* g_list_length(clist->selection));
sel_l = g_list_length(clist->selection); sel_l = g_list_length(clist->selection);
for(dummy=0; dummy < sel_l; dummy++) for(dummy=0; dummy < sel_l; dummy++)
{ {
selected[dummy] = (int)g_list_nth_data(clist->selection,dummy); selected[dummy] = (int)g_list_nth_data(clist->selection,dummy);
} }
gtk_clist_freeze( clist ); gtk_clist_freeze( clist );
gtk_clist_select_all( clist ); gtk_clist_select_all( clist );
for(dummy=0; dummy < sel_l; dummy++) for(dummy=0; dummy < sel_l; dummy++)
...@@ -236,6 +240,9 @@ void ...@@ -236,6 +240,9 @@ void
on_crop_activate (GtkMenuItem *menuitem, on_crop_activate (GtkMenuItem *menuitem,
gpointer user_data) 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_invertselection_clicked (menuitem, user_data);
on_delete_clicked(menuitem, user_data); on_delete_clicked(menuitem, user_data);
} }
...@@ -256,7 +263,7 @@ on_delete_clicked (GtkMenuItem *item, ...@@ -256,7 +263,7 @@ on_delete_clicked (GtkMenuItem *item,
/* lock the struct */ /* lock the struct */
vlc_mutex_lock( &p_intf->p_sys->change_lock ); 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... */ /* I use UNDOCUMENTED features to retrieve the selection... */
selection = clist->selection; selection = clist->selection;
...@@ -299,7 +306,7 @@ on_intf_playlist_drag_data_received (GtkWidget *widget, ...@@ -299,7 +306,7 @@ on_intf_playlist_drag_data_received (GtkWidget *widget,
GtkCList * clist; GtkCList * clist;
gint row, col; 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, if( gtk_clist_get_selection_info( clist,
x, x,
...@@ -309,7 +316,7 @@ on_intf_playlist_drag_data_received (GtkWidget *widget, ...@@ -309,7 +316,7 @@ on_intf_playlist_drag_data_received (GtkWidget *widget,
{ {
on_generic_drop_data_received( p_intf, data, info, row); on_generic_drop_data_received( p_intf, data, info, row);
} else { } else {
on_generic_drop_data_received( p_intf, data, info, 0); on_generic_drop_data_received( p_intf, data, info, PLAYLIST_END);
} }
} }
...@@ -398,7 +405,7 @@ void on_generic_drop_data_received( intf_thread_t * p_intf, ...@@ -398,7 +405,7 @@ void on_generic_drop_data_received( intf_thread_t * p_intf,
intf_WarnMsg(1, "List has %d elements",g_list_length(files)); intf_WarnMsg(1, "List has %d elements",g_list_length(files));
intf_AppendList( p_playlist, position, files ); intf_AppendList( p_playlist, position, files );
/* get the CList and rebuild it. */ /* 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 ); rebuildCList( clist , p_playlist );
/* unlock the interface */ /* unlock the interface */
...@@ -486,20 +493,23 @@ intf_readFiles(gchar * fsname ) ...@@ -486,20 +493,23 @@ intf_readFiles(gchar * fsname )
return NULL; 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 ) int intf_AppendList( playlist_t * p_playlist, int i_pos, GList * list )
{ {
guint length, dummy; guint length, dummy;
length = g_list_length( list ); length = g_list_length( list );
for(dummy=0; dummy<length; dummy++) 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,
intf_PlstAdd( p_playlist, i_pos + dummy, g_list_nth_data(list, dummy)); i_pos==PLAYLIST_END?PLAYLIST_END:(i_pos + dummy),
g_list_nth_data(list, dummy));
} }
return 0; return 0;
} }
gboolean gboolean
on_clist1_event (GtkWidget *widget, on_playlist_clist_event (GtkWidget *widget,
GdkEvent *event, GdkEvent *event,
gpointer user_data) gpointer user_data)
{ {
...@@ -510,7 +520,7 @@ on_clist1_event (GtkWidget *widget, ...@@ -510,7 +520,7 @@ on_clist1_event (GtkWidget *widget,
GtkCList * clist; GtkCList * clist;
gint row, col; 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, if( gtk_clist_get_selection_info( clist,
(event->button).x, (event->button).x,
(event->button).y, (event->button).y,
...@@ -553,7 +563,7 @@ void GtkPlayListManage( gpointer p_data ) ...@@ -553,7 +563,7 @@ void GtkPlayListManage( gpointer p_data )
color.blue = 0; color.blue = 0;
gtk_clist_set_background ( 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, p_playlist->i_index,
&color); &color);
if( p_intf->p_sys->i_playing != -1 ) if( p_intf->p_sys->i_playing != -1 )
...@@ -562,7 +572,7 @@ void GtkPlayListManage( gpointer p_data ) ...@@ -562,7 +572,7 @@ void GtkPlayListManage( gpointer p_data )
color.green = 65535; color.green = 65535;
color.blue = 65535; color.blue = 65535;
gtk_clist_set_background ( 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, p_intf->p_sys->i_playing,
&color); &color);
} }
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* intf_gtk.c: Gtk+ interface * intf_gtk.c: Gtk+ interface
***************************************************************************** *****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN * 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> * Authors: Samuel Hocevar <sam@zoy.org>
* Stphane Borel <stef@via.ecp.fr> * Stphane Borel <stef@via.ecp.fr>
...@@ -215,7 +215,7 @@ static void intf_Run( intf_thread_t *p_intf ) ...@@ -215,7 +215,7 @@ static void intf_Run( intf_thread_t *p_intf )
1, GDK_ACTION_COPY ); 1, GDK_ACTION_COPY );
/* Accept file drops on the playlist window */ /* 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 ), gtk_drag_dest_set( GTK_WIDGET( temp ),
......
...@@ -1386,12 +1386,12 @@ Henri Fallon &lt;henri@via.ecp.fr&gt;</label> ...@@ -1386,12 +1386,12 @@ Henri Fallon &lt;henri@via.ecp.fr&gt;</label>
<widget> <widget>
<class>GtkCList</class> <class>GtkCList</class>
<name>clist1</name> <name>playlist_clist</name>
<can_focus>True</can_focus> <can_focus>True</can_focus>
<signal> <signal>
<name>event</name> <name>event</name>
<handler>on_clist1_event</handler> <handler>on_playlist_clist_event</handler>
<last_modification_time>Thu, 08 Mar 2001 10:14:05 GMT</last_modification_time> <last_modification_time>Thu, 08 Mar 2001 22:18:03 GMT</last_modification_time>
</signal> </signal>
<signal> <signal>
<name>drag_data_received</name> <name>drag_data_received</name>
......
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