[nautilus/antonioffix-menus-and-popovers: 18/28] list-view: Simplify rectangle for rename popovers
- From: Carlos Soriano <csoriano src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus/antonioffix-menus-and-popovers: 18/28] list-view: Simplify rectangle for rename popovers
- Date: Tue, 23 Jan 2018 08:24:47 +0000 (UTC)
commit 92000ea28afddad03fa9dc7b7fe108a47a99a1ce
Author: António Fernandes <antoniof gnome org>
Date: Sun Jan 7 01:37:57 2018 +0000
list-view: Simplify rectangle for rename popovers
We force a rectangle with width=40 to avoid pointy popover
arrows, then center it to the file name column.
This will not work well when reusing this for context menus.
Instead, use the file name cell's area as rectangle. It should
have enough width anyway.
src/nautilus-list-view.c | 18 ++----------------
1 file changed, 2 insertions(+), 16 deletions(-)
---
diff --git a/src/nautilus-list-view.c b/src/nautilus-list-view.c
index d06d8edbd..fb6c03fb8 100644
--- a/src/nautilus-list-view.c
+++ b/src/nautilus-list-view.c
@@ -59,12 +59,6 @@
#define DEBUG_FLAG NAUTILUS_DEBUG_LIST_VIEW
#include "nautilus-debug.h"
-/* We use a rectangle to make the popover point to the right column. In an
- * ideal world with GtkListBox we would just point to the GtkListBoxRow. In our case, we
- * need to use a rectangle and we provide some width to not make the popover arrow pointy
- * in the edges if the window is small */
-#define RENAME_POPOVER_RELATIVE_TO_RECTANGLE_WIDTH 40
-
struct SelectionForeachData
{
GList *list;
@@ -3723,7 +3717,7 @@ nautilus_list_view_get_rectangle_for_popup (NautilusFilesView *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, NULL, rect);
+ 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);
@@ -3731,16 +3725,8 @@ nautilus_list_view_get_rectangle_for_popup (NautilusFilesView *view)
if (list_view->details->last_event_button_x > 0)
{
rect->x = list_view->details->last_event_button_x;
+ rect->width = 0;
}
- else
- {
- rect->x = CLAMP (gtk_tree_view_column_get_width (list_view->details->file_name_column) * 0.5 -
- RENAME_POPOVER_RELATIVE_TO_RECTANGLE_WIDTH * 0.5,
- 0,
- gtk_tree_view_column_get_width (list_view->details->file_name_column) -
- RENAME_POPOVER_RELATIVE_TO_RECTANGLE_WIDTH);
- }
- rect->width = RENAME_POPOVER_RELATIVE_TO_RECTANGLE_WIDTH;
g_list_free_full (list, (GDestroyNotify) gtk_tree_path_free);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]