Eog drag&drop GDK_ACTION_ASK support.



Saludos,

Hi people here is a patch to made eog suppport GDK_ACTION_ASK drags, to
test it just alt+drag a file to a EOG window from GMC, or right click and
drag a file to a EOG window from Nautilus

-- 
Juan Pablo Mendoza Mendoza. | "They killed Kenny!
pablo_juan yahoo com        |  THOSE BASTARDS!"
Index: shell/ChangeLog
===================================================================
RCS file: /cvs/gnome/eog/shell/ChangeLog,v
retrieving revision 1.17
diff -u -5 -r1.17 ChangeLog
--- shell/ChangeLog	2001/05/18 09:30:35	1.17
+++ shell/ChangeLog	2001/05/20 02:00:55
@@ -1,5 +1,11 @@
+2001-05-18  Juan Pablo Mendoza <pablo_juan yahoo com>
+
+	* eog-window.c (eog_window_drag_data_received): Add support for
+	GDK_ACTION_ASK when draging files to EOG.
+	(set_drag_dest): Also accept GDK_ACTION_ASK.
+
 2001-05-18  Jens Finke <jens gnome org>
 
 	* eog-window.c (eog_window_construct): Removed
 	gtk_widget_set_usize function and replaced it with
 	gtk_window_set_geometry_hints. Added window icon and allowed the
Index: shell/eog-window.c
===================================================================
RCS file: /cvs/gnome/eog/shell/eog-window.c,v
retrieving revision 1.8
diff -u -5 -r1.8 eog-window.c
--- shell/eog-window.c	2001/05/18 09:30:35	1.8
+++ shell/eog-window.c	2001/05/20 02:00:56
@@ -399,39 +399,67 @@
 	priv = window->priv;
 
 	return (priv->control != NULL);
 }
 
+static GnomeUIInfo drag_ask_popup_menu [] = {
+	GNOMEUIINFO_ITEM_NONE (N_("Open in new window"), NULL, NULL),
+	GNOMEUIINFO_ITEM_NONE (N_("Open in this window"), NULL, NULL), 
 
+	GNOMEUIINFO_SEPARATOR,
+
+	GNOMEUIINFO_ITEM_STOCK (N_("Cancel"), NULL , NULL, GNOME_STOCK_BUTTON_CANCEL),
+
+	GNOMEUIINFO_END
+};
+
 /* Drag_data_received handler for windows */
 static void
 eog_window_drag_data_received (GtkWidget *widget, GdkDragContext *context, gint x, gint y, 
 			       GtkSelectionData *selection_data, guint info, guint time)
 {
 	EogWindow *window;
 	EogWindowPrivate *priv;
 	GList *filenames;
 	GList *l;
-	gboolean need_new_window;
+	gboolean need_new_window = TRUE;
 
 	window = EOG_WINDOW (widget);
 	priv = window->priv;
 
 	if (info != TARGET_URI_LIST)
 		return;
 
+	if (context->suggested_action == GDK_ACTION_ASK) {
+		GtkWidget *menu = gnome_popup_menu_new (drag_ask_popup_menu);
+		int i = gnome_popup_menu_do_popup_modal (menu, NULL, NULL,
+						     NULL, NULL);
+		gtk_object_unref (GTK_OBJECT (menu));
+		switch (i) {
+		case 0:
+			need_new_window = TRUE;
+			break;
+		case 1:
+			need_new_window = FALSE;
+			break;
+		default:
+			return;
+			break;
+		}
+	} else {
+		/* The first image is opened in the same window only if the
+		* current window has no image in it.
+		*/
+		need_new_window = eog_window_has_contents (window);		
+	}
+
 	/* FIXME: This should use GnomeVFS later and it should not strip the
 	 * method prefix.
 	 */
 
 	filenames = gnome_uri_list_extract_filenames (selection_data->data);
 
-	/* The first image is opened in the same window only if the current
-	 * window has no image in it.
-	 */
-	need_new_window = eog_window_has_contents (window);
-
 	for (l = filenames; l; l = l->next) {
 		GtkWidget *new_window;
 		char *filename;
 
 		g_assert (l->data != NULL);
@@ -499,11 +527,11 @@
 
 	gtk_drag_dest_set (GTK_WIDGET (window),
 			   GTK_DEST_DEFAULT_MOTION | GTK_DEST_DEFAULT_DROP,
 			   drag_types,
 			   sizeof (drag_types) / sizeof (drag_types[0]),
-			   GDK_ACTION_COPY);
+			   GDK_ACTION_COPY|GDK_ACTION_ASK);
 }
 
 
 static BonoboUIVerb eog_app_verbs[] = {
 	BONOBO_UI_VERB ("FileNewWindow", verb_FileNewWindow_cb),


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