[gtk+/places-sidebar: 535/539] Move the drop feedback code to stub functions



commit 624b352d776e8b2e4d62ab29d9a7d2afe736c9c4
Author: Federico Mena Quintero <federico gnome org>
Date:   Fri Apr 19 11:25:03 2013 -0500

    Move the drop feedback code to stub functions
    
    For now it is the old, simple call to gtk_tree_view_set_drag_dest_row().  We'll do something
    fancier in the following commits.
    
    Signed-off-by: Federico Mena Quintero <federico gnome org>

 gtk/gtkplacessidebar.c | 21 ++++++++++++++++-----
 1 file changed, 16 insertions(+), 5 deletions(-)
---
diff --git a/gtk/gtkplacessidebar.c b/gtk/gtkplacessidebar.c
index f66b7c0..1e47848 100644
--- a/gtk/gtkplacessidebar.c
+++ b/gtk/gtkplacessidebar.c
@@ -1408,6 +1408,18 @@ free_drag_data (GtkPlacesSidebar *sidebar)
        }
 }
 
+static void
+start_drop_feedback (GtkPlacesSidebar *sidebar, GtkTreePath *path, GtkTreeViewDropPosition pos, gboolean 
drop_as_bookmarks)
+{
+       gtk_tree_view_set_drag_dest_row (sidebar->tree_view, path, pos);
+}
+
+static void
+stop_drop_feedback (GtkPlacesSidebar *sidebar)
+{
+       gtk_tree_view_set_drag_dest_row (sidebar->tree_view, NULL, 0);
+}
+
 static gboolean
 drag_motion_callback (GtkTreeView *tree_view,
                      GdkDragContext *context,
@@ -1421,8 +1433,10 @@ drag_motion_callback (GtkTreeView *tree_view,
        int action;
        GtkTreeIter iter;
        gboolean res;
+       gboolean drop_as_bookmarks;
 
        action = 0;
+       drop_as_bookmarks = FALSE;
 
        if (!sidebar->drag_data_received) {
                if (!get_drag_data (tree_view, context, time)) {
@@ -1449,7 +1463,6 @@ drag_motion_callback (GtkTreeView *tree_view,
                if (sidebar->drag_list != NULL) {
                        SectionType section_type;
                        PlaceType place_type;
-                       gboolean drop_as_bookmarks;
 
                        gtk_tree_model_get_iter (GTK_TREE_MODEL (sidebar->store),
                                                 &iter, path);
@@ -1459,8 +1472,6 @@ drag_motion_callback (GtkTreeView *tree_view,
                                            PLACES_SIDEBAR_COLUMN_ROW_TYPE, &place_type,
                                            -1);
 
-                       drop_as_bookmarks = FALSE;
-
                        if (section_type == SECTION_BOOKMARKS) {
                                if (pos == GTK_TREE_VIEW_DROP_BEFORE || pos == GTK_TREE_VIEW_DROP_AFTER) {
                                        action = GDK_ACTION_COPY;
@@ -1490,9 +1501,9 @@ drag_motion_callback (GtkTreeView *tree_view,
 
  out:
        if (action != 0)
-               gtk_tree_view_set_drag_dest_row (tree_view, path, pos);
+               start_drop_feedback (sidebar, path, pos, drop_as_bookmarks);
        else
-               gtk_tree_view_set_drag_dest_row (tree_view, NULL, pos);
+               stop_drop_feedback (sidebar);
 
        if (path != NULL) {
                gtk_tree_path_free (path);


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