[nautilus/antonioffix-menus-and-popovers: 11/20] files-view: Reveal file to be renamed
- From: António Fernandes <antoniof src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus/antonioffix-menus-and-popovers: 11/20] files-view: Reveal file to be renamed
- Date: Sun, 28 Jan 2018 17:09:44 +0000 (UTC)
commit f3e3e628a614214ae6e3b83026331f2d6620774a
Author: António Fernandes <antoniof gnome org>
Date: Sat Jan 6 19:28:34 2018 +0000
files-view: Reveal file to be renamed
When renaming, if the item is out of view, the popover may pop up
outside of the window or even outside of the screen.
It is conveninent to see the whole item to be renamed and provide
a visible target for the popover.
So, reveal selection before popping up a rename popover.
Fixes: https://gitlab.gnome.org/GNOME/nautilus/issues/5
src/nautilus-files-view.c | 5 +++++
src/nautilus-list-view.c | 21 +++++++++++++++++++++
2 files changed, 26 insertions(+)
---
diff --git a/src/nautilus-files-view.c b/src/nautilus-files-view.c
index e74123a7a..68728683b 100644
--- a/src/nautilus-files-view.c
+++ b/src/nautilus-files-view.c
@@ -1948,6 +1948,11 @@ nautilus_files_view_rename_file_popover_new (NautilusFilesView *view,
return;
}
+ /* Make sure the whole item is visible. The selection is a single item, the
+ * one to rename with the popover, so we can use reveal_selection() for this.
+ */
+ nautilus_files_view_reveal_selection (view);
+
pointing_to = nautilus_files_view_compute_rename_popover_pointing_to (view);
priv->rename_file_controller =
diff --git a/src/nautilus-list-view.c b/src/nautilus-list-view.c
index 5d54a863d..ffe7a755e 100644
--- a/src/nautilus-list-view.c
+++ b/src/nautilus-list-view.c
@@ -3731,6 +3731,27 @@ nautilus_list_view_compute_rename_popover_pointing_to (NautilusFilesView *view)
g_list_free_full (list, (GDestroyNotify) gtk_tree_path_free);
+ /* FIXME 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.
+ * https://bugzilla.gnome.org/show_bug.cgi?id=746773
+ * The following 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.
+ */
+ {
+ int header_height;
+
+ gtk_tree_view_convert_bin_window_to_widget_coords (tree_view,
+ 0, 0,
+ NULL, &header_height);
+
+ rect->y = CLAMP (rect->y,
+ header_height,
+ gtk_widget_get_allocated_height (GTK_WIDGET (view)) - rect->height);
+ }
+
return rect;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]