[evolution/kill-bonobo] Bug 591829 - Dragging mails to folder tree does not work



commit 9ff9063fe66817737f89decc3fdadb473fa51278
Author: Matthew Barnes <mbarnes redhat com>
Date:   Mon Aug 17 16:54:42 2009 -0400

    Bug 591829 - Dragging mails to folder tree does not work

 mail/em-folder-tree.c |   76 ++-----------------------------------------------
 mail/message-list.c   |   71 ++-------------------------------------------
 2 files changed, 7 insertions(+), 140 deletions(-)
---
diff --git a/mail/em-folder-tree.c b/mail/em-folder-tree.c
index a3813ca..0c82851 100644
--- a/mail/em-folder-tree.c
+++ b/mail/em-folder-tree.c
@@ -1383,49 +1383,6 @@ tree_drag_data_action(struct _DragDataReceivedAsync *m)
 	mail_msg_unordered_push (m);
 }
 
-#if 0  /* KILL-BONOBO */
-static void
-emft_drop_popup_copy(EPopup *ep, EPopupItem *item, gpointer data)
-{
-	struct _DragDataReceivedAsync *m = data;
-
-	m->action = GDK_ACTION_COPY;
-	tree_drag_data_action(m);
-}
-
-static void
-emft_drop_popup_move(EPopup *ep, EPopupItem *item, gpointer data)
-{
-	struct _DragDataReceivedAsync *m = data;
-
-	m->action = GDK_ACTION_MOVE;
-	tree_drag_data_action(m);
-}
-
-static void
-emft_drop_popup_cancel(EPopup *ep, EPopupItem *item, gpointer data)
-{
-	struct _DragDataReceivedAsync *m = data;
-
-	m->aborted = TRUE;
-	mail_msg_unref(m);
-}
-
-static EPopupItem emft_drop_popup_menu[] = {
-	{ E_POPUP_ITEM, (gchar *) "00.emc.00", (gchar *) N_("_Copy to Folder"), emft_drop_popup_copy, NULL, NULL, 1 },
-	{ E_POPUP_ITEM, (gchar *) "00.emc.01", (gchar *) N_("_Move to Folder"), emft_drop_popup_move, NULL, NULL, 1 },
-	{ E_POPUP_ITEM, (gchar *) "00.emc.02", (gchar *) N_("_Copy"), emft_drop_popup_copy, NULL, (gchar *) "folder-copy", 2 },
-	{ E_POPUP_ITEM, (gchar *) "00.emc.03", (gchar *) N_("_Move"), emft_drop_popup_move, NULL, (gchar *) "folder-move", 2 },
-	{ E_POPUP_BAR, (gchar *) "10.emc" },
-	{ E_POPUP_ITEM, (gchar *) "99.emc.00", (gchar *) N_("Cancel _Drag"), emft_drop_popup_cancel, NULL, (gchar *) "dialog-cancel", 0 },
-};
-
-static void
-emft_drop_popup_free(EPopup *ep, GSList *items, gpointer data)
-{
-	g_slist_free(items);
-}
-
 static void
 tree_drag_data_received(GtkWidget *widget, GdkDragContext *context, gint x, gint y, GtkSelectionData *selection, guint info, guint time, EMFolderTree *emft)
 {
@@ -1438,7 +1395,6 @@ tree_drag_data_received(GtkWidget *widget, GdkDragContext *context, gint x, gint
 	CamelStore *store;
 	GtkTreeIter iter;
 	gchar *full_name;
-	gint i;
 
 	tree_view = GTK_TREE_VIEW (emft);
 	model = gtk_tree_view_get_model (tree_view);
@@ -1484,32 +1440,8 @@ tree_drag_data_received(GtkWidget *widget, GdkDragContext *context, gint x, gint
 	memcpy(m->selection->data, selection->data, selection->length);
 	m->selection->length = selection->length;
 
-	if (context->action == GDK_ACTION_ASK) {
-		EMPopup *emp;
-		gint mask;
-		GSList *menus = NULL;
-		GtkMenu *menu;
-
-		emp = em_popup_new("org.gnome.mail.storageset.popup.drop");
-		if (info != DND_DROP_TYPE_FOLDER)
-			mask = ~1;
-		else
-			mask = ~2;
-
-		for (i=0;i<sizeof(emft_drop_popup_menu)/sizeof(emft_drop_popup_menu[0]);i++) {
-			EPopupItem *item = &emft_drop_popup_menu[i];
-
-			if ((item->visible & mask) == 0)
-				menus = g_slist_append(menus, item);
-		}
-		e_popup_add_items((EPopup *)emp, menus, NULL, emft_drop_popup_free, m);
-		menu = e_popup_create_menu_once((EPopup *)emp, NULL, mask);
-		gtk_menu_popup(menu, NULL, NULL, NULL, NULL, 0, gtk_get_current_event_time());
-	} else {
-		tree_drag_data_action(m);
-	}
+	tree_drag_data_action(m);
 }
-#endif
 
 static gboolean
 is_special_local_folder (const gchar *name)
@@ -1947,15 +1879,13 @@ em_folder_tree_enable_drag_and_drop (EMFolderTree *emft)
 		setup = 1;
 	}
 
-	gtk_drag_source_set((GtkWidget *)tree_view, GDK_BUTTON1_MASK, drag_types, NUM_DRAG_TYPES, GDK_ACTION_COPY | GDK_ACTION_MOVE | GDK_ACTION_ASK);
-	gtk_drag_dest_set((GtkWidget *)tree_view, GTK_DEST_DEFAULT_ALL, drop_types, NUM_DROP_TYPES, GDK_ACTION_COPY | GDK_ACTION_MOVE | GDK_ACTION_ASK);
+	gtk_drag_source_set((GtkWidget *)tree_view, GDK_BUTTON1_MASK, drag_types, NUM_DRAG_TYPES, GDK_ACTION_COPY | GDK_ACTION_MOVE);
+	gtk_drag_dest_set((GtkWidget *)tree_view, GTK_DEST_DEFAULT_ALL, drop_types, NUM_DROP_TYPES, GDK_ACTION_COPY | GDK_ACTION_MOVE);
 
 	g_signal_connect (tree_view, "drag-begin", G_CALLBACK (tree_drag_begin), emft);
 	g_signal_connect (tree_view, "drag-data-delete", G_CALLBACK (tree_drag_data_delete), emft);
 	g_signal_connect (tree_view, "drag-data-get", G_CALLBACK (tree_drag_data_get), emft);
-#if 0  /* KILL-BONOBO */
 	g_signal_connect (tree_view, "drag-data-received", G_CALLBACK (tree_drag_data_received), emft);
-#endif
 	g_signal_connect (tree_view, "drag-drop", G_CALLBACK (tree_drag_drop), emft);
 	g_signal_connect (tree_view, "drag-end", G_CALLBACK (tree_drag_end), emft);
 	g_signal_connect (tree_view, "drag-leave", G_CALLBACK (tree_drag_leave), emft);
diff --git a/mail/message-list.c b/mail/message-list.c
index 7e0fb9b..714768e 100644
--- a/mail/message-list.c
+++ b/mail/message-list.c
@@ -131,7 +131,7 @@ static struct {
 	GdkAtom atom;
 	guint32 actions;
 } ml_drag_info[] = {
-	{ "x-uid-list", NULL, GDK_ACTION_ASK|GDK_ACTION_MOVE|GDK_ACTION_COPY },
+	{ "x-uid-list", NULL, GDK_ACTION_MOVE|GDK_ACTION_COPY },
 	{ "message/rfc822", NULL, GDK_ACTION_COPY },
 	{ "text/uri-list", NULL, GDK_ACTION_COPY },
 };
@@ -2161,49 +2161,6 @@ ml_drop_action(struct _drop_msg *m)
 	mail_msg_unordered_push (m);
 }
 
-#if 0  /* KILL-BONOBO */
-static void
-ml_drop_popup_copy(EPopup *ep, EPopupItem *item, gpointer data)
-{
-	struct _drop_msg *m = data;
-
-	m->action = GDK_ACTION_COPY;
-	ml_drop_action(m);
-}
-
-static void
-ml_drop_popup_move(EPopup *ep, EPopupItem *item, gpointer data)
-{
-	struct _drop_msg *m = data;
-
-	m->action = GDK_ACTION_MOVE;
-	ml_drop_action(m);
-}
-
-static void
-ml_drop_popup_cancel(EPopup *ep, EPopupItem *item, gpointer data)
-{
-	struct _drop_msg *m = data;
-
-	m->aborted = TRUE;
-	mail_msg_unref(m);
-}
-
-static EPopupItem ml_drop_popup_menu[] = {
-	{ E_POPUP_ITEM, (gchar *) "00.emc.02", (gchar *) N_("_Copy"), ml_drop_popup_copy, NULL, (gchar *) "folder-copy", 0 },
-	{ E_POPUP_ITEM, (gchar *) "00.emc.03", (gchar *) N_("_Move"), ml_drop_popup_move, NULL, (gchar *) "folder-move", 0 },
-	{ E_POPUP_BAR, (gchar *) "10.emc" },
-	{ E_POPUP_ITEM, (gchar *) "99.emc.00", (gchar *) N_("Cancel _Drag"), ml_drop_popup_cancel, NULL, NULL, 0 },
-};
-
-static void
-ml_drop_popup_free(EPopup *ep, GSList *items, gpointer data)
-{
-	g_slist_free(items);
-
-	/* FIXME: free data if no item was selected? */
-}
-
 static void
 ml_tree_drag_data_received (ETree *tree, gint row, ETreePath path, gint col,
 			    GdkDragContext *context, gint x, gint y,
@@ -2230,24 +2187,8 @@ ml_tree_drag_data_received (ETree *tree, gint row, ETreePath path, gint col,
 	memcpy(m->selection->data, data->data, data->length);
 	m->selection->length = data->length;
 
-	if (context->action == GDK_ACTION_ASK) {
-		EMPopup *emp;
-		GSList *menus = NULL;
-		GtkMenu *menu;
-		gint i;
-
-		emp = em_popup_new("org.gnome.mail.messagelist.popup.drop");
-		for (i=0;i<sizeof(ml_drop_popup_menu)/sizeof(ml_drop_popup_menu[0]);i++)
-			menus = g_slist_append(menus, &ml_drop_popup_menu[i]);
-
-		e_popup_add_items((EPopup *)emp, menus, NULL, ml_drop_popup_free, m);
-		menu = e_popup_create_menu_once((EPopup *)emp, NULL, 0);
-		gtk_menu_popup(menu, NULL, NULL, NULL, NULL, 0, gtk_get_current_event_time());
-	} else {
-		ml_drop_action(m);
-	}
+	ml_drop_action(m);
 }
-#endif
 
 struct search_child_struct {
 	gboolean found;
@@ -2307,8 +2248,6 @@ ml_tree_drag_motion(ETree *tree, GdkDragContext *context, gint x, gint y, guint
 	action = context->suggested_action;
 	if (action == GDK_ACTION_COPY && (actions & GDK_ACTION_MOVE))
 		action = GDK_ACTION_MOVE;
-	else if (action == GDK_ACTION_ASK && (actions & (GDK_ACTION_MOVE|GDK_ACTION_COPY)) != (GDK_ACTION_MOVE|GDK_ACTION_COPY))
-		action = GDK_ACTION_MOVE;
 
 	gdk_drag_status(context, action, time);
 
@@ -2707,19 +2646,17 @@ message_list_construct (MessageList *message_list)
 
 	e_tree_drag_source_set(message_list->tree, GDK_BUTTON1_MASK,
 			       ml_drag_types, sizeof(ml_drag_types)/sizeof(ml_drag_types[0]),
-			       GDK_ACTION_MOVE|GDK_ACTION_COPY|GDK_ACTION_ASK);
+			       GDK_ACTION_MOVE|GDK_ACTION_COPY);
 
 	g_signal_connect(message_list->tree, "tree_drag_data_get",
 			 G_CALLBACK(ml_tree_drag_data_get), message_list);
 
 	e_tree_drag_dest_set(message_list->tree, GTK_DEST_DEFAULT_ALL,
 			     ml_drop_types, sizeof(ml_drop_types)/sizeof(ml_drop_types[0]),
-			     GDK_ACTION_MOVE|GDK_ACTION_COPY|GDK_ACTION_ASK);
+			     GDK_ACTION_MOVE|GDK_ACTION_COPY);
 
-#if 0  /* KILL-BONOBO */
 	g_signal_connect(message_list->tree, "tree_drag_data_received",
 			 G_CALLBACK(ml_tree_drag_data_received), message_list);
-#endif
 	g_signal_connect(message_list->tree, "drag-motion", G_CALLBACK(ml_tree_drag_motion), message_list);
 }
 



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