[nautilus/wip/antoniof/gtk4-preparation-step-event-controllers: 4/21] 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-step-event-controllers: 4/21] list-view: Separate column event and menu code
- Date: Wed, 22 Dec 2021 01:22:30 +0000 (UTC)
commit b356e33521dc33c30803535a2cc3f9ffbe5db073
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 4fdb96cdd..e065f8e0a 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);
@@ -1373,15 +1375,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);
@@ -1397,6 +1390,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);
@@ -1475,14 +1488,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]