[empathy: 7/17] Allow contacts to be dragged anywhere in a group, or dragged to the non-group



commit 18be92ecfb97887044867643e130ee0ee7c6b3f8
Author: Shaun McCance <Shaun McCance>
Date:   Thu Sep 17 17:11:11 2009 -0500

    Allow contacts to be dragged anywhere in a group, or dragged to the non-group

 libempathy-gtk/empathy-contact-list-view.c |   25 ++++++++++++++++++++-----
 1 files changed, 20 insertions(+), 5 deletions(-)
---
diff --git a/libempathy-gtk/empathy-contact-list-view.c b/libempathy-gtk/empathy-contact-list-view.c
index 04a4488..78e1f90 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 {



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