diff options
author | Leo Tenenbaum <pommicket@gmail.com> | 2018-08-20 21:12:06 -0400 |
---|---|---|
committer | Leo Tenenbaum <pommicket@gmail.com> | 2018-08-20 21:12:06 -0400 |
commit | 63e87c2d0c9d263f14c77b68f85c67d46ece82a9 (patch) | |
tree | 6260365cbf7d24f37d27669e8538227fcb72e243 /gtk+-mingw/share/gtk-doc/html/gio/GApplication.html | |
parent | a4460f6d9453bbd7e584937686449cef3e19f052 (diff) |
Diffstat (limited to 'gtk+-mingw/share/gtk-doc/html/gio/GApplication.html')
-rw-r--r-- | gtk+-mingw/share/gtk-doc/html/gio/GApplication.html | 1781 |
1 files changed, 0 insertions, 1781 deletions
diff --git a/gtk+-mingw/share/gtk-doc/html/gio/GApplication.html b/gtk+-mingw/share/gtk-doc/html/gio/GApplication.html deleted file mode 100644 index 8985d2f..0000000 --- a/gtk+-mingw/share/gtk-doc/html/gio/GApplication.html +++ /dev/null @@ -1,1781 +0,0 @@ -<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> -<html> -<head> -<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> -<title>GApplication</title> -<meta name="generator" content="DocBook XSL Stylesheets V1.76.1"> -<link rel="home" href="index.html" title="GIO Reference Manual"> -<link rel="up" href="application.html" title="Application support"> -<link rel="prev" href="application.html" title="Application support"> -<link rel="next" href="GApplicationCommandLine.html" title="GApplicationCommandLine"> -<meta name="generator" content="GTK-Doc V1.18 (XML mode)"> -<link rel="stylesheet" href="style.css" type="text/css"> -</head> -<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"> -<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2"> -<tr valign="middle"> -<td><a accesskey="p" href="application.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td> -<td><a accesskey="u" href="application.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td> -<td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td> -<th width="100%" align="center">GIO Reference Manual</th> -<td><a accesskey="n" href="GApplicationCommandLine.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td> -</tr> -<tr><td colspan="5" class="shortcuts"> -<a href="#GApplication.synopsis" class="shortcut">Top</a> - | - <a href="#GApplication.description" class="shortcut">Description</a> - | - <a href="#GApplication.object-hierarchy" class="shortcut">Object Hierarchy</a> - | - <a href="#GApplication.implemented-interfaces" class="shortcut">Implemented Interfaces</a> - | - <a href="#GApplication.properties" class="shortcut">Properties</a> - | - <a href="#GApplication.signals" class="shortcut">Signals</a> -</td></tr> -</table> -<div class="refentry"> -<a name="GApplication"></a><div class="titlepage"></div> -<div class="refnamediv"><table width="100%"><tr> -<td valign="top"> -<h2><span class="refentrytitle"><a name="GApplication.top_of_page"></a>GApplication</span></h2> -<p>GApplication — Core application class</p> -</td> -<td valign="top" align="right"></td> -</tr></table></div> -<div class="refsynopsisdiv"> -<a name="GApplication.synopsis"></a><h2>Synopsis</h2> -<a name="GApplicationFlags"></a><pre class="synopsis"> <a class="link" href="GApplication.html#GApplication-struct" title="GApplication">GApplication</a>; -struct <a class="link" href="GApplication.html#GApplicationClass" title="struct GApplicationClass">GApplicationClass</a>; - -enum <a class="link" href="GApplication.html#GApplicationFlags-enum" title="enum GApplicationFlags">GApplicationFlags</a>; -<a href="./../glib/glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a> <a class="link" href="GApplication.html#g-application-id-is-valid" title="g_application_id_is_valid ()">g_application_id_is_valid</a> (<em class="parameter"><code>const <a href="./../glib/glib/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *application_id</code></em>); -<a class="link" href="GApplication.html" title="GApplication"><span class="returnvalue">GApplication</span></a> * <a class="link" href="GApplication.html#g-application-new" title="g_application_new ()">g_application_new</a> (<em class="parameter"><code>const <a href="./../glib/glib/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *application_id</code></em>, - <em class="parameter"><code><a class="link" href="GApplication.html#GApplicationFlags"><span class="type">GApplicationFlags</span></a> flags</code></em>); - -const <a href="./../glib/glib/glib-Basic-Types.html#gchar"><span class="returnvalue">gchar</span></a> * <a class="link" href="GApplication.html#g-application-get-application-id" title="g_application_get_application_id ()">g_application_get_application_id</a> (<em class="parameter"><code><a class="link" href="GApplication.html" title="GApplication"><span class="type">GApplication</span></a> *application</code></em>); -<span class="returnvalue">void</span> <a class="link" href="GApplication.html#g-application-set-application-id" title="g_application_set_application_id ()">g_application_set_application_id</a> (<em class="parameter"><code><a class="link" href="GApplication.html" title="GApplication"><span class="type">GApplication</span></a> *application</code></em>, - <em class="parameter"><code>const <a href="./../glib/glib/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *application_id</code></em>); - -<a href="./../glib/glib/glib-Basic-Types.html#guint"><span class="returnvalue">guint</span></a> <a class="link" href="GApplication.html#g-application-get-inactivity-timeout" title="g_application_get_inactivity_timeout ()">g_application_get_inactivity_timeout</a> - (<em class="parameter"><code><a class="link" href="GApplication.html" title="GApplication"><span class="type">GApplication</span></a> *application</code></em>); -<span class="returnvalue">void</span> <a class="link" href="GApplication.html#g-application-set-inactivity-timeout" title="g_application_set_inactivity_timeout ()">g_application_set_inactivity_timeout</a> - (<em class="parameter"><code><a class="link" href="GApplication.html" title="GApplication"><span class="type">GApplication</span></a> *application</code></em>, - <em class="parameter"><code><a href="./../glib/glib/glib-Basic-Types.html#guint"><span class="type">guint</span></a> inactivity_timeout</code></em>); - -<a class="link" href="GApplication.html#GApplicationFlags"><span class="returnvalue">GApplicationFlags</span></a> <a class="link" href="GApplication.html#g-application-get-flags" title="g_application_get_flags ()">g_application_get_flags</a> (<em class="parameter"><code><a class="link" href="GApplication.html" title="GApplication"><span class="type">GApplication</span></a> *application</code></em>); -<span class="returnvalue">void</span> <a class="link" href="GApplication.html#g-application-set-flags" title="g_application_set_flags ()">g_application_set_flags</a> (<em class="parameter"><code><a class="link" href="GApplication.html" title="GApplication"><span class="type">GApplication</span></a> *application</code></em>, - <em class="parameter"><code><a class="link" href="GApplication.html#GApplicationFlags"><span class="type">GApplicationFlags</span></a> flags</code></em>); - -<a class="link" href="GDBusConnection.html" title="GDBusConnection"><span class="returnvalue">GDBusConnection</span></a> * <a class="link" href="GApplication.html#g-application-get-dbus-connection" title="g_application_get_dbus_connection ()">g_application_get_dbus_connection</a> (<em class="parameter"><code><a class="link" href="GApplication.html" title="GApplication"><span class="type">GApplication</span></a> *application</code></em>); -const <a href="./../glib/glib/glib-Basic-Types.html#gchar"><span class="returnvalue">gchar</span></a> * <a class="link" href="GApplication.html#g-application-get-dbus-object-path" title="g_application_get_dbus_object_path ()">g_application_get_dbus_object_path</a> (<em class="parameter"><code><a class="link" href="GApplication.html" title="GApplication"><span class="type">GApplication</span></a> *application</code></em>); - -<span class="returnvalue">void</span> <a class="link" href="GApplication.html#g-application-set-action-group" title="g_application_set_action_group ()">g_application_set_action_group</a> (<em class="parameter"><code><a class="link" href="GApplication.html" title="GApplication"><span class="type">GApplication</span></a> *application</code></em>, - <em class="parameter"><code><a class="link" href="GActionGroup.html" title="GActionGroup"><span class="type">GActionGroup</span></a> *action_group</code></em>); - -<a href="./../glib/glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a> <a class="link" href="GApplication.html#g-application-get-is-registered" title="g_application_get_is_registered ()">g_application_get_is_registered</a> (<em class="parameter"><code><a class="link" href="GApplication.html" title="GApplication"><span class="type">GApplication</span></a> *application</code></em>); -<a href="./../glib/glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a> <a class="link" href="GApplication.html#g-application-get-is-remote" title="g_application_get_is_remote ()">g_application_get_is_remote</a> (<em class="parameter"><code><a class="link" href="GApplication.html" title="GApplication"><span class="type">GApplication</span></a> *application</code></em>); -<a href="./../glib/glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a> <a class="link" href="GApplication.html#g-application-register" title="g_application_register ()">g_application_register</a> (<em class="parameter"><code><a class="link" href="GApplication.html" title="GApplication"><span class="type">GApplication</span></a> *application</code></em>, - <em class="parameter"><code><a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a> *cancellable</code></em>, - <em class="parameter"><code><a href="./../glib/glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>); - -<span class="returnvalue">void</span> <a class="link" href="GApplication.html#g-application-hold" title="g_application_hold ()">g_application_hold</a> (<em class="parameter"><code><a class="link" href="GApplication.html" title="GApplication"><span class="type">GApplication</span></a> *application</code></em>); -<span class="returnvalue">void</span> <a class="link" href="GApplication.html#g-application-release" title="g_application_release ()">g_application_release</a> (<em class="parameter"><code><a class="link" href="GApplication.html" title="GApplication"><span class="type">GApplication</span></a> *application</code></em>); -<span class="returnvalue">void</span> <a class="link" href="GApplication.html#g-application-quit" title="g_application_quit ()">g_application_quit</a> (<em class="parameter"><code><a class="link" href="GApplication.html" title="GApplication"><span class="type">GApplication</span></a> *application</code></em>); - -<span class="returnvalue">void</span> <a class="link" href="GApplication.html#g-application-activate" title="g_application_activate ()">g_application_activate</a> (<em class="parameter"><code><a class="link" href="GApplication.html" title="GApplication"><span class="type">GApplication</span></a> *application</code></em>); -<span class="returnvalue">void</span> <a class="link" href="GApplication.html#g-application-open" title="g_application_open ()">g_application_open</a> (<em class="parameter"><code><a class="link" href="GApplication.html" title="GApplication"><span class="type">GApplication</span></a> *application</code></em>, - <em class="parameter"><code><a class="link" href="GFile.html" title="GFile"><span class="type">GFile</span></a> **files</code></em>, - <em class="parameter"><code><a href="./../glib/glib/glib-Basic-Types.html#gint"><span class="type">gint</span></a> n_files</code></em>, - <em class="parameter"><code>const <a href="./../glib/glib/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *hint</code></em>); - -<span class="returnvalue">int</span> <a class="link" href="GApplication.html#g-application-run" title="g_application_run ()">g_application_run</a> (<em class="parameter"><code><a class="link" href="GApplication.html" title="GApplication"><span class="type">GApplication</span></a> *application</code></em>, - <em class="parameter"><code><span class="type">int</span> argc</code></em>, - <em class="parameter"><code><span class="type">char</span> **argv</code></em>); -<span class="returnvalue">void</span> <a class="link" href="GApplication.html#g-application-set-default" title="g_application_set_default ()">g_application_set_default</a> (<em class="parameter"><code><a class="link" href="GApplication.html" title="GApplication"><span class="type">GApplication</span></a> *application</code></em>); -<a class="link" href="GApplication.html" title="GApplication"><span class="returnvalue">GApplication</span></a> * <a class="link" href="GApplication.html#g-application-get-default" title="g_application_get_default ()">g_application_get_default</a> (<em class="parameter"><code><span class="type">void</span></code></em>); -</pre> -</div> -<div class="refsect1"> -<a name="GApplication.object-hierarchy"></a><h2>Object Hierarchy</h2> -<pre class="synopsis"> - <a href="./../gobject/gobject/gobject-The-Base-Object-Type.html#GObject">GObject</a> - +----GApplication -</pre> -<pre class="synopsis"> - GFlags - +----GApplicationFlags -</pre> -</div> -<div class="refsect1"> -<a name="GApplication.implemented-interfaces"></a><h2>Implemented Interfaces</h2> -<p> -GApplication implements - <a class="link" href="GActionGroup.html" title="GActionGroup">GActionGroup</a> and <a class="link" href="GActionMap.html" title="GActionMap">GActionMap</a>.</p> -</div> -<div class="refsect1"> -<a name="GApplication.properties"></a><h2>Properties</h2> -<pre class="synopsis"> - "<a class="link" href="GApplication.html#GApplication--action-group" title='The "action-group" property'>action-group</a>" <a class="link" href="GActionGroup.html" title="GActionGroup"><span class="type">GActionGroup</span></a>* : Write - "<a class="link" href="GApplication.html#GApplication--application-id" title='The "application-id" property'>application-id</a>" <a href="./../glib/glib/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a>* : Read / Write / Construct - "<a class="link" href="GApplication.html#GApplication--flags" title='The "flags" property'>flags</a>" <a class="link" href="GApplication.html#GApplicationFlags"><span class="type">GApplicationFlags</span></a> : Read / Write - "<a class="link" href="GApplication.html#GApplication--inactivity-timeout" title='The "inactivity-timeout" property'>inactivity-timeout</a>" <a href="./../glib/glib/glib-Basic-Types.html#guint"><span class="type">guint</span></a> : Read / Write - "<a class="link" href="GApplication.html#GApplication--is-registered" title='The "is-registered" property'>is-registered</a>" <a href="./../glib/glib/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a> : Read - "<a class="link" href="GApplication.html#GApplication--is-remote" title='The "is-remote" property'>is-remote</a>" <a href="./../glib/glib/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a> : Read -</pre> -</div> -<div class="refsect1"> -<a name="GApplication.signals"></a><h2>Signals</h2> -<pre class="synopsis"> - "<a class="link" href="GApplication.html#GApplication-activate" title='The "activate" signal'>activate</a>" : <a href="./../gobject/gobject/gobject-Signals.html#G-SIGNAL-RUN-LAST:CAPS"><code class="literal">Run Last</code></a> - "<a class="link" href="GApplication.html#GApplication-command-line" title='The "command-line" signal'>command-line</a>" : <a href="./../gobject/gobject/gobject-Signals.html#G-SIGNAL-RUN-LAST:CAPS"><code class="literal">Run Last</code></a> - "<a class="link" href="GApplication.html#GApplication-open" title='The "open" signal'>open</a>" : <a href="./../gobject/gobject/gobject-Signals.html#G-SIGNAL-RUN-LAST:CAPS"><code class="literal">Run Last</code></a> - "<a class="link" href="GApplication.html#GApplication-shutdown" title='The "shutdown" signal'>shutdown</a>" : <a href="./../gobject/gobject/gobject-Signals.html#G-SIGNAL-RUN-LAST:CAPS"><code class="literal">Run Last</code></a> - "<a class="link" href="GApplication.html#GApplication-startup" title='The "startup" signal'>startup</a>" : <a href="./../gobject/gobject/gobject-Signals.html#G-SIGNAL-RUN-FIRST:CAPS"><code class="literal">Run First</code></a> -</pre> -</div> -<div class="refsect1"> -<a name="GApplication.description"></a><h2>Description</h2> -<p> -A <a class="link" href="GApplication.html" title="GApplication"><span class="type">GApplication</span></a> is the foundation of an application. It wraps some -low-level platform-specific services and is intended to act as the -foundation for higher-level application classes such as -<a href="http://developer.gnome.org/devel/gtk/GtkApplication.html"><span class="type">GtkApplication</span></a> or <span class="type">MxApplication</span>. In general, you should not use -this class outside of a higher level framework. -</p> -<p> -GApplication provides convenient life cycle management by maintaining -a <em class="firstterm">use count</em> for the primary application instance. -The use count can be changed using <a class="link" href="GApplication.html#g-application-hold" title="g_application_hold ()"><code class="function">g_application_hold()</code></a> and -<a class="link" href="GApplication.html#g-application-release" title="g_application_release ()"><code class="function">g_application_release()</code></a>. If it drops to zero, the application exits. -Higher-level classes such as <a href="http://developer.gnome.org/devel/gtk/GtkApplication.html"><span class="type">GtkApplication</span></a> employ the use count to -ensure that the application stays alive as long as it has any opened -windows. -</p> -<p> -Another feature that GApplication (optionally) provides is process -uniqueness. Applications can make use of this functionality by -providing a unique application ID. If given, only one application -with this ID can be running at a time per session. The session -concept is platform-dependent, but corresponds roughly to a graphical -desktop login. When your application is launched again, its -arguments are passed through platform communication to the already -running program. The already running instance of the program is -called the <em class="firstterm">primary instance</em>; for non-unique -applications this is the always the current instance. -On Linux, the D-Bus session bus is used for communication. -</p> -<p> -If used, the expected form of an application identifier is very close -to that of of a -<a class="ulink" href="http://dbus.freedesktop.org/doc/dbus-specification.html#message-protocol-names-interface" target="_top">DBus bus name</a>. -Examples include: "com.example.MyApp", "org.example.internal-apps.Calculator". -For details on valid application identifiers, see <a class="link" href="GApplication.html#g-application-id-is-valid" title="g_application_id_is_valid ()"><code class="function">g_application_id_is_valid()</code></a>. -</p> -<p> -On Linux, the application identifier is claimed as a well-known bus name -on the user's session bus. This means that the uniqueness of your -application is scoped to the current session. It also means that your -application may provide additional services (through registration of other -object paths) at that bus name. The registration of these object paths -should be done with the shared GDBus session bus. Note that due to the -internal architecture of GDBus, method calls can be dispatched at any time -(even if a main loop is not running). For this reason, you must ensure that -any object paths that you wish to register are registered before <a class="link" href="GApplication.html" title="GApplication"><span class="type">GApplication</span></a> -attempts to acquire the bus name of your application (which happens in -<a class="link" href="GApplication.html#g-application-register" title="g_application_register ()"><code class="function">g_application_register()</code></a>). Unfortunately, this means that you cannot use -<a class="link" href="GApplication.html#g-application-get-is-remote" title="g_application_get_is_remote ()"><code class="function">g_application_get_is_remote()</code></a> to decide if you want to register object paths. -</p> -<p> -GApplication also implements the <a class="link" href="GActionGroup.html" title="GActionGroup"><span class="type">GActionGroup</span></a> and <a class="link" href="GActionMap.html" title="GActionMap"><span class="type">GActionMap</span></a> -interfaces and lets you easily export actions by adding them with -<a class="link" href="GActionMap.html#g-action-map-add-action" title="g_action_map_add_action ()"><code class="function">g_action_map_add_action()</code></a>. When invoking an action by calling -<a class="link" href="GActionGroup.html#g-action-group-activate-action" title="g_action_group_activate_action ()"><code class="function">g_action_group_activate_action()</code></a> on the application, it is always -invoked in the primary instance. The actions are also exported on -the session bus, and GIO provides the <a class="link" href="GDBusActionGroup.html" title="GDBusActionGroup"><span class="type">GDBusActionGroup</span></a> wrapper to -conveniently access them remotely. GIO provides a <a class="link" href="GDBusMenuModel.html" title="GDBusMenuModel"><span class="type">GDBusMenuModel</span></a> wrapper -for remote access to exported <a href="GMenuModel.html"><span class="type">GMenuModels</span></a>. -</p> -<p> -There is a number of different entry points into a GApplication: -</p> -<div class="itemizedlist"><ul class="itemizedlist" type="disc"> -<li class="listitem">via 'Activate' (i.e. just starting the application)</li> -<li class="listitem">via 'Open' (i.e. opening some files)</li> -<li class="listitem">by handling a command-line</li> -<li class="listitem">via activating an action</li> -</ul></div> -<p> -The <a class="link" href="GApplication.html#GApplication-startup" title='The "startup" signal'><span class="type">"startup"</span></a> signal lets you handle the application -initialization for all of these in a single place. -</p> -<p> -Regardless of which of these entry points is used to start the application, -GApplication passes some <em class="firstterm"><a name="platform-data"></a>platform -data</em> from the launching instance to the primary instance, -in the form of a <a href="./../glib/glib/glib-GVariant.html#GVariant"><span class="type">GVariant</span></a> dictionary mapping strings to variants. -To use platform data, override the <em class="parameter"><code>before_emit</code></em> or <em class="parameter"><code>after_emit</code></em> virtual -functions in your <a class="link" href="GApplication.html" title="GApplication"><span class="type">GApplication</span></a> subclass. When dealing with -<a class="link" href="GApplicationCommandLine.html" title="GApplicationCommandLine"><span class="type">GApplicationCommandLine</span></a> objects, the platform data is directly -available via <a class="link" href="GApplicationCommandLine.html#g-application-command-line-get-cwd" title="g_application_command_line_get_cwd ()"><code class="function">g_application_command_line_get_cwd()</code></a>, -<a class="link" href="GApplicationCommandLine.html#g-application-command-line-get-environ" title="g_application_command_line_get_environ ()"><code class="function">g_application_command_line_get_environ()</code></a> and -<a class="link" href="GApplicationCommandLine.html#g-application-command-line-get-platform-data" title="g_application_command_line_get_platform_data ()"><code class="function">g_application_command_line_get_platform_data()</code></a>. -</p> -<p> -As the name indicates, the platform data may vary depending on the -operating system, but it always includes the current directory (key -"cwd"), and optionally the environment (ie the set of environment -variables and their values) of the calling process (key "environ"). -The environment is only added to the platform data if the -<a class="link" href="GApplication.html#G-APPLICATION-SEND-ENVIRONMENT:CAPS"><code class="literal">G_APPLICATION_SEND_ENVIRONMENT</code></a> flag is set. <a class="link" href="GApplication.html" title="GApplication"><span class="type">GApplication</span></a> subclasses -can add their own platform data by overriding the <em class="parameter"><code>add_platform_data</code></em> -virtual function. For instance, <a href="http://developer.gnome.org/devel/gtk/GtkApplication.html"><span class="type">GtkApplication</span></a> adds startup notification -data in this way. -</p> -<p> -To parse commandline arguments you may handle the -<a class="link" href="GApplication.html#GApplication-command-line" title='The "command-line" signal'><span class="type">"command-line"</span></a> signal or override the <code class="function">local_command_line()</code> -vfunc, to parse them in either the primary instance or the local instance, -respectively. -</p> -<p> -</p> -<div class="example"> -<a name="gapplication-example-open"></a><p class="title"><b>Example 14. Opening files with a GApplication</b></p> -<div class="example-contents"><pre class="programlisting"> -#include <gio/gio.h> -#include <stdlib.h> -#include <string.h> - -static void -activate (GApplication *application) -{ - g_print ("activated\n"); - - /* Note: when doing a longer-lasting action here that returns - * to the mainloop, you should use g_application_hold() and - * g_application_release() to keep the application alive until - * the action is completed. - */ -} - -static void -open (GApplication *application, - GFile **files, - gint n_files, - const gchar *hint) -{ - gint i; - - for (i = 0; i < n_files; i++) - { - gchar *uri = g_file_get_uri (files[i]); - g_print ("open %s\n", uri); - g_free (uri); - } - - /* Note: when doing a longer-lasting action here that returns - * to the mainloop, you should use g_application_hold() and - * g_application_release() to keep the application alive until - * the action is completed. - */ -} - -int -main (int argc, char **argv) -{ - GApplication *app; - int status; - - app = g_application_new ("org.gtk.TestApplication", - G_APPLICATION_HANDLES_OPEN); - g_signal_connect (app, "activate", G_CALLBACK (activate), NULL); - g_signal_connect (app, "open", G_CALLBACK (open), NULL); - g_application_set_inactivity_timeout (app, 10000); - - status = g_application_run (app, argc, argv); - - g_object_unref (app); - - return status; -} - -</pre></div> -</div> -<p><br class="example-break"> -</p> -<p> -</p> -<div class="example"> -<a name="gapplication-example-actions"></a><p class="title"><b>Example 15. A GApplication with actions</b></p> -<div class="example-contents"><pre class="programlisting"> -#include <gio/gio.h> -#include <stdlib.h> -#include <string.h> - -static void -activate (GApplication *application) -{ - g_application_hold (application); - g_print ("activated\n"); - g_application_release (application); -} - -static void -activate_action (GAction *action, - GVariant *parameter, - gpointer data) -{ - GApplication *application = G_APPLICATION (data); - - g_application_hold (application); - g_print ("action %s activated\n", g_action_get_name (action)); - g_application_release (application); -} - -static void -activate_toggle_action (GSimpleAction *action, - GVariant *parameter, - gpointer data) -{ - GApplication *application = G_APPLICATION (data); - GVariant *state; - gboolean b; - - g_print ("action %s activated\n", g_action_get_name (G_ACTION (action))); - - g_application_hold (application); - state = g_action_get_state (G_ACTION (action)); - b = g_variant_get_boolean (state); - g_variant_unref (state); - g_simple_action_set_state (action, g_variant_new_boolean (!b)); - g_print ("state change %d -> %d\n", b, !b); - g_application_release (application); -} - -static void -add_actions (GApplication *app) -{ - GSimpleAction *action; - - action = g_simple_action_new ("simple-action", NULL); - g_signal_connect (action, "activate", G_CALLBACK (activate_action), app); - g_action_map_add_action (G_ACTION_MAP (app), G_ACTION (action)); - g_object_unref (action); - - action = g_simple_action_new_stateful ("toggle-action", NULL, - g_variant_new_boolean (FALSE)); - g_signal_connect (action, "activate", G_CALLBACK (activate_toggle_action), app); - g_action_map_add_action (G_ACTION_MAP (app), G_ACTION (action)); - g_object_unref (action); -} - -static void -describe_and_activate_action (GActionGroup *group, - const gchar *name) -{ - const GVariantType *param_type; - GVariant *state; - gboolean enabled; - gchar *tmp; - - param_type = g_action_group_get_action_parameter_type (group, name); - state = g_action_group_get_action_state (group, name); - enabled = g_action_group_get_action_enabled (group, name); - - g_print ("action name: %s\n", name); - tmp = param_type ? g_variant_type_dup_string (param_type) : NULL; - g_print ("parameter type: %s\n", tmp ? tmp : "<none>"); - g_free (tmp); - g_print ("state type: %s\n", - state ? g_variant_get_type_string (state) : "<none>"); - tmp = state ? g_variant_print (state, FALSE) : NULL; - g_print ("state: %s\n", tmp ? tmp : "<none>"); - g_free (tmp); - g_print ("enabled: %s\n", enabled ? "true" : "false"); - - if (state != NULL) - g_variant_unref (state); - - g_action_group_activate_action (group, name, NULL); -} - -int -main (int argc, char **argv) -{ - GApplication *app; - int status; - - app = g_application_new ("org.gtk.TestApplication", 0); - g_signal_connect (app, "activate", G_CALLBACK (activate), NULL); - g_application_set_inactivity_timeout (app, 10000); - - add_actions (app); - - if (argc > 1 && strcmp (argv[1], "--simple-action") == 0) - { - g_application_register (app, NULL, NULL); - describe_and_activate_action (G_ACTION_GROUP (app), "simple-action"); - exit (0); - } - else if (argc > 1 && strcmp (argv[1], "--toggle-action") == 0) - { - g_application_register (app, NULL, NULL); - describe_and_activate_action (G_ACTION_GROUP (app), "toggle-action"); - exit (0); - } - - status = g_application_run (app, argc, argv); - - g_object_unref (app); - - return status; -} - -</pre></div> -</div> -<p><br class="example-break"> -</p> -<p> -</p> -<div class="example"> -<a name="gapplication-example-menu"></a><p class="title"><b>Example 16. A GApplication with menus</b></p> -<div class="example-contents"><pre class="programlisting"> -FIXME: MISSING XINCLUDE CONTENT -</pre></div> -</div> -<p><br class="example-break"> -</p> -<p> -</p> -<div class="example"> -<a name="gapplication-example-dbushooks"></a><p class="title"><b>Example 17. Using extra D-Bus hooks with a GApplication</b></p> -<div class="example-contents"><pre class="programlisting"> -#include <gio/gio.h> -#include <stdlib.h> -#include <string.h> - -static void -activate (GApplication *application) -{ - g_print ("activated\n"); - - /* Note: when doing a longer-lasting action here that returns - * to the mainloop, you should use g_application_hold() and - * g_application_release() to keep the application alive until - * the action is completed. - */ -} - -typedef GApplication TestApplication; -typedef GApplicationClass TestApplicationClass; - -static GType test_application_get_type (void); -G_DEFINE_TYPE (TestApplication, test_application, G_TYPE_APPLICATION) - -static gboolean -test_application_dbus_register (GApplication *application, - GDBusConnection *connection, - const gchar *object_path, - GError **error) -{ - /* We must chain up to the parent class */ - if (!G_APPLICATION_CLASS (test_application_parent_class)->dbus_register (application, - connection, - object_path, - error)) - return FALSE; - - /* Now we can do our own stuff here. For example, we could export some D-Bus objects */ - return TRUE; -} - -static void -test_application_dbus_unregister (GApplication *application, - GDBusConnection *connection, - const gchar *object_path) -{ - /* Do our own stuff here, e.g. unexport any D-Bus objects we exported in the dbus_register - * hook above. Be sure to check that we actually did export them, since the hook - * above might have returned early due to the parent class' hook returning FALSE! - */ - - /* Lastly, we must chain up to the parent class */ - G_APPLICATION_CLASS (test_application_parent_class)->dbus_unregister (application, - connection, - object_path); -} - -static void -test_application_init (TestApplication *app) -{ -} - -static void -test_application_class_init (TestApplicationClass *class) -{ - GApplicationClass *g_application_class = G_APPLICATION_CLASS (class); - - g_application_class->dbus_register = test_application_dbus_register; - g_application_class->dbus_unregister = test_application_dbus_unregister; -} - -static GApplication * -test_application_new (const gchar *application_id, - GApplicationFlags flags) -{ - g_return_val_if_fail (g_application_id_is_valid (application_id), NULL); - - g_type_init (); - - return g_object_new (test_application_get_type (), - "application-id", application_id, - "flags", flags, - NULL); -} - -int -main (int argc, char **argv) -{ - GApplication *app; - int status; - - app = test_application_new ("org.gtk.TestApplication", 0); - g_signal_connect (app, "activate", G_CALLBACK (activate), NULL); - g_application_set_inactivity_timeout (app, 10000); - - status = g_application_run (app, argc, argv); - - g_object_unref (app); - - return status; -} - -</pre></div> -</div> -<p><br class="example-break"> -</p> -</div> -<div class="refsect1"> -<a name="GApplication.details"></a><h2>Details</h2> -<div class="refsect2"> -<a name="GApplication-struct"></a><h3>GApplication</h3> -<pre class="programlisting">typedef struct _GApplication GApplication;</pre> -<p class="since">Since 2.28</p> -</div> -<hr> -<div class="refsect2"> -<a name="GApplicationClass"></a><h3>struct GApplicationClass</h3> -<pre class="programlisting">struct GApplicationClass { - /* signals */ - void (* startup) (GApplication *application); - - void (* activate) (GApplication *application); - - void (* open) (GApplication *application, - GFile **files, - gint n_files, - const gchar *hint); - - int (* command_line) (GApplication *application, - GApplicationCommandLine *command_line); - - /* vfuncs */ - gboolean (* local_command_line) (GApplication *application, - gchar ***arguments, - int *exit_status); - - void (* before_emit) (GApplication *application, - GVariant *platform_data); - void (* after_emit) (GApplication *application, - GVariant *platform_data); - void (* add_platform_data) (GApplication *application, - GVariantBuilder *builder); - void (* quit_mainloop) (GApplication *application); - void (* run_mainloop) (GApplication *application); - void (* shutdown) (GApplication *application); - - gboolean (* dbus_register) (GApplication *application, - GDBusConnection *connection, - const gchar *object_path, - GError **error); - void (* dbus_unregister) (GApplication *application, - GDBusConnection *connection, - const gchar *object_path); -}; -</pre> -<p> -Virtual function table for <a class="link" href="GApplication.html" title="GApplication"><span class="type">GApplication</span></a>. -</p> -<div class="variablelist"><table border="0"> -<col align="left" valign="top"> -<tbody> -<tr> -<td><p><span class="term"><em class="structfield"><code><a name="GApplicationClass.startup"></a>startup</code></em> ()</span></p></td> -<td>invoked on the primary instance immediately after registration</td> -</tr> -<tr> -<td><p><span class="term"><em class="structfield"><code><a name="GApplicationClass.activate"></a>activate</code></em> ()</span></p></td> -<td>invoked on the primary instance when an activation occurs</td> -</tr> -<tr> -<td><p><span class="term"><em class="structfield"><code><a name="GApplicationClass.open"></a>open</code></em> ()</span></p></td> -<td>invoked on the primary instance when there are files to open</td> -</tr> -<tr> -<td><p><span class="term"><em class="structfield"><code><a name="GApplicationClass.command-line"></a>command_line</code></em> ()</span></p></td> -<td>invoked on the primary instance when a command-line is -not handled locally</td> -</tr> -<tr> -<td><p><span class="term"><em class="structfield"><code><a name="GApplicationClass.local-command-line"></a>local_command_line</code></em> ()</span></p></td> -<td>invoked (locally) when the process has been invoked -via commandline execution (as opposed to, say, D-Bus activation - which -is not currently supported by GApplication). The virtual function has -the chance to inspect (and possibly replace) the list of command line -arguments. See <a class="link" href="GApplication.html#g-application-run" title="g_application_run ()"><code class="function">g_application_run()</code></a> for more information.</td> -</tr> -<tr> -<td><p><span class="term"><em class="structfield"><code><a name="GApplicationClass.before-emit"></a>before_emit</code></em> ()</span></p></td> -<td>invoked on the primary instance before 'activate', 'open', -'command-line' or any action invocation, gets the 'platform data' from -the calling instance</td> -</tr> -<tr> -<td><p><span class="term"><em class="structfield"><code><a name="GApplicationClass.after-emit"></a>after_emit</code></em> ()</span></p></td> -<td>invoked on the primary instance after 'activate', 'open', -'command-line' or any action invocation, gets the 'platform data' from -the calling instance</td> -</tr> -<tr> -<td><p><span class="term"><em class="structfield"><code><a name="GApplicationClass.add-platform-data"></a>add_platform_data</code></em> ()</span></p></td> -<td>invoked (locally) to add 'platform data' to be sent to -the primary instance when activating, opening or invoking actions</td> -</tr> -<tr> -<td><p><span class="term"><em class="structfield"><code><a name="GApplicationClass.quit-mainloop"></a>quit_mainloop</code></em> ()</span></p></td> -<td>Used to be invoked on the primary instance when the use -count of the application drops to zero (and after any inactivity -timeout, if requested). Not used anymore since 2.32</td> -</tr> -<tr> -<td><p><span class="term"><em class="structfield"><code><a name="GApplicationClass.run-mainloop"></a>run_mainloop</code></em> ()</span></p></td> -<td>Used to be invoked on the primary instance from -<a class="link" href="GApplication.html#g-application-run" title="g_application_run ()"><code class="function">g_application_run()</code></a> if the use-count is non-zero. Since 2.32, -GApplication is iterating the main context directly and is not -using <em class="parameter"><code>run_mainloop</code></em> anymore</td> -</tr> -<tr> -<td><p><span class="term"><em class="structfield"><code><a name="GApplicationClass.shutdown"></a>shutdown</code></em> ()</span></p></td> -<td>invoked only on the registered primary instance immediately -after the main loop terminates</td> -</tr> -<tr> -<td><p><span class="term"><em class="structfield"><code><a name="GApplicationClass.dbus-register"></a>dbus_register</code></em> ()</span></p></td> -<td>invoked locally during registration, if the application is -using its D-Bus backend. You can use this to export extra objects on the -bus, that need to exist before the application tries to own the bus name. -The function is passed the <a class="link" href="GDBusConnection.html" title="GDBusConnection"><span class="type">GDBusConnection</span></a> to to session bus, and the -object path that <a class="link" href="GApplication.html" title="GApplication"><span class="type">GApplication</span></a> will use to export is D-Bus API. -If this function returns <a href="./../glib/glib/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a>, registration will proceed; otherwise -registration will abort. Since: 2.34</td> -</tr> -<tr> -<td><p><span class="term"><em class="structfield"><code><a name="GApplicationClass.dbus-unregister"></a>dbus_unregister</code></em> ()</span></p></td> -<td>invoked locally during unregistration, if the application -is using its D-Bus backend. Use this to undo anything done by the -<em class="parameter"><code>dbus_register</code></em> vfunc. Since: 2.34</td> -</tr> -</tbody> -</table></div> -<p class="since">Since 2.28</p> -</div> -<hr> -<div class="refsect2"> -<a name="GApplicationFlags-enum"></a><h3>enum GApplicationFlags</h3> -<pre class="programlisting">typedef enum { - G_APPLICATION_FLAGS_NONE, - G_APPLICATION_IS_SERVICE = (1 << 0), - G_APPLICATION_IS_LAUNCHER = (1 << 1), - - G_APPLICATION_HANDLES_OPEN = (1 << 2), - G_APPLICATION_HANDLES_COMMAND_LINE = (1 << 3), - G_APPLICATION_SEND_ENVIRONMENT = (1 << 4), - - G_APPLICATION_NON_UNIQUE = (1 << 5) -} GApplicationFlags; -</pre> -<p> -Flags used to define the behaviour of a <a class="link" href="GApplication.html" title="GApplication"><span class="type">GApplication</span></a>. -</p> -<div class="variablelist"><table border="0"> -<col align="left" valign="top"> -<tbody> -<tr> -<td><p><a name="G-APPLICATION-FLAGS-NONE:CAPS"></a><span class="term"><code class="literal">G_APPLICATION_FLAGS_NONE</code></span></p></td> -<td>Default -</td> -</tr> -<tr> -<td><p><a name="G-APPLICATION-IS-SERVICE:CAPS"></a><span class="term"><code class="literal">G_APPLICATION_IS_SERVICE</code></span></p></td> -<td>Run as a service. In this mode, registration - fails if the service is already running, and the application will - stay around for a while when the use count falls to zero. -</td> -</tr> -<tr> -<td><p><a name="G-APPLICATION-IS-LAUNCHER:CAPS"></a><span class="term"><code class="literal">G_APPLICATION_IS_LAUNCHER</code></span></p></td> -<td>Don't try to become the primary instance. -</td> -</tr> -<tr> -<td><p><a name="G-APPLICATION-HANDLES-OPEN:CAPS"></a><span class="term"><code class="literal">G_APPLICATION_HANDLES_OPEN</code></span></p></td> -<td>This application handles opening files (in - the primary instance). Note that this flag only affects the default - implementation of <code class="function">local_command_line()</code>, and has no effect if - <a class="link" href="GApplication.html#G-APPLICATION-HANDLES-COMMAND-LINE:CAPS"><code class="literal">G_APPLICATION_HANDLES_COMMAND_LINE</code></a> is given. - See <a class="link" href="GApplication.html#g-application-run" title="g_application_run ()"><code class="function">g_application_run()</code></a> for details. -</td> -</tr> -<tr> -<td><p><a name="G-APPLICATION-HANDLES-COMMAND-LINE:CAPS"></a><span class="term"><code class="literal">G_APPLICATION_HANDLES_COMMAND_LINE</code></span></p></td> -<td>This application handles command line - arguments (in the primary instance). Note that this flag only affect - the default implementation of <code class="function">local_command_line()</code>. - See <a class="link" href="GApplication.html#g-application-run" title="g_application_run ()"><code class="function">g_application_run()</code></a> for details. -</td> -</tr> -<tr> -<td><p><a name="G-APPLICATION-SEND-ENVIRONMENT:CAPS"></a><span class="term"><code class="literal">G_APPLICATION_SEND_ENVIRONMENT</code></span></p></td> -<td>Send the environment of the - launching process to the primary instance. Set this flag if your - application is expected to behave differently depending on certain - environment variables. For instance, an editor might be expected - to use the <code class="envar">GIT_COMMITTER_NAME</code> environment variable - when editing a git commit message. The environment is available - to the <a class="link" href="GApplication.html#GApplication-command-line" title='The "command-line" signal'><span class="type">"command-line"</span></a> signal handler, via - <a class="link" href="GApplicationCommandLine.html#g-application-command-line-getenv" title="g_application_command_line_getenv ()"><code class="function">g_application_command_line_getenv()</code></a>. -</td> -</tr> -<tr> -<td><p><a name="G-APPLICATION-NON-UNIQUE:CAPS"></a><span class="term"><code class="literal">G_APPLICATION_NON_UNIQUE</code></span></p></td> -<td>Make no attempts to do any of the typical - single-instance application negotiation, even if the application - ID is given. 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. -</td> -</tr> -</tbody> -</table></div> -<p class="since">Since 2.28</p> -</div> -<hr> -<div class="refsect2"> -<a name="g-application-id-is-valid"></a><h3>g_application_id_is_valid ()</h3> -<pre class="programlisting"><a href="./../glib/glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a> g_application_id_is_valid (<em class="parameter"><code>const <a href="./../glib/glib/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *application_id</code></em>);</pre> -<p> -Checks if <em class="parameter"><code>application_id</code></em> is a valid application identifier. -</p> -<p> -A valid ID is required for calls to <a class="link" href="GApplication.html#g-application-new" title="g_application_new ()"><code class="function">g_application_new()</code></a> and -<a class="link" href="GApplication.html#g-application-set-application-id" title="g_application_set_application_id ()"><code class="function">g_application_set_application_id()</code></a>. -</p> -<p> -For convenience, the restrictions on application identifiers are -reproduced here: -</p> -<div class="itemizedlist"><ul class="itemizedlist" type="disc"> -<li class="listitem">Application identifiers must contain only the ASCII characters "[A-Z][a-z][0-9]_-." and must not begin with a digit.</li> -<li class="listitem">Application identifiers must contain at least one '.' (period) character (and thus at least three elements).</li> -<li class="listitem">Application identifiers must not begin or end with a '.' (period) character.</li> -<li class="listitem">Application identifiers must not contain consecutive '.' (period) characters.</li> -<li class="listitem">Application identifiers must not exceed 255 characters.</li> -</ul></div> -<p> -</p> -<div class="variablelist"><table border="0"> -<col align="left" valign="top"> -<tbody> -<tr> -<td><p><span class="term"><em class="parameter"><code>application_id</code></em> :</span></p></td> -<td>a potential application identifier</td> -</tr> -<tr> -<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td> -<td> -<a href="./../glib/glib/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if <em class="parameter"><code>application_id</code></em> is valid</td> -</tr> -</tbody> -</table></div> -</div> -<hr> -<div class="refsect2"> -<a name="g-application-new"></a><h3>g_application_new ()</h3> -<pre class="programlisting"><a class="link" href="GApplication.html" title="GApplication"><span class="returnvalue">GApplication</span></a> * g_application_new (<em class="parameter"><code>const <a href="./../glib/glib/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *application_id</code></em>, - <em class="parameter"><code><a class="link" href="GApplication.html#GApplicationFlags"><span class="type">GApplicationFlags</span></a> flags</code></em>);</pre> -<p> -Creates a new <a class="link" href="GApplication.html" title="GApplication"><span class="type">GApplication</span></a> instance. -</p> -<p> -This function calls <a href="./../gobject/gobject/gobject-Type-Information.html#g-type-init"><code class="function">g_type_init()</code></a> for you. -</p> -<p> -If non-<a href="./../glib/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>, the application id must be valid. See -<a class="link" href="GApplication.html#g-application-id-is-valid" title="g_application_id_is_valid ()"><code class="function">g_application_id_is_valid()</code></a>. -</p> -<p> -If no application ID is given then some features of <a class="link" href="GApplication.html" title="GApplication"><span class="type">GApplication</span></a> -(most notably application uniqueness) will be disabled. -</p> -<div class="variablelist"><table border="0"> -<col align="left" valign="top"> -<tbody> -<tr> -<td><p><span class="term"><em class="parameter"><code>application_id</code></em> :</span></p></td> -<td>the application id. <span class="annotation">[<acronym title="NULL is ok, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span> -</td> -</tr> -<tr> -<td><p><span class="term"><em class="parameter"><code>flags</code></em> :</span></p></td> -<td>the application flags</td> -</tr> -<tr> -<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td> -<td>a new <a class="link" href="GApplication.html" title="GApplication"><span class="type">GApplication</span></a> instance</td> -</tr> -</tbody> -</table></div> -</div> -<hr> -<div class="refsect2"> -<a name="g-application-get-application-id"></a><h3>g_application_get_application_id ()</h3> -<pre class="programlisting">const <a href="./../glib/glib/glib-Basic-Types.html#gchar"><span class="returnvalue">gchar</span></a> * g_application_get_application_id (<em class="parameter"><code><a class="link" href="GApplication.html" title="GApplication"><span class="type">GApplication</span></a> *application</code></em>);</pre> -<p> -Gets the unique identifier for <em class="parameter"><code>application</code></em>. -</p> -<div class="variablelist"><table border="0"> -<col align="left" valign="top"> -<tbody> -<tr> -<td><p><span class="term"><em class="parameter"><code>application</code></em> :</span></p></td> -<td>a <a class="link" href="GApplication.html" title="GApplication"><span class="type">GApplication</span></a> -</td> -</tr> -<tr> -<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td> -<td>the identifier for <em class="parameter"><code>application</code></em>, owned by <em class="parameter"><code>application</code></em> -</td> -</tr> -</tbody> -</table></div> -<p class="since">Since 2.28</p> -</div> -<hr> -<div class="refsect2"> -<a name="g-application-set-application-id"></a><h3>g_application_set_application_id ()</h3> -<pre class="programlisting"><span class="returnvalue">void</span> g_application_set_application_id (<em class="parameter"><code><a class="link" href="GApplication.html" title="GApplication"><span class="type">GApplication</span></a> *application</code></em>, - <em class="parameter"><code>const <a href="./../glib/glib/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *application_id</code></em>);</pre> -<p> -Sets the unique identifier for <em class="parameter"><code>application</code></em>. -</p> -<p> -The application id can only be modified if <em class="parameter"><code>application</code></em> has not yet -been registered. -</p> -<p> -If non-<a href="./../glib/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>, the application id must be valid. See -<a class="link" href="GApplication.html#g-application-id-is-valid" title="g_application_id_is_valid ()"><code class="function">g_application_id_is_valid()</code></a>. -</p> -<div class="variablelist"><table border="0"> -<col align="left" valign="top"> -<tbody> -<tr> -<td><p><span class="term"><em class="parameter"><code>application</code></em> :</span></p></td> -<td>a <a class="link" href="GApplication.html" title="GApplication"><span class="type">GApplication</span></a> -</td> -</tr> -<tr> -<td><p><span class="term"><em class="parameter"><code>application_id</code></em> :</span></p></td> -<td>the identifier for <em class="parameter"><code>application</code></em>. <span class="annotation">[<acronym title="NULL is ok, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span> -</td> -</tr> -</tbody> -</table></div> -<p class="since">Since 2.28</p> -</div> -<hr> -<div class="refsect2"> -<a name="g-application-get-inactivity-timeout"></a><h3>g_application_get_inactivity_timeout ()</h3> -<pre class="programlisting"><a href="./../glib/glib/glib-Basic-Types.html#guint"><span class="returnvalue">guint</span></a> g_application_get_inactivity_timeout - (<em class="parameter"><code><a class="link" href="GApplication.html" title="GApplication"><span class="type">GApplication</span></a> *application</code></em>);</pre> -<p> -Gets the current inactivity timeout for the application. -</p> -<p> -This is the amount of time (in milliseconds) after the last call to -<a class="link" href="GApplication.html#g-application-release" title="g_application_release ()"><code class="function">g_application_release()</code></a> before the application stops running. -</p> -<div class="variablelist"><table border="0"> -<col align="left" valign="top"> -<tbody> -<tr> -<td><p><span class="term"><em class="parameter"><code>application</code></em> :</span></p></td> -<td>a <a class="link" href="GApplication.html" title="GApplication"><span class="type">GApplication</span></a> -</td> -</tr> -<tr> -<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td> -<td>the timeout, in milliseconds</td> -</tr> -</tbody> -</table></div> -<p class="since">Since 2.28</p> -</div> -<hr> -<div class="refsect2"> -<a name="g-application-set-inactivity-timeout"></a><h3>g_application_set_inactivity_timeout ()</h3> -<pre class="programlisting"><span class="returnvalue">void</span> g_application_set_inactivity_timeout - (<em class="parameter"><code><a class="link" href="GApplication.html" title="GApplication"><span class="type">GApplication</span></a> *application</code></em>, - <em class="parameter"><code><a href="./../glib/glib/glib-Basic-Types.html#guint"><span class="type">guint</span></a> inactivity_timeout</code></em>);</pre> -<p> -Sets the current inactivity timeout for the application. -</p> -<p> -This is the amount of time (in milliseconds) after the last call to -<a class="link" href="GApplication.html#g-application-release" title="g_application_release ()"><code class="function">g_application_release()</code></a> before the application stops running. -</p> -<p> -This call has no side effects of its own. The value set here is only -used for next time <a class="link" href="GApplication.html#g-application-release" title="g_application_release ()"><code class="function">g_application_release()</code></a> drops the use count to -zero. Any timeouts currently in progress are not impacted. -</p> -<div class="variablelist"><table border="0"> -<col align="left" valign="top"> -<tbody> -<tr> -<td><p><span class="term"><em class="parameter"><code>application</code></em> :</span></p></td> -<td>a <a class="link" href="GApplication.html" title="GApplication"><span class="type">GApplication</span></a> -</td> -</tr> -<tr> -<td><p><span class="term"><em class="parameter"><code>inactivity_timeout</code></em> :</span></p></td> -<td>the timeout, in milliseconds</td> -</tr> -</tbody> -</table></div> -<p class="since">Since 2.28</p> -</div> -<hr> -<div class="refsect2"> -<a name="g-application-get-flags"></a><h3>g_application_get_flags ()</h3> -<pre class="programlisting"><a class="link" href="GApplication.html#GApplicationFlags"><span class="returnvalue">GApplicationFlags</span></a> g_application_get_flags (<em class="parameter"><code><a class="link" href="GApplication.html" title="GApplication"><span class="type">GApplication</span></a> *application</code></em>);</pre> -<p> -Gets the flags for <em class="parameter"><code>application</code></em>. -</p> -<p> -See <a class="link" href="GApplication.html#GApplicationFlags"><span class="type">GApplicationFlags</span></a>. -</p> -<div class="variablelist"><table border="0"> -<col align="left" valign="top"> -<tbody> -<tr> -<td><p><span class="term"><em class="parameter"><code>application</code></em> :</span></p></td> -<td>a <a class="link" href="GApplication.html" title="GApplication"><span class="type">GApplication</span></a> -</td> -</tr> -<tr> -<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td> -<td>the flags for <em class="parameter"><code>application</code></em> -</td> -</tr> -</tbody> -</table></div> -<p class="since">Since 2.28</p> -</div> -<hr> -<div class="refsect2"> -<a name="g-application-set-flags"></a><h3>g_application_set_flags ()</h3> -<pre class="programlisting"><span class="returnvalue">void</span> g_application_set_flags (<em class="parameter"><code><a class="link" href="GApplication.html" title="GApplication"><span class="type">GApplication</span></a> *application</code></em>, - <em class="parameter"><code><a class="link" href="GApplication.html#GApplicationFlags"><span class="type">GApplicationFlags</span></a> flags</code></em>);</pre> -<p> -Sets the flags for <em class="parameter"><code>application</code></em>. -</p> -<p> -The flags can only be modified if <em class="parameter"><code>application</code></em> has not yet been -registered. -</p> -<p> -See <a class="link" href="GApplication.html#GApplicationFlags"><span class="type">GApplicationFlags</span></a>. -</p> -<div class="variablelist"><table border="0"> -<col align="left" valign="top"> -<tbody> -<tr> -<td><p><span class="term"><em class="parameter"><code>application</code></em> :</span></p></td> -<td>a <a class="link" href="GApplication.html" title="GApplication"><span class="type">GApplication</span></a> -</td> -</tr> -<tr> -<td><p><span class="term"><em class="parameter"><code>flags</code></em> :</span></p></td> -<td>the flags for <em class="parameter"><code>application</code></em> -</td> -</tr> -</tbody> -</table></div> -<p class="since">Since 2.28</p> -</div> -<hr> -<div class="refsect2"> -<a name="g-application-get-dbus-connection"></a><h3>g_application_get_dbus_connection ()</h3> -<pre class="programlisting"><a class="link" href="GDBusConnection.html" title="GDBusConnection"><span class="returnvalue">GDBusConnection</span></a> * g_application_get_dbus_connection (<em class="parameter"><code><a class="link" href="GApplication.html" title="GApplication"><span class="type">GApplication</span></a> *application</code></em>);</pre> -<p> -Gets the <a class="link" href="GDBusConnection.html" title="GDBusConnection"><span class="type">GDBusConnection</span></a> being used by the application, or <a href="./../glib/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>. -</p> -<p> -If <a class="link" href="GApplication.html" title="GApplication"><span class="type">GApplication</span></a> is using its D-Bus backend then this function will -return the <a class="link" href="GDBusConnection.html" title="GDBusConnection"><span class="type">GDBusConnection</span></a> being used for uniqueness and -communication with the desktop environment and other instances of the -application. -</p> -<p> -If <a class="link" href="GApplication.html" title="GApplication"><span class="type">GApplication</span></a> is not using D-Bus then this function will return -<a href="./../glib/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>. This includes the situation where the D-Bus backend would -normally be in use but we were unable to connect to the bus. -</p> -<p> -This function must not be called before the application has been -registered. See <a class="link" href="GApplication.html#g-application-get-is-registered" title="g_application_get_is_registered ()"><code class="function">g_application_get_is_registered()</code></a>. -</p> -<div class="variablelist"><table border="0"> -<col align="left" valign="top"> -<tbody> -<tr> -<td><p><span class="term"><em class="parameter"><code>application</code></em> :</span></p></td> -<td>a <a class="link" href="GApplication.html" title="GApplication"><span class="type">GApplication</span></a> -</td> -</tr> -<tr> -<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td> -<td>a <a class="link" href="GDBusConnection.html" title="GDBusConnection"><span class="type">GDBusConnection</span></a>, or <a href="./../glib/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>. <span class="annotation">[<acronym title="Don't free data after the code is done."><span class="acronym">transfer none</span></acronym>]</span> -</td> -</tr> -</tbody> -</table></div> -<p class="since">Since 2.34</p> -</div> -<hr> -<div class="refsect2"> -<a name="g-application-get-dbus-object-path"></a><h3>g_application_get_dbus_object_path ()</h3> -<pre class="programlisting">const <a href="./../glib/glib/glib-Basic-Types.html#gchar"><span class="returnvalue">gchar</span></a> * g_application_get_dbus_object_path (<em class="parameter"><code><a class="link" href="GApplication.html" title="GApplication"><span class="type">GApplication</span></a> *application</code></em>);</pre> -<p> -Gets the D-Bus object path being used by the application, or <a href="./../glib/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>. -</p> -<p> -If <a class="link" href="GApplication.html" title="GApplication"><span class="type">GApplication</span></a> is using its D-Bus backend then this function will -return the D-Bus object path that <a class="link" href="GApplication.html" title="GApplication"><span class="type">GApplication</span></a> is using. If the -application is the primary instance then there is an object published -at this path. If the application is not the primary instance then -the result of this function is undefined. -</p> -<p> -If <a class="link" href="GApplication.html" title="GApplication"><span class="type">GApplication</span></a> is not using D-Bus then this function will return -<a href="./../glib/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>. This includes the situation where the D-Bus backend would -normally be in use but we were unable to connect to the bus. -</p> -<p> -This function must not be called before the application has been -registered. See <a class="link" href="GApplication.html#g-application-get-is-registered" title="g_application_get_is_registered ()"><code class="function">g_application_get_is_registered()</code></a>. -</p> -<div class="variablelist"><table border="0"> -<col align="left" valign="top"> -<tbody> -<tr> -<td><p><span class="term"><em class="parameter"><code>application</code></em> :</span></p></td> -<td>a <a class="link" href="GApplication.html" title="GApplication"><span class="type">GApplication</span></a> -</td> -</tr> -<tr> -<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td> -<td>the object path, or <a href="./../glib/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> -</td> -</tr> -</tbody> -</table></div> -<p class="since">Since 2.34</p> -</div> -<hr> -<div class="refsect2"> -<a name="g-application-set-action-group"></a><h3>g_application_set_action_group ()</h3> -<pre class="programlisting"><span class="returnvalue">void</span> g_application_set_action_group (<em class="parameter"><code><a class="link" href="GApplication.html" title="GApplication"><span class="type">GApplication</span></a> *application</code></em>, - <em class="parameter"><code><a class="link" href="GActionGroup.html" title="GActionGroup"><span class="type">GActionGroup</span></a> *action_group</code></em>);</pre> -<div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;"> -<h3 class="title">Warning</h3> -<p><code class="literal">g_application_set_action_group</code> has been deprecated since version 2.32 and should not be used in newly-written code. Use the <a class="link" href="GActionMap.html" title="GActionMap"><span class="type">GActionMap</span></a> interface instead. Never ever -mix use of this API with use of <a class="link" href="GActionMap.html" title="GActionMap"><span class="type">GActionMap</span></a> on the same <em class="parameter"><code>application</code></em> -or things will go very badly wrong. This function is known to -introduce buggy behaviour (ie: signals not emitted on changes to the -action group), so you should really use <a class="link" href="GActionMap.html" title="GActionMap"><span class="type">GActionMap</span></a> instead.</p> -</div> -<p> -This used to be how actions were associated with a <a class="link" href="GApplication.html" title="GApplication"><span class="type">GApplication</span></a>. -Now there is <a class="link" href="GActionMap.html" title="GActionMap"><span class="type">GActionMap</span></a> for that. -</p> -<div class="variablelist"><table border="0"> -<col align="left" valign="top"> -<tbody> -<tr> -<td><p><span class="term"><em class="parameter"><code>application</code></em> :</span></p></td> -<td>a <a class="link" href="GApplication.html" title="GApplication"><span class="type">GApplication</span></a> -</td> -</tr> -<tr> -<td><p><span class="term"><em class="parameter"><code>action_group</code></em> :</span></p></td> -<td>a <a class="link" href="GActionGroup.html" title="GActionGroup"><span class="type">GActionGroup</span></a>, or <a href="./../glib/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>. <span class="annotation">[<acronym title="NULL is ok, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span> -</td> -</tr> -</tbody> -</table></div> -<p class="since">Since 2.28</p> -</div> -<hr> -<div class="refsect2"> -<a name="g-application-get-is-registered"></a><h3>g_application_get_is_registered ()</h3> -<pre class="programlisting"><a href="./../glib/glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a> g_application_get_is_registered (<em class="parameter"><code><a class="link" href="GApplication.html" title="GApplication"><span class="type">GApplication</span></a> *application</code></em>);</pre> -<p> -Checks if <em class="parameter"><code>application</code></em> is registered. -</p> -<p> -An application is registered if <a class="link" href="GApplication.html#g-application-register" title="g_application_register ()"><code class="function">g_application_register()</code></a> has been -successfully called. -</p> -<div class="variablelist"><table border="0"> -<col align="left" valign="top"> -<tbody> -<tr> -<td><p><span class="term"><em class="parameter"><code>application</code></em> :</span></p></td> -<td>a <a class="link" href="GApplication.html" title="GApplication"><span class="type">GApplication</span></a> -</td> -</tr> -<tr> -<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td> -<td> -<a href="./../glib/glib/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if <em class="parameter"><code>application</code></em> is registered</td> -</tr> -</tbody> -</table></div> -<p class="since">Since 2.28</p> -</div> -<hr> -<div class="refsect2"> -<a name="g-application-get-is-remote"></a><h3>g_application_get_is_remote ()</h3> -<pre class="programlisting"><a href="./../glib/glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a> g_application_get_is_remote (<em class="parameter"><code><a class="link" href="GApplication.html" title="GApplication"><span class="type">GApplication</span></a> *application</code></em>);</pre> -<p> -Checks if <em class="parameter"><code>application</code></em> is remote. -</p> -<p> -If <em class="parameter"><code>application</code></em> is remote then it means that another instance of -application already exists (the 'primary' instance). Calls to -perform actions on <em class="parameter"><code>application</code></em> will result in the actions being -performed by the primary instance. -</p> -<p> -The value of this property cannot be accessed before -<a class="link" href="GApplication.html#g-application-register" title="g_application_register ()"><code class="function">g_application_register()</code></a> has been called. See -<a class="link" href="GApplication.html#g-application-get-is-registered" title="g_application_get_is_registered ()"><code class="function">g_application_get_is_registered()</code></a>. -</p> -<div class="variablelist"><table border="0"> -<col align="left" valign="top"> -<tbody> -<tr> -<td><p><span class="term"><em class="parameter"><code>application</code></em> :</span></p></td> -<td>a <a class="link" href="GApplication.html" title="GApplication"><span class="type">GApplication</span></a> -</td> -</tr> -<tr> -<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td> -<td> -<a href="./../glib/glib/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if <em class="parameter"><code>application</code></em> is remote</td> -</tr> -</tbody> -</table></div> -<p class="since">Since 2.28</p> -</div> -<hr> -<div class="refsect2"> -<a name="g-application-register"></a><h3>g_application_register ()</h3> -<pre class="programlisting"><a href="./../glib/glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a> g_application_register (<em class="parameter"><code><a class="link" href="GApplication.html" title="GApplication"><span class="type">GApplication</span></a> *application</code></em>, - <em class="parameter"><code><a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a> *cancellable</code></em>, - <em class="parameter"><code><a href="./../glib/glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);</pre> -<p> -Attempts registration of the application. -</p> -<p> -This is the point at which the application discovers if it is the -primary instance or merely acting as a remote for an already-existing -primary instance. This is implemented by attempting to acquire the -application identifier as a unique bus name on the session bus using -GDBus. -</p> -<p> -If there is no application ID or if <a class="link" href="GApplication.html#G-APPLICATION-NON-UNIQUE:CAPS"><code class="literal">G_APPLICATION_NON_UNIQUE</code></a> was -given, then this process will always become the primary instance. -</p> -<p> -Due to the internal architecture of GDBus, method calls can be -dispatched at any time (even if a main loop is not running). For -this reason, you must ensure that any object paths that you wish to -register are registered before calling this function. -</p> -<p> -If the application has already been registered then <a href="./../glib/glib/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> is -returned with no work performed. -</p> -<p> -The <a class="link" href="GApplication.html#GApplication-startup" title='The "startup" signal'><span class="type">"startup"</span></a> signal is emitted if registration succeeds -and <em class="parameter"><code>application</code></em> is the primary instance (including the non-unique -case). -</p> -<p> -In the event of an error (such as <em class="parameter"><code>cancellable</code></em> being cancelled, or a -failure to connect to the session bus), <a href="./../glib/glib/glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> is returned and <em class="parameter"><code>error</code></em> -is set appropriately. -</p> -<p> -Note: the return value of this function is not an indicator that this -instance is or is not the primary instance of the application. See -<a class="link" href="GApplication.html#g-application-get-is-remote" title="g_application_get_is_remote ()"><code class="function">g_application_get_is_remote()</code></a> for that. -</p> -<div class="variablelist"><table border="0"> -<col align="left" valign="top"> -<tbody> -<tr> -<td><p><span class="term"><em class="parameter"><code>application</code></em> :</span></p></td> -<td>a <a class="link" href="GApplication.html" title="GApplication"><span class="type">GApplication</span></a> -</td> -</tr> -<tr> -<td><p><span class="term"><em class="parameter"><code>cancellable</code></em> :</span></p></td> -<td>a <a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a>, or <a href="./../glib/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>. <span class="annotation">[<acronym title="NULL is ok, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span> -</td> -</tr> -<tr> -<td><p><span class="term"><em class="parameter"><code>error</code></em> :</span></p></td> -<td>a pointer to a NULL <a href="./../glib/glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a>, or <a href="./../glib/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> -</td> -</tr> -<tr> -<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td> -<td> -<a href="./../glib/glib/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if registration succeeded</td> -</tr> -</tbody> -</table></div> -<p class="since">Since 2.28</p> -</div> -<hr> -<div class="refsect2"> -<a name="g-application-hold"></a><h3>g_application_hold ()</h3> -<pre class="programlisting"><span class="returnvalue">void</span> g_application_hold (<em class="parameter"><code><a class="link" href="GApplication.html" title="GApplication"><span class="type">GApplication</span></a> *application</code></em>);</pre> -<p> -Increases the use count of <em class="parameter"><code>application</code></em>. -</p> -<p> -Use this function to indicate that the application has a reason to -continue to run. For example, <a class="link" href="GApplication.html#g-application-hold" title="g_application_hold ()"><code class="function">g_application_hold()</code></a> is called by GTK+ -when a toplevel window is on the screen. -</p> -<p> -To cancel the hold, call <a class="link" href="GApplication.html#g-application-release" title="g_application_release ()"><code class="function">g_application_release()</code></a>. -</p> -<div class="variablelist"><table border="0"> -<col align="left" valign="top"> -<tbody><tr> -<td><p><span class="term"><em class="parameter"><code>application</code></em> :</span></p></td> -<td>a <a class="link" href="GApplication.html" title="GApplication"><span class="type">GApplication</span></a> -</td> -</tr></tbody> -</table></div> -</div> -<hr> -<div class="refsect2"> -<a name="g-application-release"></a><h3>g_application_release ()</h3> -<pre class="programlisting"><span class="returnvalue">void</span> g_application_release (<em class="parameter"><code><a class="link" href="GApplication.html" title="GApplication"><span class="type">GApplication</span></a> *application</code></em>);</pre> -<p> -Decrease the use count of <em class="parameter"><code>application</code></em>. -</p> -<p> -When the use count reaches zero, the application will stop running. -</p> -<p> -Never call this function except to cancel the effect of a previous -call to <a class="link" href="GApplication.html#g-application-hold" title="g_application_hold ()"><code class="function">g_application_hold()</code></a>. -</p> -<div class="variablelist"><table border="0"> -<col align="left" valign="top"> -<tbody><tr> -<td><p><span class="term"><em class="parameter"><code>application</code></em> :</span></p></td> -<td>a <a class="link" href="GApplication.html" title="GApplication"><span class="type">GApplication</span></a> -</td> -</tr></tbody> -</table></div> -</div> -<hr> -<div class="refsect2"> -<a name="g-application-quit"></a><h3>g_application_quit ()</h3> -<pre class="programlisting"><span class="returnvalue">void</span> g_application_quit (<em class="parameter"><code><a class="link" href="GApplication.html" title="GApplication"><span class="type">GApplication</span></a> *application</code></em>);</pre> -<p> -Immediately quits the application. -</p> -<p> -Upon return to the mainloop, <a class="link" href="GApplication.html#g-application-run" title="g_application_run ()"><code class="function">g_application_run()</code></a> will return, -calling only the 'shutdown' function before doing so. -</p> -<p> -The hold count is ignored. -</p> -<p> -The result of calling <a class="link" href="GApplication.html#g-application-run" title="g_application_run ()"><code class="function">g_application_run()</code></a> again after it returns is -unspecified. -</p> -<div class="variablelist"><table border="0"> -<col align="left" valign="top"> -<tbody><tr> -<td><p><span class="term"><em class="parameter"><code>application</code></em> :</span></p></td> -<td>a <a class="link" href="GApplication.html" title="GApplication"><span class="type">GApplication</span></a> -</td> -</tr></tbody> -</table></div> -<p class="since">Since 2.32</p> -</div> -<hr> -<div class="refsect2"> -<a name="g-application-activate"></a><h3>g_application_activate ()</h3> -<pre class="programlisting"><span class="returnvalue">void</span> g_application_activate (<em class="parameter"><code><a class="link" href="GApplication.html" title="GApplication"><span class="type">GApplication</span></a> *application</code></em>);</pre> -<p> -Activates the application. -</p> -<p> -In essence, this results in the <a class="link" href="GApplication.html#GApplication-activate" title='The "activate" signal'><span class="type">"activate"</span></a> signal being -emitted in the primary instance. -</p> -<p> -The application must be registered before calling this function. -</p> -<div class="variablelist"><table border="0"> -<col align="left" valign="top"> -<tbody><tr> -<td><p><span class="term"><em class="parameter"><code>application</code></em> :</span></p></td> -<td>a <a class="link" href="GApplication.html" title="GApplication"><span class="type">GApplication</span></a> -</td> -</tr></tbody> -</table></div> -<p class="since">Since 2.28</p> -</div> -<hr> -<div class="refsect2"> -<a name="g-application-open"></a><h3>g_application_open ()</h3> -<pre class="programlisting"><span class="returnvalue">void</span> g_application_open (<em class="parameter"><code><a class="link" href="GApplication.html" title="GApplication"><span class="type">GApplication</span></a> *application</code></em>, - <em class="parameter"><code><a class="link" href="GFile.html" title="GFile"><span class="type">GFile</span></a> **files</code></em>, - <em class="parameter"><code><a href="./../glib/glib/glib-Basic-Types.html#gint"><span class="type">gint</span></a> n_files</code></em>, - <em class="parameter"><code>const <a href="./../glib/glib/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *hint</code></em>);</pre> -<p> -Opens the given files. -</p> -<p> -In essence, this results in the <a class="link" href="GApplication.html#GApplication-open" title='The "open" signal'><span class="type">"open"</span></a> signal being emitted -in the primary instance. -</p> -<p> -<em class="parameter"><code>n_files</code></em> must be greater than zero. -</p> -<p> -<em class="parameter"><code>hint</code></em> is simply passed through to the ::open signal. It is -intended to be used by applications that have multiple modes for -opening files (eg: "view" vs "edit", etc). Unless you have a need -for this functionality, you should use "". -</p> -<p> -The application must be registered before calling this function -and it must have the <a class="link" href="GApplication.html#G-APPLICATION-HANDLES-OPEN:CAPS"><code class="literal">G_APPLICATION_HANDLES_OPEN</code></a> flag set. -</p> -<div class="variablelist"><table border="0"> -<col align="left" valign="top"> -<tbody> -<tr> -<td><p><span class="term"><em class="parameter"><code>application</code></em> :</span></p></td> -<td>a <a class="link" href="GApplication.html" title="GApplication"><span class="type">GApplication</span></a> -</td> -</tr> -<tr> -<td><p><span class="term"><em class="parameter"><code>files</code></em> :</span></p></td> -<td>an array of <a href="GFile.html"><span class="type">GFiles</span></a> to open. <span class="annotation">[<acronym title="Parameter points to an array of items."><span class="acronym">array</span></acronym> length=n_files]</span> -</td> -</tr> -<tr> -<td><p><span class="term"><em class="parameter"><code>n_files</code></em> :</span></p></td> -<td>the length of the <em class="parameter"><code>files</code></em> array</td> -</tr> -<tr> -<td><p><span class="term"><em class="parameter"><code>hint</code></em> :</span></p></td> -<td>a hint (or ""), but never <a href="./../glib/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> -</td> -</tr> -</tbody> -</table></div> -<p class="since">Since 2.28</p> -</div> -<hr> -<div class="refsect2"> -<a name="g-application-run"></a><h3>g_application_run ()</h3> -<pre class="programlisting"><span class="returnvalue">int</span> g_application_run (<em class="parameter"><code><a class="link" href="GApplication.html" title="GApplication"><span class="type">GApplication</span></a> *application</code></em>, - <em class="parameter"><code><span class="type">int</span> argc</code></em>, - <em class="parameter"><code><span class="type">char</span> **argv</code></em>);</pre> -<p> -Runs the application. -</p> -<p> -This function is intended to be run from <code class="function">main()</code> and its return value -is intended to be returned by <code class="function">main()</code>. Although you are expected to pass -the <em class="parameter"><code>argc</code></em>, <em class="parameter"><code>argv</code></em> parameters from <code class="function">main()</code> to this function, it is possible -to pass <a href="./../glib/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> if <em class="parameter"><code>argv</code></em> is not available or commandline handling is not -required. -</p> -<p> -First, the <code class="function">local_command_line()</code> virtual function is invoked. -This function always runs on the local instance. It gets passed a pointer -to a <a href="./../glib/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>-terminated copy of <em class="parameter"><code>argv</code></em> and is expected to remove the arguments -that it handled (shifting up remaining arguments). See -<a class="xref" href="GApplicationCommandLine.html#gapplication-example-cmdline2" title="Example 19. Split commandline handling">Example 19, “Split commandline handling”</a> for an example of -parsing <em class="parameter"><code>argv</code></em> manually. Alternatively, you may use the <a href="./../glib/glib/glib-Commandline-option-parser.html#GOptionContext"><span class="type">GOptionContext</span></a> API, -after setting <code class="literal">argc = g_strv_length (argv);</code>. -</p> -<p> -The last argument to <code class="function">local_command_line()</code> is a pointer to the <em class="parameter"><code>status</code></em> -variable which can used to set the exit status that is returned from -<a class="link" href="GApplication.html#g-application-run" title="g_application_run ()"><code class="function">g_application_run()</code></a>. -</p> -<p> -If <code class="function">local_command_line()</code> returns <a href="./../glib/glib/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a>, the command line is expected -to be completely handled, including possibly registering as the primary -instance, calling <a class="link" href="GApplication.html#g-application-activate" title="g_application_activate ()"><code class="function">g_application_activate()</code></a> or <a class="link" href="GApplication.html#g-application-open" title="g_application_open ()"><code class="function">g_application_open()</code></a>, etc. -</p> -<p> -If <code class="function">local_command_line()</code> returns <a href="./../glib/glib/glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> then the application is registered -and the <a class="link" href="GApplication.html#GApplication-command-line" title='The "command-line" signal'><span class="type">"command-line"</span></a> signal is emitted in the primary -instance (which may or may not be this instance). The signal handler -gets passed a <a class="link" href="GApplicationCommandLine.html" title="GApplicationCommandLine"><span class="type">GApplicationCommandLine</span></a> object that (among other things) -contains the remaining commandline arguments that have not been handled -by <code class="function">local_command_line()</code>. -</p> -<p> -If the application has the <a class="link" href="GApplication.html#G-APPLICATION-HANDLES-COMMAND-LINE:CAPS"><code class="literal">G_APPLICATION_HANDLES_COMMAND_LINE</code></a> -flag set then the default implementation of <code class="function">local_command_line()</code> -always returns <a href="./../glib/glib/glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> immediately, resulting in the commandline -always being handled in the primary instance. -</p> -<p> -Otherwise, the default implementation of <code class="function">local_command_line()</code> tries -to do a couple of things that are probably reasonable for most -applications. First, <a class="link" href="GApplication.html#g-application-register" title="g_application_register ()"><code class="function">g_application_register()</code></a> is called to attempt -to register the application. If that works, then the command line -arguments are inspected. If no commandline arguments are given, then -<a class="link" href="GApplication.html#g-application-activate" title="g_application_activate ()"><code class="function">g_application_activate()</code></a> is called. If commandline arguments are -given and the <a class="link" href="GApplication.html#G-APPLICATION-HANDLES-OPEN:CAPS"><code class="literal">G_APPLICATION_HANDLES_OPEN</code></a> flag is set then they -are assumed to be filenames and <a class="link" href="GApplication.html#g-application-open" title="g_application_open ()"><code class="function">g_application_open()</code></a> is called. -</p> -<p> -If you need to handle commandline arguments that are not filenames, -and you don't mind commandline handling to happen in the primary -instance, you should set <a class="link" href="GApplication.html#G-APPLICATION-HANDLES-COMMAND-LINE:CAPS"><code class="literal">G_APPLICATION_HANDLES_COMMAND_LINE</code></a> and -process the commandline arguments in your <a class="link" href="GApplication.html#GApplication-command-line" title='The "command-line" signal'><span class="type">"command-line"</span></a> -signal handler, either manually or using the <a href="./../glib/glib/glib-Commandline-option-parser.html#GOptionContext"><span class="type">GOptionContext</span></a> API. -</p> -<p> -If you are interested in doing more complicated local handling of the -commandline then you should implement your own <a class="link" href="GApplication.html" title="GApplication"><span class="type">GApplication</span></a> subclass -and override <code class="function">local_command_line()</code>. In this case, you most likely want -to return <a href="./../glib/glib/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> from your <code class="function">local_command_line()</code> implementation to -suppress the default handling. See -<a class="xref" href="GApplicationCommandLine.html#gapplication-example-cmdline2" title="Example 19. Split commandline handling">Example 19, “Split commandline handling”</a> for an example. -</p> -<p> -If, after the above is done, the use count of the application is zero -then the exit status is returned immediately. If the use count is -non-zero then the default main context is iterated until the use count -falls to zero, at which point 0 is returned. -</p> -<p> -If the <a class="link" href="GApplication.html#G-APPLICATION-IS-SERVICE:CAPS"><code class="literal">G_APPLICATION_IS_SERVICE</code></a> flag is set, then the exiting at -use count of zero is delayed for a while (ie: the instance stays -around to provide its <span class="emphasis"><em>service</em></span> to others). -</p> -<div class="variablelist"><table border="0"> -<col align="left" valign="top"> -<tbody> -<tr> -<td><p><span class="term"><em class="parameter"><code>application</code></em> :</span></p></td> -<td>a <a class="link" href="GApplication.html" title="GApplication"><span class="type">GApplication</span></a> -</td> -</tr> -<tr> -<td><p><span class="term"><em class="parameter"><code>argc</code></em> :</span></p></td> -<td>the argc from <code class="function">main()</code> (or 0 if <em class="parameter"><code>argv</code></em> is <a href="./../glib/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>)</td> -</tr> -<tr> -<td><p><span class="term"><em class="parameter"><code>argv</code></em> :</span></p></td> -<td>the argv from <code class="function">main()</code>, or <a href="./../glib/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>. <span class="annotation">[<acronym title="Parameter points to an array of items."><span class="acronym">array</span></acronym> length=argc][<acronym title="NULL is ok, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span> -</td> -</tr> -<tr> -<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td> -<td>the exit status</td> -</tr> -</tbody> -</table></div> -<p class="since">Since 2.28</p> -</div> -<hr> -<div class="refsect2"> -<a name="g-application-set-default"></a><h3>g_application_set_default ()</h3> -<pre class="programlisting"><span class="returnvalue">void</span> g_application_set_default (<em class="parameter"><code><a class="link" href="GApplication.html" title="GApplication"><span class="type">GApplication</span></a> *application</code></em>);</pre> -<p> -Sets or unsets the default application for the process, as returned -by <a class="link" href="GApplication.html#g-application-get-default" title="g_application_get_default ()"><code class="function">g_application_get_default()</code></a>. -</p> -<p> -This function does not take its own reference on <em class="parameter"><code>application</code></em>. If -<em class="parameter"><code>application</code></em> is destroyed then the default application will revert -back to <a href="./../glib/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>. -</p> -<div class="variablelist"><table border="0"> -<col align="left" valign="top"> -<tbody><tr> -<td><p><span class="term"><em class="parameter"><code>application</code></em> :</span></p></td> -<td>the application to set as default, or <a href="./../glib/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>. <span class="annotation">[<acronym title="NULL is ok, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span> -</td> -</tr></tbody> -</table></div> -<p class="since">Since 2.32</p> -</div> -<hr> -<div class="refsect2"> -<a name="g-application-get-default"></a><h3>g_application_get_default ()</h3> -<pre class="programlisting"><a class="link" href="GApplication.html" title="GApplication"><span class="returnvalue">GApplication</span></a> * g_application_get_default (<em class="parameter"><code><span class="type">void</span></code></em>);</pre> -<p> -Returns the default <a class="link" href="GApplication.html" title="GApplication"><span class="type">GApplication</span></a> instance for this process. -</p> -<p> -Normally there is only one <a class="link" href="GApplication.html" title="GApplication"><span class="type">GApplication</span></a> per process and it becomes -the default when it is created. You can exercise more control over -this by using <a class="link" href="GApplication.html#g-application-set-default" title="g_application_set_default ()"><code class="function">g_application_set_default()</code></a>. -</p> -<p> -If there is no default application then <a href="./../glib/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> is returned. -</p> -<div class="variablelist"><table border="0"> -<col align="left" valign="top"> -<tbody><tr> -<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td> -<td>the default application for this process, or <a href="./../glib/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>. <span class="annotation">[<acronym title="Don't free data after the code is done."><span class="acronym">transfer none</span></acronym>]</span> -</td> -</tr></tbody> -</table></div> -<p class="since">Since 2.32</p> -</div> -</div> -<div class="refsect1"> -<a name="GApplication.property-details"></a><h2>Property Details</h2> -<div class="refsect2"> -<a name="GApplication--action-group"></a><h3>The <code class="literal">"action-group"</code> property</h3> -<pre class="programlisting"> "action-group" <a class="link" href="GActionGroup.html" title="GActionGroup"><span class="type">GActionGroup</span></a>* : Write</pre> -<p>The group of actions that the application exports.</p> -</div> -<hr> -<div class="refsect2"> -<a name="GApplication--application-id"></a><h3>The <code class="literal">"application-id"</code> property</h3> -<pre class="programlisting"> "application-id" <a href="./../glib/glib/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a>* : Read / Write / Construct</pre> -<p>The unique identifier for the application.</p> -<p>Default value: NULL</p> -</div> -<hr> -<div class="refsect2"> -<a name="GApplication--flags"></a><h3>The <code class="literal">"flags"</code> property</h3> -<pre class="programlisting"> "flags" <a class="link" href="GApplication.html#GApplicationFlags"><span class="type">GApplicationFlags</span></a> : Read / Write</pre> -<p>Flags specifying the behaviour of the application.</p> -</div> -<hr> -<div class="refsect2"> -<a name="GApplication--inactivity-timeout"></a><h3>The <code class="literal">"inactivity-timeout"</code> property</h3> -<pre class="programlisting"> "inactivity-timeout" <a href="./../glib/glib/glib-Basic-Types.html#guint"><span class="type">guint</span></a> : Read / Write</pre> -<p>Time (ms) to stay alive after becoming idle.</p> -<p>Default value: 0</p> -</div> -<hr> -<div class="refsect2"> -<a name="GApplication--is-registered"></a><h3>The <code class="literal">"is-registered"</code> property</h3> -<pre class="programlisting"> "is-registered" <a href="./../glib/glib/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a> : Read</pre> -<p>If g_application_register() has been called.</p> -<p>Default value: FALSE</p> -</div> -<hr> -<div class="refsect2"> -<a name="GApplication--is-remote"></a><h3>The <code class="literal">"is-remote"</code> property</h3> -<pre class="programlisting"> "is-remote" <a href="./../glib/glib/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a> : Read</pre> -<p>If this application instance is remote.</p> -<p>Default value: FALSE</p> -</div> -</div> -<div class="refsect1"> -<a name="GApplication.signal-details"></a><h2>Signal Details</h2> -<div class="refsect2"> -<a name="GApplication-activate"></a><h3>The <code class="literal">"activate"</code> signal</h3> -<pre class="programlisting"><span class="returnvalue">void</span> user_function (<a class="link" href="GApplication.html" title="GApplication"><span class="type">GApplication</span></a> *application, - <a href="./../glib/glib/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> user_data) : <a href="./../gobject/gobject/gobject-Signals.html#G-SIGNAL-RUN-LAST:CAPS"><code class="literal">Run Last</code></a></pre> -<p> -The ::activate signal is emitted on the primary instance when an -activation occurs. See <a class="link" href="GApplication.html#g-application-activate" title="g_application_activate ()"><code class="function">g_application_activate()</code></a>. -</p> -<div class="variablelist"><table border="0"> -<col align="left" valign="top"> -<tbody> -<tr> -<td><p><span class="term"><em class="parameter"><code>application</code></em> :</span></p></td> -<td>the application</td> -</tr> -<tr> -<td><p><span class="term"><em class="parameter"><code>user_data</code></em> :</span></p></td> -<td>user data set when the signal handler was connected.</td> -</tr> -</tbody> -</table></div> -</div> -<hr> -<div class="refsect2"> -<a name="GApplication-command-line"></a><h3>The <code class="literal">"command-line"</code> signal</h3> -<pre class="programlisting"><a href="./../glib/glib/glib-Basic-Types.html#gint"><span class="returnvalue">gint</span></a> user_function (<a class="link" href="GApplication.html" title="GApplication"><span class="type">GApplication</span></a> *application, - <a class="link" href="GApplicationCommandLine.html" title="GApplicationCommandLine"><span class="type">GApplicationCommandLine</span></a> *command_line, - <a href="./../glib/glib/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> user_data) : <a href="./../gobject/gobject/gobject-Signals.html#G-SIGNAL-RUN-LAST:CAPS"><code class="literal">Run Last</code></a></pre> -<p> -The ::command-line signal is emitted on the primary instance when -a commandline is not handled locally. See <a class="link" href="GApplication.html#g-application-run" title="g_application_run ()"><code class="function">g_application_run()</code></a> and -the <a class="link" href="GApplicationCommandLine.html" title="GApplicationCommandLine"><span class="type">GApplicationCommandLine</span></a> documentation for more information. -</p> -<div class="variablelist"><table border="0"> -<col align="left" valign="top"> -<tbody> -<tr> -<td><p><span class="term"><em class="parameter"><code>application</code></em> :</span></p></td> -<td>the application</td> -</tr> -<tr> -<td><p><span class="term"><em class="parameter"><code>command_line</code></em> :</span></p></td> -<td>a <a class="link" href="GApplicationCommandLine.html" title="GApplicationCommandLine"><span class="type">GApplicationCommandLine</span></a> representing the -passed commandline</td> -</tr> -<tr> -<td><p><span class="term"><em class="parameter"><code>user_data</code></em> :</span></p></td> -<td>user data set when the signal handler was connected.</td> -</tr> -<tr> -<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td> -<td>An integer that is set as the exit status for the calling -process. See <a class="link" href="GApplicationCommandLine.html#g-application-command-line-set-exit-status" title="g_application_command_line_set_exit_status ()"><code class="function">g_application_command_line_set_exit_status()</code></a>.</td> -</tr> -</tbody> -</table></div> -</div> -<hr> -<div class="refsect2"> -<a name="GApplication-open"></a><h3>The <code class="literal">"open"</code> signal</h3> -<pre class="programlisting"><span class="returnvalue">void</span> user_function (<a class="link" href="GApplication.html" title="GApplication"><span class="type">GApplication</span></a> *application, - <a href="./../glib/glib/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> files, - <a href="./../glib/glib/glib-Basic-Types.html#gint"><span class="type">gint</span></a> n_files, - <a href="./../glib/glib/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *hint, - <a href="./../glib/glib/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> user_data) : <a href="./../gobject/gobject/gobject-Signals.html#G-SIGNAL-RUN-LAST:CAPS"><code class="literal">Run Last</code></a></pre> -<p> -The ::open signal is emitted on the primary instance when there are -files to open. See <a class="link" href="GApplication.html#g-application-open" title="g_application_open ()"><code class="function">g_application_open()</code></a> for more information. -</p> -<div class="variablelist"><table border="0"> -<col align="left" valign="top"> -<tbody> -<tr> -<td><p><span class="term"><em class="parameter"><code>application</code></em> :</span></p></td> -<td>the application</td> -</tr> -<tr> -<td><p><span class="term"><em class="parameter"><code>files</code></em> :</span></p></td> -<td>an array of <a href="GFile.html"><span class="type">GFiles</span></a>. <span class="annotation">[<acronym title="Parameter points to an array of items."><span class="acronym">array</span></acronym> length=n_files][<acronym title="Generics and defining elements of containers and arrays."><span class="acronym">element-type</span></acronym> GFile]</span> -</td> -</tr> -<tr> -<td><p><span class="term"><em class="parameter"><code>n_files</code></em> :</span></p></td> -<td>the length of <em class="parameter"><code>files</code></em> -</td> -</tr> -<tr> -<td><p><span class="term"><em class="parameter"><code>hint</code></em> :</span></p></td> -<td>a hint provided by the calling instance</td> -</tr> -<tr> -<td><p><span class="term"><em class="parameter"><code>user_data</code></em> :</span></p></td> -<td>user data set when the signal handler was connected.</td> -</tr> -</tbody> -</table></div> -</div> -<hr> -<div class="refsect2"> -<a name="GApplication-shutdown"></a><h3>The <code class="literal">"shutdown"</code> signal</h3> -<pre class="programlisting"><span class="returnvalue">void</span> user_function (<a class="link" href="GApplication.html" title="GApplication"><span class="type">GApplication</span></a> *application, - <a href="./../glib/glib/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> user_data) : <a href="./../gobject/gobject/gobject-Signals.html#G-SIGNAL-RUN-LAST:CAPS"><code class="literal">Run Last</code></a></pre> -<p> -The ::shutdown signal is emitted only on the registered primary instance -immediately after the main loop terminates. -</p> -<div class="variablelist"><table border="0"> -<col align="left" valign="top"> -<tbody> -<tr> -<td><p><span class="term"><em class="parameter"><code>application</code></em> :</span></p></td> -<td>the application</td> -</tr> -<tr> -<td><p><span class="term"><em class="parameter"><code>user_data</code></em> :</span></p></td> -<td>user data set when the signal handler was connected.</td> -</tr> -</tbody> -</table></div> -</div> -<hr> -<div class="refsect2"> -<a name="GApplication-startup"></a><h3>The <code class="literal">"startup"</code> signal</h3> -<pre class="programlisting"><span class="returnvalue">void</span> user_function (<a class="link" href="GApplication.html" title="GApplication"><span class="type">GApplication</span></a> *application, - <a href="./../glib/glib/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> user_data) : <a href="./../gobject/gobject/gobject-Signals.html#G-SIGNAL-RUN-FIRST:CAPS"><code class="literal">Run First</code></a></pre> -<p> -The ::startup signal is emitted on the primary instance immediately -after registration. See <a class="link" href="GApplication.html#g-application-register" title="g_application_register ()"><code class="function">g_application_register()</code></a>. -</p> -<div class="variablelist"><table border="0"> -<col align="left" valign="top"> -<tbody> -<tr> -<td><p><span class="term"><em class="parameter"><code>application</code></em> :</span></p></td> -<td>the application</td> -</tr> -<tr> -<td><p><span class="term"><em class="parameter"><code>user_data</code></em> :</span></p></td> -<td>user data set when the signal handler was connected.</td> -</tr> -</tbody> -</table></div> -</div> -</div> -</div> -<div class="footer"> -<hr> - Generated by GTK-Doc V1.18</div> -</body> -</html>
\ No newline at end of file |