[glib] GApplication: add G_APPLICATION_NON_UNIQUE
- From: Ryan Lortie <ryanl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib] GApplication: add G_APPLICATION_NON_UNIQUE
- Date: Sun, 10 Apr 2011 11:57:43 +0000 (UTC)
commit 9d204338f3e2a0eb7fb53eb7287040eb8d0f8589
Author: Ryan Lortie <desrt desrt ca>
Date: Sun Apr 10 07:51:55 2011 -0400
GApplication: add G_APPLICATION_NON_UNIQUE
Add a flag to essentially short-circuit g_application_register(). The
application makes no attempt to acquire the bus name or check for
existing instances with that name. The application is never considered
as being 'remote' and all requests are handled locally.
Closes #646985.
gio/gapplication.c | 19 +++++++++++--------
gio/gioenums.h | 9 ++++++++-
2 files changed, 19 insertions(+), 9 deletions(-)
---
diff --git a/gio/gapplication.c b/gio/gapplication.c
index 7a97fef..c37c3db 100644
--- a/gio/gapplication.c
+++ b/gio/gapplication.c
@@ -1006,14 +1006,17 @@ g_application_register (GApplication *application,
if (!application->priv->is_registered)
{
- application->priv->impl =
- g_application_impl_register (application, application->priv->id,
- application->priv->flags,
- &application->priv->remote_actions,
- cancellable, error);
-
- if (application->priv->impl == NULL)
- return FALSE;
+ if (~application->priv->flags & G_APPLICATION_NON_UNIQUE)
+ {
+ application->priv->impl =
+ g_application_impl_register (application, application->priv->id,
+ application->priv->flags,
+ &application->priv->remote_actions,
+ cancellable, error);
+
+ if (application->priv->impl == NULL)
+ return FALSE;
+ }
application->priv->is_remote = application->priv->remote_actions != NULL;
application->priv->is_registered = TRUE;
diff --git a/gio/gioenums.h b/gio/gioenums.h
index 0989799..01bab21 100644
--- a/gio/gioenums.h
+++ b/gio/gioenums.h
@@ -1265,6 +1265,11 @@ typedef enum
* when editing a git commit message. The environment is available
* to the #GApplication::command-line signal handler, via
* g_application_command_line_getenv().
+ * @G_APPLICATION_NON_UNIQUE: Make no attempts to do any of the typical
+ * single-instance application negotiation. The application neither
+ * attempts to become the owner of the application ID nor does it
+ * check if an existing owner already exists. Everything occurs in
+ * the local process. Since: 2.30.
*
* Flags used to define the behaviour of a #GApplication.
*
@@ -1278,7 +1283,9 @@ typedef enum
G_APPLICATION_HANDLES_OPEN = (1 << 2),
G_APPLICATION_HANDLES_COMMAND_LINE = (1 << 3),
- G_APPLICATION_SEND_ENVIRONMENT = (1 << 4)
+ G_APPLICATION_SEND_ENVIRONMENT = (1 << 4),
+
+ G_APPLICATION_NON_UNIQUE = (1 << 5),
} GApplicationFlags;
/**
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]