[connections/kbd-shortcuts: 5/7] window: Add Ctrl+Q shortcut to quit application




commit be2d98f5165abdc823634742dbde422943a0eb77
Author: Felipe Borges <felipeborges gnome org>
Date:   Tue Mar 16 13:39:19 2021 +0100

    window: Add Ctrl+Q shortcut to quit application
    
    Fixes #35

 src/application.vala | 11 +++++++++++
 1 file changed, 11 insertions(+)
---
diff --git a/src/application.vala b/src/application.vala
index 1dd8618..6417f67 100644
--- a/src/application.vala
+++ b/src/application.vala
@@ -50,6 +50,10 @@ namespace Connections {
             action = new GLib.SimpleAction ("about", null);
             action.activate.connect (show_about_dialog);
             add_action (action);
+
+            action = new GLib.SimpleAction ("quit", null);
+            action.activate.connect (quit_app);
+            add_action (action);
         }
 
         private void show_help () {
@@ -205,6 +209,13 @@ namespace Connections {
             }
         }
 
+        public void quit_app () {
+            foreach (var window in windows)
+                window.hide ();
+
+            quit ();
+        }
+
         static string[] opt_uris;
         static string opt_file_import_uri;
         const OptionEntry[] options = {


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