1 /* GIO - GLib Input, Output and Streaming Library
3 * Copyright © 2010 Red Hat, Inc
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General
16 * Public License along with this library; if not, write to the
17 * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
18 * Boston, MA 02111-1307, USA.
20 * Authors: Colin Walters <walters@verbum.org>
21 * Emmanuele Bassi <ebassi@linux.intel.com>
29 #include <gobject/gvaluecollector.h>
31 #include "gapplication.h"
32 #include "gio-marshal.h"
37 #include "gdbusconnection.h"
38 #include "gdbusintrospection.h"
39 #include "gdbusmethodinvocation.h"
44 * SECTION: gapplication
45 * @title: GApplication
46 * @short_description: Core application class
48 * A #GApplication is the foundation of an application, unique for a
49 * given application identifier. The #GApplication wraps some
50 * low-level platform-specific services and is intended to act as the
51 * foundation for higher-level application classes such as
52 * #GtkApplication or #MxApplication. In general, you should not use
53 * this class outside of a higher level framework. By default,
54 * g_application_register_with_data() will invoke g_error() if it is
55 * run in a context where it cannot support its core features. Note
56 * that g_error() is by default fatal.
58 * One of the core features that #GApplication provides is process
59 * uniqueness, in the context of a "session". The session concept is
60 * platform-dependent, but corresponds roughly to a graphical desktop
61 * login. When your application is launched again, its arguments
62 * are passed through platform communication to the already running
65 * In addition, #GApplication provides support for 'actions', which
66 * can be presented to the user in a platform-specific way
67 * (e.g. Windows 7 jump lists). Note that these are just simple
68 * actions without parameters. For more flexible scriptability,
69 * implementing a a separate D-Bus interface is recommended, see e.g.
70 * <xref linkend="gdbus-convenience"/>.
72 * Finally, #GApplication acts as a basic lifecycle root; see the
73 * g_application_run() and g_application_quit_with_data() methods.
75 * Before using #GApplication, you must choose an "application identifier".
76 * The expected form of an application identifier is very close to that of
77 * of a <ulink url="http://dbus.freedesktop.org/doc/dbus-specification.html#message-protocol-names-interface">DBus bus name</ulink>.
78 * Examples include: "com.example.MyApp" "org.example.internal-apps.Calculator"
79 * For convenience, the restrictions on application identifiers are reproduced
82 * <listitem>Application identifiers must contain only the ASCII characters "[A-Z][a-z][0-9]_-" and must not begin with a digit.</listitem>
83 * <listitem>Application identifiers must contain at least one '.' (period) character (and thus at least two elements).</listitem>
84 * <listitem>Application identifiers must not begin with a '.' (period) character.</listitem>
85 * <listitem>Application identifiers must not exceed 255 characters.</listitem>
88 * <refsect2><title>D-Bus implementation</title>
90 * On UNIX systems using D-Bus, #GApplication is implemented by claiming the
91 * application identifier as a bus name on the session bus. The implementation
92 * exports an object at the object path that is created by replacing '.' with
93 * '/' in the application identifier (e.g. the object path for the
94 * application id 'org.gtk.TestApp' is '/org/gtk/TestApp'). The object
95 * implements the org.gtk.Application interface.
97 * <classsynopsis class="interface">
98 * <ooclass><interfacename>org.gtk.Application</interfacename></ooclass>
101 * <methodname>Activate</methodname>
102 * <methodparam><modifier>in</modifier><type>aay</type><parameter>arguments</parameter></methodparam>
103 * <methodparam><modifier>in</modifier><type>a{sv}</type><parameter>data</parameter></methodparam>
107 * <methodname>InvokeAction</methodname>
108 * <methodparam><modifier>in</modifier><type>s</type><parameter>action</parameter></methodparam>
109 * <methodparam><modifier>in</modifier><type>a{sv}</type><parameter>data</parameter></methodparam>
112 * <type>a{s(sb)}</type>
113 * <methodname>ListActions</methodname>
118 * <methodname>Quit</methodname>
119 * <methodparam><modifier>in</modifier><type>a{sv}</type><parameter>data</parameter></methodparam>
122 * <modifier>Signal</modifier>
124 * <methodname>ActionsChanged</methodname>
129 * The <methodname>Activate</methodname> function is called on the existing
130 * application instance when a second instance fails to take the bus name.
131 * @arguments contains the commandline arguments given to the second instance
132 * and @data contains platform-specific additional data.
135 * The <methodname>InvokeAction</methodname> function can be called to
136 * invoke one of the actions exported by the application. On X11
137 * platforms, the platform_data argument should have a "timestamp"
138 * parameter of type "u" with the server time of the initiating event.
141 * The <methodname>ListActions</methodname> function returns a dictionary
142 * with the exported actions of the application. The keys of the dictionary
143 * are the action names, and the values are structs containing the description
144 * for the action and a boolean that represents if the action is enabled or not.
147 * The <methodname>Quit</methodname> function can be called to
148 * terminate the application. The @data parameter contains
149 * platform-specific data. On X11 platforms, the platform_data
150 * argument should have a "timestamp" parameter of type "u" with the
151 * server time of the initiating event.
154 * The <methodname>ActionsChanged</methodname> signal is emitted when the
155 * exported actions change (i.e. an action is added, removed, enabled,
156 * disabled, or otherwise changed).
159 * #GApplication is supported since Gio 2.26.
164 G_DEFINE_TYPE (GApplication, g_application, G_TYPE_OBJECT);
184 static guint application_signals[LAST_SIGNAL] = { 0 };
190 } GApplicationAction;
192 struct _GApplicationPrivate
195 GHashTable *actions; /* name -> GApplicationAction */
198 guint default_quit : 1;
201 guint actions_changed_id;
205 GDBusConnection *session_bus;
209 static GApplication *primary_application = NULL;
210 static GHashTable *instances_for_appid = NULL;
212 static void _g_application_platform_init (GApplication *app);
213 static gboolean _g_application_platform_acquire_single_instance (GApplication *app,
215 static void _g_application_platform_remote_invoke_action (GApplication *app,
217 GVariant *platform_data);
218 static void _g_application_platform_remote_quit (GApplication *app,
219 GVariant *platform_data);
220 static void _g_application_platform_activate (GApplication *app,
221 GVariant *data) G_GNUC_NORETURN;
222 static void _g_application_platform_on_actions_changed (GApplication *app);
225 #include "gdbusapplication.c"
227 #include "gnullapplication.c"
231 _g_application_validate_id (const char *id)
235 if (strlen (id) > 255)
238 if (!g_ascii_isalpha (*id))
245 if (g_ascii_isalnum (*id) || (*id == '-') || (*id == '_'))
247 else if (allow_dot && *id == '.')
256 init_appid_statics (gpointer data)
258 instances_for_appid = g_hash_table_new (g_str_hash, g_str_equal);
262 static GApplication *
263 application_for_appid (const char *appid)
265 static GOnce appid_once = G_ONCE_INIT;
267 g_once (&appid_once, init_appid_statics, NULL);
269 return g_hash_table_lookup (instances_for_appid, appid);
273 g_application_default_quit_with_data (GApplication *application,
274 GVariant *platform_data)
276 g_return_val_if_fail (application->priv->mainloop != NULL, FALSE);
277 g_main_loop_quit (application->priv->mainloop);
283 g_application_default_run (GApplication *application)
285 if (application->priv->mainloop == NULL)
286 application->priv->mainloop = g_main_loop_new (NULL, TRUE);
288 g_main_loop_run (application->priv->mainloop);
292 _g_application_handle_activation (GApplication *app,
295 GVariant *platform_data)
297 GVariantBuilder builder;
301 g_variant_builder_init (&builder, G_VARIANT_TYPE ("(aaya{sv})"));
302 g_variant_builder_open (&builder, G_VARIANT_TYPE ("aay"));
304 for (i = 1; i < argc; i++)
309 g_variant_builder_open (&builder, G_VARIANT_TYPE ("ay"));
311 argv_bytes = (guint8*) argv[i];
312 for (j = 0; argv_bytes[j]; j++)
313 g_variant_builder_add_value (&builder,
314 g_variant_new_byte (argv_bytes[j]));
315 g_variant_builder_close (&builder);
317 g_variant_builder_close (&builder);
320 g_variant_builder_add (&builder, "@a{sv}", platform_data);
323 g_variant_builder_open (&builder, G_VARIANT_TYPE ("a{sv}"));
324 g_variant_builder_close (&builder);
327 message = g_variant_builder_end (&builder);
328 _g_application_platform_activate (app, message);
329 g_variant_unref (message);
333 timeout_handle_actions_changed (gpointer user_data)
335 GApplication *application = user_data;
337 application->priv->actions_changed_id = 0;
339 _g_application_platform_on_actions_changed (application);
345 queue_actions_change_notification (GApplication *application)
347 GApplicationPrivate *priv = application->priv;
349 if (priv->actions_changed_id == 0)
350 priv->actions_changed_id = g_timeout_add (0, timeout_handle_actions_changed, application);
354 g_application_action_free (gpointer data)
356 if (G_LIKELY (data != NULL))
358 GApplicationAction *action = data;
360 g_free (action->name);
361 g_free (action->description);
363 g_slice_free (GApplicationAction, action);
370 * @appid: System-dependent application identifier
372 * Create a new #GApplication. The application is initially in
373 * "remote" mode. Almost certainly, you want to call
374 * g_application_register() immediately after this function, which
375 * will finish initialization.
377 * As a convenience, this function is defined to call g_type_init() as
378 * its very first action.
380 * Returns: (transfer full): An application instance
385 g_application_new (const gchar *appid)
389 return G_APPLICATION (g_object_new (G_TYPE_APPLICATION, "application-id", appid, NULL));
393 * g_application_register_with_data:
394 * @application: A #GApplication
395 * @argc: System argument count
396 * @argv: (array length=argc): System argument vector
397 * @platform_data: (allow-none): Arbitrary platform-specific data, must have signature "a{sv}"
399 * Ensure the current process is the unique owner of the application.
400 * If successful, the #GApplication:is-remote property will be changed
401 * to %FALSE, and it is safe to continue creating other resources
402 * such as graphics windows.
404 * If the given @appid is already running in another process, the
405 * #GApplication:default-exit property will be evaluated. If it's
406 * %TRUE, then a platform-specific action such as bringing any
407 * graphics windows associated with the application to the foreground
408 * may be initiated. After that, the current process will terminate.
409 * If %FALSE, then the application remains in the #GApplication:is-remote
410 * state, and you can e.g. call g_application_invoke_action().
412 * This function may do synchronous I/O to obtain unique ownership
413 * of the application id, and will block the calling thread in this
417 g_application_register_with_data (GApplication *application,
420 GVariant *platform_data)
422 g_return_if_fail (application->priv->appid != NULL);
423 g_return_if_fail (application->priv->is_remote);
424 g_return_if_fail (platform_data == NULL
425 || g_variant_is_of_type (platform_data, G_VARIANT_TYPE ("a{sv}")));
427 if (!_g_application_platform_acquire_single_instance (application, NULL))
429 if (application->priv->default_quit)
430 _g_application_handle_activation (application, argc, argv, platform_data);
435 application->priv->is_remote = FALSE;
437 _g_application_platform_init (application);
441 * g_application_new_and_register:
442 * @appid: An application identifier
443 * @argc: System argument count
444 * @argv: (array length=argc): System argument vector
446 * This is a convenience function which combines g_application_new()
447 * with g_application_register_with_data(). Therefore, it may block
448 * the calling thread just like g_application_register_with_data().
451 g_application_new_and_register (const gchar *appid,
455 GApplication *app = g_application_new (appid);
456 g_application_register_with_data (app, argc, argv, NULL);
461 * g_application_add_action:
462 * @application: a #GApplication
463 * @name: the action name
464 * @description: the action description; can be a translatable
467 * Adds an action @name to the list of exported actions of @application.
469 * It is an error to call this function if @application is a proxy for
470 * a remote application.
472 * You can invoke an action using g_application_invoke_action().
474 * The newly added action is enabled by default; you can call
475 * g_application_set_action_enabled() to disable it.
480 g_application_add_action (GApplication *application,
482 const gchar *description)
484 GApplicationPrivate *priv;
485 GApplicationAction *action;
487 g_return_if_fail (G_IS_APPLICATION (application));
488 g_return_if_fail (name != NULL && *name != '\0');
489 g_return_if_fail (!application->priv->is_remote);
491 priv = application->priv;
493 g_return_if_fail (g_hash_table_lookup (priv->actions, name) == NULL);
495 action = g_slice_new (GApplicationAction);
496 action->name = g_strdup (name);
497 action->description = g_strdup (description);
498 action->enabled = TRUE;
500 g_hash_table_insert (priv->actions, action->name, action);
501 queue_actions_change_notification (application);
505 * g_application_remove_action:
506 * @application: a #GApplication
507 * @name: the name of the action to remove
509 * Removes the action @name from the list of exported actions of @application.
511 * It is an error to call this function if @application is a proxy for
512 * a remote application.
517 g_application_remove_action (GApplication *application,
520 GApplicationPrivate *priv;
522 g_return_if_fail (G_IS_APPLICATION (application));
523 g_return_if_fail (name != NULL && *name != '\0');
524 g_return_if_fail (!application->priv->is_remote);
526 priv = application->priv;
528 g_return_if_fail (g_hash_table_lookup (priv->actions, name) != NULL);
530 g_hash_table_remove (priv->actions, name);
531 queue_actions_change_notification (application);
535 * g_application_invoke_action:
536 * @application: a #GApplication
537 * @name: the name of the action to invoke
538 * @platform_data: (allow-none): platform-specific event data
540 * Invokes the action @name of the passed #GApplication.
542 * This function has different behavior depending on whether @application
543 * is acting as a proxy for another process. In the normal case where
544 * the current process is hosting the application, and the specified
545 * action exists and is enabled, the #GApplication::action signal will
548 * If @application is a proxy, then the specified action will be invoked
549 * in the remote process. It is not necessary to call
550 * g_application_add_action() in the current process in order to invoke
556 g_application_invoke_action (GApplication *application,
558 GVariant *platform_data)
560 GApplicationPrivate *priv;
561 GApplicationAction *action;
563 g_return_if_fail (G_IS_APPLICATION (application));
564 g_return_if_fail (name != NULL);
565 g_return_if_fail (platform_data == NULL
566 || g_variant_is_of_type (platform_data, "a{sv}"));
568 priv = application->priv;
572 _g_application_platform_remote_invoke_action (application, name, platform_data);
576 action = g_hash_table_lookup (priv->actions, name);
577 g_return_if_fail (action != NULL);
578 if (!action->enabled)
581 g_signal_emit (application, application_signals[ACTION_WITH_DATA],
582 g_quark_from_string (name),
588 * g_application_list_actions:
589 * @application: a #GApplication
591 * Retrieves the list of action names currently exported by @application.
593 * It is an error to call this function if @application is a proxy for
594 * a remote application.
596 * Return value: (transfer full): a newly allocation, %NULL-terminated array
597 * of strings containing action names; use g_strfreev() to free the
598 * resources used by the returned array
603 g_application_list_actions (GApplication *application)
605 GApplicationPrivate *priv;
611 g_return_val_if_fail (G_IS_APPLICATION (application), NULL);
612 g_return_val_if_fail (!application->priv->is_remote, NULL);
614 priv = application->priv;
616 retval = g_new (gchar*, g_hash_table_size (priv->actions));
619 g_hash_table_iter_init (&iter, priv->actions);
620 while (g_hash_table_iter_next (&iter, &key, NULL))
621 retval[i++] = g_strdup (key);
629 * g_application_set_action_enabled:
630 * @application: a #GApplication
631 * @name: the name of the application
632 * @enabled: whether to enable or disable the action @name
634 * Sets whether the action @name inside @application should be enabled
637 * It is an error to call this function if @application is a proxy for
638 * a remote application.
640 * Invoking a disabled action will not result in the #GApplication::action
641 * signal being emitted.
646 g_application_set_action_enabled (GApplication *application,
650 GApplicationAction *action;
652 g_return_if_fail (G_IS_APPLICATION (application));
653 g_return_if_fail (name != NULL);
654 g_return_if_fail (!application->priv->is_remote);
658 action = g_hash_table_lookup (application->priv->actions, name);
659 g_return_if_fail (action != NULL);
660 if (action->enabled == enabled)
663 action->enabled = enabled;
665 queue_actions_change_notification (application);
670 * g_application_get_action_description:
671 * @application: a #GApplication
674 * Gets the description of the action @name.
676 * It is an error to call this function if @application is a proxy for
677 * a remote application.
679 * Returns: Description for the given action named @name
683 G_CONST_RETURN gchar *
684 g_application_get_action_description (GApplication *application,
687 GApplicationAction *action;
689 g_return_val_if_fail (G_IS_APPLICATION (application), NULL);
690 g_return_val_if_fail (name != NULL, NULL);
691 g_return_val_if_fail (!application->priv->is_remote, NULL);
693 action = g_hash_table_lookup (application->priv->actions, name);
694 g_return_val_if_fail (action != NULL, NULL);
696 return action->description;
701 * g_application_get_action_enabled:
702 * @application: a #GApplication
703 * @name: the name of the action
705 * Retrieves whether the action @name is enabled or not.
707 * See g_application_set_action_enabled().
709 * It is an error to call this function if @application is a proxy for
710 * a remote application.
712 * Return value: %TRUE if the action was enabled, and %FALSE otherwise
717 g_application_get_action_enabled (GApplication *application,
720 GApplicationAction *action;
722 g_return_val_if_fail (G_IS_APPLICATION (application), FALSE);
723 g_return_val_if_fail (name != NULL, FALSE);
724 g_return_val_if_fail (!application->priv->is_remote, FALSE);
726 action = g_hash_table_lookup (application->priv->actions, name);
727 g_return_val_if_fail (action != NULL, FALSE);
729 return action->enabled;
734 * @application: a #GApplication
736 * Starts the application.
738 * The default implementation of this virtual function will simply run
741 * It is an error to call this function if @application is a proxy for
742 * a remote application.
747 g_application_run (GApplication *application)
749 g_return_if_fail (G_IS_APPLICATION (application));
750 g_return_if_fail (!application->priv->is_remote);
752 G_APPLICATION_GET_CLASS (application)->run (application);
756 * g_application_quit_with_data:
757 * @application: a #GApplication
758 * @platform_data: (allow-none): platform-specific data
760 * Request that the application quits.
762 * This function has different behavior depending on whether @application
763 * is acting as a proxy for another process. In the normal case where
764 * the current process is hosting the application, the default
765 * implementation will quit the main loop created by g_application_run().
767 * If @application is a proxy, then the remote process will be asked
770 * Returns: %TRUE if the application accepted the request, %FALSE otherwise
775 g_application_quit_with_data (GApplication *application,
776 GVariant *platform_data)
778 gboolean retval = FALSE;
780 g_return_val_if_fail (G_IS_APPLICATION (application), FALSE);
781 g_return_val_if_fail (platform_data == NULL
782 || g_variant_is_of_type (platform_data, "a{sv}"), FALSE);
784 if (application->priv->is_remote)
786 _g_application_platform_remote_quit (application, platform_data);
790 g_signal_emit (application, application_signals[QUIT_WITH_DATA], 0, platform_data, &retval);
796 * g_application_get_instance:
798 * In the normal case where there is exactly one #GApplication instance
799 * in this process, return that instance. If there are multiple, the
800 * first one created will be returned. Otherwise, return %NULL.
802 * Returns: (transfer none): The primary instance of #GApplication,
803 * or %NULL if none is set
808 g_application_get_instance (void)
810 return primary_application;
814 * g_application_get_id:
815 * @application: a #GApplication
817 * Retrieves the platform-specific identifier for the #GApplication.
819 * Return value: The platform-specific identifier. The returned string
820 * is owned by the #GApplication instance and it should never be
825 G_CONST_RETURN gchar *
826 g_application_get_id (GApplication *application)
828 g_return_val_if_fail (G_IS_APPLICATION (application), NULL);
830 return application->priv->appid;
834 * g_application_is_remote:
835 * @application: a #GApplication
837 * Returns: %TRUE if this object represents a proxy for a remote application.
840 g_application_is_remote (GApplication *application)
842 g_return_val_if_fail (G_IS_APPLICATION (application), FALSE);
844 return application->priv->is_remote;
848 g_application_init (GApplication *app)
850 app->priv = G_TYPE_INSTANCE_GET_PRIVATE (app,
852 GApplicationPrivate);
854 app->priv->actions = g_hash_table_new_full (g_str_hash, g_str_equal,
856 g_application_action_free);
857 app->priv->default_quit = TRUE;
858 app->priv->is_remote = TRUE;
862 g_application_get_property (GObject *object,
867 GApplication *app = G_APPLICATION (object);
871 case PROP_APPLICATION_ID:
872 g_value_set_string (value, g_application_get_id (app));
875 case PROP_DEFAULT_QUIT:
876 g_value_set_boolean (value, app->priv->default_quit);
880 g_value_set_boolean (value, g_application_is_remote (app));
884 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
889 g_application_set_property (GObject *object,
894 GApplication *app = G_APPLICATION (object);
898 case PROP_APPLICATION_ID:
899 g_return_if_fail (_g_application_validate_id (g_value_get_string (value)));
900 app->priv->appid = g_value_dup_string (value);
903 case PROP_DEFAULT_QUIT:
904 app->priv->default_quit = g_value_get_boolean (value);
908 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
913 g_application_constructor (GType type,
914 guint n_construct_properties,
915 GObjectConstructParam *construct_params)
919 const char *appid = NULL;
922 for (i = 0; i < n_construct_properties; i++)
924 GObjectConstructParam *param = &construct_params[i];
925 if (strcmp (param->pspec->name, "application-id") == 0)
926 appid = g_value_get_string (param->value);
929 g_return_val_if_fail (appid != NULL, NULL);
931 app = application_for_appid (appid);
933 return g_object_ref (app);
935 object = (* G_OBJECT_CLASS (g_application_parent_class)->constructor) (type,
936 n_construct_properties,
938 app = G_APPLICATION (object);
940 if (primary_application == NULL)
941 primary_application = app;
942 g_hash_table_insert (instances_for_appid, g_strdup (appid), app);
948 g_application_finalize (GObject *object)
950 GApplication *app = G_APPLICATION (object);
952 g_free (app->priv->appid);
953 if (app->priv->actions)
954 g_hash_table_unref (app->priv->actions);
955 if (app->priv->actions_changed_id)
956 g_source_remove (app->priv->actions_changed_id);
957 if (app->priv->mainloop)
958 g_main_loop_unref (app->priv->mainloop);
961 g_free (app->priv->dbus_path);
962 if (app->priv->session_bus)
963 g_object_unref (app->priv->session_bus);
966 G_OBJECT_CLASS (g_application_parent_class)->finalize (object);
970 g_application_class_init (GApplicationClass *klass)
972 GObjectClass *gobject_class G_GNUC_UNUSED = G_OBJECT_CLASS (klass);
974 g_type_class_add_private (klass, sizeof (GApplicationPrivate));
976 gobject_class->constructor = g_application_constructor;
977 gobject_class->set_property = g_application_set_property;
978 gobject_class->get_property = g_application_get_property;
980 gobject_class->finalize = g_application_finalize;
982 klass->run = g_application_default_run;
983 klass->quit_with_data = g_application_default_quit_with_data;
986 * GApplication::quit-with-data:
987 * @application: the object on which the signal is emitted
988 * @platform_data: Platform-specific data, or %NULL
990 * This signal is emitted when the Quit action is invoked on the
993 * The default handler for this signal exits the mainloop of the
996 * Returns: %TRUE if the signal has been handled, %FALSE to continue
999 application_signals[QUIT_WITH_DATA] =
1000 g_signal_new (g_intern_static_string ("quit-with-data"),
1001 G_OBJECT_CLASS_TYPE (klass),
1003 G_STRUCT_OFFSET (GApplicationClass, quit_with_data),
1004 g_signal_accumulator_true_handled, NULL,
1005 _gio_marshal_BOOLEAN__BOXED,
1010 * GApplication::action-with-data:
1011 * @application: the object on which the signal is emitted
1012 * @name: The name of the activated action
1013 * @platform_data: Platform-specific data, or %NULL
1015 * This signal is emitted when an action is activated. The action name
1016 * is passed as the first argument, but also as signal detail, so it
1017 * is possible to connect to this signal for individual actions.
1019 * The signal is never emitted for disabled actions.
1021 application_signals[ACTION_WITH_DATA] =
1022 g_signal_new (g_intern_static_string ("action-with-data"),
1023 G_OBJECT_CLASS_TYPE (klass),
1024 G_SIGNAL_RUN_FIRST | G_SIGNAL_NO_RECURSE | G_SIGNAL_DETAILED,
1025 G_STRUCT_OFFSET (GApplicationClass, action_with_data),
1027 _gio_marshal_VOID__STRING_BOXED,
1033 * GApplication::prepare-activation:
1034 * @application: the object on which the signal is emitted
1035 * @arguments: A #GVariant with the signature "aay"
1036 * @platform_data: A #GVariant with the signature "a{sv}", or %NULL
1038 * This signal is emitted when a non-primary process for a given
1039 * application is invoked while your application is running; for
1040 * example, when a file browser launches your program to open a
1041 * file. The raw operating system arguments are passed in the
1042 * @arguments variant. Additional platform-dependent data is
1043 * stored in @platform_data.
1045 application_signals[PREPARE_ACTIVATION] =
1046 g_signal_new (g_intern_static_string ("prepare-activation"),
1047 G_OBJECT_CLASS_TYPE (klass),
1049 G_STRUCT_OFFSET (GApplicationClass, prepare_activation),
1051 _gio_marshal_VOID__BOXED_BOXED,
1057 * GApplication:application-id:
1059 * The unique identifier for this application. See the documentation for
1060 * #GApplication for more information about this property.
1063 g_object_class_install_property (gobject_class,
1064 PROP_APPLICATION_ID,
1065 g_param_spec_string ("application-id",
1066 P_("Application ID"),
1067 P_("Identifier for this application"),
1070 G_PARAM_CONSTRUCT_ONLY |
1071 G_PARAM_STATIC_STRINGS));
1074 * GApplication:default-quit:
1076 * By default, if a different process is running this application, the
1077 * process will be exited. Set this property to %FALSE to allow custom
1078 * interaction with the remote process.
1081 g_object_class_install_property (gobject_class,
1083 g_param_spec_boolean ("default-quit",
1085 P_("Exit the process by default"),
1088 G_PARAM_CONSTRUCT_ONLY |
1089 G_PARAM_STATIC_STRINGS));
1093 * GApplication:is-remote:
1095 * This property is %TRUE if this application instance represents a proxy
1096 * to the instance of this application in another process.
1099 g_object_class_install_property (gobject_class,
1101 g_param_spec_boolean ("is-remote",
1103 P_("Whether this application is a proxy for another process"),
1105 G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
1108 #define __G_APPLICATION_C__
1109 #include "gioaliasdef.c"