[gnome-terminal/wip/fmuellner/headerbar: 6/6] window: Expose more actions in primary menu



commit 08415713bc3c3560f6b0ef17091aa7d738cd4f80
Author: Florian Müllner <fmuellner gnome org>
Date:   Fri Nov 2 01:08:56 2018 +0100

    window: Expose more actions in primary menu
    
    Unlike the old app menu, the primary window menu doesn't have to limit
    itself to infrequently used application actions. So expose a couple
    more of the available actions, so that the headerbar can fully replace
    the traditional menubar for the majority of users.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=756798

 src/terminal-app.c          |  4 ++++
 src/terminal-primarymenu.ui | 45 +++++++++++++++++++++++++++++++++++++++++++++
 src/terminal-window.c       | 12 ++++++++++++
 3 files changed, 61 insertions(+)
---
diff --git a/src/terminal-app.c b/src/terminal-app.c
index 06fa3bc3..f11b57a3 100644
--- a/src/terminal-app.c
+++ b/src/terminal-app.c
@@ -649,6 +649,10 @@ terminal_app_startup (GApplication *application)
                                                                         "new-terminal-section");
   fill_new_terminal_section (app, winmenu_new_terminal_section, NULL, 0); /* no submenu */
 
+  GMenu *winmenu_encoding_submenu = gtk_application_get_menu_by_id (gtk_application,
+                                                                    "set-encoding-submenu");
+  terminal_encodings_append_menu (winmenu_encoding_submenu);
+
   /* Menubar */
   /* If the menubar is shown by the shell, omit mnemonics for the submenus. This is because Alt+F etc.
    * are more important to be usable in the terminal, the menu cannot be replaced runtime (to toggle
diff --git a/src/terminal-primarymenu.ui b/src/terminal-primarymenu.ui
index 8d8c0638..b53533e0 100644
--- a/src/terminal-primarymenu.ui
+++ b/src/terminal-primarymenu.ui
@@ -17,7 +17,52 @@
 -->
 <interface>
   <menu id="primary-menu">
+    <section>
+      <attribute name="display-hint">horizontal-buttons</attribute>
+      <item>
+        <attribute name="label" translatable="yes">Zoom _Out</attribute>
+        <attribute name="verb-icon">zoom-out-symbolic</attribute>
+        <attribute name="action">win.zoom-out</attribute>
+      </item>
+      <item>
+        <attribute name="label">100%</attribute>
+        <attribute name="action">win.zoom-normal</attribute>
+      </item>
+      <item>
+        <attribute name="label" translatable="yes">Zoom _In</attribute>
+        <attribute name="verb-icon">zoom-in-symbolic</attribute>
+        <attribute name="action">win.zoom-in</attribute>
+      </item>
+    </section>
     <section id="new-terminal-section" />
+    <section>
+      <item>
+        <attribute name="label" translatable="yes">_Fullscreen</attribute>
+        <attribute name="action">win.enter-fullscreen</attribute>
+      </item>
+      <submenu>
+        <attribute name="label" translatable="yes">_Advanced</attribute>
+        <section>
+          <submenu id="set-encoding-submenu">
+            <attribute name="label" translatable="yes">Set _Character Encoding</attribute>
+          </submenu>
+          <item>
+            <attribute name="label" translatable="yes">_Reset</attribute>
+            <attribute name="action">win.reset</attribute>
+            <attribute name="target" type="b">false</attribute>
+          </item>
+          <item>
+            <attribute name="label" translatable="yes">Reset and _Clear</attribute>
+            <attribute name="action">win.reset</attribute>
+            <attribute name="target" type="b">true</attribute>
+          </item>
+          <item>
+            <attribute name="label" translatable="yes">_Inspector</attribute>
+            <attribute name="action">win.inspector</attribute>
+          </item>
+        </section>
+      </submenu>
+    </section>
     <section>
       <item>
         <attribute name="label" translatable="yes">_Preferences</attribute>
diff --git a/src/terminal-window.c b/src/terminal-window.c
index 6f82b3eb..954aeb3a 100644
--- a/src/terminal-window.c
+++ b/src/terminal-window.c
@@ -1048,6 +1048,17 @@ action_copy_hyperlink_cb (GSimpleAction *action,
   gtk_clipboard_set_text (priv->clipboard, info->hyperlink, -1);
 }
 
+static void
+action_enter_fullscreen_cb (GSimpleAction *action,
+                            GVariant      *parameter,
+                            gpointer       user_data)
+{
+  TerminalWindow *window = user_data;
+
+  g_action_group_change_action_state (G_ACTION_GROUP (window), "fullscreen",
+                                      g_variant_new_boolean (TRUE));
+}
+
 static void
 action_leave_fullscreen_cb (GSimpleAction *action,
                             GVariant      *parameter,
@@ -2034,6 +2045,7 @@ terminal_window_init (TerminalWindow *window)
     { "copy-hyperlink",      action_copy_hyperlink_cb,   NULL,   NULL, NULL },
     { "copy-match",          action_copy_match_cb,       NULL,   NULL, NULL },
     { "edit-preferences",    action_edit_preferences_cb, NULL,   NULL, NULL },
+    { "enter-fullscreen",    action_enter_fullscreen_cb, NULL,   NULL, NULL },
     { "find",                action_find_cb,             NULL,   NULL, NULL },
     { "find-backward",       action_find_backward_cb,    NULL,   NULL, NULL },
     { "find-clear",          action_find_clear_cb,       NULL,   NULL, NULL },


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