[totem/wip/hadess/more-shortcuts: 1/4] main: Add F10 menu shortcut in browse view




commit 71222a669a822f3b68a0062c82be7f889d206e4e
Author: Bastien Nocera <hadess hadess net>
Date:   Thu Feb 17 13:09:33 2022 +0100

    main: Add F10 menu shortcut in browse view

 src/totem-menu.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)
---
diff --git a/src/totem-menu.c b/src/totem-menu.c
index 4cb99b17f..143d01c94 100644
--- a/src/totem-menu.c
+++ b/src/totem-menu.c
@@ -37,6 +37,16 @@
 
 #include "totem-profile.h"
 
+static void
+main_menu_cb (GSimpleAction *action,
+             GVariant      *parameter,
+             gpointer       user_data)
+{
+       TotemObject *totem = user_data;
+       gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (totem->main_menu_button),
+                                     !gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON 
(totem->main_menu_button)));
+}
+
 static void
 open_action_cb (GSimpleAction *action,
                GVariant      *parameter,
@@ -302,6 +312,7 @@ remote_command_cb (GSimpleAction *action,
 
 static GActionEntry app_entries[] = {
        /* Main app menu */
+       { "main-menu", main_menu_cb, NULL, NULL, NULL },
        { "open", open_action_cb, NULL, NULL, NULL },
        { "open-location", open_location_action_cb, NULL, NULL, NULL },
        { "fullscreen", toggle_action_cb, NULL, "false", fullscreen_change_state },
@@ -354,6 +365,8 @@ totem_app_menu_setup (Totem *totem)
        };
 
        /* FIXME: https://gitlab.gnome.org/GNOME/glib/issues/700 */
+       accels[0] = "F10";
+       gtk_application_set_accels_for_action (GTK_APPLICATION (totem), "app.main-menu", (const char * const 
*) accels);
        accels[0] = "<Primary>G";
        gtk_application_set_accels_for_action (GTK_APPLICATION (totem), "app.next-angle", (const char * const 
*) accels);
        accels[0] = "<Primary>M";


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]