From c2d0fb9b196b8cc93b4467f8872eea10e7e8b8c5 Mon Sep 17 00:00:00 2001 From: Jeffrey Stedfast Date: Wed, 28 Jan 2004 18:09:14 +0000 Subject: And thus completes the fixes for bug #52766. 2004-01-28 Jeffrey Stedfast And thus completes the fixes for bug #52766. * em-folder-tree.c (tree_drag_drop): Don't call gtk_drag_get_data() manually here or we end up getting 2 drag-data-received callbacks which is Not Good (tm). * em-folder-tree-model.c (drop_folder): Now takes a moved argument to specify whether or not the contents were moved (the move argument is just a hint). (drop_uid_list): Same. (em_folder_tree_model_drag_data_received): Updated for the above api changes. svn path=/trunk/; revision=24497 --- mail/ChangeLog | 15 +++++++++++++++ mail/em-folder-tree-model.c | 20 +++++++++++++------- mail/em-folder-tree.c | 23 ++--------------------- 3 files changed, 30 insertions(+), 28 deletions(-) (limited to 'mail') diff --git a/mail/ChangeLog b/mail/ChangeLog index 6831f3b639..fd69f26c8a 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,3 +1,18 @@ +2004-01-28 Jeffrey Stedfast + + And thus completes the fixes for bug #52766. + + * em-folder-tree.c (tree_drag_drop): Don't call + gtk_drag_get_data() manually here or we end up getting 2 + drag-data-received callbacks which is Not Good (tm). + + * em-folder-tree-model.c (drop_folder): Now takes a moved argument + to specify whether or not the contents were moved (the move + argument is just a hint). + (drop_uid_list): Same. + (em_folder_tree_model_drag_data_received): Updated for the above + api changes. + 2004-01-28 Not Zed ** See bug #53179 diff --git a/mail/em-folder-tree-model.c b/mail/em-folder-tree-model.c index cd0b1de9e0..989519c86b 100644 --- a/mail/em-folder-tree-model.c +++ b/mail/em-folder-tree-model.c @@ -949,12 +949,14 @@ em_folder_tree_model_set_unread_count (EMFolderTreeModel *model, CamelStore *sto /* Drag & Drop methods */ static void -drop_uid_list (CamelFolder *dest, GtkSelectionData *selection, gboolean move, CamelException *ex) +drop_uid_list (CamelFolder *dest, GtkSelectionData *selection, gboolean move, gboolean *moved, CamelException *ex) { CamelFolder *src; GPtrArray *uids; char *src_uri; + *moved = FALSE; + em_utils_selection_get_uidlist (selection, &src_uri, &uids); if (!(src = mail_tool_uri_to_folder (src_uri, 0, ex))) { @@ -968,13 +970,17 @@ drop_uid_list (CamelFolder *dest, GtkSelectionData *selection, gboolean move, Ca camel_folder_transfer_messages_to (src, uids, dest, NULL, move, ex); em_utils_uids_free (uids); camel_object_unref (src); + + *moved = move && !camel_exception_is_set (ex); } static void -drop_folder (CamelFolder *dest, GtkSelectionData *selection, gboolean move, CamelException *ex) +drop_folder (CamelFolder *dest, GtkSelectionData *selection, gboolean move, gboolean *moved, CamelException *ex) { CamelFolder *src; + *moved = FALSE; + /* get the folder being dragged */ if (!(src = mail_tool_uri_to_folder (selection->data, 0, ex))) return; @@ -988,6 +994,8 @@ drop_folder (CamelFolder *dest, GtkSelectionData *selection, gboolean move, Came camel_store_rename_folder (dest->parent_store, old_name, new_name, ex); + *moved = !camel_exception_is_set (ex); + g_free (old_name); g_free (new_name); } else { @@ -1151,14 +1159,12 @@ em_folder_tree_model_drag_data_received (EMFolderTreeModel *model, GtkTreePath * switch (info) { case DND_DROP_TYPE_UID_LIST: /* import a list of uids from another evo folder */ - drop_uid_list (folder, selection, move, &ex); - *moved = move; + drop_uid_list (folder, selection, move, moved, &ex); d(printf ("\t* dropped a x-uid-list\n")); break; case DND_DROP_TYPE_FOLDER: /* copy or move (aka rename) a folder */ - drop_folder (folder, selection, move, &ex); - *moved = move; + drop_folder (folder, selection, move, moved, &ex); d(printf ("\t* dropped a x-folder ('%s' into '%s')\n", selection->data, full_name)); break; case DND_DROP_TYPE_MESSAGE_RFC822: @@ -1177,8 +1183,8 @@ em_folder_tree_model_drag_data_received (EMFolderTreeModel *model, GtkTreePath * } if (camel_exception_is_set (&ex)) { + printf ("\t* exception: %s\n", ex.desc); camel_exception_clear (&ex); - *moved = FALSE; return FALSE; } diff --git a/mail/em-folder-tree.c b/mail/em-folder-tree.c index 52d9764381..facf3f697e 100644 --- a/mail/em-folder-tree.c +++ b/mail/em-folder-tree.c @@ -518,8 +518,6 @@ tree_drag_begin (GtkWidget *widget, GdkDragContext *context, EMFolderTree *emft) GtkTreePath *path; GtkTreeIter iter; - printf ("::drag-begin called\n"); - selection = gtk_tree_view_get_selection ((GtkTreeView *) widget); if (!gtk_tree_selection_get_selected (selection, &model, &iter)) return; @@ -537,8 +535,6 @@ tree_drag_data_delete (GtkWidget *widget, GdkDragContext *context, EMFolderTree struct _EMFolderTreePrivate *priv = emft->priv; GtkTreePath *path; - printf ("::drag-data-delete called\n"); - if (!priv->drag_row || (path = gtk_tree_row_reference_get_path (priv->drag_row))) return; @@ -552,8 +548,6 @@ tree_drag_data_get (GtkWidget *widget, GdkDragContext *context, GtkSelectionData struct _EMFolderTreePrivate *priv = emft->priv; GtkTreePath *path; - printf ("::drag-data-get called\n"); - if (!priv->drag_row || !(path = gtk_tree_row_reference_get_path (priv->drag_row))) return; @@ -572,8 +566,6 @@ tree_drag_data_received (GtkWidget *widget, GdkDragContext *context, int x, int gboolean moved; gboolean move; - printf ("::drag-data-received called\n"); - if (!gtk_tree_view_get_dest_row_at_pos (priv->treeview, x, y, &path, &pos)) return; @@ -592,19 +584,13 @@ tree_drag_drop (GtkWidget *widget, GdkDragContext *context, int x, int y, guint GtkTreePath *path; GdkAtom target; - printf ("::drag-drop called\n"); - if (!gtk_tree_view_get_path_at_pos (priv->treeview, x, y, &path, &column, &cell_x, &cell_y)) return FALSE; target = em_folder_tree_model_row_drop_target (priv->model, path, context->targets); - if (target == GDK_NONE) { - gtk_tree_path_free (path); - return FALSE; - } - gtk_tree_path_free (path); - gtk_drag_get_data (widget, context, target, time); + if (target == GDK_NONE) + return FALSE; return TRUE; } @@ -614,8 +600,6 @@ tree_drag_end (GtkWidget *widget, GdkDragContext *context, EMFolderTree *emft) { struct _EMFolderTreePrivate *priv = emft->priv; - printf ("::drag-end called\n"); - if (priv->drag_row) { gtk_tree_row_reference_free (priv->drag_row); priv->drag_row = NULL; @@ -628,7 +612,6 @@ static void tree_drag_leave (GtkWidget *widget, GdkDragContext *context, guint time, EMFolderTree *emft) { /* FIXME: unhighlight target row? */ - printf ("::drag-leave called\n"); } static gboolean @@ -639,8 +622,6 @@ tree_drag_motion (GtkWidget *widget, GdkDragContext *context, int x, int y, guin GtkTreePath *path; GdkDragAction action; - printf ("::drag-motion called\n"); - if (!gtk_tree_view_get_dest_row_at_pos (priv->treeview, x, y, &path, &pos)) return FALSE; -- cgit