[gedit] dbus service: use --gapplication-service



commit 016a3fc66fc6b3509f3d8ee7695bb3e6083eeddc
Author: Ryan Lortie <desrt desrt ca>
Date:   Fri Jan 10 09:32:31 2014 -0500

    dbus service: use --gapplication-service
    
    We have to parse this argument for ourselves because we do our own
    commandline argument handling.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=721892

 data/org.gnome.gedit.service.in |    2 +-
 gedit/gedit-app.c               |   16 ++++++++++++++++
 2 files changed, 17 insertions(+), 1 deletions(-)
---
diff --git a/data/org.gnome.gedit.service.in b/data/org.gnome.gedit.service.in
index 9e6d0af..cf5a5b2 100644
--- a/data/org.gnome.gedit.service.in
+++ b/data/org.gnome.gedit.service.in
@@ -1,3 +1,3 @@
 [D-BUS Service]
 Name=org.gnome.gedit
-Exec= bindir@/gedit
+Exec= bindir@/gedit --gapplication-service
diff --git a/gedit/gedit-app.c b/gedit/gedit-app.c
index 6d9a399..b7328df 100644
--- a/gedit/gedit-app.c
+++ b/gedit/gedit-app.c
@@ -97,6 +97,7 @@ static gboolean new_window = FALSE;
 static gboolean new_document = FALSE;
 static gchar *geometry = NULL;
 static gboolean wait = FALSE;
+static gboolean gapplication_service = FALSE;
 static gboolean standalone = FALSE;
 static gchar **remaining_args = NULL;
 static const GeditEncoding *encoding = NULL;
@@ -159,6 +160,14 @@ static const GOptionEntry options[] =
                N_("GEOMETRY")
        },
 
+       /* GApplication service mode */
+       {
+               "gapplication-service", '\0', 0, G_OPTION_ARG_NONE,
+               &gapplication_service,
+               N_("Enter GApplication service mode"),
+               NULL
+       },
+
        /* Wait for closing documents */
        {
                "wait", 'w', 0, G_OPTION_ARG_NONE,
@@ -954,6 +963,13 @@ gedit_app_local_command_line (GApplication   *application,
                *exit_status = 1;
                ret = TRUE;
        }
+       else if (gapplication_service)
+       {
+               GApplicationFlags old_flags;
+
+               old_flags = g_application_get_flags (application);
+               g_application_set_flags (application, old_flags | G_APPLICATION_IS_SERVICE);
+       }
        else if (version)
        {
                g_print ("%s - Version %s\n", g_get_application_name (), VERSION);


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