| <!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: GIO Reference Manual</title> |
| <meta name="generator" content="DocBook XSL Stylesheets V1.79.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.25.1 (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="5"><tr valign="middle"> |
| <td width="100%" align="left" class="shortcuts"> |
| <a href="#" class="shortcut">Top</a><span id="nav_description"> <span class="dim">|</span> |
| <a href="#GApplication.description" class="shortcut">Description</a></span><span id="nav_hierarchy"> <span class="dim">|</span> |
| <a href="#GApplication.object-hierarchy" class="shortcut">Object Hierarchy</a></span><span id="nav_interfaces"> <span class="dim">|</span> |
| <a href="#GApplication.implemented-interfaces" class="shortcut">Implemented Interfaces</a></span><span id="nav_properties"> <span class="dim">|</span> |
| <a href="#GApplication.properties" class="shortcut">Properties</a></span><span id="nav_signals"> <span class="dim">|</span> |
| <a href="#GApplication.signals" class="shortcut">Signals</a></span> |
| </td> |
| <td><a accesskey="h" href="index.html"><img src="home.png" width="16" height="16" border="0" alt="Home"></a></td> |
| <td><a accesskey="u" href="application.html"><img src="up.png" width="16" height="16" border="0" alt="Up"></a></td> |
| <td><a accesskey="p" href="application.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td> |
| <td><a accesskey="n" href="GApplicationCommandLine.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></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 class="gallery_image" valign="top" align="right"></td> |
| </tr></table></div> |
| <div class="refsect1"> |
| <a name="GApplication.functions"></a><h2>Functions</h2> |
| <div class="informaltable"><table class="informaltable" width="100%" border="0"> |
| <colgroup> |
| <col width="150px" class="functions_return"> |
| <col class="functions_name"> |
| </colgroup> |
| <tbody> |
| <tr> |
| <td class="function_type"> |
| <a href="../glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a> |
| </td> |
| <td class="function_name"> |
| <a class="link" href="GApplication.html#g-application-id-is-valid" title="g_application_id_is_valid ()">g_application_id_is_valid</a> <span class="c_punctuation">()</span> |
| </td> |
| </tr> |
| <tr> |
| <td class="function_type"> |
| <a class="link" href="GApplication.html" title="GApplication"><span class="returnvalue">GApplication</span></a> * |
| </td> |
| <td class="function_name"> |
| <a class="link" href="GApplication.html#g-application-new" title="g_application_new ()">g_application_new</a> <span class="c_punctuation">()</span> |
| </td> |
| </tr> |
| <tr> |
| <td class="function_type">const <a href="../glib-Basic-Types.html#gchar"><span class="returnvalue">gchar</span></a> * |
| </td> |
| <td class="function_name"> |
| <a class="link" href="GApplication.html#g-application-get-application-id" title="g_application_get_application_id ()">g_application_get_application_id</a> <span class="c_punctuation">()</span> |
| </td> |
| </tr> |
| <tr> |
| <td class="function_type"> |
| <span class="returnvalue">void</span> |
| </td> |
| <td class="function_name"> |
| <a class="link" href="GApplication.html#g-application-set-application-id" title="g_application_set_application_id ()">g_application_set_application_id</a> <span class="c_punctuation">()</span> |
| </td> |
| </tr> |
| <tr> |
| <td class="function_type"> |
| <a href="../glib-Basic-Types.html#guint"><span class="returnvalue">guint</span></a> |
| </td> |
| <td class="function_name"> |
| <a class="link" href="GApplication.html#g-application-get-inactivity-timeout" title="g_application_get_inactivity_timeout ()">g_application_get_inactivity_timeout</a> <span class="c_punctuation">()</span> |
| </td> |
| </tr> |
| <tr> |
| <td class="function_type"> |
| <span class="returnvalue">void</span> |
| </td> |
| <td class="function_name"> |
| <a class="link" href="GApplication.html#g-application-set-inactivity-timeout" title="g_application_set_inactivity_timeout ()">g_application_set_inactivity_timeout</a> <span class="c_punctuation">()</span> |
| </td> |
| </tr> |
| <tr> |
| <td class="function_type"> |
| <a class="link" href="GApplication.html#GApplicationFlags" title="enum GApplicationFlags"><span class="returnvalue">GApplicationFlags</span></a> |
| </td> |
| <td class="function_name"> |
| <a class="link" href="GApplication.html#g-application-get-flags" title="g_application_get_flags ()">g_application_get_flags</a> <span class="c_punctuation">()</span> |
| </td> |
| </tr> |
| <tr> |
| <td class="function_type"> |
| <span class="returnvalue">void</span> |
| </td> |
| <td class="function_name"> |
| <a class="link" href="GApplication.html#g-application-set-flags" title="g_application_set_flags ()">g_application_set_flags</a> <span class="c_punctuation">()</span> |
| </td> |
| </tr> |
| <tr> |
| <td class="function_type">const <a href="../glib-Basic-Types.html#gchar"><span class="returnvalue">gchar</span></a> * |
| </td> |
| <td class="function_name"> |
| <a class="link" href="GApplication.html#g-application-get-resource-base-path" title="g_application_get_resource_base_path ()">g_application_get_resource_base_path</a> <span class="c_punctuation">()</span> |
| </td> |
| </tr> |
| <tr> |
| <td class="function_type"> |
| <span class="returnvalue">void</span> |
| </td> |
| <td class="function_name"> |
| <a class="link" href="GApplication.html#g-application-set-resource-base-path" title="g_application_set_resource_base_path ()">g_application_set_resource_base_path</a> <span class="c_punctuation">()</span> |
| </td> |
| </tr> |
| <tr> |
| <td class="function_type"> |
| <a class="link" href="GDBusConnection.html" title="GDBusConnection"><span class="returnvalue">GDBusConnection</span></a> * |
| </td> |
| <td class="function_name"> |
| <a class="link" href="GApplication.html#g-application-get-dbus-connection" title="g_application_get_dbus_connection ()">g_application_get_dbus_connection</a> <span class="c_punctuation">()</span> |
| </td> |
| </tr> |
| <tr> |
| <td class="function_type">const <a href="../glib-Basic-Types.html#gchar"><span class="returnvalue">gchar</span></a> * |
| </td> |
| <td class="function_name"> |
| <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> <span class="c_punctuation">()</span> |
| </td> |
| </tr> |
| <tr> |
| <td class="function_type"> |
| <span class="returnvalue">void</span> |
| </td> |
| <td class="function_name"> |
| <a class="link" href="GApplication.html#g-application-set-action-group" title="g_application_set_action_group ()">g_application_set_action_group</a> <span class="c_punctuation">()</span> |
| </td> |
| </tr> |
| <tr> |
| <td class="function_type"> |
| <a href="../glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a> |
| </td> |
| <td class="function_name"> |
| <a class="link" href="GApplication.html#g-application-get-is-registered" title="g_application_get_is_registered ()">g_application_get_is_registered</a> <span class="c_punctuation">()</span> |
| </td> |
| </tr> |
| <tr> |
| <td class="function_type"> |
| <a href="../glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a> |
| </td> |
| <td class="function_name"> |
| <a class="link" href="GApplication.html#g-application-get-is-remote" title="g_application_get_is_remote ()">g_application_get_is_remote</a> <span class="c_punctuation">()</span> |
| </td> |
| </tr> |
| <tr> |
| <td class="function_type"> |
| <a href="../glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a> |
| </td> |
| <td class="function_name"> |
| <a class="link" href="GApplication.html#g-application-register" title="g_application_register ()">g_application_register</a> <span class="c_punctuation">()</span> |
| </td> |
| </tr> |
| <tr> |
| <td class="function_type"> |
| <span class="returnvalue">void</span> |
| </td> |
| <td class="function_name"> |
| <a class="link" href="GApplication.html#g-application-hold" title="g_application_hold ()">g_application_hold</a> <span class="c_punctuation">()</span> |
| </td> |
| </tr> |
| <tr> |
| <td class="function_type"> |
| <span class="returnvalue">void</span> |
| </td> |
| <td class="function_name"> |
| <a class="link" href="GApplication.html#g-application-release" title="g_application_release ()">g_application_release</a> <span class="c_punctuation">()</span> |
| </td> |
| </tr> |
| <tr> |
| <td class="function_type"> |
| <span class="returnvalue">void</span> |
| </td> |
| <td class="function_name"> |
| <a class="link" href="GApplication.html#g-application-quit" title="g_application_quit ()">g_application_quit</a> <span class="c_punctuation">()</span> |
| </td> |
| </tr> |
| <tr> |
| <td class="function_type"> |
| <span class="returnvalue">void</span> |
| </td> |
| <td class="function_name"> |
| <a class="link" href="GApplication.html#g-application-activate" title="g_application_activate ()">g_application_activate</a> <span class="c_punctuation">()</span> |
| </td> |
| </tr> |
| <tr> |
| <td class="function_type"> |
| <span class="returnvalue">void</span> |
| </td> |
| <td class="function_name"> |
| <a class="link" href="GApplication.html#g-application-open" title="g_application_open ()">g_application_open</a> <span class="c_punctuation">()</span> |
| </td> |
| </tr> |
| <tr> |
| <td class="function_type"> |
| <span class="returnvalue">void</span> |
| </td> |
| <td class="function_name"> |
| <a class="link" href="GApplication.html#g-application-send-notification" title="g_application_send_notification ()">g_application_send_notification</a> <span class="c_punctuation">()</span> |
| </td> |
| </tr> |
| <tr> |
| <td class="function_type"> |
| <span class="returnvalue">void</span> |
| </td> |
| <td class="function_name"> |
| <a class="link" href="GApplication.html#g-application-withdraw-notification" title="g_application_withdraw_notification ()">g_application_withdraw_notification</a> <span class="c_punctuation">()</span> |
| </td> |
| </tr> |
| <tr> |
| <td class="function_type"> |
| <span class="returnvalue">int</span> |
| </td> |
| <td class="function_name"> |
| <a class="link" href="GApplication.html#g-application-run" title="g_application_run ()">g_application_run</a> <span class="c_punctuation">()</span> |
| </td> |
| </tr> |
| <tr> |
| <td class="function_type"> |
| <span class="returnvalue">void</span> |
| </td> |
| <td class="function_name"> |
| <a class="link" href="GApplication.html#g-application-add-main-option-entries" title="g_application_add_main_option_entries ()">g_application_add_main_option_entries</a> <span class="c_punctuation">()</span> |
| </td> |
| </tr> |
| <tr> |
| <td class="function_type"> |
| <span class="returnvalue">void</span> |
| </td> |
| <td class="function_name"> |
| <a class="link" href="GApplication.html#g-application-add-main-option" title="g_application_add_main_option ()">g_application_add_main_option</a> <span class="c_punctuation">()</span> |
| </td> |
| </tr> |
| <tr> |
| <td class="function_type"> |
| <span class="returnvalue">void</span> |
| </td> |
| <td class="function_name"> |
| <a class="link" href="GApplication.html#g-application-add-option-group" title="g_application_add_option_group ()">g_application_add_option_group</a> <span class="c_punctuation">()</span> |
| </td> |
| </tr> |
| <tr> |
| <td class="function_type"> |
| <span class="returnvalue">void</span> |
| </td> |
| <td class="function_name"> |
| <a class="link" href="GApplication.html#g-application-set-default" title="g_application_set_default ()">g_application_set_default</a> <span class="c_punctuation">()</span> |
| </td> |
| </tr> |
| <tr> |
| <td class="function_type"> |
| <a class="link" href="GApplication.html" title="GApplication"><span class="returnvalue">GApplication</span></a> * |
| </td> |
| <td class="function_name"> |
| <a class="link" href="GApplication.html#g-application-get-default" title="g_application_get_default ()">g_application_get_default</a> <span class="c_punctuation">()</span> |
| </td> |
| </tr> |
| <tr> |
| <td class="function_type"> |
| <span class="returnvalue">void</span> |
| </td> |
| <td class="function_name"> |
| <a class="link" href="GApplication.html#g-application-mark-busy" title="g_application_mark_busy ()">g_application_mark_busy</a> <span class="c_punctuation">()</span> |
| </td> |
| </tr> |
| <tr> |
| <td class="function_type"> |
| <span class="returnvalue">void</span> |
| </td> |
| <td class="function_name"> |
| <a class="link" href="GApplication.html#g-application-unmark-busy" title="g_application_unmark_busy ()">g_application_unmark_busy</a> <span class="c_punctuation">()</span> |
| </td> |
| </tr> |
| <tr> |
| <td class="function_type"> |
| <a href="../glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a> |
| </td> |
| <td class="function_name"> |
| <a class="link" href="GApplication.html#g-application-get-is-busy" title="g_application_get_is_busy ()">g_application_get_is_busy</a> <span class="c_punctuation">()</span> |
| </td> |
| </tr> |
| <tr> |
| <td class="function_type"> |
| <span class="returnvalue">void</span> |
| </td> |
| <td class="function_name"> |
| <a class="link" href="GApplication.html#g-application-bind-busy-property" title="g_application_bind_busy_property ()">g_application_bind_busy_property</a> <span class="c_punctuation">()</span> |
| </td> |
| </tr> |
| <tr> |
| <td class="function_type"> |
| <span class="returnvalue">void</span> |
| </td> |
| <td class="function_name"> |
| <a class="link" href="GApplication.html#g-application-unbind-busy-property" title="g_application_unbind_busy_property ()">g_application_unbind_busy_property</a> <span class="c_punctuation">()</span> |
| </td> |
| </tr> |
| </tbody> |
| </table></div> |
| </div> |
| <div class="refsect1"> |
| <a name="GApplication.properties"></a><h2>Properties</h2> |
| <div class="informaltable"><table class="informaltable" border="0"> |
| <colgroup> |
| <col width="150px" class="properties_type"> |
| <col width="300px" class="properties_name"> |
| <col width="200px" class="properties_flags"> |
| </colgroup> |
| <tbody> |
| <tr> |
| <td class="property_type"> |
| <a class="link" href="GActionGroup.html" title="GActionGroup"><span class="type">GActionGroup</span></a> *</td> |
| <td class="property_name"><a class="link" href="GApplication.html#GApplication--action-group" title="The “action-group” property">action-group</a></td> |
| <td class="property_flags">Write</td> |
| </tr> |
| <tr> |
| <td class="property_type"> |
| <a href="../glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *</td> |
| <td class="property_name"><a class="link" href="GApplication.html#GApplication--application-id" title="The “application-id” property">application-id</a></td> |
| <td class="property_flags">Read / Write / Construct</td> |
| </tr> |
| <tr> |
| <td class="property_type"><a class="link" href="GApplication.html#GApplicationFlags" title="enum GApplicationFlags"><span class="type">GApplicationFlags</span></a></td> |
| <td class="property_name"><a class="link" href="GApplication.html#GApplication--flags" title="The “flags” property">flags</a></td> |
| <td class="property_flags">Read / Write</td> |
| </tr> |
| <tr> |
| <td class="property_type"><a href="../glib-Basic-Types.html#guint"><span class="type">guint</span></a></td> |
| <td class="property_name"><a class="link" href="GApplication.html#GApplication--inactivity-timeout" title="The “inactivity-timeout” property">inactivity-timeout</a></td> |
| <td class="property_flags">Read / Write</td> |
| </tr> |
| <tr> |
| <td class="property_type"><a href="../glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a></td> |
| <td class="property_name"><a class="link" href="GApplication.html#GApplication--is-busy" title="The “is-busy” property">is-busy</a></td> |
| <td class="property_flags">Read</td> |
| </tr> |
| <tr> |
| <td class="property_type"><a href="../glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a></td> |
| <td class="property_name"><a class="link" href="GApplication.html#GApplication--is-registered" title="The “is-registered” property">is-registered</a></td> |
| <td class="property_flags">Read</td> |
| </tr> |
| <tr> |
| <td class="property_type"><a href="../glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a></td> |
| <td class="property_name"><a class="link" href="GApplication.html#GApplication--is-remote" title="The “is-remote” property">is-remote</a></td> |
| <td class="property_flags">Read</td> |
| </tr> |
| <tr> |
| <td class="property_type"> |
| <a href="../glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *</td> |
| <td class="property_name"><a class="link" href="GApplication.html#GApplication--resource-base-path" title="The “resource-base-path” property">resource-base-path</a></td> |
| <td class="property_flags">Read / Write</td> |
| </tr> |
| </tbody> |
| </table></div> |
| </div> |
| <div class="refsect1"> |
| <a name="GApplication.signals"></a><h2>Signals</h2> |
| <div class="informaltable"><table class="informaltable" border="0"> |
| <colgroup> |
| <col width="150px" class="signals_return"> |
| <col width="300px" class="signals_name"> |
| <col width="200px" class="signals_flags"> |
| </colgroup> |
| <tbody> |
| <tr> |
| <td class="signal_type"><span class="returnvalue">void</span></td> |
| <td class="signal_name"><a class="link" href="GApplication.html#GApplication-activate" title="The “activate” signal">activate</a></td> |
| <td class="signal_flags"><a href="../gobject-Signals.html#G-SIGNAL-RUN-LAST:CAPS">Run Last</a></td> |
| </tr> |
| <tr> |
| <td class="signal_type"><a href="../glib-Basic-Types.html#gint"><span class="returnvalue">gint</span></a></td> |
| <td class="signal_name"><a class="link" href="GApplication.html#GApplication-command-line" title="The “command-line” signal">command-line</a></td> |
| <td class="signal_flags"><a href="../gobject-Signals.html#G-SIGNAL-RUN-LAST:CAPS">Run Last</a></td> |
| </tr> |
| <tr> |
| <td class="signal_type"><a href="../glib-Basic-Types.html#gint"><span class="returnvalue">gint</span></a></td> |
| <td class="signal_name"><a class="link" href="GApplication.html#GApplication-handle-local-options" title="The “handle-local-options” signal">handle-local-options</a></td> |
| <td class="signal_flags"><a href="../gobject-Signals.html#G-SIGNAL-RUN-LAST:CAPS">Run Last</a></td> |
| </tr> |
| <tr> |
| <td class="signal_type"><span class="returnvalue">void</span></td> |
| <td class="signal_name"><a class="link" href="GApplication.html#GApplication-open" title="The “open” signal">open</a></td> |
| <td class="signal_flags"><a href="../gobject-Signals.html#G-SIGNAL-RUN-LAST:CAPS">Run Last</a></td> |
| </tr> |
| <tr> |
| <td class="signal_type"><span class="returnvalue">void</span></td> |
| <td class="signal_name"><a class="link" href="GApplication.html#GApplication-shutdown" title="The “shutdown” signal">shutdown</a></td> |
| <td class="signal_flags"><a href="../gobject-Signals.html#G-SIGNAL-RUN-LAST:CAPS">Run Last</a></td> |
| </tr> |
| <tr> |
| <td class="signal_type"><span class="returnvalue">void</span></td> |
| <td class="signal_name"><a class="link" href="GApplication.html#GApplication-startup" title="The “startup” signal">startup</a></td> |
| <td class="signal_flags"><a href="../gobject-Signals.html#G-SIGNAL-RUN-FIRST:CAPS">Run First</a></td> |
| </tr> |
| </tbody> |
| </table></div> |
| </div> |
| <div class="refsect1"> |
| <a name="GApplication.other"></a><h2>Types and Values</h2> |
| <div class="informaltable"><table class="informaltable" width="100%" border="0"> |
| <colgroup> |
| <col width="150px" class="name"> |
| <col class="description"> |
| </colgroup> |
| <tbody> |
| <tr> |
| <td class="datatype_keyword"> </td> |
| <td class="function_name"><a class="link" href="GApplication.html#GApplication-struct" title="GApplication">GApplication</a></td> |
| </tr> |
| <tr> |
| <td class="datatype_keyword">struct</td> |
| <td class="function_name"><a class="link" href="GApplication.html#GApplicationClass" title="struct GApplicationClass">GApplicationClass</a></td> |
| </tr> |
| <tr> |
| <td class="datatype_keyword">enum</td> |
| <td class="function_name"><a class="link" href="GApplication.html#GApplicationFlags" title="enum GApplicationFlags">GApplicationFlags</a></td> |
| </tr> |
| </tbody> |
| </table></div> |
| </div> |
| <div class="refsect1"> |
| <a name="GApplication.object-hierarchy"></a><h2>Object Hierarchy</h2> |
| <pre class="screen"> <a href="../gobject-The-Base-Object-Type.html#GObject-struct">GObject</a> |
| <span class="lineart">╰──</span> GApplication |
| </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.includes"></a><h2>Includes</h2> |
| <pre class="synopsis">#include <gio/gio.h> |
| </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/gtk3/GtkApplication.html#GtkApplication-struct"><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 "use count" 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/gtk3/GtkApplication.html#GtkApplication-struct"><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 "primary instance"; for non-unique applications this is |
| the always the current instance. On Linux, the D-Bus session bus |
| is used for communication.</p> |
| <p>The use of <a class="link" href="GApplication.html" title="GApplication"><span class="type">GApplication</span></a> differs from some other commonly-used |
| uniqueness libraries (such as libunique) in important ways. The |
| application is not expected to manually register itself and check |
| if it is the primary instance. Instead, the <code class="function">main()</code> function of a |
| <a class="link" href="GApplication.html" title="GApplication"><span class="type">GApplication</span></a> should do very little more than instantiating the |
| application instance, possibly connecting signal handlers, then |
| calling <a class="link" href="GApplication.html#g-application-run" title="g_application_run ()"><code class="function">g_application_run()</code></a>. All checks for uniqueness are done |
| internally. If the application is the primary instance then the |
| startup signal is emitted and the mainloop runs. If the application |
| is not the primary instance then a signal is sent to the primary |
| instance and <a class="link" href="GApplication.html#g-application-run" title="g_application_run ()"><code class="function">g_application_run()</code></a> promptly returns. See the code |
| examples below.</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#GMenuModel-struct"><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" style="list-style-type: disc; "> |
| <li class="listitem"><p>via 'Activate' (i.e. just starting the application)</p></li> |
| <li class="listitem"><p>via 'Open' (i.e. opening some files)</p></li> |
| <li class="listitem"><p>by handling a command-line</p></li> |
| <li class="listitem"><p>via activating an action</p></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 "platform data from the |
| launching instance to the primary instance, in the form of a |
| <a href="../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/gtk3/GtkApplication.html#GtkApplication-struct"><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>For an example of opening files with a GApplication, see |
| <a class="ulink" href="https://git.gnome.org/browse/glib/tree/gio/tests/gapplication-example-open.c" target="_top">gapplication-example-open.c</a>.</p> |
| <p>For an example of using actions with GApplication, see |
| <a class="ulink" href="https://git.gnome.org/browse/glib/tree/gio/tests/gapplication-example-actions.c" target="_top">gapplication-example-actions.c</a>.</p> |
| <p>For an example of using extra D-Bus hooks with GApplication, see |
| <a class="ulink" href="https://git.gnome.org/browse/glib/tree/gio/tests/gapplication-example-dbushooks.c" target="_top">gapplication-example-dbushooks.c</a>.</p> |
| </div> |
| <div class="refsect1"> |
| <a name="GApplication.functions_details"></a><h2>Functions</h2> |
| <div class="refsect2"> |
| <a name="g-application-id-is-valid"></a><h3>g_application_id_is_valid ()</h3> |
| <pre class="programlisting"><a href="../glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a> |
| g_application_id_is_valid (<em class="parameter"><code>const <a href="../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" style="list-style-type: disc; "> |
| <li class="listitem"><p>Application identifiers must contain only the ASCII characters |
| "A-Z[0-9]_-." and must not begin with a digit.</p></li> |
| <li class="listitem"><p>Application identifiers must contain at least one '.' (period) |
| character (and thus at least three elements).</p></li> |
| <li class="listitem"><p>Application identifiers must not begin or end with a '.' (period) |
| character.</p></li> |
| <li class="listitem"><p>Application identifiers must not contain consecutive '.' (period) |
| characters.</p></li> |
| <li class="listitem"><p>Application identifiers must not exceed 255 characters.</p></li> |
| </ul></div> |
| <div class="refsect3"> |
| <a name="g-application-id-is-valid.parameters"></a><h4>Parameters</h4> |
| <div class="informaltable"><table class="informaltable" width="100%" border="0"> |
| <colgroup> |
| <col width="150px" class="parameters_name"> |
| <col class="parameters_description"> |
| <col width="200px" class="parameters_annotations"> |
| </colgroup> |
| <tbody><tr> |
| <td class="parameter_name"><p>application_id</p></td> |
| <td class="parameter_description"><p>a potential application identifier</p></td> |
| <td class="parameter_annotations"> </td> |
| </tr></tbody> |
| </table></div> |
| </div> |
| <div class="refsect3"> |
| <a name="g-application-id-is-valid.returns"></a><h4>Returns</h4> |
| <p> <a href="../glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if <em class="parameter"><code>application_id</code></em> |
| is valid</p> |
| </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-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" title="enum 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>If non-<a href="../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="refsect3"> |
| <a name="g-application-new.parameters"></a><h4>Parameters</h4> |
| <div class="informaltable"><table class="informaltable" width="100%" border="0"> |
| <colgroup> |
| <col width="150px" class="parameters_name"> |
| <col class="parameters_description"> |
| <col width="200px" class="parameters_annotations"> |
| </colgroup> |
| <tbody> |
| <tr> |
| <td class="parameter_name"><p>application_id</p></td> |
| <td class="parameter_description"><p> the application id. </p></td> |
| <td class="parameter_annotations"><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 class="parameter_name"><p>flags</p></td> |
| <td class="parameter_description"><p>the application flags</p></td> |
| <td class="parameter_annotations"> </td> |
| </tr> |
| </tbody> |
| </table></div> |
| </div> |
| <div class="refsect3"> |
| <a name="g-application-new.returns"></a><h4>Returns</h4> |
| <p> a new <a class="link" href="GApplication.html" title="GApplication"><span class="type">GApplication</span></a> instance</p> |
| </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-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="refsect3"> |
| <a name="g-application-get-application-id.parameters"></a><h4>Parameters</h4> |
| <div class="informaltable"><table class="informaltable" width="100%" border="0"> |
| <colgroup> |
| <col width="150px" class="parameters_name"> |
| <col class="parameters_description"> |
| <col width="200px" class="parameters_annotations"> |
| </colgroup> |
| <tbody><tr> |
| <td class="parameter_name"><p>application</p></td> |
| <td class="parameter_description"><p>a <a class="link" href="GApplication.html" title="GApplication"><span class="type">GApplication</span></a></p></td> |
| <td class="parameter_annotations"> </td> |
| </tr></tbody> |
| </table></div> |
| </div> |
| <div class="refsect3"> |
| <a name="g-application-get-application-id.returns"></a><h4>Returns</h4> |
| <p> the identifier for <em class="parameter"><code>application</code></em> |
| , owned by <em class="parameter"><code>application</code></em> |
| </p> |
| </div> |
| <p class="since">Since: <a class="link" href="api-index-2-28.html#api-index-2.28">2.28</a></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-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-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="refsect3"> |
| <a name="g-application-set-application-id.parameters"></a><h4>Parameters</h4> |
| <div class="informaltable"><table class="informaltable" width="100%" border="0"> |
| <colgroup> |
| <col width="150px" class="parameters_name"> |
| <col class="parameters_description"> |
| <col width="200px" class="parameters_annotations"> |
| </colgroup> |
| <tbody> |
| <tr> |
| <td class="parameter_name"><p>application</p></td> |
| <td class="parameter_description"><p>a <a class="link" href="GApplication.html" title="GApplication"><span class="type">GApplication</span></a></p></td> |
| <td class="parameter_annotations"> </td> |
| </tr> |
| <tr> |
| <td class="parameter_name"><p>application_id</p></td> |
| <td class="parameter_description"><p> the identifier for <em class="parameter"><code>application</code></em> |
| . </p></td> |
| <td class="parameter_annotations"><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> |
| </div> |
| <p class="since">Since: <a class="link" href="api-index-2-28.html#api-index-2.28">2.28</a></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-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="refsect3"> |
| <a name="g-application-get-inactivity-timeout.parameters"></a><h4>Parameters</h4> |
| <div class="informaltable"><table class="informaltable" width="100%" border="0"> |
| <colgroup> |
| <col width="150px" class="parameters_name"> |
| <col class="parameters_description"> |
| <col width="200px" class="parameters_annotations"> |
| </colgroup> |
| <tbody><tr> |
| <td class="parameter_name"><p>application</p></td> |
| <td class="parameter_description"><p>a <a class="link" href="GApplication.html" title="GApplication"><span class="type">GApplication</span></a></p></td> |
| <td class="parameter_annotations"> </td> |
| </tr></tbody> |
| </table></div> |
| </div> |
| <div class="refsect3"> |
| <a name="g-application-get-inactivity-timeout.returns"></a><h4>Returns</h4> |
| <p> the timeout, in milliseconds</p> |
| </div> |
| <p class="since">Since: <a class="link" href="api-index-2-28.html#api-index-2.28">2.28</a></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-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="refsect3"> |
| <a name="g-application-set-inactivity-timeout.parameters"></a><h4>Parameters</h4> |
| <div class="informaltable"><table class="informaltable" width="100%" border="0"> |
| <colgroup> |
| <col width="150px" class="parameters_name"> |
| <col class="parameters_description"> |
| <col width="200px" class="parameters_annotations"> |
| </colgroup> |
| <tbody> |
| <tr> |
| <td class="parameter_name"><p>application</p></td> |
| <td class="parameter_description"><p>a <a class="link" href="GApplication.html" title="GApplication"><span class="type">GApplication</span></a></p></td> |
| <td class="parameter_annotations"> </td> |
| </tr> |
| <tr> |
| <td class="parameter_name"><p>inactivity_timeout</p></td> |
| <td class="parameter_description"><p>the timeout, in milliseconds</p></td> |
| <td class="parameter_annotations"> </td> |
| </tr> |
| </tbody> |
| </table></div> |
| </div> |
| <p class="since">Since: <a class="link" href="api-index-2-28.html#api-index-2.28">2.28</a></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" title="enum 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" title="enum GApplicationFlags"><span class="type">GApplicationFlags</span></a>.</p> |
| <div class="refsect3"> |
| <a name="g-application-get-flags.parameters"></a><h4>Parameters</h4> |
| <div class="informaltable"><table class="informaltable" width="100%" border="0"> |
| <colgroup> |
| <col width="150px" class="parameters_name"> |
| <col class="parameters_description"> |
| <col width="200px" class="parameters_annotations"> |
| </colgroup> |
| <tbody><tr> |
| <td class="parameter_name"><p>application</p></td> |
| <td class="parameter_description"><p>a <a class="link" href="GApplication.html" title="GApplication"><span class="type">GApplication</span></a></p></td> |
| <td class="parameter_annotations"> </td> |
| </tr></tbody> |
| </table></div> |
| </div> |
| <div class="refsect3"> |
| <a name="g-application-get-flags.returns"></a><h4>Returns</h4> |
| <p> the flags for <em class="parameter"><code>application</code></em> |
| </p> |
| </div> |
| <p class="since">Since: <a class="link" href="api-index-2-28.html#api-index-2.28">2.28</a></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" title="enum 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" title="enum GApplicationFlags"><span class="type">GApplicationFlags</span></a>.</p> |
| <div class="refsect3"> |
| <a name="g-application-set-flags.parameters"></a><h4>Parameters</h4> |
| <div class="informaltable"><table class="informaltable" width="100%" border="0"> |
| <colgroup> |
| <col width="150px" class="parameters_name"> |
| <col class="parameters_description"> |
| <col width="200px" class="parameters_annotations"> |
| </colgroup> |
| <tbody> |
| <tr> |
| <td class="parameter_name"><p>application</p></td> |
| <td class="parameter_description"><p>a <a class="link" href="GApplication.html" title="GApplication"><span class="type">GApplication</span></a></p></td> |
| <td class="parameter_annotations"> </td> |
| </tr> |
| <tr> |
| <td class="parameter_name"><p>flags</p></td> |
| <td class="parameter_description"><p>the flags for <em class="parameter"><code>application</code></em> |
| </p></td> |
| <td class="parameter_annotations"> </td> |
| </tr> |
| </tbody> |
| </table></div> |
| </div> |
| <p class="since">Since: <a class="link" href="api-index-2-28.html#api-index-2.28">2.28</a></p> |
| </div> |
| <hr> |
| <div class="refsect2"> |
| <a name="g-application-get-resource-base-path"></a><h3>g_application_get_resource_base_path ()</h3> |
| <pre class="programlisting">const <a href="../glib-Basic-Types.html#gchar"><span class="returnvalue">gchar</span></a> * |
| g_application_get_resource_base_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 resource base path of <em class="parameter"><code>application</code></em> |
| .</p> |
| <p>See <a class="link" href="GApplication.html#g-application-set-resource-base-path" title="g_application_set_resource_base_path ()"><code class="function">g_application_set_resource_base_path()</code></a> for more information.</p> |
| <div class="refsect3"> |
| <a name="g-application-get-resource-base-path.parameters"></a><h4>Parameters</h4> |
| <div class="informaltable"><table class="informaltable" width="100%" border="0"> |
| <colgroup> |
| <col width="150px" class="parameters_name"> |
| <col class="parameters_description"> |
| <col width="200px" class="parameters_annotations"> |
| </colgroup> |
| <tbody><tr> |
| <td class="parameter_name"><p>application</p></td> |
| <td class="parameter_description"><p>a <a class="link" href="GApplication.html" title="GApplication"><span class="type">GApplication</span></a></p></td> |
| <td class="parameter_annotations"> </td> |
| </tr></tbody> |
| </table></div> |
| </div> |
| <div class="refsect3"> |
| <a name="g-application-get-resource-base-path.returns"></a><h4>Returns</h4> |
| <p> the base resource path, if one is set. </p> |
| <p><span class="annotation">[<acronym title="NULL may be passed as the value in, out, in-out; or as a return value."><span class="acronym">nullable</span></acronym>]</span></p> |
| </div> |
| <p class="since">Since: <a class="link" href="api-index-2-42.html#api-index-2.42">2.42</a></p> |
| </div> |
| <hr> |
| <div class="refsect2"> |
| <a name="g-application-set-resource-base-path"></a><h3>g_application_set_resource_base_path ()</h3> |
| <pre class="programlisting"><span class="returnvalue">void</span> |
| g_application_set_resource_base_path (<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-Basic-Types.html#gchar"><span class="type">gchar</span></a> *resource_path</code></em>);</pre> |
| <p>Sets (or unsets) the base resource path of <em class="parameter"><code>application</code></em> |
| .</p> |
| <p>The path is used to automatically load various <GTKDOCLINK HREF="gresource">application |
| resources</GTKDOCLINK> such as menu layouts and action descriptions. |
| The various types of resources will be found at fixed names relative |
| to the given base path.</p> |
| <p>By default, the resource base path is determined from the application |
| ID by prefixing '/' and replacing each '.' with '/'. This is done at |
| the time that the <a class="link" href="GApplication.html" title="GApplication"><span class="type">GApplication</span></a> object is constructed. Changes to |
| the application ID after that point will not have an impact on the |
| resource base path.</p> |
| <p>As an example, if the application has an ID of "org.example.app" then |
| the default resource base path will be "/org/example/app". If this |
| is a <a href="http://developer.gnome.org/gtk3/GtkApplication.html#GtkApplication-struct"><span class="type">GtkApplication</span></a> (and you have not manually changed the path) |
| then Gtk will then search for the menus of the application at |
| "/org/example/app/gtk/menus.ui".</p> |
| <p>See <a class="link" href="GResource.html" title="GResource"><span class="type">GResource</span></a> for more information about adding resources to your |
| application.</p> |
| <p>You can disable automatic resource loading functionality by setting |
| the path to <a href="../glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>.</p> |
| <p>Changing the resource base path once the application is running is |
| not recommended. The point at which the resource path is consulted |
| for forming paths for various purposes is unspecified. When writing |
| a sub-class of <a class="link" href="GApplication.html" title="GApplication"><span class="type">GApplication</span></a> you should either set the |
| <a class="link" href="GApplication.html#GApplication--resource-base-path" title="The “resource-base-path” property"><span class="type">“resource-base-path”</span></a> property at construction time, or call |
| this function during the instance initialization. Alternatively, you |
| can call this function in the <a class="link" href="GApplication.html#GApplicationClass.startup"><span class="type">GApplicationClass.startup</span></a> virtual function, |
| before chaining up to the parent implementation.</p> |
| <div class="refsect3"> |
| <a name="g-application-set-resource-base-path.parameters"></a><h4>Parameters</h4> |
| <div class="informaltable"><table class="informaltable" width="100%" border="0"> |
| <colgroup> |
| <col width="150px" class="parameters_name"> |
| <col class="parameters_description"> |
| <col width="200px" class="parameters_annotations"> |
| </colgroup> |
| <tbody> |
| <tr> |
| <td class="parameter_name"><p>application</p></td> |
| <td class="parameter_description"><p>a <a class="link" href="GApplication.html" title="GApplication"><span class="type">GApplication</span></a></p></td> |
| <td class="parameter_annotations"> </td> |
| </tr> |
| <tr> |
| <td class="parameter_name"><p>resource_path</p></td> |
| <td class="parameter_description"><p> the resource path to use. </p></td> |
| <td class="parameter_annotations"><span class="annotation">[<acronym title="NULL may be passed as the value in, out, in-out; or as a return value."><span class="acronym">nullable</span></acronym>]</span></td> |
| </tr> |
| </tbody> |
| </table></div> |
| </div> |
| <p class="since">Since: <a class="link" href="api-index-2-42.html#api-index-2.42">2.42</a></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-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-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="refsect3"> |
| <a name="g-application-get-dbus-connection.parameters"></a><h4>Parameters</h4> |
| <div class="informaltable"><table class="informaltable" width="100%" border="0"> |
| <colgroup> |
| <col width="150px" class="parameters_name"> |
| <col class="parameters_description"> |
| <col width="200px" class="parameters_annotations"> |
| </colgroup> |
| <tbody><tr> |
| <td class="parameter_name"><p>application</p></td> |
| <td class="parameter_description"><p>a <a class="link" href="GApplication.html" title="GApplication"><span class="type">GApplication</span></a></p></td> |
| <td class="parameter_annotations"> </td> |
| </tr></tbody> |
| </table></div> |
| </div> |
| <div class="refsect3"> |
| <a name="g-application-get-dbus-connection.returns"></a><h4>Returns</h4> |
| <p> a <a class="link" href="GDBusConnection.html" title="GDBusConnection"><span class="type">GDBusConnection</span></a>, or <a href="../glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>. </p> |
| <p><span class="annotation">[<acronym title="Don't free data after the code is done."><span class="acronym">transfer none</span></acronym>]</span></p> |
| </div> |
| <p class="since">Since: <a class="link" href="api-index-2-34.html#api-index-2.34">2.34</a></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-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-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-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="refsect3"> |
| <a name="g-application-get-dbus-object-path.parameters"></a><h4>Parameters</h4> |
| <div class="informaltable"><table class="informaltable" width="100%" border="0"> |
| <colgroup> |
| <col width="150px" class="parameters_name"> |
| <col class="parameters_description"> |
| <col width="200px" class="parameters_annotations"> |
| </colgroup> |
| <tbody><tr> |
| <td class="parameter_name"><p>application</p></td> |
| <td class="parameter_description"><p>a <a class="link" href="GApplication.html" title="GApplication"><span class="type">GApplication</span></a></p></td> |
| <td class="parameter_annotations"> </td> |
| </tr></tbody> |
| </table></div> |
| </div> |
| <div class="refsect3"> |
| <a name="g-application-get-dbus-object-path.returns"></a><h4>Returns</h4> |
| <p> the object path, or <a href="../glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a></p> |
| </div> |
| <p class="since">Since: <a class="link" href="api-index-2-34.html#api-index-2.34">2.34</a></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"> |
| <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.</p> |
| <p>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="refsect3"> |
| <a name="g-application-set-action-group.parameters"></a><h4>Parameters</h4> |
| <div class="informaltable"><table class="informaltable" width="100%" border="0"> |
| <colgroup> |
| <col width="150px" class="parameters_name"> |
| <col class="parameters_description"> |
| <col width="200px" class="parameters_annotations"> |
| </colgroup> |
| <tbody> |
| <tr> |
| <td class="parameter_name"><p>application</p></td> |
| <td class="parameter_description"><p>a <a class="link" href="GApplication.html" title="GApplication"><span class="type">GApplication</span></a></p></td> |
| <td class="parameter_annotations"> </td> |
| </tr> |
| <tr> |
| <td class="parameter_name"><p>action_group</p></td> |
| <td class="parameter_description"><p> a <a class="link" href="GActionGroup.html" title="GActionGroup"><span class="type">GActionGroup</span></a>, or <a href="../glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>. </p></td> |
| <td class="parameter_annotations"><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> |
| </div> |
| <p class="since">Since: <a class="link" href="api-index-2-28.html#api-index-2.28">2.28</a></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-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="refsect3"> |
| <a name="g-application-get-is-registered.parameters"></a><h4>Parameters</h4> |
| <div class="informaltable"><table class="informaltable" width="100%" border="0"> |
| <colgroup> |
| <col width="150px" class="parameters_name"> |
| <col class="parameters_description"> |
| <col width="200px" class="parameters_annotations"> |
| </colgroup> |
| <tbody><tr> |
| <td class="parameter_name"><p>application</p></td> |
| <td class="parameter_description"><p>a <a class="link" href="GApplication.html" title="GApplication"><span class="type">GApplication</span></a></p></td> |
| <td class="parameter_annotations"> </td> |
| </tr></tbody> |
| </table></div> |
| </div> |
| <div class="refsect3"> |
| <a name="g-application-get-is-registered.returns"></a><h4>Returns</h4> |
| <p> <a href="../glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if <em class="parameter"><code>application</code></em> |
| is registered</p> |
| </div> |
| <p class="since">Since: <a class="link" href="api-index-2-28.html#api-index-2.28">2.28</a></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-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="refsect3"> |
| <a name="g-application-get-is-remote.parameters"></a><h4>Parameters</h4> |
| <div class="informaltable"><table class="informaltable" width="100%" border="0"> |
| <colgroup> |
| <col width="150px" class="parameters_name"> |
| <col class="parameters_description"> |
| <col width="200px" class="parameters_annotations"> |
| </colgroup> |
| <tbody><tr> |
| <td class="parameter_name"><p>application</p></td> |
| <td class="parameter_description"><p>a <a class="link" href="GApplication.html" title="GApplication"><span class="type">GApplication</span></a></p></td> |
| <td class="parameter_annotations"> </td> |
| </tr></tbody> |
| </table></div> |
| </div> |
| <div class="refsect3"> |
| <a name="g-application-get-is-remote.returns"></a><h4>Returns</h4> |
| <p> <a href="../glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if <em class="parameter"><code>application</code></em> |
| is remote</p> |
| </div> |
| <p class="since">Since: <a class="link" href="api-index-2-28.html#api-index-2.28">2.28</a></p> |
| </div> |
| <hr> |
| <div class="refsect2"> |
| <a name="g-application-register"></a><h3>g_application_register ()</h3> |
| <pre class="programlisting"><a href="../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-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-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-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="refsect3"> |
| <a name="g-application-register.parameters"></a><h4>Parameters</h4> |
| <div class="informaltable"><table class="informaltable" width="100%" border="0"> |
| <colgroup> |
| <col width="150px" class="parameters_name"> |
| <col class="parameters_description"> |
| <col width="200px" class="parameters_annotations"> |
| </colgroup> |
| <tbody> |
| <tr> |
| <td class="parameter_name"><p>application</p></td> |
| <td class="parameter_description"><p>a <a class="link" href="GApplication.html" title="GApplication"><span class="type">GApplication</span></a></p></td> |
| <td class="parameter_annotations"> </td> |
| </tr> |
| <tr> |
| <td class="parameter_name"><p>cancellable</p></td> |
| <td class="parameter_description"><p> a <a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a>, or <a href="../glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>. </p></td> |
| <td class="parameter_annotations"><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 class="parameter_name"><p>error</p></td> |
| <td class="parameter_description"><p>a pointer to a NULL <a href="../glib-Error-Reporting.html#GError"><span class="type">GError</span></a>, or <a href="../glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a></p></td> |
| <td class="parameter_annotations"> </td> |
| </tr> |
| </tbody> |
| </table></div> |
| </div> |
| <div class="refsect3"> |
| <a name="g-application-register.returns"></a><h4>Returns</h4> |
| <p> <a href="../glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if registration succeeded</p> |
| </div> |
| <p class="since">Since: <a class="link" href="api-index-2-28.html#api-index-2.28">2.28</a></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="refsect3"> |
| <a name="g-application-hold.parameters"></a><h4>Parameters</h4> |
| <div class="informaltable"><table class="informaltable" width="100%" border="0"> |
| <colgroup> |
| <col width="150px" class="parameters_name"> |
| <col class="parameters_description"> |
| <col width="200px" class="parameters_annotations"> |
| </colgroup> |
| <tbody><tr> |
| <td class="parameter_name"><p>application</p></td> |
| <td class="parameter_description"><p>a <a class="link" href="GApplication.html" title="GApplication"><span class="type">GApplication</span></a></p></td> |
| <td class="parameter_annotations"> </td> |
| </tr></tbody> |
| </table></div> |
| </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="refsect3"> |
| <a name="g-application-release.parameters"></a><h4>Parameters</h4> |
| <div class="informaltable"><table class="informaltable" width="100%" border="0"> |
| <colgroup> |
| <col width="150px" class="parameters_name"> |
| <col class="parameters_description"> |
| <col width="200px" class="parameters_annotations"> |
| </colgroup> |
| <tbody><tr> |
| <td class="parameter_name"><p>application</p></td> |
| <td class="parameter_description"><p>a <a class="link" href="GApplication.html" title="GApplication"><span class="type">GApplication</span></a></p></td> |
| <td class="parameter_annotations"> </td> |
| </tr></tbody> |
| </table></div> |
| </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="refsect3"> |
| <a name="g-application-quit.parameters"></a><h4>Parameters</h4> |
| <div class="informaltable"><table class="informaltable" width="100%" border="0"> |
| <colgroup> |
| <col width="150px" class="parameters_name"> |
| <col class="parameters_description"> |
| <col width="200px" class="parameters_annotations"> |
| </colgroup> |
| <tbody><tr> |
| <td class="parameter_name"><p>application</p></td> |
| <td class="parameter_description"><p>a <a class="link" href="GApplication.html" title="GApplication"><span class="type">GApplication</span></a></p></td> |
| <td class="parameter_annotations"> </td> |
| </tr></tbody> |
| </table></div> |
| </div> |
| <p class="since">Since: <a class="link" href="api-index-2-32.html#api-index-2.32">2.32</a></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="refsect3"> |
| <a name="g-application-activate.parameters"></a><h4>Parameters</h4> |
| <div class="informaltable"><table class="informaltable" width="100%" border="0"> |
| <colgroup> |
| <col width="150px" class="parameters_name"> |
| <col class="parameters_description"> |
| <col width="200px" class="parameters_annotations"> |
| </colgroup> |
| <tbody><tr> |
| <td class="parameter_name"><p>application</p></td> |
| <td class="parameter_description"><p>a <a class="link" href="GApplication.html" title="GApplication"><span class="type">GApplication</span></a></p></td> |
| <td class="parameter_annotations"> </td> |
| </tr></tbody> |
| </table></div> |
| </div> |
| <p class="since">Since: <a class="link" href="api-index-2-28.html#api-index-2.28">2.28</a></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-Basic-Types.html#gint"><span class="type">gint</span></a> n_files</code></em>, |
| <em class="parameter"><code>const <a href="../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="refsect3"> |
| <a name="g-application-open.parameters"></a><h4>Parameters</h4> |
| <div class="informaltable"><table class="informaltable" width="100%" border="0"> |
| <colgroup> |
| <col width="150px" class="parameters_name"> |
| <col class="parameters_description"> |
| <col width="200px" class="parameters_annotations"> |
| </colgroup> |
| <tbody> |
| <tr> |
| <td class="parameter_name"><p>application</p></td> |
| <td class="parameter_description"><p>a <a class="link" href="GApplication.html" title="GApplication"><span class="type">GApplication</span></a></p></td> |
| <td class="parameter_annotations"> </td> |
| </tr> |
| <tr> |
| <td class="parameter_name"><p>files</p></td> |
| <td class="parameter_description"><p> an array of <a href="GFile.html#GFile-struct"><span class="type">GFiles</span></a> to open. </p></td> |
| <td class="parameter_annotations"><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 class="parameter_name"><p>n_files</p></td> |
| <td class="parameter_description"><p>the length of the <em class="parameter"><code>files</code></em> |
| array</p></td> |
| <td class="parameter_annotations"> </td> |
| </tr> |
| <tr> |
| <td class="parameter_name"><p>hint</p></td> |
| <td class="parameter_description"><p>a hint (or ""), but never <a href="../glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a></p></td> |
| <td class="parameter_annotations"> </td> |
| </tr> |
| </tbody> |
| </table></div> |
| </div> |
| <p class="since">Since: <a class="link" href="api-index-2-28.html#api-index-2.28">2.28</a></p> |
| </div> |
| <hr> |
| <div class="refsect2"> |
| <a name="g-application-send-notification"></a><h3>g_application_send_notification ()</h3> |
| <pre class="programlisting"><span class="returnvalue">void</span> |
| g_application_send_notification (<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-Basic-Types.html#gchar"><span class="type">gchar</span></a> *id</code></em>, |
| <em class="parameter"><code><a class="link" href="GNotification.html" title="GNotification"><span class="type">GNotification</span></a> *notification</code></em>);</pre> |
| <p>Sends a notification on behalf of <em class="parameter"><code>application</code></em> |
| to the desktop shell. |
| There is no guarantee that the notification is displayed immediately, |
| or even at all.</p> |
| <p>Notifications may persist after the application exits. It will be |
| D-Bus-activated when the notification or one of its actions is |
| activated.</p> |
| <p>Modifying <em class="parameter"><code>notification</code></em> |
| after this call has no effect. However, the |
| object can be reused for a later call to this function.</p> |
| <p><em class="parameter"><code>id</code></em> |
| may be any string that uniquely identifies the event for the |
| application. It does not need to be in any special format. For |
| example, "new-message" might be appropriate for a notification about |
| new messages.</p> |
| <p>If a previous notification was sent with the same <em class="parameter"><code>id</code></em> |
| , it will be |
| replaced with <em class="parameter"><code>notification</code></em> |
| and shown again as if it was a new |
| notification. This works even for notifications sent from a previous |
| execution of the application, as long as <em class="parameter"><code>id</code></em> |
| is the same string.</p> |
| <p><em class="parameter"><code>id</code></em> |
| may be <a href="../glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>, but it is impossible to replace or withdraw |
| notifications without an id.</p> |
| <p>If <em class="parameter"><code>notification</code></em> |
| is no longer relevant, it can be withdrawn with |
| <a class="link" href="GApplication.html#g-application-withdraw-notification" title="g_application_withdraw_notification ()"><code class="function">g_application_withdraw_notification()</code></a>.</p> |
| <div class="refsect3"> |
| <a name="g-application-send-notification.parameters"></a><h4>Parameters</h4> |
| <div class="informaltable"><table class="informaltable" width="100%" border="0"> |
| <colgroup> |
| <col width="150px" class="parameters_name"> |
| <col class="parameters_description"> |
| <col width="200px" class="parameters_annotations"> |
| </colgroup> |
| <tbody> |
| <tr> |
| <td class="parameter_name"><p>application</p></td> |
| <td class="parameter_description"><p>a <a class="link" href="GApplication.html" title="GApplication"><span class="type">GApplication</span></a></p></td> |
| <td class="parameter_annotations"> </td> |
| </tr> |
| <tr> |
| <td class="parameter_name"><p>id</p></td> |
| <td class="parameter_description"><p> id of the notification, or <a href="../glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>. </p></td> |
| <td class="parameter_annotations"><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 class="parameter_name"><p>notification</p></td> |
| <td class="parameter_description"><p>the <a class="link" href="GNotification.html" title="GNotification"><span class="type">GNotification</span></a> to send</p></td> |
| <td class="parameter_annotations"> </td> |
| </tr> |
| </tbody> |
| </table></div> |
| </div> |
| <p class="since">Since: <a class="link" href="api-index-2-40.html#api-index-2.40">2.40</a></p> |
| </div> |
| <hr> |
| <div class="refsect2"> |
| <a name="g-application-withdraw-notification"></a><h3>g_application_withdraw_notification ()</h3> |
| <pre class="programlisting"><span class="returnvalue">void</span> |
| g_application_withdraw_notification (<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-Basic-Types.html#gchar"><span class="type">gchar</span></a> *id</code></em>);</pre> |
| <p>Withdraws a notification that was sent with |
| <a class="link" href="GApplication.html#g-application-send-notification" title="g_application_send_notification ()"><code class="function">g_application_send_notification()</code></a>.</p> |
| <p>This call does nothing if a notification with <em class="parameter"><code>id</code></em> |
| doesn't exist or |
| the notification was never sent.</p> |
| <p>This function works even for notifications sent in previous |
| executions of this application, as long <em class="parameter"><code>id</code></em> |
| is the same as it was for |
| the sent notification.</p> |
| <p>Note that notifications are dismissed when the user clicks on one |
| of the buttons in a notification or triggers its default action, so |
| there is no need to explicitly withdraw the notification in that case.</p> |
| <div class="refsect3"> |
| <a name="g-application-withdraw-notification.parameters"></a><h4>Parameters</h4> |
| <div class="informaltable"><table class="informaltable" width="100%" border="0"> |
| <colgroup> |
| <col width="150px" class="parameters_name"> |
| <col class="parameters_description"> |
| <col width="200px" class="parameters_annotations"> |
| </colgroup> |
| <tbody> |
| <tr> |
| <td class="parameter_name"><p>application</p></td> |
| <td class="parameter_description"><p>a <a class="link" href="GApplication.html" title="GApplication"><span class="type">GApplication</span></a></p></td> |
| <td class="parameter_annotations"> </td> |
| </tr> |
| <tr> |
| <td class="parameter_name"><p>id</p></td> |
| <td class="parameter_description"><p>id of a previously sent notification</p></td> |
| <td class="parameter_annotations"> </td> |
| </tr> |
| </tbody> |
| </table></div> |
| </div> |
| <p class="since">Since: <a class="link" href="api-index-2-40.html#api-index-2.40">2.40</a></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-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. Note that on Windows, <em class="parameter"><code>argc</code></em> |
| and <em class="parameter"><code>argv</code></em> |
| are ignored, and |
| <a href="../glib-Windows-Compatibility-Functions.html#g-win32-get-command-line"><code class="function">g_win32_get_command_line()</code></a> is called internally (for proper support |
| of Unicode commandline arguments).</p> |
| <p><a class="link" href="GApplication.html" title="GApplication"><span class="type">GApplication</span></a> will attempt to parse the commandline arguments. You |
| can add commandline flags to the list of recognised options by way of |
| <a class="link" href="GApplication.html#g-application-add-main-option-entries" title="g_application_add_main_option_entries ()"><code class="function">g_application_add_main_option_entries()</code></a>. After this, the |
| <a class="link" href="GApplication.html#GApplication-handle-local-options" title="The “handle-local-options” signal"><span class="type">“handle-local-options”</span></a> signal is emitted, from which the |
| application can inspect the values of its <a href="../glib-Commandline-option-parser.html#GOptionEntry"><span class="type">GOptionEntrys</span></a>.</p> |
| <p><a class="link" href="GApplication.html#GApplication-handle-local-options" title="The “handle-local-options” signal"><span class="type">“handle-local-options”</span></a> is a good place to handle options |
| such as <code class="literal">--version</code>, where an immediate reply from the local process is |
| desired (instead of communicating with an already-running instance). |
| A <a class="link" href="GApplication.html#GApplication-handle-local-options" title="The “handle-local-options” signal"><span class="type">“handle-local-options”</span></a> handler can stop further processing |
| by returning a non-negative value, which then becomes the exit status of |
| the process.</p> |
| <p>What happens next depends on the flags: if |
| <a class="link" href="GApplication.html#G-APPLICATION-HANDLES-COMMAND-LINE:CAPS"><code class="literal">G_APPLICATION_HANDLES_COMMAND_LINE</code></a> was specified then the remaining |
| commandline arguments are sent to the primary instance, where a |
| <a class="link" href="GApplication.html#GApplication-command-line" title="The “command-line” signal"><span class="type">“command-line”</span></a> signal is emitted. Otherwise, the |
| remaining commandline arguments are assumed to be a list of files. |
| If there are no files listed, the application is activated via the |
| <a class="link" href="GApplication.html#GApplication-activate" title="The “activate” signal"><span class="type">“activate”</span></a> signal. If there are one or more files, and |
| <a class="link" href="GApplication.html#G-APPLICATION-HANDLES-OPEN:CAPS"><code class="literal">G_APPLICATION_HANDLES_OPEN</code></a> was specified then the files are opened |
| via the <a class="link" href="GApplication.html#GApplication-open" title="The “open” signal"><span class="type">“open”</span></a> signal.</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-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 |
| gapplication-example-cmdline2.c |
| 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 service will |
| run for as much as 10 seconds with a use count of zero while waiting |
| for the message that caused the activation to arrive. After that, |
| if the use count falls to zero the application will exit immediately, |
| except in the case that <a class="link" href="GApplication.html#g-application-set-inactivity-timeout" title="g_application_set_inactivity_timeout ()"><code class="function">g_application_set_inactivity_timeout()</code></a> is in |
| use.</p> |
| <p>This function sets the prgname (<a href="../glib-Miscellaneous-Utility-Functions.html#g-set-prgname"><code class="function">g_set_prgname()</code></a>), if not already set, |
| to the basename of argv[0].</p> |
| <p>Much like <a href="../glib-The-Main-Event-Loop.html#g-main-loop-run"><code class="function">g_main_loop_run()</code></a>, this function will acquire the main context |
| for the duration that the application is running.</p> |
| <p>Since 2.40, applications that are not explicitly flagged as services |
| or launchers (ie: neither <a class="link" href="GApplication.html#G-APPLICATION-IS-SERVICE:CAPS"><code class="literal">G_APPLICATION_IS_SERVICE</code></a> or |
| <a class="link" href="GApplication.html#G-APPLICATION-IS-LAUNCHER:CAPS"><code class="literal">G_APPLICATION_IS_LAUNCHER</code></a> are given as flags) will check (from the |
| default handler for local_command_line) if "--gapplication-service" |
| was given in the command line. If this flag is present then normal |
| commandline processing is interrupted and the |
| <a class="link" href="GApplication.html#G-APPLICATION-IS-SERVICE:CAPS"><code class="literal">G_APPLICATION_IS_SERVICE</code></a> flag is set. This provides a "compromise" |
| solution whereby running an application directly from the commandline |
| will invoke it in the normal way (which can be useful for debugging) |
| while still allowing applications to be D-Bus activated in service |
| mode. The D-Bus service file should invoke the executable with |
| "--gapplication-service" as the sole commandline argument. This |
| approach is suitable for use by most graphical applications but |
| should not be used from applications like editors that need precise |
| control over when processes invoked via the commandline will exit and |
| what their exit status will be.</p> |
| <div class="refsect3"> |
| <a name="g-application-run.parameters"></a><h4>Parameters</h4> |
| <div class="informaltable"><table class="informaltable" width="100%" border="0"> |
| <colgroup> |
| <col width="150px" class="parameters_name"> |
| <col class="parameters_description"> |
| <col width="200px" class="parameters_annotations"> |
| </colgroup> |
| <tbody> |
| <tr> |
| <td class="parameter_name"><p>application</p></td> |
| <td class="parameter_description"><p>a <a class="link" href="GApplication.html" title="GApplication"><span class="type">GApplication</span></a></p></td> |
| <td class="parameter_annotations"> </td> |
| </tr> |
| <tr> |
| <td class="parameter_name"><p>argc</p></td> |
| <td class="parameter_description"><p>the argc from <code class="function">main()</code> (or 0 if <em class="parameter"><code>argv</code></em> |
| is <a href="../glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>)</p></td> |
| <td class="parameter_annotations"> </td> |
| </tr> |
| <tr> |
| <td class="parameter_name"><p>argv</p></td> |
| <td class="parameter_description"><p> the argv from <code class="function">main()</code>, or <a href="../glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>. </p></td> |
| <td class="parameter_annotations"><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> |
| </tbody> |
| </table></div> |
| </div> |
| <div class="refsect3"> |
| <a name="g-application-run.returns"></a><h4>Returns</h4> |
| <p> the exit status</p> |
| </div> |
| <p class="since">Since: <a class="link" href="api-index-2-28.html#api-index-2.28">2.28</a></p> |
| </div> |
| <hr> |
| <div class="refsect2"> |
| <a name="g-application-add-main-option-entries"></a><h3>g_application_add_main_option_entries ()</h3> |
| <pre class="programlisting"><span class="returnvalue">void</span> |
| g_application_add_main_option_entries (<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-Commandline-option-parser.html#GOptionEntry"><span class="type">GOptionEntry</span></a> *entries</code></em>);</pre> |
| <p>Adds main option entries to be handled by <em class="parameter"><code>application</code></em> |
| .</p> |
| <p>This function is comparable to <a href="../glib-Commandline-option-parser.html#g-option-context-add-main-entries"><code class="function">g_option_context_add_main_entries()</code></a>.</p> |
| <p>After the commandline arguments are parsed, the |
| <a class="link" href="GApplication.html#GApplication-handle-local-options" title="The “handle-local-options” signal"><span class="type">“handle-local-options”</span></a> signal will be emitted. At this |
| point, the application can inspect the values pointed to by <em class="parameter"><code>arg_data</code></em> |
| |
| in the given <a href="../glib-Commandline-option-parser.html#GOptionEntry"><span class="type">GOptionEntrys</span></a>.</p> |
| <p>Unlike <a href="../glib-Commandline-option-parser.html#GOptionContext"><span class="type">GOptionContext</span></a>, <a class="link" href="GApplication.html" title="GApplication"><span class="type">GApplication</span></a> supports giving a <a href="../glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> |
| <em class="parameter"><code>arg_data</code></em> |
| for a non-callback <a href="../glib-Commandline-option-parser.html#GOptionEntry"><span class="type">GOptionEntry</span></a>. This results in the |
| argument in question being packed into a <a href="../glib-GVariant.html#GVariantDict"><span class="type">GVariantDict</span></a> which is also |
| passed to <a class="link" href="GApplication.html#GApplication-handle-local-options" title="The “handle-local-options” signal"><span class="type">“handle-local-options”</span></a>, where it can be |
| inspected and modified. If <a class="link" href="GApplication.html#G-APPLICATION-HANDLES-COMMAND-LINE:CAPS"><code class="literal">G_APPLICATION_HANDLES_COMMAND_LINE</code></a> is |
| set, then the resulting dictionary is sent to the primary instance, |
| where <a class="link" href="GApplicationCommandLine.html#g-application-command-line-get-options-dict" title="g_application_command_line_get_options_dict ()"><code class="function">g_application_command_line_get_options_dict()</code></a> will return it. |
| This "packing" is done according to the type of the argument -- |
| booleans for normal flags, strings for strings, bytestrings for |
| filenames, etc. The packing only occurs if the flag is given (ie: we |
| do not pack a "false" <a href="../glib-GVariant.html#GVariant"><span class="type">GVariant</span></a> in the case that a flag is missing).</p> |
| <p>In general, it is recommended that all commandline arguments are |
| parsed locally. The options dictionary should then be used to |
| transmit the result of the parsing to the primary instance, where |
| <a href="../glib-GVariant.html#g-variant-dict-lookup"><code class="function">g_variant_dict_lookup()</code></a> can be used. For local options, it is |
| possible to either use <em class="parameter"><code>arg_data</code></em> |
| in the usual way, or to consult (and |
| potentially remove) the option from the options dictionary.</p> |
| <p>This function is new in GLib 2.40. Before then, the only real choice |
| was to send all of the commandline arguments (options and all) to the |
| primary instance for handling. <a class="link" href="GApplication.html" title="GApplication"><span class="type">GApplication</span></a> ignored them completely |
| on the local side. Calling this function "opts in" to the new |
| behaviour, and in particular, means that unrecognised options will be |
| treated as errors. Unrecognised options have never been ignored when |
| <a class="link" href="GApplication.html#G-APPLICATION-HANDLES-COMMAND-LINE:CAPS"><code class="literal">G_APPLICATION_HANDLES_COMMAND_LINE</code></a> is unset.</p> |
| <p>If <a class="link" href="GApplication.html#GApplication-handle-local-options" title="The “handle-local-options” signal"><span class="type">“handle-local-options”</span></a> needs to see the list of |
| filenames, then the use of <a href="../glib-Commandline-option-parser.html#G-OPTION-REMAINING:CAPS"><code class="literal">G_OPTION_REMAINING</code></a> is recommended. If |
| <em class="parameter"><code>arg_data</code></em> |
| is <a href="../glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> then <a href="../glib-Commandline-option-parser.html#G-OPTION-REMAINING:CAPS"><code class="literal">G_OPTION_REMAINING</code></a> can be used as a key into |
| the options dictionary. If you do use <a href="../glib-Commandline-option-parser.html#G-OPTION-REMAINING:CAPS"><code class="literal">G_OPTION_REMAINING</code></a> then you |
| need to handle these arguments for yourself because once they are |
| consumed, they will no longer be visible to the default handling |
| (which treats them as filenames to be opened).</p> |
| <p>It is important to use the proper GVariant format when retrieving |
| the options with <a href="../glib-GVariant.html#g-variant-dict-lookup"><code class="function">g_variant_dict_lookup()</code></a>:</p> |
| <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "> |
| <li class="listitem"><p>for <a href="../glib-Commandline-option-parser.html#G-OPTION-ARG-NONE:CAPS"><code class="literal">G_OPTION_ARG_NONE</code></a>, use b</p></li> |
| <li class="listitem"><p>for <a href="../glib-Commandline-option-parser.html#G-OPTION-ARG-STRING:CAPS"><code class="literal">G_OPTION_ARG_STRING</code></a>, use &s</p></li> |
| <li class="listitem"><p>for <a href="../glib-Commandline-option-parser.html#G-OPTION-ARG-INT:CAPS"><code class="literal">G_OPTION_ARG_INT</code></a>, use i</p></li> |
| <li class="listitem"><p>for <a href="../glib-Commandline-option-parser.html#G-OPTION-ARG-INT64:CAPS"><code class="literal">G_OPTION_ARG_INT64</code></a>, use x</p></li> |
| <li class="listitem"><p>for <a href="../glib-Commandline-option-parser.html#G-OPTION-ARG-DOUBLE:CAPS"><code class="literal">G_OPTION_ARG_DOUBLE</code></a>, use d</p></li> |
| <li class="listitem"><p>for <a href="../glib-Commandline-option-parser.html#G-OPTION-ARG-FILENAME:CAPS"><code class="literal">G_OPTION_ARG_FILENAME</code></a>, use ^ay</p></li> |
| <li class="listitem"><p>for <a href="../glib-Commandline-option-parser.html#G-OPTION-ARG-STRING-ARRAY:CAPS"><code class="literal">G_OPTION_ARG_STRING_ARRAY</code></a>, use &as</p></li> |
| <li class="listitem"><p>for <a href="../glib-Commandline-option-parser.html#G-OPTION-ARG-FILENAME-ARRAY:CAPS"><code class="literal">G_OPTION_ARG_FILENAME_ARRAY</code></a>, use ^aay</p></li> |
| </ul></div> |
| <div class="refsect3"> |
| <a name="g-application-add-main-option-entries.parameters"></a><h4>Parameters</h4> |
| <div class="informaltable"><table class="informaltable" width="100%" border="0"> |
| <colgroup> |
| <col width="150px" class="parameters_name"> |
| <col class="parameters_description"> |
| <col width="200px" class="parameters_annotations"> |
| </colgroup> |
| <tbody> |
| <tr> |
| <td class="parameter_name"><p>application</p></td> |
| <td class="parameter_description"><p>a <a class="link" href="GApplication.html" title="GApplication"><span class="type">GApplication</span></a></p></td> |
| <td class="parameter_annotations"> </td> |
| </tr> |
| <tr> |
| <td class="parameter_name"><p>entries</p></td> |
| <td class="parameter_description"><p>(array zero-terminated=1) (element-type GOptionEntry) a |
| <a href="../glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>-terminated list of <a href="../glib-Commandline-option-parser.html#GOptionEntry"><span class="type">GOptionEntrys</span></a></p></td> |
| <td class="parameter_annotations"> </td> |
| </tr> |
| </tbody> |
| </table></div> |
| </div> |
| <p class="since">Since: <a class="link" href="api-index-2-40.html#api-index-2.40">2.40</a></p> |
| </div> |
| <hr> |
| <div class="refsect2"> |
| <a name="g-application-add-main-option"></a><h3>g_application_add_main_option ()</h3> |
| <pre class="programlisting"><span class="returnvalue">void</span> |
| g_application_add_main_option (<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 <span class="type">char</span> *long_name</code></em>, |
| <em class="parameter"><code><span class="type">char</span> short_name</code></em>, |
| <em class="parameter"><code><a href="../glib-Commandline-option-parser.html#GOptionFlags"><span class="type">GOptionFlags</span></a> flags</code></em>, |
| <em class="parameter"><code><a href="../glib-Commandline-option-parser.html#GOptionArg"><span class="type">GOptionArg</span></a> arg</code></em>, |
| <em class="parameter"><code>const <span class="type">char</span> *description</code></em>, |
| <em class="parameter"><code>const <span class="type">char</span> *arg_description</code></em>);</pre> |
| <p>Add an option to be handled by <em class="parameter"><code>application</code></em> |
| .</p> |
| <p>Calling this function is the equivalent of calling |
| <a class="link" href="GApplication.html#g-application-add-main-option-entries" title="g_application_add_main_option_entries ()"><code class="function">g_application_add_main_option_entries()</code></a> with a single <a href="../glib-Commandline-option-parser.html#GOptionEntry"><span class="type">GOptionEntry</span></a> |
| that has its arg_data member set to <a href="../glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>.</p> |
| <p>The parsed arguments will be packed into a <a href="../glib-GVariant.html#GVariantDict"><span class="type">GVariantDict</span></a> which |
| is passed to <a class="link" href="GApplication.html#GApplication-handle-local-options" title="The “handle-local-options” signal"><span class="type">“handle-local-options”</span></a>. If |
| <a class="link" href="GApplication.html#G-APPLICATION-HANDLES-COMMAND-LINE:CAPS"><code class="literal">G_APPLICATION_HANDLES_COMMAND_LINE</code></a> is set, then it will also |
| be sent to the primary instance. See |
| <a class="link" href="GApplication.html#g-application-add-main-option-entries" title="g_application_add_main_option_entries ()"><code class="function">g_application_add_main_option_entries()</code></a> for more details.</p> |
| <p>See <a href="../glib-Commandline-option-parser.html#GOptionEntry"><span class="type">GOptionEntry</span></a> for more documentation of the arguments.</p> |
| <div class="refsect3"> |
| <a name="g-application-add-main-option.parameters"></a><h4>Parameters</h4> |
| <div class="informaltable"><table class="informaltable" width="100%" border="0"> |
| <colgroup> |
| <col width="150px" class="parameters_name"> |
| <col class="parameters_description"> |
| <col width="200px" class="parameters_annotations"> |
| </colgroup> |
| <tbody> |
| <tr> |
| <td class="parameter_name"><p>application</p></td> |
| <td class="parameter_description"><p>the <a class="link" href="GApplication.html" title="GApplication"><span class="type">GApplication</span></a></p></td> |
| <td class="parameter_annotations"> </td> |
| </tr> |
| <tr> |
| <td class="parameter_name"><p>long_name</p></td> |
| <td class="parameter_description"><p>the long name of an option used to specify it in a commandline</p></td> |
| <td class="parameter_annotations"> </td> |
| </tr> |
| <tr> |
| <td class="parameter_name"><p>short_name</p></td> |
| <td class="parameter_description"><p>the short name of an option</p></td> |
| <td class="parameter_annotations"> </td> |
| </tr> |
| <tr> |
| <td class="parameter_name"><p>flags</p></td> |
| <td class="parameter_description"><p>flags from <a href="../glib-Commandline-option-parser.html#GOptionFlags"><span class="type">GOptionFlags</span></a></p></td> |
| <td class="parameter_annotations"> </td> |
| </tr> |
| <tr> |
| <td class="parameter_name"><p>arg</p></td> |
| <td class="parameter_description"><p>the type of the option, as a <a href="../glib-Commandline-option-parser.html#GOptionArg"><span class="type">GOptionArg</span></a></p></td> |
| <td class="parameter_annotations"> </td> |
| </tr> |
| <tr> |
| <td class="parameter_name"><p>description</p></td> |
| <td class="parameter_description"><p>the description for the option in <code class="literal">--help</code> output</p></td> |
| <td class="parameter_annotations"> </td> |
| </tr> |
| <tr> |
| <td class="parameter_name"><p>arg_description</p></td> |
| <td class="parameter_description"><p> the placeholder to use for the extra argument |
| parsed by the option in <code class="literal">--help</code> output. </p></td> |
| <td class="parameter_annotations"><span class="annotation">[<acronym title="NULL may be passed as the value in, out, in-out; or as a return value."><span class="acronym">nullable</span></acronym>]</span></td> |
| </tr> |
| </tbody> |
| </table></div> |
| </div> |
| <p class="since">Since: <a class="link" href="api-index-2-42.html#api-index-2.42">2.42</a></p> |
| </div> |
| <hr> |
| <div class="refsect2"> |
| <a name="g-application-add-option-group"></a><h3>g_application_add_option_group ()</h3> |
| <pre class="programlisting"><span class="returnvalue">void</span> |
| g_application_add_option_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 href="../glib-Commandline-option-parser.html#GOptionGroup"><span class="type">GOptionGroup</span></a> *group</code></em>);</pre> |
| <p>Adds a <a href="../glib-Commandline-option-parser.html#GOptionGroup"><span class="type">GOptionGroup</span></a> to the commandline handling of <em class="parameter"><code>application</code></em> |
| .</p> |
| <p>This function is comparable to <a href="../glib-Commandline-option-parser.html#g-option-context-add-group"><code class="function">g_option_context_add_group()</code></a>.</p> |
| <p>Unlike <a class="link" href="GApplication.html#g-application-add-main-option-entries" title="g_application_add_main_option_entries ()"><code class="function">g_application_add_main_option_entries()</code></a>, this function does |
| not deal with <a href="../glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> <em class="parameter"><code>arg_data</code></em> |
| and never transmits options to the |
| primary instance.</p> |
| <p>The reason for that is because, by the time the options arrive at the |
| primary instance, it is typically too late to do anything with them. |
| Taking the GTK option group as an example: GTK will already have been |
| initialised by the time the <a class="link" href="GApplication.html#GApplication-command-line" title="The “command-line” signal"><span class="type">“command-line”</span></a> handler runs. |
| In the case that this is not the first-running instance of the |
| application, the existing instance may already have been running for |
| a very long time.</p> |
| <p>This means that the options from <a href="../glib-Commandline-option-parser.html#GOptionGroup"><span class="type">GOptionGroup</span></a> are only really usable |
| in the case that the instance of the application being run is the |
| first instance. Passing options like <code class="literal">--display=</code> or <code class="literal">--gdk-debug=</code> |
| on future runs will have no effect on the existing primary instance.</p> |
| <p>Calling this function will cause the options in the supplied option |
| group to be parsed, but it does not cause you to be "opted in" to the |
| new functionality whereby unrecognised options are rejected even if |
| <a class="link" href="GApplication.html#G-APPLICATION-HANDLES-COMMAND-LINE:CAPS"><code class="literal">G_APPLICATION_HANDLES_COMMAND_LINE</code></a> was given.</p> |
| <div class="refsect3"> |
| <a name="g-application-add-option-group.parameters"></a><h4>Parameters</h4> |
| <div class="informaltable"><table class="informaltable" width="100%" border="0"> |
| <colgroup> |
| <col width="150px" class="parameters_name"> |
| <col class="parameters_description"> |
| <col width="200px" class="parameters_annotations"> |
| </colgroup> |
| <tbody> |
| <tr> |
| <td class="parameter_name"><p>application</p></td> |
| <td class="parameter_description"><p>the <a class="link" href="GApplication.html" title="GApplication"><span class="type">GApplication</span></a></p></td> |
| <td class="parameter_annotations"> </td> |
| </tr> |
| <tr> |
| <td class="parameter_name"><p>group</p></td> |
| <td class="parameter_description"><p> a <a href="../glib-Commandline-option-parser.html#GOptionGroup"><span class="type">GOptionGroup</span></a>. </p></td> |
| <td class="parameter_annotations"><span class="annotation">[<acronym title="Free data after the code is done."><span class="acronym">transfer full</span></acronym>]</span></td> |
| </tr> |
| </tbody> |
| </table></div> |
| </div> |
| <p class="since">Since: <a class="link" href="api-index-2-40.html#api-index-2.40">2.40</a></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-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>.</p> |
| <div class="refsect3"> |
| <a name="g-application-set-default.parameters"></a><h4>Parameters</h4> |
| <div class="informaltable"><table class="informaltable" width="100%" border="0"> |
| <colgroup> |
| <col width="150px" class="parameters_name"> |
| <col class="parameters_description"> |
| <col width="200px" class="parameters_annotations"> |
| </colgroup> |
| <tbody><tr> |
| <td class="parameter_name"><p>application</p></td> |
| <td class="parameter_description"><p> the application to set as default, or <a href="../glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>. </p></td> |
| <td class="parameter_annotations"><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> |
| </div> |
| <p class="since">Since: <a class="link" href="api-index-2-32.html#api-index-2.32">2.32</a></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-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> is returned.</p> |
| <div class="refsect3"> |
| <a name="g-application-get-default.returns"></a><h4>Returns</h4> |
| <p> the default application for this process, or <a href="../glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>. </p> |
| <p><span class="annotation">[<acronym title="Don't free data after the code is done."><span class="acronym">transfer none</span></acronym>]</span></p> |
| </div> |
| <p class="since">Since: <a class="link" href="api-index-2-32.html#api-index-2.32">2.32</a></p> |
| </div> |
| <hr> |
| <div class="refsect2"> |
| <a name="g-application-mark-busy"></a><h3>g_application_mark_busy ()</h3> |
| <pre class="programlisting"><span class="returnvalue">void</span> |
| g_application_mark_busy (<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 busy count of <em class="parameter"><code>application</code></em> |
| .</p> |
| <p>Use this function to indicate that the application is busy, for instance |
| while a long running operation is pending.</p> |
| <p>The busy state will be exposed to other processes, so a session shell will |
| use that information to indicate the state to the user (e.g. with a |
| spinner).</p> |
| <p>To cancel the busy indication, use <a class="link" href="GApplication.html#g-application-unmark-busy" title="g_application_unmark_busy ()"><code class="function">g_application_unmark_busy()</code></a>.</p> |
| <div class="refsect3"> |
| <a name="g-application-mark-busy.parameters"></a><h4>Parameters</h4> |
| <div class="informaltable"><table class="informaltable" width="100%" border="0"> |
| <colgroup> |
| <col width="150px" class="parameters_name"> |
| <col class="parameters_description"> |
| <col width="200px" class="parameters_annotations"> |
| </colgroup> |
| <tbody><tr> |
| <td class="parameter_name"><p>application</p></td> |
| <td class="parameter_description"><p>a <a class="link" href="GApplication.html" title="GApplication"><span class="type">GApplication</span></a></p></td> |
| <td class="parameter_annotations"> </td> |
| </tr></tbody> |
| </table></div> |
| </div> |
| <p class="since">Since: <a class="link" href="api-index-2-38.html#api-index-2.38">2.38</a></p> |
| </div> |
| <hr> |
| <div class="refsect2"> |
| <a name="g-application-unmark-busy"></a><h3>g_application_unmark_busy ()</h3> |
| <pre class="programlisting"><span class="returnvalue">void</span> |
| g_application_unmark_busy (<em class="parameter"><code><a class="link" href="GApplication.html" title="GApplication"><span class="type">GApplication</span></a> *application</code></em>);</pre> |
| <p>Decreases the busy count of <em class="parameter"><code>application</code></em> |
| .</p> |
| <p>When the busy count reaches zero, the new state will be propagated |
| to other processes.</p> |
| <p>This function must only be called to cancel the effect of a previous |
| call to <a class="link" href="GApplication.html#g-application-mark-busy" title="g_application_mark_busy ()"><code class="function">g_application_mark_busy()</code></a>.</p> |
| <div class="refsect3"> |
| <a name="g-application-unmark-busy.parameters"></a><h4>Parameters</h4> |
| <div class="informaltable"><table class="informaltable" width="100%" border="0"> |
| <colgroup> |
| <col width="150px" class="parameters_name"> |
| <col class="parameters_description"> |
| <col width="200px" class="parameters_annotations"> |
| </colgroup> |
| <tbody><tr> |
| <td class="parameter_name"><p>application</p></td> |
| <td class="parameter_description"><p>a <a class="link" href="GApplication.html" title="GApplication"><span class="type">GApplication</span></a></p></td> |
| <td class="parameter_annotations"> </td> |
| </tr></tbody> |
| </table></div> |
| </div> |
| <p class="since">Since: <a class="link" href="api-index-2-38.html#api-index-2.38">2.38</a></p> |
| </div> |
| <hr> |
| <div class="refsect2"> |
| <a name="g-application-get-is-busy"></a><h3>g_application_get_is_busy ()</h3> |
| <pre class="programlisting"><a href="../glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a> |
| g_application_get_is_busy (<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 application's current busy state, as set through |
| <a class="link" href="GApplication.html#g-application-mark-busy" title="g_application_mark_busy ()"><code class="function">g_application_mark_busy()</code></a> or <a class="link" href="GApplication.html#g-application-bind-busy-property" title="g_application_bind_busy_property ()"><code class="function">g_application_bind_busy_property()</code></a>.</p> |
| <div class="refsect3"> |
| <a name="g-application-get-is-busy.parameters"></a><h4>Parameters</h4> |
| <div class="informaltable"><table class="informaltable" width="100%" border="0"> |
| <colgroup> |
| <col width="150px" class="parameters_name"> |
| <col class="parameters_description"> |
| <col width="200px" class="parameters_annotations"> |
| </colgroup> |
| <tbody><tr> |
| <td class="parameter_name"><p>application</p></td> |
| <td class="parameter_description"><p>a <a class="link" href="GApplication.html" title="GApplication"><span class="type">GApplication</span></a></p></td> |
| <td class="parameter_annotations"> </td> |
| </tr></tbody> |
| </table></div> |
| </div> |
| <div class="refsect3"> |
| <a name="g-application-get-is-busy.returns"></a><h4>Returns</h4> |
| <p> <a href="../glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if <em class="parameter"><code>application</code></em> |
| is currenty marked as busy</p> |
| </div> |
| <p class="since">Since: <a class="link" href="api-index-2-44.html#api-index-2.44">2.44</a></p> |
| </div> |
| <hr> |
| <div class="refsect2"> |
| <a name="g-application-bind-busy-property"></a><h3>g_application_bind_busy_property ()</h3> |
| <pre class="programlisting"><span class="returnvalue">void</span> |
| g_application_bind_busy_property (<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-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> object</code></em>, |
| <em class="parameter"><code>const <a href="../glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *property</code></em>);</pre> |
| <p>Marks <em class="parameter"><code>application</code></em> |
| as busy (see <a class="link" href="GApplication.html#g-application-mark-busy" title="g_application_mark_busy ()"><code class="function">g_application_mark_busy()</code></a>) while |
| <em class="parameter"><code>property</code></em> |
| on <em class="parameter"><code>object</code></em> |
| is <a href="../glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a>.</p> |
| <p>The binding holds a reference to <em class="parameter"><code>application</code></em> |
| while it is active, but |
| not to <em class="parameter"><code>object</code></em> |
| . Instead, the binding is destroyed when <em class="parameter"><code>object</code></em> |
| is |
| finalized.</p> |
| <div class="refsect3"> |
| <a name="g-application-bind-busy-property.parameters"></a><h4>Parameters</h4> |
| <div class="informaltable"><table class="informaltable" width="100%" border="0"> |
| <colgroup> |
| <col width="150px" class="parameters_name"> |
| <col class="parameters_description"> |
| <col width="200px" class="parameters_annotations"> |
| </colgroup> |
| <tbody> |
| <tr> |
| <td class="parameter_name"><p>application</p></td> |
| <td class="parameter_description"><p>a <a class="link" href="GApplication.html" title="GApplication"><span class="type">GApplication</span></a></p></td> |
| <td class="parameter_annotations"> </td> |
| </tr> |
| <tr> |
| <td class="parameter_name"><p>object</p></td> |
| <td class="parameter_description"><p> a <a href="../gobject-The-Base-Object-Type.html#GObject-struct"><span class="type">GObject</span></a>. </p></td> |
| <td class="parameter_annotations"><span class="annotation">[<acronym title="Override the parsed C type with given type."><span class="acronym">type</span></acronym> GObject.Object]</span></td> |
| </tr> |
| <tr> |
| <td class="parameter_name"><p>property</p></td> |
| <td class="parameter_description"><p>the name of a boolean property of <em class="parameter"><code>object</code></em> |
| </p></td> |
| <td class="parameter_annotations"> </td> |
| </tr> |
| </tbody> |
| </table></div> |
| </div> |
| <p class="since">Since: <a class="link" href="api-index-2-44.html#api-index-2.44">2.44</a></p> |
| </div> |
| <hr> |
| <div class="refsect2"> |
| <a name="g-application-unbind-busy-property"></a><h3>g_application_unbind_busy_property ()</h3> |
| <pre class="programlisting"><span class="returnvalue">void</span> |
| g_application_unbind_busy_property (<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-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> object</code></em>, |
| <em class="parameter"><code>const <a href="../glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *property</code></em>);</pre> |
| <p>Destroys a binding between <em class="parameter"><code>property</code></em> |
| and the busy state of |
| <em class="parameter"><code>application</code></em> |
| that was previously created with |
| <a class="link" href="GApplication.html#g-application-bind-busy-property" title="g_application_bind_busy_property ()"><code class="function">g_application_bind_busy_property()</code></a>.</p> |
| <div class="refsect3"> |
| <a name="g-application-unbind-busy-property.parameters"></a><h4>Parameters</h4> |
| <div class="informaltable"><table class="informaltable" width="100%" border="0"> |
| <colgroup> |
| <col width="150px" class="parameters_name"> |
| <col class="parameters_description"> |
| <col width="200px" class="parameters_annotations"> |
| </colgroup> |
| <tbody> |
| <tr> |
| <td class="parameter_name"><p>application</p></td> |
| <td class="parameter_description"><p>a <a class="link" href="GApplication.html" title="GApplication"><span class="type">GApplication</span></a></p></td> |
| <td class="parameter_annotations"> </td> |
| </tr> |
| <tr> |
| <td class="parameter_name"><p>object</p></td> |
| <td class="parameter_description"><p> a <a href="../gobject-The-Base-Object-Type.html#GObject-struct"><span class="type">GObject</span></a>. </p></td> |
| <td class="parameter_annotations"><span class="annotation">[<acronym title="Override the parsed C type with given type."><span class="acronym">type</span></acronym> GObject.Object]</span></td> |
| </tr> |
| <tr> |
| <td class="parameter_name"><p>property</p></td> |
| <td class="parameter_description"><p>the name of a boolean property of <em class="parameter"><code>object</code></em> |
| </p></td> |
| <td class="parameter_annotations"> </td> |
| </tr> |
| </tbody> |
| </table></div> |
| </div> |
| <p class="since">Since: <a class="link" href="api-index-2-44.html#api-index-2.44">2.44</a></p> |
| </div> |
| </div> |
| <div class="refsect1"> |
| <a name="GApplication.other_details"></a><h2>Types and Values</h2> |
| <div class="refsect2"> |
| <a name="GApplication-struct"></a><h3>GApplication</h3> |
| <pre class="programlisting">typedef struct _GApplication GApplication;</pre> |
| <p><a class="link" href="GApplication.html" title="GApplication"><span class="type">GApplication</span></a> is an opaque data structure and can only be accessed |
| using the following functions.</p> |
| <p class="since">Since: <a class="link" href="api-index-2-28.html#api-index-2.28">2.28</a></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 */ |
| |
| /** |
| * GApplicationClass::local_command_line: |
| * @application: a #GApplication |
| * @arguments: (inout) (array zero-terminated=1): array of command line arguments |
| * @exit_status: (out): exit status to fill after processing the command line. |
| * |
| * This virtual function is always invoked in the local instance. It |
| * gets passed a pointer to a %NULL-terminated copy of @argv and is |
| * expected to remove arguments that it handled (shifting up remaining |
| * arguments). |
| * |
| * The last argument to local_command_line() is a pointer to the @status |
| * variable which can used to set the exit status that is returned from |
| * g_application_run(). |
| * |
| * See g_application_run() for more details on #GApplication startup. |
| * |
| * Returns: %TRUE if the commandline has been completely handled |
| */ |
| 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); |
| gint (* handle_local_options)(GApplication *application, |
| GVariantDict *options); |
| }; |
| </pre> |
| <p>Virtual function table for <a class="link" href="GApplication.html" title="GApplication"><span class="type">GApplication</span></a>.</p> |
| <div class="refsect3"> |
| <a name="GApplicationClass.members"></a><h4>Members</h4> |
| <div class="informaltable"><table class="informaltable" width="100%" border="0"> |
| <colgroup> |
| <col width="300px" class="struct_members_name"> |
| <col class="struct_members_description"> |
| <col width="200px" class="struct_members_annotations"> |
| </colgroup> |
| <tbody> |
| <tr> |
| <td class="struct_member_name"><p><em class="structfield"><code><a name="GApplicationClass.startup"></a>startup</code></em> ()</p></td> |
| <td class="struct_member_description"><p>invoked on the primary instance immediately after registration</p></td> |
| <td class="struct_member_annotations"> </td> |
| </tr> |
| <tr> |
| <td class="struct_member_name"><p><em class="structfield"><code><a name="GApplicationClass.activate"></a>activate</code></em> ()</p></td> |
| <td class="struct_member_description"><p>invoked on the primary instance when an activation occurs</p></td> |
| <td class="struct_member_annotations"> </td> |
| </tr> |
| <tr> |
| <td class="struct_member_name"><p><em class="structfield"><code><a name="GApplicationClass.open"></a>open</code></em> ()</p></td> |
| <td class="struct_member_description"><p>invoked on the primary instance when there are files to open</p></td> |
| <td class="struct_member_annotations"> </td> |
| </tr> |
| <tr> |
| <td class="struct_member_name"><p><em class="structfield"><code><a name="GApplicationClass.command-line"></a>command_line</code></em> ()</p></td> |
| <td class="struct_member_description"><p>invoked on the primary instance when a command-line is |
| not handled locally</p></td> |
| <td class="struct_member_annotations"> </td> |
| </tr> |
| <tr> |
| <td class="struct_member_name"><p><em class="structfield"><code><a name="GApplicationClass.local-command-line"></a>local_command_line</code></em> ()</p></td> |
| <td class="struct_member_description"><p>invoked (locally). The virtual function has the chance |
| to inspect (and possibly replace) 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. Also see the |
| <a class="link" href="GApplication.html#GApplication-handle-local-options" title="The “handle-local-options” signal"><span class="type">“handle-local-options”</span></a> signal, which is a simpler |
| alternative to handling some commandline options locally</p></td> |
| <td class="struct_member_annotations"> </td> |
| </tr> |
| <tr> |
| <td class="struct_member_name"><p><em class="structfield"><code><a name="GApplicationClass.before-emit"></a>before_emit</code></em> ()</p></td> |
| <td class="struct_member_description"><p>invoked on the primary instance before 'activate', 'open', |
| 'command-line' or any action invocation, gets the 'platform data' from |
| the calling instance</p></td> |
| <td class="struct_member_annotations"> </td> |
| </tr> |
| <tr> |
| <td class="struct_member_name"><p><em class="structfield"><code><a name="GApplicationClass.after-emit"></a>after_emit</code></em> ()</p></td> |
| <td class="struct_member_description"><p>invoked on the primary instance after 'activate', 'open', |
| 'command-line' or any action invocation, gets the 'platform data' from |
| the calling instance</p></td> |
| <td class="struct_member_annotations"> </td> |
| </tr> |
| <tr> |
| <td class="struct_member_name"><p><em class="structfield"><code><a name="GApplicationClass.add-platform-data"></a>add_platform_data</code></em> ()</p></td> |
| <td class="struct_member_description"><p>invoked (locally) to add 'platform data' to be sent to |
| the primary instance when activating, opening or invoking actions</p></td> |
| <td class="struct_member_annotations"> </td> |
| </tr> |
| <tr> |
| <td class="struct_member_name"><p><em class="structfield"><code><a name="GApplicationClass.quit-mainloop"></a>quit_mainloop</code></em> ()</p></td> |
| <td class="struct_member_description"><p>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</p></td> |
| <td class="struct_member_annotations"> </td> |
| </tr> |
| <tr> |
| <td class="struct_member_name"><p><em class="structfield"><code><a name="GApplicationClass.run-mainloop"></a>run_mainloop</code></em> ()</p></td> |
| <td class="struct_member_description"><p>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</p></td> |
| <td class="struct_member_annotations"> </td> |
| </tr> |
| <tr> |
| <td class="struct_member_name"><p><em class="structfield"><code><a name="GApplicationClass.shutdown"></a>shutdown</code></em> ()</p></td> |
| <td class="struct_member_description"><p>invoked only on the registered primary instance immediately |
| after the main loop terminates</p></td> |
| <td class="struct_member_annotations"> </td> |
| </tr> |
| <tr> |
| <td class="struct_member_name"><p><em class="structfield"><code><a name="GApplicationClass.dbus-register"></a>dbus_register</code></em> ()</p></td> |
| <td class="struct_member_description"><p>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-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a>, registration will proceed; otherwise |
| registration will abort. Since: 2.34</p></td> |
| <td class="struct_member_annotations"> </td> |
| </tr> |
| <tr> |
| <td class="struct_member_name"><p><em class="structfield"><code><a name="GApplicationClass.dbus-unregister"></a>dbus_unregister</code></em> ()</p></td> |
| <td class="struct_member_description"><p>invoked locally during unregistration, if the application |
| is using its D-Bus backend. Use this to undo anything done by the</p></td> |
| <td class="struct_member_annotations"> </td> |
| </tr> |
| <tr> |
| <td class="struct_member_name"><p><em class="structfield"><code><a name="GApplicationClass.handle-local-options"></a>handle_local_options</code></em> ()</p></td> |
| <td class="struct_member_description"><p>invoked locally after the parsing of the commandline |
| options has occurred. Since: 2.40</p></td> |
| <td class="struct_member_annotations"> </td> |
| </tr> |
| </tbody> |
| </table></div> |
| </div> |
| <p class="since">Since: <a class="link" href="api-index-2-28.html#api-index-2.28">2.28</a></p> |
| </div> |
| <hr> |
| <div class="refsect2"> |
| <a name="GApplicationFlags"></a><h3>enum GApplicationFlags</h3> |
| <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="refsect3"> |
| <a name="GApplicationFlags.members"></a><h4>Members</h4> |
| <div class="informaltable"><table class="informaltable" width="100%" border="0"> |
| <colgroup> |
| <col width="300px" class="enum_members_name"> |
| <col class="enum_members_description"> |
| <col width="200px" class="enum_members_annotations"> |
| </colgroup> |
| <tbody> |
| <tr> |
| <td class="enum_member_name"><p><a name="G-APPLICATION-FLAGS-NONE:CAPS"></a>G_APPLICATION_FLAGS_NONE</p></td> |
| <td class="enum_member_description"> |
| <p>Default</p> |
| </td> |
| <td class="enum_member_annotations"> </td> |
| </tr> |
| <tr> |
| <td class="enum_member_name"><p><a name="G-APPLICATION-IS-SERVICE:CAPS"></a>G_APPLICATION_IS_SERVICE</p></td> |
| <td class="enum_member_description"> |
| <p>Run as a service. In this mode, registration |
| fails if the service is already running, and the application |
| will initially wait up to 10 seconds for an initial activation |
| message to arrive.</p> |
| </td> |
| <td class="enum_member_annotations"> </td> |
| </tr> |
| <tr> |
| <td class="enum_member_name"><p><a name="G-APPLICATION-IS-LAUNCHER:CAPS"></a>G_APPLICATION_IS_LAUNCHER</p></td> |
| <td class="enum_member_description"> |
| <p>Don't try to become the primary instance.</p> |
| </td> |
| <td class="enum_member_annotations"> </td> |
| </tr> |
| <tr> |
| <td class="enum_member_name"><p><a name="G-APPLICATION-HANDLES-OPEN:CAPS"></a>G_APPLICATION_HANDLES_OPEN</p></td> |
| <td class="enum_member_description"> |
| <p>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.</p> |
| </td> |
| <td class="enum_member_annotations"> </td> |
| </tr> |
| <tr> |
| <td class="enum_member_name"><p><a name="G-APPLICATION-HANDLES-COMMAND-LINE:CAPS"></a>G_APPLICATION_HANDLES_COMMAND_LINE</p></td> |
| <td class="enum_member_description"> |
| <p>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.</p> |
| </td> |
| <td class="enum_member_annotations"> </td> |
| </tr> |
| <tr> |
| <td class="enum_member_name"><p><a name="G-APPLICATION-SEND-ENVIRONMENT:CAPS"></a>G_APPLICATION_SEND_ENVIRONMENT</p></td> |
| <td class="enum_member_description"> |
| <p>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="literal">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>.</p> |
| </td> |
| <td class="enum_member_annotations"> </td> |
| </tr> |
| <tr> |
| <td class="enum_member_name"><p><a name="G-APPLICATION-NON-UNIQUE:CAPS"></a>G_APPLICATION_NON_UNIQUE</p></td> |
| <td class="enum_member_description"> |
| <p>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.</p> |
| </td> |
| <td class="enum_member_annotations"> </td> |
| </tr> |
| <tr> |
| <td class="enum_member_name"><p><a name="G-APPLICATION-CAN-OVERRIDE-APP-ID:CAPS"></a>G_APPLICATION_CAN_OVERRIDE_APP_ID</p></td> |
| <td class="enum_member_description"> |
| <p>Allow users to override the |
| application ID from the command line with <code class="literal">--gapplication-app-id</code>. |
| Since: 2.48</p> |
| </td> |
| <td class="enum_member_annotations"> </td> |
| </tr> |
| </tbody> |
| </table></div> |
| </div> |
| <p class="since">Since: <a class="link" href="api-index-2-28.html#api-index-2.28">2.28</a></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> *</pre> |
| <p>The group of actions that the application exports.</p> |
| <p>Flags: Write</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-Basic-Types.html#gchar"><span class="type">gchar</span></a> *</pre> |
| <p>The unique identifier for the application.</p> |
| <p>Flags: Read / Write / Construct</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" title="enum GApplicationFlags"><span class="type">GApplicationFlags</span></a></pre> |
| <p>Flags specifying the behaviour of the application.</p> |
| <p>Flags: Read / Write</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-Basic-Types.html#guint"><span class="type">guint</span></a></pre> |
| <p>Time (ms) to stay alive after becoming idle.</p> |
| <p>Flags: Read / Write</p> |
| <p>Default value: 0</p> |
| </div> |
| <hr> |
| <div class="refsect2"> |
| <a name="GApplication--is-busy"></a><h3>The <code class="literal">“is-busy”</code> property</h3> |
| <pre class="programlisting"> “is-busy” <a href="../glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a></pre> |
| <p>Whether the application is currently marked as busy through |
| <a class="link" href="GApplication.html#g-application-mark-busy" title="g_application_mark_busy ()"><code class="function">g_application_mark_busy()</code></a> or <a class="link" href="GApplication.html#g-application-bind-busy-property" title="g_application_bind_busy_property ()"><code class="function">g_application_bind_busy_property()</code></a>.</p> |
| <p>Flags: Read</p> |
| <p>Default value: FALSE</p> |
| <p class="since">Since: <a class="link" href="api-index-2-44.html#api-index-2.44">2.44</a></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-Basic-Types.html#gboolean"><span class="type">gboolean</span></a></pre> |
| <p>If g_application_register() has been called.</p> |
| <p>Flags: Read</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-Basic-Types.html#gboolean"><span class="type">gboolean</span></a></pre> |
| <p>If this application instance is remote.</p> |
| <p>Flags: Read</p> |
| <p>Default value: FALSE</p> |
| </div> |
| <hr> |
| <div class="refsect2"> |
| <a name="GApplication--resource-base-path"></a><h3>The <code class="literal">“resource-base-path”</code> property</h3> |
| <pre class="programlisting"> “resource-base-path” <a href="../glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *</pre> |
| <p>The base resource path for the application.</p> |
| <p>Flags: Read / Write</p> |
| <p>Default value: NULL</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-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> user_data)</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="refsect3"> |
| <a name="GApplication-activate.parameters"></a><h4>Parameters</h4> |
| <div class="informaltable"><table class="informaltable" width="100%" border="0"> |
| <colgroup> |
| <col width="150px" class="parameters_name"> |
| <col class="parameters_description"> |
| <col width="200px" class="parameters_annotations"> |
| </colgroup> |
| <tbody> |
| <tr> |
| <td class="parameter_name"><p>application</p></td> |
| <td class="parameter_description"><p>the application</p></td> |
| <td class="parameter_annotations"> </td> |
| </tr> |
| <tr> |
| <td class="parameter_name"><p>user_data</p></td> |
| <td class="parameter_description"><p>user data set when the signal handler was connected.</p></td> |
| <td class="parameter_annotations"> </td> |
| </tr> |
| </tbody> |
| </table></div> |
| </div> |
| <p>Flags: <a href="../gobject-Signals.html#G-SIGNAL-RUN-LAST:CAPS">Run Last</a></p> |
| </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-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-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> user_data)</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="refsect3"> |
| <a name="GApplication-command-line.parameters"></a><h4>Parameters</h4> |
| <div class="informaltable"><table class="informaltable" width="100%" border="0"> |
| <colgroup> |
| <col width="150px" class="parameters_name"> |
| <col class="parameters_description"> |
| <col width="200px" class="parameters_annotations"> |
| </colgroup> |
| <tbody> |
| <tr> |
| <td class="parameter_name"><p>application</p></td> |
| <td class="parameter_description"><p>the application</p></td> |
| <td class="parameter_annotations"> </td> |
| </tr> |
| <tr> |
| <td class="parameter_name"><p>command_line</p></td> |
| <td class="parameter_description"><p>a <a class="link" href="GApplicationCommandLine.html" title="GApplicationCommandLine"><span class="type">GApplicationCommandLine</span></a> representing the |
| passed commandline</p></td> |
| <td class="parameter_annotations"> </td> |
| </tr> |
| <tr> |
| <td class="parameter_name"><p>user_data</p></td> |
| <td class="parameter_description"><p>user data set when the signal handler was connected.</p></td> |
| <td class="parameter_annotations"> </td> |
| </tr> |
| </tbody> |
| </table></div> |
| </div> |
| <div class="refsect3"> |
| <a name="GApplication-command-line.returns"></a><h4>Returns</h4> |
| <p> 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>.</p> |
| </div> |
| <p>Flags: <a href="../gobject-Signals.html#G-SIGNAL-RUN-LAST:CAPS">Run Last</a></p> |
| </div> |
| <hr> |
| <div class="refsect2"> |
| <a name="GApplication-handle-local-options"></a><h3>The <code class="literal">“handle-local-options”</code> signal</h3> |
| <pre class="programlisting"><a href="../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 href="../glib-GVariant.html#GVariantDict"><span class="type">GVariantDict</span></a> *options, |
| <a href="../glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> user_data)</pre> |
| <p>The ::handle-local-options signal is emitted on the local instance |
| after the parsing of the commandline options has occurred.</p> |
| <p>You can add options to be recognised during commandline option |
| parsing using <a class="link" href="GApplication.html#g-application-add-main-option-entries" title="g_application_add_main_option_entries ()"><code class="function">g_application_add_main_option_entries()</code></a> and |
| <a class="link" href="GApplication.html#g-application-add-option-group" title="g_application_add_option_group ()"><code class="function">g_application_add_option_group()</code></a>.</p> |
| <p>Signal handlers can inspect <em class="parameter"><code>options</code></em> |
| (along with values pointed to |
| from the <em class="parameter"><code>arg_data</code></em> |
| of an installed <a href="../glib-Commandline-option-parser.html#GOptionEntry"><span class="type">GOptionEntrys</span></a>) in order to |
| decide to perform certain actions, including direct local handling |
| (which may be useful for options like --version).</p> |
| <p>In the event that the application is marked |
| <a class="link" href="GApplication.html#G-APPLICATION-HANDLES-COMMAND-LINE:CAPS"><code class="literal">G_APPLICATION_HANDLES_COMMAND_LINE</code></a> the "normal processing" will |
| send the <em class="parameter"><code>options</code></em> |
| dictionary to the primary instance where it can be |
| read with <a class="link" href="GApplicationCommandLine.html#g-application-command-line-get-options-dict" title="g_application_command_line_get_options_dict ()"><code class="function">g_application_command_line_get_options_dict()</code></a>. The signal |
| handler can modify the dictionary before returning, and the |
| modified dictionary will be sent.</p> |
| <p>In the event that <a class="link" href="GApplication.html#G-APPLICATION-HANDLES-COMMAND-LINE:CAPS"><code class="literal">G_APPLICATION_HANDLES_COMMAND_LINE</code></a> is not set, |
| "normal processing" will treat the remaining uncollected command |
| line arguments as filenames or URIs. If there are no arguments, |
| the application is activated by <a class="link" href="GApplication.html#g-application-activate" title="g_application_activate ()"><code class="function">g_application_activate()</code></a>. One or |
| more arguments results in a call to <a class="link" href="GApplication.html#g-application-open" title="g_application_open ()"><code class="function">g_application_open()</code></a>.</p> |
| <p>If you want to handle the local commandline arguments for yourself |
| by converting them to calls to <a class="link" href="GApplication.html#g-application-open" title="g_application_open ()"><code class="function">g_application_open()</code></a> or |
| <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> then you must be sure to register |
| the application first. You should probably not call |
| <a class="link" href="GApplication.html#g-application-activate" title="g_application_activate ()"><code class="function">g_application_activate()</code></a> for yourself, however: just return -1 and |
| allow the default handler to do it for you. This will ensure that |
| the <code class="literal">--gapplication-service</code> switch works properly (i.e. no activation |
| in that case).</p> |
| <p>Note that this signal is emitted from the default implementation of |
| <code class="function">local_command_line()</code>. If you override that function and don't |
| chain up then this signal will never be emitted.</p> |
| <p>You can override <code class="function">local_command_line()</code> if you need more powerful |
| capabilities than what is provided here, but this should not |
| normally be required.</p> |
| <div class="refsect3"> |
| <a name="GApplication-handle-local-options.parameters"></a><h4>Parameters</h4> |
| <div class="informaltable"><table class="informaltable" width="100%" border="0"> |
| <colgroup> |
| <col width="150px" class="parameters_name"> |
| <col class="parameters_description"> |
| <col width="200px" class="parameters_annotations"> |
| </colgroup> |
| <tbody> |
| <tr> |
| <td class="parameter_name"><p>application</p></td> |
| <td class="parameter_description"><p>the application</p></td> |
| <td class="parameter_annotations"> </td> |
| </tr> |
| <tr> |
| <td class="parameter_name"><p>options</p></td> |
| <td class="parameter_description"><p>the options dictionary</p></td> |
| <td class="parameter_annotations"> </td> |
| </tr> |
| <tr> |
| <td class="parameter_name"><p>user_data</p></td> |
| <td class="parameter_description"><p>user data set when the signal handler was connected.</p></td> |
| <td class="parameter_annotations"> </td> |
| </tr> |
| </tbody> |
| </table></div> |
| </div> |
| <div class="refsect3"> |
| <a name="GApplication-handle-local-options.returns"></a><h4>Returns</h4> |
| <p> an exit code. If you have handled your options and want |
| to exit the process, return a non-negative option, 0 for success, |
| and a positive value for failure. To continue, return -1 to let |
| the default option processing continue.</p> |
| </div> |
| <p>Flags: <a href="../gobject-Signals.html#G-SIGNAL-RUN-LAST:CAPS">Run Last</a></p> |
| <p class="since">Since: <a class="link" href="api-index-2-40.html#api-index-2.40">2.40</a></p> |
| </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-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> files, |
| <a href="../glib-Basic-Types.html#gint"><span class="type">gint</span></a> n_files, |
| <a href="../glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *hint, |
| <a href="../glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> user_data)</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="refsect3"> |
| <a name="GApplication-open.parameters"></a><h4>Parameters</h4> |
| <div class="informaltable"><table class="informaltable" width="100%" border="0"> |
| <colgroup> |
| <col width="150px" class="parameters_name"> |
| <col class="parameters_description"> |
| <col width="200px" class="parameters_annotations"> |
| </colgroup> |
| <tbody> |
| <tr> |
| <td class="parameter_name"><p>application</p></td> |
| <td class="parameter_description"><p>the application</p></td> |
| <td class="parameter_annotations"> </td> |
| </tr> |
| <tr> |
| <td class="parameter_name"><p>files</p></td> |
| <td class="parameter_description"><p> an array of <a href="GFile.html#GFile-struct"><span class="type">GFiles</span></a>. </p></td> |
| <td class="parameter_annotations"><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 class="parameter_name"><p>n_files</p></td> |
| <td class="parameter_description"><p>the length of <em class="parameter"><code>files</code></em> |
| </p></td> |
| <td class="parameter_annotations"> </td> |
| </tr> |
| <tr> |
| <td class="parameter_name"><p>hint</p></td> |
| <td class="parameter_description"><p>a hint provided by the calling instance</p></td> |
| <td class="parameter_annotations"> </td> |
| </tr> |
| <tr> |
| <td class="parameter_name"><p>user_data</p></td> |
| <td class="parameter_description"><p>user data set when the signal handler was connected.</p></td> |
| <td class="parameter_annotations"> </td> |
| </tr> |
| </tbody> |
| </table></div> |
| </div> |
| <p>Flags: <a href="../gobject-Signals.html#G-SIGNAL-RUN-LAST:CAPS">Run Last</a></p> |
| </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-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> user_data)</pre> |
| <p>The ::shutdown signal is emitted only on the registered primary instance |
| immediately after the main loop terminates.</p> |
| <div class="refsect3"> |
| <a name="GApplication-shutdown.parameters"></a><h4>Parameters</h4> |
| <div class="informaltable"><table class="informaltable" width="100%" border="0"> |
| <colgroup> |
| <col width="150px" class="parameters_name"> |
| <col class="parameters_description"> |
| <col width="200px" class="parameters_annotations"> |
| </colgroup> |
| <tbody> |
| <tr> |
| <td class="parameter_name"><p>application</p></td> |
| <td class="parameter_description"><p>the application</p></td> |
| <td class="parameter_annotations"> </td> |
| </tr> |
| <tr> |
| <td class="parameter_name"><p>user_data</p></td> |
| <td class="parameter_description"><p>user data set when the signal handler was connected.</p></td> |
| <td class="parameter_annotations"> </td> |
| </tr> |
| </tbody> |
| </table></div> |
| </div> |
| <p>Flags: <a href="../gobject-Signals.html#G-SIGNAL-RUN-LAST:CAPS">Run Last</a></p> |
| </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-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> user_data)</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="refsect3"> |
| <a name="GApplication-startup.parameters"></a><h4>Parameters</h4> |
| <div class="informaltable"><table class="informaltable" width="100%" border="0"> |
| <colgroup> |
| <col width="150px" class="parameters_name"> |
| <col class="parameters_description"> |
| <col width="200px" class="parameters_annotations"> |
| </colgroup> |
| <tbody> |
| <tr> |
| <td class="parameter_name"><p>application</p></td> |
| <td class="parameter_description"><p>the application</p></td> |
| <td class="parameter_annotations"> </td> |
| </tr> |
| <tr> |
| <td class="parameter_name"><p>user_data</p></td> |
| <td class="parameter_description"><p>user data set when the signal handler was connected.</p></td> |
| <td class="parameter_annotations"> </td> |
| </tr> |
| </tbody> |
| </table></div> |
| </div> |
| <p>Flags: <a href="../gobject-Signals.html#G-SIGNAL-RUN-FIRST:CAPS">Run First</a></p> |
| </div> |
| </div> |
| </div> |
| <div class="footer"> |
| <hr>Generated by GTK-Doc V1.25.1</div> |
| </body> |
| </html> |