[nautilus/wip/antoniof/gtk4-preparation-step-event-controllers: 7/22] list-view: Stop connecting to header button ::event
- From: António Fernandes <antoniof src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus/wip/antoniof/gtk4-preparation-step-event-controllers: 7/22] list-view: Stop connecting to header button ::event
- Date: Wed, 11 Aug 2021 00:21:35 +0000 (UTC)
commit da25032ec354f3732fcf9f1b4f48763ada10cc58
Author: António Fernandes <antoniof gnome org>
Date: Sun Aug 8 20:54:55 2021 +0100
list-view: Stop connecting to header button ::event
The ::event signal is gone in GTK4.
We already have a gesture for clicks, use it instead.
src/nautilus-list-view.c | 46 ++++++++++++++--------------------------------
1 file changed, 14 insertions(+), 32 deletions(-)
---
diff --git a/src/nautilus-list-view.c b/src/nautilus-list-view.c
index cd5235225..2a0356ec3 100644
--- a/src/nautilus-list-view.c
+++ b/src/nautilus-list-view.c
@@ -97,6 +97,8 @@ 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,
+ const GdkEvent *event);
G_DEFINE_TYPE (NautilusListView, nautilus_list_view, NAUTILUS_TYPE_FILES_VIEW);
@@ -567,6 +569,15 @@ on_tree_view_multi_press_gesture_pressed (GtkGestureMultiPress *gesture,
/* Remove after switching to GTK+ 4. */
if (gdk_event_get_window (event) != gtk_tree_view_get_bin_window (tree_view))
{
+ if (button == GDK_BUTTON_SECONDARY)
+ {
+ popup_column_header_menu (view, event);
+ gtk_gesture_set_state (GTK_GESTURE (gesture), GTK_EVENT_SEQUENCE_CLAIMED);
+ }
+ else
+ {
+ gtk_gesture_set_state (GTK_GESTURE (gesture), GTK_EVENT_SEQUENCE_DENIED);
+ }
return;
}
@@ -1455,13 +1466,10 @@ column_header_menu_use_default (GtkMenuItem *menu_item,
g_strfreev (default_order);
}
-static gboolean
-on_column_header_event (GtkWidget *widget,
- GdkEvent *event,
- gpointer user_data)
+static void
+popup_column_header_menu (NautilusListView *list_view,
+ const GdkEvent *event)
{
- NautilusListView *list_view;
- guint button;
NautilusFile *file;
char **visible_columns;
char **column_order;
@@ -1472,20 +1480,6 @@ on_column_header_event (GtkWidget *widget,
GtkWidget *menu;
GtkWidget *menu_item;
- list_view = NAUTILUS_LIST_VIEW (user_data);
-
- if (gdk_event_get_event_type (event) != GDK_BUTTON_PRESS)
- {
- return GDK_EVENT_PROPAGATE;
- }
-
- g_assert (gdk_event_get_button (event, &button));
-
- if (button != GDK_BUTTON_SECONDARY)
- {
- return GDK_EVENT_PROPAGATE;
- }
-
file = nautilus_files_view_get_directory_as_file (NAUTILUS_FILES_VIEW (list_view));
visible_columns = get_visible_columns (list_view);
@@ -1570,8 +1564,6 @@ on_column_header_event (GtkWidget *widget,
nautilus_column_list_free (all_columns);
g_strfreev (column_order);
g_strfreev (visible_columns);
-
- return GDK_EVENT_STOP;
}
static void
@@ -2260,11 +2252,6 @@ create_and_set_up_tree_view (NautilusListView *view)
g_strdup ("name"),
view->details->file_name_column);
- g_signal_connect (gtk_tree_view_column_get_button (view->details->file_name_column),
- "event",
- G_CALLBACK (on_column_header_event),
- view);
-
gtk_tree_view_set_search_column (view->details->tree_view, column_num);
gtk_tree_view_column_set_sort_column_id (view->details->file_name_column, column_num);
@@ -2355,11 +2342,6 @@ create_and_set_up_tree_view (NautilusListView *view)
g_strdup (name),
column);
- g_signal_connect (gtk_tree_view_column_get_button (column),
- "event",
- G_CALLBACK (on_column_header_event),
- view);
-
gtk_tree_view_column_set_resizable (column, TRUE);
gtk_tree_view_column_set_sort_order (column, sort_order);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]