From 18be92ecfb97887044867643e130ee0ee7c6b3f8 Mon Sep 17 00:00:00 2001 From: Shaun McCance Date: Thu, 17 Sep 2009 17:11:11 -0500 Subject: Allow contacts to be dragged anywhere in a group, or dragged to the non-group --- libempathy-gtk/empathy-contact-list-view.c | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/libempathy-gtk/empathy-contact-list-view.c b/libempathy-gtk/empathy-contact-list-view.c index 04a448817..78e1f9020 100644 --- a/libempathy-gtk/empathy-contact-list-view.c +++ b/libempathy-gtk/empathy-contact-list-view.c @@ -454,20 +454,35 @@ contact_list_view_drag_motion (GtkWidget *widget, gtk_tree_model_get_iter (model, &iter, path); if (target == GDK_NONE) { - gboolean is_group; + GtkTreeIter group_iter; + gboolean is_group; + GtkTreePath *group_path; gtk_tree_model_get (model, &iter, EMPATHY_CONTACT_LIST_STORE_COL_IS_GROUP, &is_group, -1); + if (is_group) { + group_iter = iter; + } + else { + if (gtk_tree_model_iter_parent (model, &group_iter, &iter)) + gtk_tree_model_get (model, &group_iter, + EMPATHY_CONTACT_LIST_STORE_COL_IS_GROUP, &is_group, + -1); + } if (is_group) { gdk_drag_status (context, GDK_ACTION_MOVE, time_); + group_path = gtk_tree_model_get_path (model, &group_iter); gtk_tree_view_set_drag_dest_row (GTK_TREE_VIEW (widget), - path, + group_path, GTK_TREE_VIEW_DROP_INTO_OR_BEFORE); + gtk_tree_path_free (group_path); } else { - gdk_drag_status (context, 0, time_); - gtk_tree_view_set_drag_dest_row (GTK_TREE_VIEW (widget), NULL, 0); - retval = FALSE; + group_path = gtk_tree_path_new_first (); + gdk_drag_status (context, GDK_ACTION_MOVE, time_); + gtk_tree_view_set_drag_dest_row (GTK_TREE_VIEW (widget), + group_path, + GTK_TREE_VIEW_DROP_BEFORE); } } else { -- cgit v1.2.3