New option --no-unique
authorJohn Darrington <john@darrington.wattle.id.au>
Sat, 13 Aug 2016 06:25:03 +0000 (08:25 +0200)
committerJohn Darrington <john@darrington.wattle.id.au>
Sat, 13 Aug 2016 06:25:03 +0000 (08:25 +0200)
src/ui/gui/main.c

index c860a077618500eb34ce0b18d2541acff2adf569..6b908e0fe7a293b7a5bdfcbbfe35d47ac614b8bc 100644 (file)
@@ -57,8 +57,8 @@ show_version_and_exit ()
 
   return TRUE;
 }
-\f
 
+\f
 
 gboolean
 init_prepare (GSource * source, gint * timeout_)
@@ -139,20 +139,29 @@ static gint
 on_local_options (GApplication * application,
                   GVariantDict * options, gpointer user_data)
 {
-  GVariant *b;
-
-  b =
-    g_variant_dict_lookup_value (options, "no-splash",
-                                 G_VARIANT_TYPE_BOOLEAN);
-  if (b)
-    {
+  {
+    GVariant *b =
+      g_variant_dict_lookup_value (options, "no-unique",
+                                  G_VARIANT_TYPE_BOOLEAN);
+    if (b)
+      {
+       GApplicationFlags flags =  g_application_get_flags (application);
+       flags |= G_APPLICATION_NON_UNIQUE;
+       g_application_set_flags (application, flags);
+       g_variant_unref (b);
+      }
+  }
+  {
+    GVariant *b =
+      g_variant_dict_lookup_value (options, "no-splash",
+                                  G_VARIANT_TYPE_BOOLEAN);
+    if (b)
       g_variant_unref (b);
-    }
-  else
-    {
+    else
       start_time = g_get_monotonic_time ();
-    }
+  }
 
+  
   return -1;
 }
 
@@ -271,6 +280,8 @@ main (int argc, char *argv[])
   GOptionEntry oe[] = {
     {"no-splash", 'q', G_OPTION_FLAG_NONE, G_OPTION_ARG_NONE, NULL,
       N_("Do not display the splash screen"), 0},
+    {"no-unique", 'n', G_OPTION_FLAG_NONE, G_OPTION_ARG_NONE, NULL,
+      N_("Do not attempt single instance negotiation"), 0},
     {NULL}
   };