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



commit 500675536f8f93b928c6b547667c1d4acb68d54e
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-headermenu.ui | 74 ++++++++++++++++++++++++++++++++++++++++++++++
 src/terminal-window.c      | 12 ++++++++
 2 files changed, 86 insertions(+)
---
diff --git a/src/terminal-headermenu.ui b/src/terminal-headermenu.ui
index 2b06ca3b..5731003f 100644
--- a/src/terminal-headermenu.ui
+++ b/src/terminal-headermenu.ui
@@ -17,12 +17,86 @@
 -->
 <interface>
   <menu id="headermenu">
+    <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>
       <item>
         <attribute name="label" translatable="yes">New _Window</attribute>
         <attribute name="action">win.new-terminal</attribute>
         <attribute name="target" type="(ss)">('window', 'current')</attribute>
       </item>
+      <item>
+        <attribute name="label" translatable="yes">_Full Screen</attribute>
+        <attribute name="action">win.enter-fullscreen</attribute>
+      </item>
+      <submenu>
+        <attribute name="label" translatable="yes">_Set Size</attribute>
+        <section>
+          <item>
+            <attribute name="label" translatable="yes">_1. 80×24</attribute>
+            <attribute name="action">win.size-to</attribute>
+            <attribute name="target" type="(uu)">(80, 24)</attribute>
+          </item>
+          <item>
+            <attribute name="label" translatable="yes">_2. 80×43</attribute>
+            <attribute name="action">win.size-to</attribute>
+            <attribute name="target" type="(uu)">(80, 43)</attribute>
+          </item>
+          <item>
+            <attribute name="label" translatable="yes">_3. 132×24</attribute>
+            <attribute name="action">win.size-to</attribute>
+            <attribute name="target" type="(uu)">(132, 24)</attribute>
+          </item>
+          <item>
+            <attribute name="label" translatable="yes">_4. 132×43</attribute>
+            <attribute name="action">win.size-to</attribute>
+            <attribute name="target" type="(uu)">(132, 43)</attribute>
+          </item>
+        </section>
+      </submenu>
+      <submenu>
+        <attribute name="label" translatable="yes">_Advanced</attribute>
+        <section>
+          <item>
+            <attribute name="label" translatable="yes">Read-_Only</attribute>
+            <attribute name="action">win.read-only</attribute>
+          </item>
+        </section>
+        <section>
+          <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>
+        </section>
+        <section>
+          <item>
+            <attribute name="label" translatable="yes">_Inspector</attribute>
+            <attribute name="action">win.inspector</attribute>
+            <attribute name="hidden-when">action-disabled</attribute>
+          </item>
+        </section>
+      </submenu>
     </section>
     <section>
       <item>
diff --git a/src/terminal-window.c b/src/terminal-window.c
index c5f5ee63..e86a2983 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,
@@ -2046,6 +2057,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]