diff options
author | Milan Crha <mcrha@redhat.com> | 2008-07-09 15:53:24 +0800 |
---|---|---|
committer | Milan Crha <mcrha@src.gnome.org> | 2008-07-09 15:53:24 +0800 |
commit | 7103db294cb63cc4af283e11f19166fbcf169894 (patch) | |
tree | 2bfc9fac973595b5a7ade98b0354495bead52c2a /mail/message-list.c | |
parent | 1fe74f379d97c06001ba47c782f736b8ff42146f (diff) | |
download | gsoc2013-evolution-7103db294cb63cc4af283e11f19166fbcf169894.tar.gz gsoc2013-evolution-7103db294cb63cc4af283e11f19166fbcf169894.tar.zst gsoc2013-evolution-7103db294cb63cc4af283e11f19166fbcf169894.zip |
** Fix for bug #207802 (Patch suggested by Veerapuram Varadhan.)
2008-07-09 Milan Crha <mcrha@redhat.com>
** Fix for bug #207802 (Patch suggested by Veerapuram Varadhan.)
* message-list.c: (struct search_child_struct), (search_child_cb),
(is_tree_widget_children), (ml_tree_drag_motion): Do not allow drop
messages to the same message list as is the source. Also do not
allow drop over message list if it doesn't have set a folder.
svn path=/trunk/; revision=35732
Diffstat (limited to 'mail/message-list.c')
-rw-r--r-- | mail/message-list.c | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/mail/message-list.c b/mail/message-list.c index cdd9fad99d..8fd0ea8092 100644 --- a/mail/message-list.c +++ b/mail/message-list.c @@ -2100,12 +2100,50 @@ ml_tree_drag_data_received (ETree *tree, int row, ETreePath path, int col, } } +struct search_child_struct { + gboolean found; + gconstpointer looking_for; +}; + +static void +search_child_cb (GtkWidget *widget, gpointer data) +{ + struct search_child_struct *search = (struct search_child_struct *) data; + + search->found = search->found || g_direct_equal (widget, search->looking_for); +} + +static gboolean +is_tree_widget_children (ETree *tree, gconstpointer widget) +{ + struct search_child_struct search; + + search.found = FALSE; + search.looking_for = widget; + + gtk_container_foreach (GTK_CONTAINER (tree), search_child_cb, &search); + + return search.found; +} + static gboolean ml_tree_drag_motion(ETree *tree, GdkDragContext *context, gint x, gint y, guint time, MessageList *ml) { GList *targets; GdkDragAction action, actions = 0; + /* If drop target is name of the account/store and not actual folder, don't allow any action */ + if (!ml->folder) { + gdk_drag_status (context, 0, time); + return TRUE; + } + + /* If source widget is packed under 'tree', don't allow any action */ + if (is_tree_widget_children (tree, gtk_drag_get_source_widget (context))) { + gdk_drag_status (context, 0, time); + return TRUE; + } + for (targets = context->targets; targets; targets = targets->next) { int i; |