[geary] Add -q/--quit command line options. Fixes Bug 730537.



commit 65c5363a0657cc706d670966941013e2a6dcc492
Author: Michael James Gratton <mike vee net>
Date:   Sun Sep 25 01:46:36 2016 +1000

    Add -q/--quit command line options. Fixes Bug 730537.
    
    * src/client/application/geary-args.vala (Args): Add a quit var and arg.
    
    * src/client/application/geary-application.vala
      (GearyApplication::local_command_line): If quit was present, send the
      quit action.

 src/client/application/geary-application.vala |   20 +++++++++++++-------
 src/client/application/geary-args.vala        |    2 ++
 2 files changed, 15 insertions(+), 7 deletions(-)
---
diff --git a/src/client/application/geary-application.vala b/src/client/application/geary-application.vala
index 3f5f516..e4869e7 100644
--- a/src/client/application/geary-application.vala
+++ b/src/client/application/geary-application.vala
@@ -122,13 +122,19 @@ public class GearyApplication : Gtk.Application {
             exit_status = 1;
             return true;
         }
-        
-        activate();
-        foreach (unowned string arg in args) {
-            if (arg != null && arg == Geary.ComposedEmail.MAILTO_SCHEME)
-                activate_action(ACTION_COMPOSE, null);
-            else if (arg != null && arg.has_prefix(Geary.ComposedEmail.MAILTO_SCHEME))
-                activate_action(ACTION_MAILTO, new Variant.string(arg));
+
+        if (!Args.quit) {
+            activate();
+            foreach (unowned string arg in args) {
+                if (arg != null) {
+                    if (arg == Geary.ComposedEmail.MAILTO_SCHEME)
+                        activate_action(ACTION_COMPOSE, null);
+                    else if (arg.has_prefix(Geary.ComposedEmail.MAILTO_SCHEME))
+                        activate_action(ACTION_MAILTO, new Variant.string(arg));
+                }
+            }
+        } else {
+            activate_action(ACTION_QUIT, null);
         }
 
         exit_status = 0;
diff --git a/src/client/application/geary-args.vala b/src/client/application/geary-args.vala
index 88c0840..ef4e226 100644
--- a/src/client/application/geary-args.vala
+++ b/src/client/application/geary-args.vala
@@ -24,6 +24,7 @@ private const OptionEntry[] options = {
     { "log-folder-normalization", 0, 0, OptionArg.NONE, ref log_folder_normalization, N_("Log folder 
normalization"), null },
     { "inspector", 'i', 0, OptionArg.NONE, ref inspector, N_("Allow inspection of WebView"), null },
     { "revoke-certs", 0, 0, OptionArg.NONE, ref revoke_certs, N_("Revoke all server certificates with TLS 
warnings"), null },
+    { "quit", 'q', 0, OptionArg.NONE, ref quit, N_("Perform a graceful quit."), null },
     { "version", 'V', 0, OptionArg.NONE, ref version, N_("Display program version"), null },
     { null }
 };
@@ -39,6 +40,7 @@ public bool log_periodic = false;
 public bool log_sql = false;
 public bool log_folder_normalization = false;
 public bool inspector = false;
+public bool quit = false;
 public bool revoke_certs = false;
 public bool version = false;
 


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