From 2dd6c47a83afef6b9317e7605e825f223f1d2e0f Mon Sep 17 00:00:00 2001 From: John Darrington Date: Sat, 13 Aug 2016 08:25:03 +0200 Subject: [PATCH] New option --no-unique --- src/ui/gui/main.c | 35 +++++++++++++++++++++++------------ 1 file changed, 23 insertions(+), 12 deletions(-) diff --git a/src/ui/gui/main.c b/src/ui/gui/main.c index c860a07761..6b908e0fe7 100644 --- a/src/ui/gui/main.c +++ b/src/ui/gui/main.c @@ -57,8 +57,8 @@ show_version_and_exit () return TRUE; } - + 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} }; -- 2.30.2