[nautilus/wip/oholy/gnome-42: 33/41] Revert "general: Stop using GtkWidget::popup-menu"
- From: Ondrej Holy <oholy src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus/wip/oholy/gnome-42: 33/41] Revert "general: Stop using GtkWidget::popup-menu"
- Date: Fri, 11 Feb 2022 14:07:55 +0000 (UTC)
commit 9dc557e86194df0f73134b3bdf69a345ae2e3dd0
Author: Ondrej Holy <oholy redhat com>
Date: Fri Feb 11 14:47:04 2022 +0100
Revert "general: Stop using GtkWidget::popup-menu"
This reverts commit 80b6f77d2bc1b9463dc0195f44c786f35478d826.
src/nautilus-files-view.c | 38 +++++++++++++++++++++++---------------
src/nautilus-window.c | 12 ++++++++++++
2 files changed, 35 insertions(+), 15 deletions(-)
---
diff --git a/src/nautilus-files-view.c b/src/nautilus-files-view.c
index 956f7328b..41d392e3b 100644
--- a/src/nautilus-files-view.c
+++ b/src/nautilus-files-view.c
@@ -1662,16 +1662,6 @@ action_preview_selection (GSimpleAction *action,
nautilus_files_view_preview (view, data);
}
-static void
-action_popup_menu (GSimpleAction *action,
- GVariant *state,
- gpointer user_data)
-{
- NautilusFilesView *view = NAUTILUS_FILES_VIEW (user_data);
-
- nautilus_files_view_pop_up_selection_context_menu (view, -1, -1);
-}
-
static void
pattern_select_response_cb (GtkWidget *dialog,
int response,
@@ -7056,7 +7046,6 @@ const GActionEntry view_entries[] =
{ "select-pattern", action_select_pattern },
{ "invert-selection", action_invert_selection },
{ "preview-selection", action_preview_selection },
- { "popup-menu", action_popup_menu },
};
static gboolean
@@ -7643,9 +7632,6 @@ real_update_actions_state (NautilusFilesView *view)
action = g_action_map_lookup_action (G_ACTION_MAP (view_action_group),
"preview-selection");
g_simple_action_set_enabled (G_SIMPLE_ACTION (action), selection_count != 0);
- action = g_action_map_lookup_action (G_ACTION_MAP (view_action_group),
- "popup-menu");
- g_simple_action_set_enabled (G_SIMPLE_ACTION (action), selection_count != 0);
/* Drive menu */
show_mount = (selection != NULL);
@@ -8310,6 +8296,25 @@ nautilus_files_view_pop_up_background_context_menu (NautilusFilesView *view,
gtk_popover_popup (GTK_POPOVER (priv->background_menu));
}
+static gboolean
+popup_menu_callback (NautilusFilesView *view)
+{
+ g_autolist (NautilusFile) selection = NULL;
+
+ selection = nautilus_view_get_selection (NAUTILUS_VIEW (view));
+
+ if (selection != NULL)
+ {
+ nautilus_files_view_pop_up_selection_context_menu (view, -1, -1);
+ }
+ else
+ {
+ nautilus_files_view_pop_up_background_context_menu (view, 0, 0);
+ }
+
+ return TRUE;
+}
+
static void
schedule_update_context_menus (NautilusFilesView *view)
{
@@ -9590,6 +9595,10 @@ nautilus_files_view_init (NautilusFilesView *view)
"event",
G_CALLBACK (on_event),
view);
+ g_signal_connect_swapped (priv->scrolled_window,
+ "popup-menu",
+ G_CALLBACK (popup_menu_callback),
+ view);
gtk_overlay_set_child (GTK_OVERLAY (priv->overlay), priv->scrolled_window);
@@ -9748,7 +9757,6 @@ nautilus_files_view_init (NautilusFilesView *view)
nautilus_application_set_accelerators (app, "view.zoom-standard", zoom_standard_accels);
nautilus_application_set_accelerator (app, "view.invert-selection", "<shift><control>i");
nautilus_application_set_accelerator (app, "view.preview-selection", "space");
- nautilus_application_set_accelerator (app, "view.popup-menu", "Menu");
priv->starred_cancellable = g_cancellable_new ();
priv->tag_manager = nautilus_tag_manager_get ();
diff --git a/src/nautilus-window.c b/src/nautilus-window.c
index af695ad0a..5890f4167 100644
--- a/src/nautilus-window.c
+++ b/src/nautilus-window.c
@@ -1821,6 +1821,15 @@ notebook_button_press_cb (GtkGestureMultiPress *gesture,
}
}
+static gboolean
+notebook_popup_menu_cb (GtkWidget *widget,
+ gpointer user_data)
+{
+ NautilusWindow *window = user_data;
+ notebook_popup_menu_show (window, 0, 0);
+ return TRUE;
+}
+
GtkWidget *
nautilus_window_get_toolbar (NautilusWindow *window)
{
@@ -1938,6 +1947,9 @@ notebook_create_window_cb (GtkNotebook *notebook,
static void
setup_notebook (NautilusWindow *window)
{
+ g_signal_connect (window->notebook, "popup-menu",
+ G_CALLBACK (notebook_popup_menu_cb),
+ window);
g_signal_connect (window->notebook, "switch-page",
G_CALLBACK (notebook_switch_page_cb),
window);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]