[gtk+/places-sidebar] Emit drag-action-requested and feed the result to gdk_drag_status()



commit a5184c2eb178cdafd80b874731f032a9d809d33a
Author: Federico Mena Quintero <federico gnome org>
Date:   Mon Dec 3 17:37:11 2012 -0600

    Emit drag-action-requested and feed the result to gdk_drag_status()
    
    Signed-off-by: Federico Mena Quintero <federico gnome org>

 gtk/gtkplacessidebar.c |   22 ++++++++--------------
 1 files changed, 8 insertions(+), 14 deletions(-)
---
diff --git a/gtk/gtkplacessidebar.c b/gtk/gtkplacessidebar.c
index e586099..267f55f 100644
--- a/gtk/gtkplacessidebar.c
+++ b/gtk/gtkplacessidebar.c
@@ -40,6 +40,9 @@
  *   that, Nautilus does the "volume has trash, empty it first?" dance.  Cosimo
  *   suggests that this logic should be part of GtkMountOperation, which can
  *   have Unix-specific code for emptying trash.
+ *
+ * * Nautilus needs to connect to "drag-action-requested", and call
+ *   nautilus_drag_default_drop_action_for_icons().
  */
 
 #include "config.h"
@@ -1405,7 +1408,7 @@ drag_motion_callback (GtkTreeView *tree_view,
 		goto out;
 	}
 
-	if (pos == GTK_TREE_VIEW_DROP_AFTER ) {
+	if (pos == GTK_TREE_VIEW_DROP_AFTER) {
 		if (sidebar->drag_data_received &&
 		    sidebar->drag_data_info == GTK_TREE_MODEL_ROW) {
 			action = GDK_ACTION_MOVE;
@@ -1413,20 +1416,15 @@ drag_motion_callback (GtkTreeView *tree_view,
 			action = 0;
 		}
 	} else {
-		if (sidebar->drag_list == NULL) {
-			action = 0;
-		} else {
+		action = 0;
+		if (sidebar->drag_list != NULL) {
 			gtk_tree_model_get_iter (GTK_TREE_MODEL (sidebar->store),
 						 &iter, path);
 			gtk_tree_model_get (GTK_TREE_MODEL (sidebar->store),
 					    &iter,
 					    PLACES_SIDEBAR_COLUMN_URI, &uri,
 					    -1);
-#if DO_NOT_COMPILE
-			nautilus_drag_default_drop_action_for_icons (context, uri,
-								     sidebar->drag_list,
-								     &action);
-#endif
+			emit_drag_action_requested (sidebar, context, uri, sidebar->drag_list, &action);
 			g_free (uri);
 		}
 	}
@@ -1442,11 +1440,7 @@ drag_motion_callback (GtkTreeView *tree_view,
  out:
 	g_signal_stop_emission_by_name (tree_view, "drag-motion");
 
-	if (action != 0) {
-		gdk_drag_status (context, action, time);
-	} else {
-		gdk_drag_status (context, 0, time);
-	}
+	gdk_drag_status (context, action, time);
 
 	return TRUE;
 }



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