totem r5808 - in trunk: . src



Author: pwithnall
Date: Fri Nov 28 07:33:02 2008
New Revision: 5808
URL: http://svn.gnome.org/viewvc/totem?rev=5808&view=rev

Log:
2008-11-28  Philip Withnall  <philip tecnocode co uk>

	* src/totem-playlist.c (drop_cb):
	* src/totem.c (drop_video_cb), (drag_motion_video_cb),
	(drop_playlist_cb), (video_widget_create): Patch by Robin 
Stocker
	<robin nibor org> to add a drag-and-drop modifier key for the 
video
	widget and playlist, allowing adding to and replacing of the 
playlist,
	respectively. (Closes: #372220)



Modified:
   trunk/ChangeLog
   trunk/src/totem-playlist.c
   trunk/src/totem.c

Modified: trunk/src/totem-playlist.c
==============================================================================
--- trunk/src/totem-playlist.c	(original)
+++ trunk/src/totem-playlist.c	Fri Nov 28 07:33:02 2008
@@ -392,6 +392,10 @@
 	GList *p, *file_list;
 	guint i;
 
+	if (context->action == GDK_ACTION_MOVE) {
+		totem_playlist_clear (playlist);
+	}
+
 	list = g_uri_list_extract_uris ((char *)data->data);
 	file_list = NULL;
 

Modified: trunk/src/totem.c
==============================================================================
--- trunk/src/totem.c	(original)
+++ trunk/src/totem.c	Fri Nov 28 07:33:02 2008
@@ -1548,12 +1548,33 @@
 	 Totem              *totem)
 {
 	gboolean retval;
+	gboolean empty_pl;
 
-	retval = totem_action_drop_files (totem, data, info, TRUE);
+	empty_pl = (context->action == GDK_ACTION_MOVE);
+
+	retval = totem_action_drop_files (totem, data, info, empty_pl);
 	gtk_drag_finish (context, retval, FALSE, time);
 }
 
 static void
+drag_motion_video_cb (GtkWidget      *widget,
+                      GdkDragContext *context,
+                      gint            x,
+                      gint            y,
+                      guint           time,
+                      Totem          *totem)
+{
+	GdkModifierType mask;
+
+	gdk_window_get_pointer (widget->window, NULL, NULL, &mask);
+	if (mask & GDK_CONTROL_MASK) {
+		gdk_drag_status (context, GDK_ACTION_COPY, time);
+	} else {
+		gdk_drag_status (context, GDK_ACTION_MOVE, time);
+	}
+}
+
+static void
 drop_playlist_cb (GtkWidget     *widget,
 	       GdkDragContext     *context,
 	       gint                x,
@@ -1564,8 +1585,11 @@
 	       Totem              *totem)
 {
 	gboolean retval;
+	gboolean empty_pl;
+
+	empty_pl = (context->action == GDK_ACTION_MOVE);
 
-	retval = totem_action_drop_files (totem, data, info, FALSE);
+	retval = totem_action_drop_files (totem, data, info, empty_pl);
 	gtk_drag_finish (context, retval, FALSE, time);
 }
 
@@ -3344,6 +3368,8 @@
 
 	g_signal_connect (G_OBJECT (totem->bvw), "drag_data_received",
 			G_CALLBACK (drop_video_cb), totem);
+	g_signal_connect (G_OBJECT (totem->bvw), "drag_motion",
+			G_CALLBACK (drag_motion_video_cb), totem);
 	gtk_drag_dest_set (GTK_WIDGET (totem->bvw), GTK_DEST_DEFAULT_ALL,
 			target_table, G_N_ELEMENTS (target_table),
 			GDK_ACTION_COPY | GDK_ACTION_MOVE);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]