[glib/wip/gapplication] [GApplication] Rework to avoid _try_new; return a stub proxy class for remoting
- From: Colin Walters <walters src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib/wip/gapplication] [GApplication] Rework to avoid _try_new; return a stub proxy class for remoting
- Date: Tue, 18 May 2010 22:10:29 +0000 (UTC)
commit 719cb78a192bbc509c14abec8354e248d21037ae
Author: Colin Walters <walters verbum org>
Date: Tue May 18 13:41:29 2010 -0400
[GApplication] Rework to avoid _try_new; return a stub proxy class for remoting
gio/gapplication.c | 388 ++++++++++++++++++++---------------------------
gio/gapplication.h | 45 +-----
gio/gio.symbols | 5 +-
gio/gunixapplication.c | 37 +++--
gio/tests/application.c | 2 +-
5 files changed, 194 insertions(+), 283 deletions(-)
---
diff --git a/gio/gapplication.c b/gio/gapplication.c
index 44c851a..88f502e 100644
--- a/gio/gapplication.c
+++ b/gio/gapplication.c
@@ -48,7 +48,9 @@ enum
{
PROP_0,
- PROP_APPID
+ PROP_APPID,
+ PROP_DEFAULT_EXIT,
+ PROP_IS_REMOTE
};
enum
@@ -73,19 +75,25 @@ struct _GApplicationPrivate
GHashTable *actions; /* name -> GApplicationAction */
GMainLoop *mainloop;
+ gboolean default_exit : 1;
+ gboolean is_remote : 1;
+
guint actions_changed_id;
#ifdef G_OS_UNIX
GDBusConnection *session_bus;
- GDBusProxy *session_bus_proxy;
#endif
};
-static GApplication *application_instance = NULL;
+GApplication *primary_application = NULL;
+static GHashTable *instances_for_appid = NULL;
static void _g_application_platform_init (GApplication *app);
static gboolean _g_application_platform_acquire_single_instance (const char *appid,
GError **error);
+static void _g_application_platform_remote_invoke_action (GApplication *app,
+ const char *action,
+ guint timestamp);
static void _g_application_platform_default_exit (void) G_GNUC_NORETURN;
static void _g_application_platform_on_actions_changed (GApplication *app);
@@ -93,6 +101,23 @@ static void _g_application_platform_on_actions_changed (GApplication *
#include "gunixapplication.c"
#endif
+static gpointer
+init_appid_statics (gpointer data)
+{
+ instances_for_appid = g_hash_table_new (g_str_hash, g_str_equal);
+ return NULL;
+}
+
+static GApplication *
+application_for_appid (const char *appid)
+{
+ static GOnce appid_once = G_ONCE_INIT;
+
+ g_once (&appid_once, init_appid_statics, NULL);
+
+ return g_hash_table_lookup (instances_for_appid, appid);
+}
+
static gboolean
g_application_default_quit (GApplication *application,
guint timestamp)
@@ -106,9 +131,10 @@ g_application_default_quit (GApplication *application,
static void
g_application_default_run (GApplication *application)
{
- GMainLoop *mainloop = g_application_get_mainloop (application);
+ if (application->priv->mainloop == NULL)
+ application->priv->mainloop = g_main_loop_new (NULL, TRUE);
- g_main_loop_run (mainloop);
+ g_main_loop_run (application->priv->mainloop);
}
static gboolean
@@ -146,204 +172,29 @@ g_application_action_free (gpointer data)
}
}
-/**
- * g_application_try_newv:
- * @flags: Application flags
- * @type: Actual GObject class type to instantiate
- * @on_other_process_exists: (scope call) (allow-none): Called if this
- * application is already running
- * @user_data: (closure): User data
- * @n_parameters: Number of object construction parameters
- * @args: (array length=n_parameters): Object construction parameters
- *
- * Attempt to create an application instance. If the application is
- * already running in another process, then call @on_other_process_exists.
- * The default if @on_other_process_exists is %NULL will terminate the
- * current process.
- *
- * This function is defined to call g_type_init() as its very first
- * action.
- *
- * If called multiple times, this function will return the extant
- * application instance.
- *
- * Returns: (transfer full): The application instance
- *
- * Since: 2.26
- */
-GApplication *
-g_application_try_newv (GApplicationFlags flags,
- GType class_type,
- GApplicationExistsCallback on_other_process_exists,
- gpointer user_data,
- guint n_parameters,
- GParameter *parameters)
-{
- if (application_instance != NULL)
- return g_object_ref (application_instance);
-
- g_type_init ();
-
- if (!(flags & G_APPLICATION_DISABLE_SINGLE_INSTANCE))
- {
- if (!_g_application_platform_acquire_single_instance (g_value_get_string (¶meters[0].value), NULL))
- {
- if (on_other_process_exists)
- on_other_process_exists (user_data);
- else
- _g_application_platform_default_exit ();
- }
- }
-
- return G_APPLICATION (g_object_newv (class_type, n_parameters, parameters));
-}
/**
* g_application_new:
- * @appid: (allow-none): System-dependent application identifier
- * @flags: Initialization flags
+ * @appid: System-dependent application identifier
*
- * Create a new #GApplication, or if one has already been initialized,
- * return the existing instance. If the application is already running
- * in another process, this function will terminate the current process.
+ * Create a new #GApplication, or if one has already been initialized
+ * for the given @appid, return the existing instance. If the
+ * application is already running in another process, this function
+ * will initiate an platform-specific action such as bringing any
+ * graphics windows associated with the application to the foreground.
*
* This function is defined to call g_type_init() as its very first
* action.
*
- * If called multiple times, this function will return the extant
- * application instance.
- *
* Returns: (transfer full): An application instance
*/
-GApplication*
-g_application_new (const char *appid,
- GApplicationFlags flags)
+GApplication *
+g_application_new (const char *appid)
{
- GApplication *app;
- GParameter parameters = { NULL, };
-
g_type_init ();
-
- g_return_val_if_fail (application_instance == NULL, NULL);
-
- parameters.name = "appid";
-
- g_value_init (¶meters.value, G_TYPE_STRING);
- g_value_set_string (¶meters.value, appid);
-
- app = g_application_try_newv (flags, G_TYPE_APPLICATION,
- NULL, NULL,
- 1,
- ¶meters);
-
- g_value_unset (¶meters.value);
-
- return app;
+ return g_object_new (G_TYPE_APPLICATION, "appid", appid, NULL);
}
-/**
- * g_application_try_new:
- * @flags: Application flags
- * @type: Actual GObject class type to instantiate
- * @on_other_process_exists: (scope call) (allow-none): Called if this
- * application is already running
- * @user_data: (closure): User data
- * @first_property_name: the name of the property
- * @var_args: the value for the property name, followed by a list of
- * pairs of property names and values, terminated by %NULL
- *
- * Attempt to create an application instance. If the application is
- * already running in another process, then call @on_other_process_exists.
- * The default if @on_other_process_exists is %NULL will terminate the
- * current process.
- *
- * This function is defined to call g_type_init() as its very first
- * action.
- *
- * If called multiple times, this function will return the extant
- * application instance.
- *
- * This function is the variadic arguments version of g_application_try_newv()
- * and it's meant as a convenience function for the C API. Bindings should
- * use the array-based function instead.
- *
- * Returns: (transfer full): The application instance
- *
- * Since: 2.26
- */
-GApplication *
-g_application_try_new (GApplicationFlags flags,
- GType class_type,
- GApplicationExistsCallback on_other_process_exists,
- gpointer user_data,
- const char *first_property_name,
- ...)
-{
- GApplication *retval;
- GObjectClass *class;
- GParameter *params;
- const gchar *name;
- va_list args;
- gint n_alloced_params = 16, n_params;
-
- va_start (args, first_property_name);
-
- class = g_type_class_ref (class_type);
-
- params = g_new0 (GParameter, n_alloced_params);
- name = first_property_name;
- while (name != NULL)
- {
- gchar *error = NULL;
- GParamSpec *pspec = g_object_class_find_property (class, name);
- if (pspec == NULL)
- {
- g_warning ("%s: object class `%s' has no property named `%s'",
- G_STRFUNC,
- g_type_name (class_type),
- name);
- break;
- }
-
- if (n_params >= n_alloced_params)
- {
- n_alloced_params += 16;
- params = g_renew (GParameter, params, n_alloced_params);
- }
-
- params[n_params].name = name;
- G_VALUE_COLLECT_INIT (¶ms[n_params].value, pspec->value_type,
- args,
- 0,
- &error);
- if (error)
- {
- g_warning ("%s: %s", G_STRFUNC, error);
- g_free (error);
- g_value_unset (¶ms[n_params].value);
- break;
- }
-
- n_params += 1;
-
- name = va_arg (args, gchar*);
- }
-
- retval = g_application_try_newv (flags, class_type,
- on_other_process_exists, user_data,
- n_params, params);
-
- while (n_params--)
- g_value_unset (¶ms[n_params].value);
-
- g_free (params);
-
- g_type_class_unref (class);
-
- va_end (args);
-
- return retval;
-}
/**
* g_application_add_action:
@@ -371,6 +222,7 @@ g_application_add_action (GApplication *application,
g_return_if_fail (G_IS_APPLICATION (application));
g_return_if_fail (name != NULL && *name != '\0');
+ g_return_if_fail (!application->priv->is_remote);
priv = application->priv;
@@ -402,6 +254,7 @@ g_application_remove_action (GApplication *application,
g_return_if_fail (G_IS_APPLICATION (application));
g_return_if_fail (name != NULL && *name != '\0');
+ g_return_if_fail (!application->priv->is_remote);
priv = application->priv;
@@ -420,8 +273,14 @@ g_application_remove_action (GApplication *application,
*
* Invokes the action @name of the passed #GApplication.
*
- * If the action exists and is enabled, the #GApplication::action
- * signal will be emitted.
+ * This function has different behavior depending on whether @application
+ * is acting as a proxy for another process. In the normal case where
+ * the current process is hosting the application, and the specified
+ * action exists and is enabled, the #GApplication::action signal will be emitted.
+ *
+ * If @application is a proxy, then the specified action will be invoked
+ * in the remote process. It is not necessary to call g_application_add_action()
+ * in the current process in order to invoke one remotely.
*
* Since: 2.26
*/
@@ -438,6 +297,12 @@ g_application_invoke_action (GApplication *application,
priv = application->priv;
+ if (priv->is_remote)
+ {
+ _g_application_platform_remote_invoke_action (application, name, timestamp);
+ return;
+ }
+
action = g_hash_table_lookup (priv->actions, name);
g_return_if_fail (action != NULL);
if (!action->enabled)
@@ -471,6 +336,7 @@ g_application_list_actions (GApplication *application)
gint i;
g_return_val_if_fail (G_IS_APPLICATION (application), NULL);
+ g_return_val_if_fail (!application->priv->is_remote, NULL);
priv = application->priv;
@@ -509,6 +375,7 @@ g_application_set_action_enabled (GApplication *application,
g_return_if_fail (G_IS_APPLICATION (application));
g_return_if_fail (name != NULL);
+ g_return_if_fail (!application->priv->is_remote);
enabled = !!enabled;
@@ -529,18 +396,21 @@ g_application_set_action_enabled (GApplication *application,
* @name: Action name
*
* Returns: Description for the given action named @name
+ *
+ * Since: 2.26
*/
-void
+G_CONST_RETURN gchar *
g_application_get_action_description (GApplication *application,
- const char *name)
+ const char *name)
{
GApplicationAction *action;
- g_return_if_fail (G_IS_APPLICATION (application));
- g_return_if_fail (name != NULL);
+ g_return_val_if_fail (G_IS_APPLICATION (application), NULL);
+ g_return_val_if_fail (name != NULL, NULL);
+ g_return_val_if_fail (!application->priv->is_remote, NULL);
action = g_hash_table_lookup (application->priv->actions, name);
- g_return_if_fail (action != NULL);
+ g_return_val_if_fail (action != NULL, NULL);
return action->description;
}
@@ -567,6 +437,7 @@ g_application_get_action_enabled (GApplication *application,
g_return_val_if_fail (G_IS_APPLICATION (application), FALSE);
g_return_val_if_fail (name != NULL, FALSE);
+ g_return_val_if_fail (!application->priv->is_remote, FALSE);
action = g_hash_table_lookup (application->priv->actions, name);
g_return_val_if_fail (action != NULL, FALSE);
@@ -589,6 +460,7 @@ void
g_application_run (GApplication *application)
{
g_return_if_fail (G_IS_APPLICATION (application));
+ g_return_if_fail (!application->priv->is_remote);
G_APPLICATION_GET_CLASS (application)->run (application);
}
@@ -614,6 +486,7 @@ g_application_quit (GApplication *application,
gboolean retval = FALSE;
g_return_val_if_fail (G_IS_APPLICATION (application), FALSE);
+ g_return_val_if_fail (!application->priv->is_remote, FALSE);
g_signal_emit (application, application_signals[QUIT], 0, timestamp, &retval);
@@ -623,15 +496,17 @@ g_application_quit (GApplication *application,
/**
* g_application_get_instance:
*
- * Retrieves the singleton instance of #GApplication
+ * In the normal case where there is exactly one #GApplication instance
+ * in this process, return that instance. If there are multiple, the
+ * first one created will be returned. Otherwise, return %NULL.
*
- * Returns: (transfer none): The singleton instance of #GApplication,
+ * Returns: (transfer none): The primary instance of #GApplication,
* or %NULL if none is set
*/
GApplication *
g_application_get_instance (void)
{
- return application_instance;
+ return primary_application;
}
/**
@@ -654,29 +529,17 @@ g_application_get_id (GApplication *application)
}
/**
- * g_application_get_mainloop:
+ * g_application_is_remote:
* @application: a #GApplication
*
- * Retrieves the #GMainLoop associated with the #GApplication
- *
- * Return value: (transfer none): The #GMainLoop associated with
- * this application
- *
- * Since: 2.26
- */
-GMainLoop *
-g_application_get_mainloop (GApplication *application)
+ * Returns: %TRUE if this object represents a proxy for a remote application.
+ */
+gboolean
+g_application_is_remote (GApplication *application)
{
- GApplicationPrivate *priv;
-
- g_return_val_if_fail (G_IS_APPLICATION (application), NULL);
-
- priv = application->priv;
-
- if (priv->mainloop == NULL)
- priv->mainloop = g_main_loop_new (NULL, TRUE);
+ g_return_val_if_fail (G_IS_APPLICATION (application), FALSE);
- return priv->mainloop;
+ return application->priv->is_remote;
}
static void
@@ -689,6 +552,7 @@ g_application_init (GApplication *app)
app->priv->actions = g_hash_table_new_full (g_str_hash, g_str_equal,
NULL,
g_application_action_free);
+ app->priv->default_exit = TRUE;
_g_application_platform_init (app);
}
@@ -706,6 +570,14 @@ g_application_get_property (GObject *object,
g_value_set_string (value, g_application_get_id (app));
break;
+ case PROP_DEFAULT_EXIT:
+ g_value_set_boolean (value, app->priv->default_exit);
+ break;
+
+ case PROP_IS_REMOTE:
+ g_value_set_boolean (value, g_application_is_remote (app));
+ break;
+
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
}
@@ -725,6 +597,10 @@ g_application_set_property (GObject *object,
app->priv->appid = g_value_dup_string (value);
break;
+ case PROP_DEFAULT_EXIT:
+ app->priv->default_exit = g_value_get_boolean (value);
+ break;
+
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
}
@@ -735,15 +611,50 @@ g_application_constructor (GType type,
guint n_construct_properties,
GObjectConstructParam *construct_params)
{
+ GApplication *app;
GObject *object;
-
- if (application_instance != NULL)
- return G_OBJECT (g_object_ref (application_instance));
+ guint i;
+ const char *appid = NULL;
+ gboolean default_quit = TRUE;
+ gboolean is_remote;
+
+ for (i = 0; i < n_construct_properties; i++)
+ {
+ GObjectConstructParam *param = &construct_params[i];
+ if (strcmp (param->pspec->name, "appid") == 0)
+ appid = g_value_get_string (param->value);
+ else if (strcmp (param->pspec->name, "default-quit") == 0)
+ default_quit = g_value_get_boolean (param->value);
+ }
+
+ if (appid == NULL)
+ {
+ g_error ("Missing mandatory \"appid\" parameter for GApplication constructor");
+ return NULL;
+ }
+ is_remote = FALSE;
+ if (!_g_application_platform_acquire_single_instance (appid, NULL))
+ {
+ if (default_quit)
+ _g_application_platform_default_exit ();
+ else
+ is_remote = TRUE;
+ }
+
+ app = application_for_appid (appid);
+ if (app != NULL)
+ return g_object_ref (app);
+
object = (* G_OBJECT_CLASS (g_application_parent_class)->constructor) (type,
n_construct_properties,
construct_params);
- application_instance = G_APPLICATION (object);
+ app = G_APPLICATION (object);
+ app->priv->is_remote = is_remote;
+
+ if (primary_application == NULL)
+ primary_application = app;
+ g_hash_table_insert (instances_for_appid, g_strdup (appid), app);
return object;
}
@@ -801,6 +712,39 @@ g_application_class_init (GApplicationClass *klass)
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY |
G_PARAM_STATIC_STRINGS));
+
+ /**
+ * GApplication:default-exit:
+ *
+ * By default, if a different process is running this application, the
+ * process will be exited. Set this property to %FALSE to allow custom
+ * interaction with the remote process.
+ *
+ */
+ g_object_class_install_property (gobject_class,
+ PROP_DEFAULT_EXIT,
+ g_param_spec_boolean ("default-exit",
+ P_("Default Exit"),
+ P_("Exit the process by default"),
+ TRUE,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT_ONLY |
+ G_PARAM_STATIC_STRINGS));
+
+ /**
+ * GApplication:is-remote:
+ *
+ * This property is %TRUE if this application instance represents a proxy
+ * to the instance of this application in another process.
+ *
+ */
+ g_object_class_install_property (gobject_class,
+ PROP_IS_REMOTE,
+ g_param_spec_boolean ("is-remote",
+ P_("Is Remote"),
+ P_("Whether this application is a proxy for another process"),
+ FALSE,
+ G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
}
#define __G_APPLICATION_C__
diff --git a/gio/gapplication.h b/gio/gapplication.h
index aa571fc..768ff6f 100644
--- a/gio/gapplication.h
+++ b/gio/gapplication.h
@@ -45,32 +45,6 @@ typedef struct _GApplicationPrivate GApplicationPrivate;
typedef struct _GApplicationClass GApplicationClass;
/**
- * GApplicationExistsCallback:
- * @user_data: data passed to the callback
- *
- * Function called by g_application_try_new() if an existing instance of
- * #GApplication with the same name already exists
- *
- * Since: 2.26
- */
-typedef void (* GApplicationExistsCallback) (gpointer user_data);
-
-/**
- * GApplicationFlags:
- * @G_APPLICATION_DISABLE_SINGLE_INSTANCE: If specified, do not check in
- * construction for another running process
- *
- * Flags used when creating a #GApplication.
- *
- * Since: 2.26
- */
-typedef enum { /*< prefix=G_APPLICATION >*/
- G_APPLICATION_FLAGS_NONE = 0,
-
- G_APPLICATION_DISABLE_SINGLE_INSTANCE = 1 << 0
-} GApplicationFlags;
-
-/**
* GApplication:
*
* The <structname>GApplication</structname> structure contains private
@@ -125,20 +99,7 @@ struct _GApplicationClass
GType g_application_get_type (void) G_GNUC_CONST;
-GApplication * g_application_new (const char *appid,
- GApplicationFlags flags);
-GApplication * g_application_try_new (GApplicationFlags flags,
- GType class_type,
- GApplicationExistsCallback on_other_process_exists,
- gpointer user_data,
- const char *first_property_name,
- ...) G_GNUC_NULL_TERMINATED;
-GApplication * g_application_try_newv (GApplicationFlags flags,
- GType class_type,
- GApplicationExistsCallback on_other_process_exists,
- gpointer user_data,
- guint n_parameters,
- GParameter *parameters);
+GApplication * g_application_new (const char *appid);
GApplication * g_application_get_instance (void);
G_CONST_RETURN gchar * g_application_get_id (GApplication *application);
@@ -154,15 +115,17 @@ void g_application_set_action_enabled (GApplication
gboolean enabled);
gboolean g_application_get_action_enabled (GApplication *application,
const char *name);
+G_CONST_RETURN gchar * g_application_get_action_description (GApplication *application,
+ const char *name);
void g_application_invoke_action (GApplication *application,
const char *name,
guint timestamp);
-GMainLoop * g_application_get_mainloop (GApplication *application);
void g_application_run (GApplication *application);
gboolean g_application_quit (GApplication *app,
guint timestamp);
+gboolean g_application_is_remote (GApplication *application);
G_END_DECLS
#endif /* __G_APPLICATION_H__ */
diff --git a/gio/gio.symbols b/gio/gio.symbols
index 4680d86..c82f0bb 100644
--- a/gio/gio.symbols
+++ b/gio/gio.symbols
@@ -30,19 +30,18 @@ g_vfs_get_local
#if IN_FILE(__G_APPLICATION_C__)
g_application_get_type G_GNUC_CONST
g_application_new
-g_application_try_new
-g_application_try_newv
g_application_get_instance
g_application_get_id
g_application_set_action_enabled
g_application_get_action_enabled
+g_application_get_action_description
g_application_add_action
g_application_remove_action
g_application_invoke_action
g_application_list_actions
-g_application_get_mainloop
g_application_run
g_application_quit
+g_application_is_remote
#endif
#endif
diff --git a/gio/gunixapplication.c b/gio/gunixapplication.c
index 185a115..f4f8b63 100644
--- a/gio/gunixapplication.c
+++ b/gio/gunixapplication.c
@@ -39,6 +39,8 @@ application_dbus_method_call (GDBusConnection *connection,
GDBusMethodInvocation *invocation,
gpointer user_data)
{
+ GApplication *app = G_APPLICATION (user_data);
+
if (method_name == NULL && *method_name == '\0')
return;
@@ -47,7 +49,7 @@ application_dbus_method_call (GDBusConnection *connection,
guint32 timestamp;
g_variant_get (parameters, "(u)", ×tamp);
- g_application_quit (application_instance, timestamp);
+ g_application_quit (app, timestamp);
g_dbus_method_invocation_return_value (invocation, NULL);
}
@@ -60,8 +62,8 @@ application_dbus_method_call (GDBusConnection *connection,
GVariant *return_args;
GVariant *result;
- actions = g_new (char *, g_hash_table_size (application_instance->priv->actions) + 1);
- g_hash_table_iter_init (&iter, application_instance->priv->actions);
+ actions = g_new (char *, g_hash_table_size (app->priv->actions) + 1);
+ g_hash_table_iter_init (&iter, app->priv->actions);
i = 0;
while (g_hash_table_iter_next (&iter, &key, &value))
actions[i++] = key;
@@ -82,7 +84,7 @@ application_dbus_method_call (GDBusConnection *connection,
g_variant_get (parameters, "(su)", &action_name, ×tamp);
- action = g_hash_table_lookup (application_instance->priv->actions, action_name);
+ action = g_hash_table_lookup (app->priv->actions, action_name);
if (!action)
{
@@ -92,7 +94,7 @@ application_dbus_method_call (GDBusConnection *connection,
return;
}
- g_signal_emit (application_instance, application_signals[ACTION], g_quark_from_string (action_name), (guint)timestamp);
+ g_signal_emit (app, application_signals[ACTION], g_quark_from_string (action_name), (guint)timestamp);
g_dbus_method_invocation_return_value (invocation, NULL);
}
@@ -240,29 +242,24 @@ _g_application_platform_init (GApplication *app)
registration_id = g_dbus_connection_register_object (priv->session_bus, "/org/freedesktop/Application",
&application_dbus_interface_info,
&application_dbus_vtable,
- NULL, NULL,
+ app, NULL,
&error);
if (registration_id == 0)
g_error ("%s", error->message);
}
static gboolean
-_g_application_platform_acquire_single_instance (const char *appid,
- GError **error)
+_g_application_platform_acquire_single_instance (const char *appid,
+ GError **error)
{
GDBusConnection *connection;
gboolean ret = FALSE;
GVariant *request_result;
guint32 request_status;
- if (application_instance != NULL)
- connection = g_object_ref (application_instance->priv->session_bus);
- else
- {
- connection = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, error);
- if (connection == NULL)
- return FALSE;
- }
+ connection = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, error);
+ if (connection == NULL)
+ return FALSE;
request_result = g_dbus_connection_call_sync (connection,
"org.freedesktop.DBus",
@@ -306,6 +303,14 @@ _g_application_platform_on_actions_changed (GApplication *app)
}
static void
+_g_application_platform_remote_invoke_action (GApplication *app,
+ const char *action,
+ guint timestamp)
+{
+ /* TODO */
+}
+
+static void
_g_application_platform_default_exit (void)
{
exit (0);
diff --git a/gio/tests/application.c b/gio/tests/application.c
index c934d80..7acd520 100644
--- a/gio/tests/application.c
+++ b/gio/tests/application.c
@@ -108,7 +108,7 @@ test_basic (void)
{
GApplication *app;
- app = g_application_new ("org.gtk.TestApplication", 0);
+ app = g_application_new ("org.gtk.TestApplication");
g_application_add_action (app, "About", "Print an about message");
g_signal_connect (app, "action::About", G_CALLBACK (on_app_action), NULL);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]