[nautilus/antonioffix-menus-and-popovers: 22/28] files_view: Make rectangle getter internal to reveal_selection



commit 28b422b0324ad0cf2a6db8f269a85a288a99805e
Author: António Fernandes <antoniof gnome org>
Date:   Thu Jan 11 18:37:41 2018 +0000

    files_view: Make rectangle getter internal to reveal_selection
    
    Since the last commit, we always call reveal_selection() before
    get_rectangle_for_popups(). Both functions assume that the 1st
    item of selection is the one to be revealed and popup menus from.
    
    We are going to break this assumption later. Getting the correct
    GdkRectangle is going to require knowledge of which item is
    actually revealed.
    
    In preparation, make the revealed GdkRectangle computation
    internal to reveal_selection(), as an optional output.

 src/nautilus-canvas-view.c          |  64 +++++++++++---------
 src/nautilus-files-view.c           |  47 +++++++--------
 src/nautilus-files-view.h           |   9 ++-
 src/nautilus-list-view.c            | 114 ++++++++++++++++++------------------
 src/nautilus-view-icon-controller.c |  75 +++++++++++++-----------
 5 files changed, 159 insertions(+), 150 deletions(-)
---
diff --git a/src/nautilus-canvas-view.c b/src/nautilus-canvas-view.c
index 7e75db072..605fccfc1 100644
--- a/src/nautilus-canvas-view.c
+++ b/src/nautilus-canvas-view.c
@@ -178,7 +178,8 @@ static void                 nautilus_canvas_view_set_directory_sort_by (Nautilus
                                                                         NautilusFile        *file,
                                                                         const SortCriterion *sort);
 static void                 nautilus_canvas_view_update_click_mode (NautilusCanvasView *canvas_view);
-static void                 nautilus_canvas_view_reveal_selection (NautilusFilesView *view);
+static void                 nautilus_canvas_view_reveal_selection (NautilusFilesView *view,
+                                                                   GdkRectangle      *revealed_area);
 static const SortCriterion *get_sort_criterion_by_metadata_text (const char *metadata_text,
                                                                  gboolean    reversed);
 static const SortCriterion *get_sort_criterion_by_sort_type (NautilusFileSortType sort_type,
@@ -756,7 +757,7 @@ action_sort_order_changed (GSimpleAction *action,
     update_sort_criterion (user_data, sort_criterion, TRUE);
 
     nautilus_canvas_container_sort (get_canvas_container (user_data));
-    nautilus_canvas_view_reveal_selection (NAUTILUS_FILES_VIEW (user_data));
+    nautilus_canvas_view_reveal_selection (NAUTILUS_FILES_VIEW (user_data), NULL);
 
     g_simple_action_set_state (action, value);
 }
@@ -913,7 +914,33 @@ nautilus_canvas_view_select_first (NautilusFilesView *view)
 }
 
 static void
-nautilus_canvas_view_reveal_selection (NautilusFilesView *view)
+get_revealed_rectangle (NautilusFilesView *view,
+                        GdkRectangle      *rect)
+{
+    GArray *bounding_boxes;
+    g_autofree GdkRectangle *bounding_box;
+    NautilusCanvasContainer *canvas_container;
+    GtkAdjustment *vadjustment, *hadjustment;
+    GtkWidget *parent_container;
+
+    canvas_container = get_canvas_container (NAUTILUS_CANVAS_VIEW (view));
+    bounding_boxes = nautilus_canvas_container_get_selected_icons_bounding_box (canvas_container);
+    bounding_box = &g_array_index (bounding_boxes, GdkRectangle, 0);
+    parent_container = nautilus_files_view_get_content_widget (view);
+    vadjustment = gtk_scrolled_window_get_vadjustment (GTK_SCROLLED_WINDOW (parent_container));
+    hadjustment = gtk_scrolled_window_get_hadjustment (GTK_SCROLLED_WINDOW (parent_container));
+
+    rect->x = bounding_box->x - gtk_adjustment_get_value (hadjustment);
+    rect->y = bounding_box->y - gtk_adjustment_get_value (vadjustment);
+    rect->width = bounding_box->width;
+    rect->height = bounding_box->height;
+
+    g_array_free (bounding_boxes, FALSE);
+}
+
+static void
+nautilus_canvas_view_reveal_selection (NautilusFilesView *view,
+                                       GdkRectangle      *revealed_area)
 {
     GList *selection;
 
@@ -929,36 +956,16 @@ nautilus_canvas_view_reveal_selection (NautilusFilesView *view)
         nautilus_canvas_container_reveal
             (get_canvas_container (NAUTILUS_CANVAS_VIEW (view)),
             selection->data);
+
+        if (revealed_area)
+        {
+            get_revealed_rectangle (view, revealed_area);
+        }
     }
 
     nautilus_file_list_free (selection);
 }
 
-static GdkRectangle *
-nautilus_canvas_view_get_rectangle_for_popup (NautilusFilesView *view)
-{
-    GArray *bounding_boxes;
-    GdkRectangle *bounding_box;
-    NautilusCanvasContainer *canvas_container;
-    GtkAdjustment *vadjustment, *hadjustment;
-    GtkWidget *parent_container;
-
-    canvas_container = get_canvas_container (NAUTILUS_CANVAS_VIEW (view));
-    bounding_boxes = nautilus_canvas_container_get_selected_icons_bounding_box (canvas_container);
-    /* We only allow renaming one item at once */
-    bounding_box = &g_array_index (bounding_boxes, GdkRectangle, 0);
-    parent_container = nautilus_files_view_get_content_widget (view);
-    vadjustment = gtk_scrolled_window_get_vadjustment (GTK_SCROLLED_WINDOW (parent_container));
-    hadjustment = gtk_scrolled_window_get_hadjustment (GTK_SCROLLED_WINDOW (parent_container));
-
-    bounding_box->x -= gtk_adjustment_get_value (hadjustment);
-    bounding_box->y -= gtk_adjustment_get_value (vadjustment);
-
-    g_array_free (bounding_boxes, FALSE);
-
-    return bounding_box;
-}
-
 static void
 nautilus_canvas_view_set_selection (NautilusFilesView *view,
                                     GList             *selection)
@@ -1496,7 +1503,6 @@ nautilus_canvas_view_class_init (NautilusCanvasViewClass *klass)
     nautilus_files_view_class->clear = nautilus_canvas_view_clear;
     nautilus_files_view_class->end_loading = nautilus_canvas_view_end_loading;
     nautilus_files_view_class->file_changed = nautilus_canvas_view_file_changed;
-    nautilus_files_view_class->get_rectangle_for_popup = nautilus_canvas_view_get_rectangle_for_popup;
     nautilus_files_view_class->get_selection = nautilus_canvas_view_get_selection;
     nautilus_files_view_class->get_selection_for_file_transfer = nautilus_canvas_view_get_selection;
     nautilus_files_view_class->is_empty = nautilus_canvas_view_is_empty;
diff --git a/src/nautilus-files-view.c b/src/nautilus-files-view.c
index 56693bb60..57ddd157c 100644
--- a/src/nautilus-files-view.c
+++ b/src/nautilus-files-view.c
@@ -657,14 +657,17 @@ nautilus_files_view_invert_selection (NautilusFilesView *view)
 /**
  * nautilus_files_view_reveal_selection:
  *
- * Scroll as necessary to reveal the selected items.
+ * Scroll as necessary to reveal the selected items. Optionally, fill a
+ * GdkRectangle with the area of a revealed item, relative to the view widget.
  **/
 static void
-nautilus_files_view_reveal_selection (NautilusFilesView *view)
+nautilus_files_view_reveal_selection (NautilusFilesView *view,
+                                      GdkRectangle      *revealed_area)
 {
     g_return_if_fail (NAUTILUS_IS_FILES_VIEW (view));
 
-    NAUTILUS_FILES_VIEW_CLASS (G_OBJECT_GET_CLASS (view))->reveal_selection (view);
+    NAUTILUS_FILES_VIEW_CLASS (G_OBJECT_GET_CLASS (view))->reveal_selection (view,
+                                                                             revealed_area);
 }
 
 /**
@@ -1654,7 +1657,7 @@ pattern_select_response_cb (GtkWidget *dialog,
                 nautilus_files_view_call_set_selection (view, selection);
                 nautilus_file_list_free (selection);
 
-                nautilus_files_view_reveal_selection (view);
+                nautilus_files_view_reveal_selection (view, NULL);
             }
             /* fall through */
         }
@@ -1837,7 +1840,7 @@ new_folder_done (GFile    *new_folder,
     {
         /* The file was already added */
         nautilus_files_view_select_file (directory_view, file);
-        nautilus_files_view_reveal_selection (directory_view);
+        nautilus_files_view_reveal_selection (directory_view, NULL);
     }
     else
     {
@@ -1886,12 +1889,6 @@ new_folder_data_new (NautilusFilesView *directory_view,
     return data;
 }
 
-static GdkRectangle *
-nautilus_files_view_get_rectangle_for_popup (NautilusFilesView *view)
-{
-    return NAUTILUS_FILES_VIEW_CLASS (G_OBJECT_GET_CLASS (view))->get_rectangle_for_popup (view);
-}
-
 static void
 rename_file_popover_controller_on_name_accepted (NautilusFileNameWidgetController *controller,
                                                  gpointer                          user_data)
@@ -1936,8 +1933,8 @@ static void
 nautilus_files_view_rename_file_popover_new (NautilusFilesView *view,
                                              NautilusFile      *target_file)
 {
-    GdkRectangle *pointing_to;
     NautilusFilesViewPrivate *priv;
+    g_autofree GdkRectangle *pointing_to = NULL;
 
     priv = nautilus_files_view_get_instance_private (view);
 
@@ -1946,9 +1943,8 @@ nautilus_files_view_rename_file_popover_new (NautilusFilesView *view,
         return;
     }
 
-    nautilus_files_view_reveal_selection (view);
-
-    pointing_to = nautilus_files_view_get_rectangle_for_popup (view);
+    pointing_to = g_new0 (GdkRectangle, 1);
+    nautilus_files_view_reveal_selection (view, pointing_to);
 
     priv->rename_file_controller =
         nautilus_rename_file_popover_controller_new (target_file,
@@ -2106,7 +2102,7 @@ compress_done (GFile    *new_file,
     {
         /* The file was already added */
         nautilus_files_view_select_file (view, file);
-        nautilus_files_view_reveal_selection (view);
+        nautilus_files_view_reveal_selection (view, NULL);
     }
     else
     {
@@ -3044,7 +3040,7 @@ nautilus_files_view_set_selection (NautilusView *nautilus_files_view,
          * and reveal the new selection.
          */
         nautilus_files_view_call_set_selection (view, selection);
-        nautilus_files_view_reveal_selection (view);
+        nautilus_files_view_reveal_selection (view, NULL);
     }
     else
     {
@@ -3473,7 +3469,7 @@ reveal_selection_idle_callback (gpointer data)
     priv = nautilus_files_view_get_instance_private (view);
 
     priv->reveal_selection_idle_id = 0;
-    nautilus_files_view_reveal_selection (view);
+    nautilus_files_view_reveal_selection (view, NULL);
 
     return FALSE;
 }
@@ -3594,7 +3590,7 @@ done_loading (NautilusFilesView *view,
             }
             else
             {
-                nautilus_files_view_reveal_selection (view);
+                nautilus_files_view_reveal_selection (view, NULL);
             }
         }
         nautilus_files_view_display_selection_info (view);
@@ -3657,7 +3653,7 @@ debuting_files_add_files_callback (NautilusFilesView *view,
     if (g_hash_table_size (data->debuting_files) == 0)
     {
         nautilus_files_view_call_set_selection (view, data->added_files);
-        nautilus_files_view_reveal_selection (view);
+        nautilus_files_view_reveal_selection (view, NULL);
         g_signal_handlers_disconnect_by_func (view,
                                               G_CALLBACK (debuting_files_add_files_callback),
                                               data);
@@ -3822,7 +3818,7 @@ copy_move_done_callback (GHashTable *debuting_files,
             {
                 nautilus_files_view_call_set_selection (directory_view,
                                                         debuting_files_data->added_files);
-                nautilus_files_view_reveal_selection (directory_view);
+                nautilus_files_view_reveal_selection (directory_view, NULL);
             }
             debuting_files_data_free (debuting_files_data);
         }
@@ -4047,7 +4043,7 @@ on_end_file_changes (NautilusFilesView *view)
         if (all_files_acknowledged)
         {
             nautilus_files_view_set_selection (NAUTILUS_VIEW (view), keys);
-            nautilus_files_view_reveal_selection (view);
+            nautilus_files_view_reveal_selection (view, NULL);
             g_hash_table_remove_all (priv->pending_reveal);
         }
 
@@ -6252,7 +6248,7 @@ extract_done (GList    *outputs,
 
         nautilus_files_view_set_selection (NAUTILUS_VIEW (data->view),
                                            selection);
-        nautilus_files_view_reveal_selection (data->view);
+        nautilus_files_view_reveal_selection (data->view, NULL);
 
         nautilus_file_list_free (selection);
     }
@@ -8132,9 +8128,8 @@ nautilus_files_view_pop_up_selection_context_menu  (NautilusFilesView *view,
         /* It was triggered from the keyboard, so we need to popup at selection,
          * not pointer. But first make sure the selection is scrolled into view.
          */
-        nautilus_files_view_reveal_selection (view);
-
-        rectangle = nautilus_files_view_get_rectangle_for_popup (view);
+        rectangle = g_new0 (GdkRectangle, 1);
+        nautilus_files_view_reveal_selection (view, rectangle);
     }
 
     nautilus_pop_up_context_menu (GTK_WIDGET (view), priv->selection_menu, event, rectangle);
diff --git a/src/nautilus-files-view.h b/src/nautilus-files-view.h
index 1ef989e8e..745ebc52e 100644
--- a/src/nautilus-files-view.h
+++ b/src/nautilus-files-view.h
@@ -176,8 +176,11 @@ struct _NautilusFilesViewClass {
          * override to make sure the selected items are sufficiently
          * apparent to the user (e.g., scrolled into view). By default,
          * this does nothing.
+         * Optionally, it will fill a GdkRectangle with the area of a revealed
+         * item, relative to the view widget.
          */
-        void     (* reveal_selection)        (NautilusFilesView *view);
+        void     (* reveal_selection)        (NautilusFilesView *view,
+                                              GdkRectangle      *revealed_area);
 
         /* update_menus is a function pointer that subclasses can override to
          * update the sensitivity or wording of menu items in the menu bar.
@@ -229,10 +232,6 @@ struct _NautilusFilesViewClass {
 
         NautilusWindow * (*get_window)       (NautilusFilesView *view);
 
-        /* Use this to point a popover or anchor a context menu to the
-           selected item(s) */
-        GdkRectangle * (* get_rectangle_for_popup) (NautilusFilesView *view);
-
         GIcon *        (* get_icon)          (NautilusFilesView *view);
 
         /* Use this to show an optional visual feedback when the directory is empty.
diff --git a/src/nautilus-list-view.c b/src/nautilus-list-view.c
index 66b333deb..f29cc0a9b 100644
--- a/src/nautilus-list-view.c
+++ b/src/nautilus-list-view.c
@@ -1148,8 +1148,59 @@ test_expand_row_callback (GtkTreeView *tree_view,
                                     NAUTILUS_PREFERENCES_LIST_VIEW_USE_TREE);
 }
 
+
 static void
-nautilus_list_view_reveal_selection (NautilusFilesView *view)
+get_revealed_rectangle (NautilusFilesView *view,
+                        GdkRectangle      *rect)
+{
+    GtkTreeSelection *selection;
+    GtkTreePath *path;
+    GtkTreeModel *model;
+    GtkTreeView *tree_view;
+    GList *list;
+    NautilusListView *list_view;
+    int header_h;
+
+    list_view = NAUTILUS_LIST_VIEW (view);
+    tree_view = list_view->details->tree_view;
+    selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (list_view->details->tree_view));
+    model = GTK_TREE_MODEL (list_view->details->model);
+    list = gtk_tree_selection_get_selected_rows (selection, &model);
+    path = list->data;
+    gtk_tree_view_get_cell_area (tree_view, path, list_view->details->file_name_column, rect);
+    gtk_tree_view_convert_bin_window_to_widget_coords (tree_view,
+                                                       rect->x, rect->y,
+                                                       &rect->x, &rect->y);
+
+    if (list_view->details->last_event_button_x > 0)
+    {
+        rect->x = list_view->details->last_event_button_x;
+        rect->width = 0;
+    }
+
+    g_list_free_full (list, (GDestroyNotify) gtk_tree_path_free);
+
+    /* Workaround to https://bugzilla.gnome.org/show_bug.cgi?id=746773
+     * In short: due to smooth scrolling, we get the cell area while the view is
+     * still scrolling (and still outside the view), not at the final position
+     * of the cell after scrolling.
+     * This workaround guesses the final "y" coordinate by clamping it to
+     * the widget edge. Note that the top edge has got columns header, which is
+     * private, so first guess the header height from the difference between
+     * widget coordinates and bin cooridinates.
+     */
+    gtk_tree_view_convert_bin_window_to_widget_coords (tree_view,
+                                                       NULL, 0,
+                                                       NULL, &header_h);
+
+    rect->y = CLAMP (rect->y,
+                     header_h,
+                     gtk_widget_get_allocated_height (GTK_WIDGET (view)) - rect->height);
+}
+
+static void
+nautilus_list_view_reveal_selection (NautilusFilesView *view,
+                                     GdkRectangle      *revealed_area)
 {
     GList *selection;
 
@@ -1175,6 +1226,11 @@ nautilus_list_view_reveal_selection (NautilusFilesView *view)
 
             gtk_tree_path_free (path);
         }
+
+        if (revealed_area)
+        {
+            get_revealed_rectangle (view, revealed_area);
+        }
     }
 
     nautilus_file_list_free (selection);
@@ -1263,7 +1319,7 @@ sort_column_changed_callback (GtkTreeSortable  *sortable,
                                 default_reversed_attr, reversed_attr);
 
     /* Make sure selected item(s) is visible after sort */
-    nautilus_list_view_reveal_selection (NAUTILUS_FILES_VIEW (view));
+    nautilus_list_view_reveal_selection (NAUTILUS_FILES_VIEW (view), NULL);
 
     view->details->last_sort_attr = sort_attr;
 }
@@ -3699,59 +3755,6 @@ nautilus_list_view_get_id (NautilusFilesView *view)
     return NAUTILUS_VIEW_LIST_ID;
 }
 
-static GdkRectangle *
-nautilus_list_view_get_rectangle_for_popup (NautilusFilesView *view)
-{
-    GtkTreeSelection *selection;
-    GtkTreePath *path;
-    GdkRectangle *rect;
-    GtkTreeModel *model;
-    GtkTreeView *tree_view;
-    GList *list;
-    NautilusListView *list_view;
-    int header_h;
-
-    rect = g_malloc0 (sizeof (GdkRectangle));
-    list_view = NAUTILUS_LIST_VIEW (view);
-    tree_view = list_view->details->tree_view;
-    selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (list_view->details->tree_view));
-    model = GTK_TREE_MODEL (list_view->details->model);
-    list = gtk_tree_selection_get_selected_rows (selection, &model);
-    path = list->data;
-    gtk_tree_view_get_cell_area (tree_view, path, list_view->details->file_name_column, rect);
-    gtk_tree_view_convert_bin_window_to_widget_coords (tree_view,
-                                                       rect->x, rect->y,
-                                                       &rect->x, &rect->y);
-
-    if (list_view->details->last_event_button_x > 0)
-    {
-        rect->x = list_view->details->last_event_button_x;
-        rect->width = 0;
-    }
-
-    g_list_free_full (list, (GDestroyNotify) gtk_tree_path_free);
-
-    /* Workaround to https://bugzilla.gnome.org/show_bug.cgi?id=746773
-     * In short: due to smooth scrolling, we get the cell area while the view is
-     * still scrolling (and still outside the view), not at the final position
-     * of the cell after scrolling.
-     * This workaround guesses the final "y" coordinate by clamping it to
-     * the widget edge. Note that the top edge has got columns header, which is
-     * private, so first guess the header height from the difference between
-     * widget coordinates and bin cooridinates.
-     */
-    gtk_tree_view_convert_bin_window_to_widget_coords (tree_view,
-                                                       NULL, 0,
-                                                       NULL, &header_h);
-
-    rect->y = CLAMP (rect->y,
-                     header_h,
-                     gtk_widget_get_allocated_height (GTK_WIDGET (view)) - rect->height);
-    /* End of workaroud */
-
-    return rect;
-}
-
 static void
 nautilus_list_view_class_init (NautilusListViewClass *class)
 {
@@ -3790,7 +3793,6 @@ nautilus_list_view_class_init (NautilusListViewClass *class)
     nautilus_files_view_class->get_view_id = nautilus_list_view_get_id;
     nautilus_files_view_class->get_first_visible_file = nautilus_list_view_get_first_visible_file;
     nautilus_files_view_class->scroll_to_file = list_view_scroll_to_file;
-    nautilus_files_view_class->get_rectangle_for_popup = nautilus_list_view_get_rectangle_for_popup;
 }
 
 static void
diff --git a/src/nautilus-view-icon-controller.c b/src/nautilus-view-icon-controller.c
index c070ea9f7..0a7976ad9 100644
--- a/src/nautilus-view-icon-controller.c
+++ b/src/nautilus-view-icon-controller.c
@@ -387,8 +387,43 @@ real_select_all (NautilusFilesView *files_view)
     gtk_flow_box_select_all (GTK_FLOW_BOX (self->view_ui));
 }
 
+
 static void
-real_reveal_selection (NautilusFilesView *files_view)
+get_revealed_rectangle (NautilusFilesView *files_view,
+                        GdkRectangle      *rect)
+{
+    NautilusViewIconController *self;
+    GdkRectangle *allocation;
+    GtkAdjustment *vadjustment;
+    GtkAdjustment *hadjustment;
+    GtkWidget *parent_container;
+    g_autoptr (GQueue) selection_files = NULL;
+    g_autoptr (GQueue) selection_item_models = NULL;
+    GList *selection;
+    GtkWidget *icon_item_ui;
+
+    self = NAUTILUS_VIEW_ICON_CONTROLLER (files_view);
+    allocation = g_new0 (GdkRectangle, 1);
+
+    parent_container = nautilus_files_view_get_content_widget (files_view);
+    vadjustment = gtk_scrolled_window_get_vadjustment (GTK_SCROLLED_WINDOW (parent_container));
+    hadjustment = gtk_scrolled_window_get_hadjustment (GTK_SCROLLED_WINDOW (parent_container));
+    selection = nautilus_view_get_selection (NAUTILUS_VIEW (files_view));
+    selection_files = convert_glist_to_queue (selection);
+    selection_item_models = nautilus_view_model_get_items_from_files (self->model, selection_files);
+    /* We only allow one item to be renamed with a popover */
+    icon_item_ui = nautilus_view_item_model_get_item_ui (g_queue_peek_head (selection_item_models));
+    gtk_widget_get_allocation (icon_item_ui, allocation);
+
+    rect->x = allocation->x - gtk_adjustment_get_value (hadjustment);
+    rect->y = allocation->y - gtk_adjustment_get_value (vadjustment);
+    rect->width =allocation->width;
+    rect->height =allocation->height;
+}
+
+static void
+real_reveal_selection (NautilusFilesView *files_view,
+                       GdkRectangle      *revealed_area)
 {
     GList *selection;
     NautilusViewItemModel *item_model;
@@ -412,6 +447,11 @@ real_reveal_selection (NautilusFilesView *files_view)
     vadjustment = gtk_scrolled_window_get_vadjustment (GTK_SCROLLED_WINDOW (content_widget));
     gtk_adjustment_set_value (vadjustment, allocation.y);
 
+    if (revealed_area)
+    {
+        get_revealed_rectangle (files_view, revealed_area);
+    }
+
     g_list_foreach (selection, (GFunc) g_object_unref, NULL);
 }
 
@@ -593,38 +633,6 @@ real_can_zoom_out (NautilusFilesView *files_view)
     return TRUE;
 }
 
-static GdkRectangle *
-real_get_rectangle_for_popup (NautilusFilesView *files_view)
-{
-    NautilusViewIconController *self;
-    GdkRectangle *allocation;
-    GtkAdjustment *vadjustment;
-    GtkAdjustment *hadjustment;
-    GtkWidget *parent_container;
-    g_autoptr (GQueue) selection_files = NULL;
-    g_autoptr (GQueue) selection_item_models = NULL;
-    GList *selection;
-    GtkWidget *icon_item_ui;
-
-    self = NAUTILUS_VIEW_ICON_CONTROLLER (files_view);
-    allocation = g_new0 (GdkRectangle, 1);
-
-    parent_container = nautilus_files_view_get_content_widget (files_view);
-    vadjustment = gtk_scrolled_window_get_vadjustment (GTK_SCROLLED_WINDOW (parent_container));
-    hadjustment = gtk_scrolled_window_get_hadjustment (GTK_SCROLLED_WINDOW (parent_container));
-    selection = nautilus_view_get_selection (NAUTILUS_VIEW (files_view));
-    selection_files = convert_glist_to_queue (selection);
-    selection_item_models = nautilus_view_model_get_items_from_files (self->model, selection_files);
-    /* We only allow one item to be renamed with a popover */
-    icon_item_ui = nautilus_view_item_model_get_item_ui (g_queue_peek_head (selection_item_models));
-    gtk_widget_get_allocation (icon_item_ui, allocation);
-
-    allocation->x -= gtk_adjustment_get_value (hadjustment);
-    allocation->y -= gtk_adjustment_get_value (vadjustment);
-
-    return allocation;
-}
-
 static void
 real_click_policy_changed (NautilusFilesView *files_view)
 {
@@ -915,7 +923,6 @@ nautilus_view_icon_controller_class_init (NautilusViewIconControllerClass *klass
     files_view_class->restore_standard_zoom_level = real_restore_standard_zoom_level;
     files_view_class->get_zoom_level_percentage = real_get_zoom_level_percentage;
     files_view_class->is_zoom_level_default = real_is_zoom_level_default;
-    files_view_class->get_rectangle_for_popup = real_get_rectangle_for_popup;
 }
 
 static void


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