[nautilus/wip/antoniof/gtk4-preparation-popovers: 10/11] list-view: Separate column event and menu code
- From: António Fernandes <antoniof src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus/wip/antoniof/gtk4-preparation-popovers: 10/11] list-view: Separate column event and menu code
- Date: Fri, 17 Dec 2021 13:37:41 +0000 (UTC)
commit 8dc54454d11e6e6edd18837ea1af0f35c94841c4
Author: António Fernandes <antoniof gnome org>
Date: Fri Dec 17 12:18:09 2021 +0000
list-view: Separate column event and menu code
This is a preparation for the next commit, in order to avoid
conflict between branches.
src/nautilus-list-view.c | 37 ++++++++++++++++++++++++-------------
1 file changed, 24 insertions(+), 13 deletions(-)
---
diff --git a/src/nautilus-list-view.c b/src/nautilus-list-view.c
index 491d38cc4..de2ba5f5d 100644
--- a/src/nautilus-list-view.c
+++ b/src/nautilus-list-view.c
@@ -98,7 +98,9 @@ static char **get_default_column_order (NautilusListView *list_view);
static void on_clipboard_owner_changed (GtkClipboard *clipboard,
GdkEvent *event,
gpointer user_data);
-
+static void popup_column_header_menu (NautilusListView *list_view,
+ gdouble x,
+ gdouble y);
G_DEFINE_TYPE (NautilusListView, nautilus_list_view, NAUTILUS_TYPE_FILES_VIEW);
@@ -1499,15 +1501,6 @@ on_column_header_event (GtkWidget *widget,
{
NautilusListView *list_view;
guint button;
- NautilusFile *file;
- char **visible_columns;
- char **column_order;
- GList *all_columns;
- GHashTable *visible_columns_hash;
- int i;
- GList *l;
- GtkWidget *menu;
- GtkWidget *menu_item;
list_view = NAUTILUS_LIST_VIEW (user_data);
@@ -1523,6 +1516,26 @@ on_column_header_event (GtkWidget *widget,
return GDK_EVENT_PROPAGATE;
}
+ popup_column_header_menu (list_view, (&event->button)->x, (&event->button)->y);
+
+ return GDK_EVENT_STOP;
+}
+
+static void
+popup_column_header_menu (NautilusListView *list_view,
+ gdouble x,
+ gdouble y)
+{
+ NautilusFile *file;
+ char **visible_columns;
+ char **column_order;
+ GList *all_columns;
+ GHashTable *visible_columns_hash;
+ int i;
+ GList *l;
+ GtkWidget *menu;
+ GtkWidget *menu_item;
+
file = nautilus_files_view_get_directory_as_file (NAUTILUS_FILES_VIEW (list_view));
visible_columns = get_visible_columns (list_view);
@@ -1601,14 +1614,12 @@ on_column_header_event (GtkWidget *widget,
list_view);
gtk_widget_show_all (menu);
- gtk_menu_popup_at_pointer (GTK_MENU (menu), event);
+ gtk_menu_popup_at_pointer (GTK_MENU (menu), NULL);
g_hash_table_destroy (visible_columns_hash);
nautilus_column_list_free (all_columns);
g_strfreev (column_order);
g_strfreev (visible_columns);
-
- return GDK_EVENT_STOP;
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]