[gtk+/multiroot-filechooser: 22/30] Don't use gtktreeprivate in the file chooser



commit c3524bab42cbac95087f38041bdab7d9b77a385c
Author: Federico Mena Quintero <federico novell com>
Date:   Wed Aug 25 13:00:27 2010 -0500

    Don't use gtktreeprivate in the file chooser
    
    We were using TREE_VIEW_HEADER_HEIGHT() to factor out the Y position
    during drag-and-drop; now we use the public function
    gtk_tree_view_get_dest_row_at_pos().
    
    Signed-off-by: Federico Mena Quintero <federico novell com>

 gtk/gtkfilechooserdefault.c |   19 +++++++------------
 1 files changed, 7 insertions(+), 12 deletions(-)
---
diff --git a/gtk/gtkfilechooserdefault.c b/gtk/gtkfilechooserdefault.c
index 3a4dc9b..7b05202 100644
--- a/gtk/gtkfilechooserdefault.c
+++ b/gtk/gtkfilechooserdefault.c
@@ -3191,23 +3191,15 @@ shortcuts_compute_drop_position (GtkFileChooserDefault   *impl,
 				 GtkTreeViewDropPosition *pos)
 {
   GtkTreeView *tree_view;
-  GtkTreeViewColumn *column;
-  int cell_y;
-  GdkRectangle cell;
   int row;
   int bookmarks_index;
+  GtkTreeViewDropPosition raw_pos;
 
   tree_view = GTK_TREE_VIEW (impl->browse_shortcuts_tree_view);
 
   bookmarks_index = shortcuts_get_index (impl, SHORTCUTS_BOOKMARKS);
 
-  if (!gtk_tree_view_get_path_at_pos (tree_view,
-                                      x,
-				      y - TREE_VIEW_HEADER_HEIGHT (tree_view),
-                                      path,
-                                      &column,
-                                      NULL,
-                                      &cell_y))
+  if (!gtk_tree_view_get_dest_row_at_pos (tree_view, x, y, path, &raw_pos))
     {
       row = bookmarks_index + impl->num_bookmarks - 1;
       *path = gtk_tree_path_new_from_indices (row, -1);
@@ -3216,7 +3208,6 @@ shortcuts_compute_drop_position (GtkFileChooserDefault   *impl,
     }
 
   row = *gtk_tree_path_get_indices (*path);
-  gtk_tree_view_get_background_area (tree_view, *path, column, &cell);
   gtk_tree_path_free (*path);
 
   if (row < bookmarks_index)
@@ -3231,7 +3222,11 @@ shortcuts_compute_drop_position (GtkFileChooserDefault   *impl,
     }
   else
     {
-      if (cell_y < cell.height / 2)
+      /* For dropping folders in the shortcuts pane, we don't support
+       * "drop into".  So, we cook GTK+'s idea of where things should
+       * be dropped into just "before" or "after".
+       */
+      if (pos == GTK_TREE_VIEW_DROP_BEFORE || pos == GTK_TREE_VIEW_DROP_INTO_OR_BEFORE)
 	*pos = GTK_TREE_VIEW_DROP_BEFORE;
       else
 	*pos = GTK_TREE_VIEW_DROP_AFTER;



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