[polari] application: Add 'quit' command line option



commit b10e3b4386d685d086c9c3d17a4c6032dd36394d
Author: Will Burklund <waburklund gmail com>
Date:   Fri May 10 09:15:02 2019 -0500

    application: Add 'quit' command line option
    
    This provides a 'quit' command line option that exits background
    instances of Polari via the GApplication API.
    
    Closes https://gitlab.gnome.org/GNOME/polari/issues/20

 src/application.js | 9 +++++++++
 1 file changed, 9 insertions(+)
---
diff --git a/src/application.js b/src/application.js
index 67f2018..2e45ee1 100644
--- a/src/application.js
+++ b/src/application.js
@@ -52,6 +52,9 @@ var Application = GObject.registerClass({
         this.add_main_option('version', 0,
             GLib.OptionFlags.NONE, GLib.OptionArg.NONE,
             _('Print version and exit'), null);
+        this.add_main_option('quit', 0,
+            GLib.OptionFlags.NONE, GLib.OptionArg.NONE,
+            _('Quit'), null);
         this.connect('handle-local-options', (o, dict) => {
             let v = dict.lookup_value('version', null);
             if (v && v.get_boolean()) {
@@ -75,6 +78,12 @@ var Application = GObject.registerClass({
                 return 0;
             }
 
+            v = dict.lookup_value('quit', null);
+            if (v && v.get_boolean()) {
+                this.activate_action('quit', null);
+                return 0;
+            }
+
             return -1;
         });
     }


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