[rhythmbox] application: use G_APPLICATION_NON_UNIQUE to implement -n



commit e28b32f1b8bf91d027dc7515a51c187cab61d956
Author: Jonathan Matthew <jonathan d14n org>
Date:   Mon Sep 25 18:38:01 2017 +1000

    application: use G_APPLICATION_NON_UNIQUE to implement -n
    
    This seems to be much more useful than the previous approach, which
    just crashed on startup.

 shell/rb-application.c |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)
---
diff --git a/shell/rb-application.c b/shell/rb-application.c
index 0012f3c..7550f66 100644
--- a/shell/rb-application.c
+++ b/shell/rb-application.c
@@ -434,9 +434,8 @@ impl_local_command_line (GApplication *app, gchar ***args, int *exit_status)
        if (rb->priv->no_registration) {
                if (n_files > 0) {
                        g_warning ("Unable to open files on the commandline with --no-registration");
+                       n_files = 0;
                }
-               impl_startup (app);
-               return TRUE;
        }
 
        if (!g_application_register (app, NULL, &error)) {
@@ -662,7 +661,12 @@ rb_application_run (RBApplication *app, int argc, char **argv)
        else
                rb_debug_init (debug);
 
-       g_object_set (app, "register-session", !app->priv->no_registration, NULL);
+       if (app->priv->no_registration) {
+               GApplicationFlags flags;
+               g_object_get (app, "flags", &flags, NULL);
+               flags |= G_APPLICATION_NON_UNIQUE;
+               g_object_set (app, "flags", flags, NULL);
+       }
 
        return g_application_run (G_APPLICATION (app), nargc, nargv);
 }


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