[connections/wip/fullscreen] topbar: Add fullscreen menu option while in display view



commit 3c8f0e944f13684b5dfbbd1730cd8dda5b737e54
Author: Felipe Borges <felipeborges gnome org>
Date:   Wed May 12 10:42:25 2021 +0200

    topbar: Add fullscreen menu option while in display view
    
    This is an alternative to the F11 keyboard shortcut.

 src/topbar.vala  | 12 +++++++++++-
 src/ui/topbar.ui |  4 ++++
 2 files changed, 15 insertions(+), 1 deletion(-)
---
diff --git a/src/topbar.vala b/src/topbar.vala
index a3170d6..2ae4e7b 100644
--- a/src/topbar.vala
+++ b/src/topbar.vala
@@ -31,8 +31,9 @@ namespace Connections {
 
         private weak Connections.Connection connection;
         private const GLib.ActionEntry[] action_entries = {
-            {"properties", properties_activated},
             {"take_screenshot", take_screenshot_activated},
+            {"fullscreen", fullscreen_activated},
+            {"properties", properties_activated},
         };
 
         private const GLib.ActionEntry[] key_input_action_entries = {
@@ -56,6 +57,10 @@ namespace Connections {
             var action = action_group.lookup_action ("take_screenshot") as GLib.SimpleAction;
             action.set_enabled (true);
 
+            section.append (_("Fullscreen"), "display.fullscreen");
+            action = action_group.lookup_action ("fullscreen") as GLib.SimpleAction;
+            action.set_enabled (true);
+
             section.append (_("Properties"), "display.properties");
             action = action_group.lookup_action ("properties") as GLib.SimpleAction;
             action.set_enabled (true);
@@ -77,6 +82,11 @@ namespace Connections {
                 connection.take_screenshot.begin ();
         }
 
+        private void fullscreen_activated () {
+            Application.application.main_window.fullscreened =
+                !Application.application.main_window.fullscreened;
+        }
+
         [GtkCallback]
         private void add_new_connection_button_clicked () {
             (new Connections.Assistant (Application.application.main_window)).run ();
diff --git a/src/ui/topbar.ui b/src/ui/topbar.ui
index 71048a0..32c96bf 100644
--- a/src/ui/topbar.ui
+++ b/src/ui/topbar.ui
@@ -211,6 +211,10 @@
         <attribute name="action">display.take_screenshot</attribute>
         <attribute name="label" translatable="yes">Take Screenshot</attribute>
       </item>
+      <item>
+        <attribute name="action">display.fullscreen</attribute>
+        <attribute name="label" translatable="yes">Fullscreen</attribute>
+      </item>
       <item>
         <attribute name="action">display.properties</attribute>
         <attribute name="label" translatable="yes">Properties</attribute>


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