blob: 9a39973cb3216e83f2c9e8486579acf28a84046a [file] [log] [blame]
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>GSimpleAction: 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="GAction.html" title="GAction">
<link rel="next" href="GPropertyAction.html" title="GPropertyAction">
<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="#GSimpleAction.description" class="shortcut">Description</a></span><span id="nav_hierarchy">  <span class="dim">|</span> 
<a href="#GSimpleAction.object-hierarchy" class="shortcut">Object Hierarchy</a></span><span id="nav_interfaces">  <span class="dim">|</span> 
<a href="#GSimpleAction.implemented-interfaces" class="shortcut">Implemented Interfaces</a></span><span id="nav_properties">  <span class="dim">|</span> 
<a href="#GSimpleAction.properties" class="shortcut">Properties</a></span><span id="nav_signals">  <span class="dim">|</span> 
<a href="#GSimpleAction.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="GAction.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
<td><a accesskey="n" href="GPropertyAction.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td>
</tr></table>
<div class="refentry">
<a name="GSimpleAction"></a><div class="titlepage"></div>
<div class="refnamediv"><table width="100%"><tr>
<td valign="top">
<h2><span class="refentrytitle"><a name="GSimpleAction.top_of_page"></a>GSimpleAction</span></h2>
<p>GSimpleAction — A simple GAction implementation</p>
</td>
<td class="gallery_image" valign="top" align="right"></td>
</tr></table></div>
<div class="refsect1">
<a name="GSimpleAction.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 class="link" href="GSimpleAction.html" title="GSimpleAction"><span class="returnvalue">GSimpleAction</span></a> *
</td>
<td class="function_name">
<a class="link" href="GSimpleAction.html#g-simple-action-new" title="g_simple_action_new ()">g_simple_action_new</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="GSimpleAction.html" title="GSimpleAction"><span class="returnvalue">GSimpleAction</span></a> *
</td>
<td class="function_name">
<a class="link" href="GSimpleAction.html#g-simple-action-new-stateful" title="g_simple_action_new_stateful ()">g_simple_action_new_stateful</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="GSimpleAction.html#g-simple-action-set-enabled" title="g_simple_action_set_enabled ()">g_simple_action_set_enabled</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="GSimpleAction.html#g-simple-action-set-state" title="g_simple_action_set_state ()">g_simple_action_set_state</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="GSimpleAction.html#g-simple-action-set-state-hint" title="g_simple_action_set_state_hint ()">g_simple_action_set_state_hint</a> <span class="c_punctuation">()</span>
</td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect1">
<a name="GSimpleAction.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 href="../glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a></td>
<td class="property_name"><a class="link" href="GSimpleAction.html#GSimpleAction--enabled" title="The “enabled” property">enabled</a></td>
<td class="property_flags">Read / 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="GSimpleAction.html#GSimpleAction--name" title="The “name” property">name</a></td>
<td class="property_flags">Read / Write / Construct Only</td>
</tr>
<tr>
<td class="property_type">
<a href="../glib-GVariantType.html#GVariantType"><span class="type">GVariantType</span></a> *</td>
<td class="property_name"><a class="link" href="GSimpleAction.html#GSimpleAction--parameter-type" title="The “parameter-type” property">parameter-type</a></td>
<td class="property_flags">Read / Write / Construct Only</td>
</tr>
<tr>
<td class="property_type">
<a href="../glib-GVariant.html#GVariant"><span class="type">GVariant</span></a> *</td>
<td class="property_name"><a class="link" href="GSimpleAction.html#GSimpleAction--state" title="The “state” property">state</a></td>
<td class="property_flags">Read / Write / Construct</td>
</tr>
<tr>
<td class="property_type">
<a href="../glib-GVariantType.html#GVariantType"><span class="type">GVariantType</span></a> *</td>
<td class="property_name"><a class="link" href="GSimpleAction.html#GSimpleAction--state-type" title="The “state-type” property">state-type</a></td>
<td class="property_flags">Read</td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect1">
<a name="GSimpleAction.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="GSimpleAction.html#GSimpleAction-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"><span class="returnvalue">void</span></td>
<td class="signal_name"><a class="link" href="GSimpleAction.html#GSimpleAction-change-state" title="The “change-state” signal">change-state</a></td>
<td class="signal_flags"><a href="../gobject-Signals.html#G-SIGNAL-RUN-LAST:CAPS">Run Last</a></td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect1">
<a name="GSimpleAction.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="GSimpleAction.html#GSimpleAction-struct" title="GSimpleAction">GSimpleAction</a></td>
</tr></tbody>
</table></div>
</div>
<div class="refsect1">
<a name="GSimpleAction.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> GSimpleAction
</pre>
</div>
<div class="refsect1">
<a name="GSimpleAction.implemented-interfaces"></a><h2>Implemented Interfaces</h2>
<p>
GSimpleAction implements
<a class="link" href="GAction.html" title="GAction">GAction</a>.</p>
</div>
<div class="refsect1">
<a name="GSimpleAction.includes"></a><h2>Includes</h2>
<pre class="synopsis">#include &lt;gio/gio.h&gt;
</pre>
</div>
<div class="refsect1">
<a name="GSimpleAction.description"></a><h2>Description</h2>
<p>A <a class="link" href="GSimpleAction.html" title="GSimpleAction"><span class="type">GSimpleAction</span></a> is the obvious simple implementation of the <a class="link" href="GAction.html" title="GAction"><span class="type">GAction</span></a>
interface. This is the easiest way to create an action for purposes of
adding it to a <a class="link" href="GSimpleActionGroup.html" title="GSimpleActionGroup"><span class="type">GSimpleActionGroup</span></a>.</p>
<p>See also <a href="http://developer.gnome.org/gtk3/GtkAction.html#GtkAction-struct"><span class="type">GtkAction</span></a>.</p>
</div>
<div class="refsect1">
<a name="GSimpleAction.functions_details"></a><h2>Functions</h2>
<div class="refsect2">
<a name="g-simple-action-new"></a><h3>g_simple_action_new ()</h3>
<pre class="programlisting"><a class="link" href="GSimpleAction.html" title="GSimpleAction"><span class="returnvalue">GSimpleAction</span></a> *
g_simple_action_new (<em class="parameter"><code>const <a href="../glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *name</code></em>,
<em class="parameter"><code>const <a href="../glib-GVariantType.html#GVariantType"><span class="type">GVariantType</span></a> *parameter_type</code></em>);</pre>
<p>Creates a new action.</p>
<p>The created action is stateless. See <a class="link" href="GSimpleAction.html#g-simple-action-new-stateful" title="g_simple_action_new_stateful ()"><code class="function">g_simple_action_new_stateful()</code></a>.</p>
<div class="refsect3">
<a name="g-simple-action-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>name</p></td>
<td class="parameter_description"><p>the name of the action</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>parameter_type</p></td>
<td class="parameter_description"><p> the type of parameter to the activate function. </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>
<div class="refsect3">
<a name="g-simple-action-new.returns"></a><h4>Returns</h4>
<p> a new <a class="link" href="GSimpleAction.html" title="GSimpleAction"><span class="type">GSimpleAction</span></a></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-simple-action-new-stateful"></a><h3>g_simple_action_new_stateful ()</h3>
<pre class="programlisting"><a class="link" href="GSimpleAction.html" title="GSimpleAction"><span class="returnvalue">GSimpleAction</span></a> *
g_simple_action_new_stateful (<em class="parameter"><code>const <a href="../glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *name</code></em>,
<em class="parameter"><code>const <a href="../glib-GVariantType.html#GVariantType"><span class="type">GVariantType</span></a> *parameter_type</code></em>,
<em class="parameter"><code><a href="../glib-GVariant.html#GVariant"><span class="type">GVariant</span></a> *state</code></em>);</pre>
<p>Creates a new stateful action.</p>
<p><em class="parameter"><code>state</code></em>
is the initial state of the action. All future state values
must have the same <a href="../glib-GVariantType.html#GVariantType"><span class="type">GVariantType</span></a> as the initial state.</p>
<p>If the <em class="parameter"><code>state</code></em>
GVariant is floating, it is consumed.</p>
<div class="refsect3">
<a name="g-simple-action-new-stateful.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>name</p></td>
<td class="parameter_description"><p>the name of the action</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>parameter_type</p></td>
<td class="parameter_description"><p> the type of the parameter to the activate function. </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>state</p></td>
<td class="parameter_description"><p>the initial state of the action</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-simple-action-new-stateful.returns"></a><h4>Returns</h4>
<p> a new <a class="link" href="GSimpleAction.html" title="GSimpleAction"><span class="type">GSimpleAction</span></a></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-simple-action-set-enabled"></a><h3>g_simple_action_set_enabled ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>
g_simple_action_set_enabled (<em class="parameter"><code><a class="link" href="GSimpleAction.html" title="GSimpleAction"><span class="type">GSimpleAction</span></a> *simple</code></em>,
<em class="parameter"><code><a href="../glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a> enabled</code></em>);</pre>
<p>Sets the action as enabled or not.</p>
<p>An action must be enabled in order to be activated or in order to
have its state changed from outside callers.</p>
<p>This should only be called by the implementor of the action. Users
of the action should not attempt to modify its enabled flag.</p>
<div class="refsect3">
<a name="g-simple-action-set-enabled.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>simple</p></td>
<td class="parameter_description"><p>a <a class="link" href="GSimpleAction.html" title="GSimpleAction"><span class="type">GSimpleAction</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>enabled</p></td>
<td class="parameter_description"><p>whether the action is enabled</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-simple-action-set-state"></a><h3>g_simple_action_set_state ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>
g_simple_action_set_state (<em class="parameter"><code><a class="link" href="GSimpleAction.html" title="GSimpleAction"><span class="type">GSimpleAction</span></a> *simple</code></em>,
<em class="parameter"><code><a href="../glib-GVariant.html#GVariant"><span class="type">GVariant</span></a> *value</code></em>);</pre>
<p>Sets the state of the action.</p>
<p>This directly updates the 'state' property to the given value.</p>
<p>This should only be called by the implementor of the action. Users
of the action should not attempt to directly modify the 'state'
property. Instead, they should call <a class="link" href="GAction.html#g-action-change-state" title="g_action_change_state ()"><code class="function">g_action_change_state()</code></a> to
request the change.</p>
<p>If the <em class="parameter"><code>value</code></em>
GVariant is floating, it is consumed.</p>
<div class="refsect3">
<a name="g-simple-action-set-state.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>simple</p></td>
<td class="parameter_description"><p>a <a class="link" href="GSimpleAction.html" title="GSimpleAction"><span class="type">GSimpleAction</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>value</p></td>
<td class="parameter_description"><p>the new <a href="../glib-GVariant.html#GVariant"><span class="type">GVariant</span></a> for the state</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<p class="since">Since: <a class="link" href="api-index-2-30.html#api-index-2.30">2.30</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-simple-action-set-state-hint"></a><h3>g_simple_action_set_state_hint ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>
g_simple_action_set_state_hint (<em class="parameter"><code><a class="link" href="GSimpleAction.html" title="GSimpleAction"><span class="type">GSimpleAction</span></a> *simple</code></em>,
<em class="parameter"><code><a href="../glib-GVariant.html#GVariant"><span class="type">GVariant</span></a> *state_hint</code></em>);</pre>
<p>Sets the state hint for the action.</p>
<p>See <a class="link" href="GAction.html#g-action-get-state-hint" title="g_action_get_state_hint ()"><code class="function">g_action_get_state_hint()</code></a> for more information about
action state hints.</p>
<div class="refsect3">
<a name="g-simple-action-set-state-hint.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>simple</p></td>
<td class="parameter_description"><p>a <a class="link" href="GSimpleAction.html" title="GSimpleAction"><span class="type">GSimpleAction</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>state_hint</p></td>
<td class="parameter_description"><p> a <a href="../glib-GVariant.html#GVariant"><span class="type">GVariant</span></a> representing the state hint. </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-44.html#api-index-2.44">2.44</a></p>
</div>
</div>
<div class="refsect1">
<a name="GSimpleAction.other_details"></a><h2>Types and Values</h2>
<div class="refsect2">
<a name="GSimpleAction-struct"></a><h3>GSimpleAction</h3>
<pre class="programlisting">typedef struct _GSimpleAction GSimpleAction;</pre>
<p><a class="link" href="GSimpleAction.html" title="GSimpleAction"><span class="type">GSimpleAction</span></a> is an opaque data structure and can only be accessed
using the following functions.</p>
</div>
</div>
<div class="refsect1">
<a name="GSimpleAction.property-details"></a><h2>Property Details</h2>
<div class="refsect2">
<a name="GSimpleAction--enabled"></a><h3>The <code class="literal">“enabled”</code> property</h3>
<pre class="programlisting"> “enabled” <a href="../glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a></pre>
<p>If <em class="parameter"><code>action</code></em>
is currently enabled.</p>
<p>If the action is disabled then calls to <a class="link" href="GAction.html#g-action-activate" title="g_action_activate ()"><code class="function">g_action_activate()</code></a> and
<a class="link" href="GAction.html#g-action-change-state" title="g_action_change_state ()"><code class="function">g_action_change_state()</code></a> have no effect.</p>
<p>Flags: Read / Write</p>
<p>Default value: TRUE</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="GSimpleAction--name"></a><h3>The <code class="literal">“name”</code> property</h3>
<pre class="programlisting"> “name” <a href="../glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *</pre>
<p>The name of the action. This is mostly meaningful for identifying
the action once it has been added to a <a class="link" href="GSimpleActionGroup.html" title="GSimpleActionGroup"><span class="type">GSimpleActionGroup</span></a>.</p>
<p>Flags: Read / Write / Construct Only</p>
<p>Default value: NULL</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="GSimpleAction--parameter-type"></a><h3>The <code class="literal">“parameter-type”</code> property</h3>
<pre class="programlisting"> “parameter-type” <a href="../glib-GVariantType.html#GVariantType"><span class="type">GVariantType</span></a> *</pre>
<p>The type of the parameter that must be given when activating the
action.</p>
<p>Flags: Read / Write / Construct Only</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="GSimpleAction--state"></a><h3>The <code class="literal">“state”</code> property</h3>
<pre class="programlisting"> “state” <a href="../glib-GVariant.html#GVariant"><span class="type">GVariant</span></a> *</pre>
<p>The state of the action, or <a href="../glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> if the action is stateless.</p>
<p>Flags: Read / Write / Construct</p>
<p>Allowed values: GVariant&lt;*&gt;</p>
<p>Default value: NULL</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="GSimpleAction--state-type"></a><h3>The <code class="literal">“state-type”</code> property</h3>
<pre class="programlisting"> “state-type” <a href="../glib-GVariantType.html#GVariantType"><span class="type">GVariantType</span></a> *</pre>
<p>The <a href="../glib-GVariantType.html#GVariantType"><span class="type">GVariantType</span></a> of the state that the action has, or <a href="../glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> if the
action is stateless.</p>
<p>Flags: Read</p>
<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="GSimpleAction.signal-details"></a><h2>Signal Details</h2>
<div class="refsect2">
<a name="GSimpleAction-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="GSimpleAction.html" title="GSimpleAction"><span class="type">GSimpleAction</span></a> *simple,
<a href="../glib-GVariant.html#GVariant"><span class="type">GVariant</span></a> *parameter,
<a href="../glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> user_data)</pre>
<p>Indicates that the action was just activated.</p>
<p><em class="parameter"><code>parameter</code></em>
will always be of the expected type. In the event that
an incorrect type was given, no signal will be emitted.</p>
<p>Since GLib 2.40, if no handler is connected to this signal then the
default behaviour for boolean-stated actions with a <a href="../glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> parameter
type is to toggle them via the <a class="link" href="GSimpleAction.html#GSimpleAction-change-state" title="The “change-state” signal"><span class="type">“change-state”</span></a> signal.
For stateful actions where the state type is equal to the parameter
type, the default is to forward them directly to
<a class="link" href="GSimpleAction.html#GSimpleAction-change-state" title="The “change-state” signal"><span class="type">“change-state”</span></a>. This should allow almost all users
of <a class="link" href="GSimpleAction.html" title="GSimpleAction"><span class="type">GSimpleAction</span></a> to connect only one handler or the other.</p>
<div class="refsect3">
<a name="GSimpleAction-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>simple</p></td>
<td class="parameter_description"><p>the <a class="link" href="GSimpleAction.html" title="GSimpleAction"><span class="type">GSimpleAction</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>parameter</p></td>
<td class="parameter_description"><p> the parameter to the activation. </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>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>
<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="GSimpleAction-change-state"></a><h3>The <code class="literal">“change-state”</code> signal</h3>
<pre class="programlisting"><span class="returnvalue">void</span>
user_function (<a class="link" href="GSimpleAction.html" title="GSimpleAction"><span class="type">GSimpleAction</span></a> *simple,
<a href="../glib-GVariant.html#GVariant"><span class="type">GVariant</span></a> *value,
<a href="../glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> user_data)</pre>
<p>Indicates that the action just received a request to change its
state.</p>
<p><em class="parameter"><code>value</code></em>
will always be of the correct state type. In the event that
an incorrect type was given, no signal will be emitted.</p>
<p>If no handler is connected to this signal then the default
behaviour is to call <a class="link" href="GSimpleAction.html#g-simple-action-set-state" title="g_simple_action_set_state ()"><code class="function">g_simple_action_set_state()</code></a> to set the state
to the requested value. If you connect a signal handler then no
default action is taken. If the state should change then you must
call <a class="link" href="GSimpleAction.html#g-simple-action-set-state" title="g_simple_action_set_state ()"><code class="function">g_simple_action_set_state()</code></a> from the handler.</p>
<p>An example of a 'change-state' handler:</p>
<div class="informalexample">
<table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td class="listing_lines" align="right"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13</pre></td>
<td class="listing_code"><pre class="programlisting"><span class="keyword">static</span><span class="normal"> </span><span class="type">void</span>
<span class="function">change_volume_state</span><span class="normal"> </span><span class="symbol">(</span><span class="usertype">GSimpleAction</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">action</span><span class="symbol">,</span>
<span class="normal"> </span><span class="usertype">GVariant</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">value</span><span class="symbol">,</span>
<span class="normal"> </span><span class="usertype">gpointer</span><span class="normal"> user_data</span><span class="symbol">)</span>
<span class="cbracket">{</span>
<span class="normal"> </span><span class="usertype">gint</span><span class="normal"> requested</span><span class="symbol">;</span>
<span class="normal"> requested </span><span class="symbol">=</span><span class="normal"> </span><span class="function"><a href="../glib-GVariant.html#g-variant-get-int32">g_variant_get_int32</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">value</span><span class="symbol">);</span>
<span class="normal"> </span><span class="comment">// Volume only goes from 0 to 10</span>
<span class="normal"> </span><span class="keyword">if</span><span class="normal"> </span><span class="symbol">(</span><span class="number">0</span><span class="normal"> </span><span class="symbol">&lt;=</span><span class="normal"> requested </span><span class="symbol">&amp;&amp;</span><span class="normal"> requested </span><span class="symbol">&lt;=</span><span class="normal"> </span><span class="number">10</span><span class="symbol">)</span>
<span class="normal"> </span><span class="function"><a href="GSimpleAction.html#g-simple-action-set-state">g_simple_action_set_state</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">action</span><span class="symbol">,</span><span class="normal"> value</span><span class="symbol">);</span>
<span class="cbracket">}</span></pre></td>
</tr>
</tbody>
</table>
</div>
<p></p>
<p>The handler need not set the state to the requested value.
It could set it to any value at all, or take some other action.</p>
<div class="refsect3">
<a name="GSimpleAction-change-state.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>simple</p></td>
<td class="parameter_description"><p>the <a class="link" href="GSimpleAction.html" title="GSimpleAction"><span class="type">GSimpleAction</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>value</p></td>
<td class="parameter_description"><p> the requested value for the state. </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>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>
<p class="since">Since: <a class="link" href="api-index-2-30.html#api-index-2.30">2.30</a></p>
</div>
</div>
</div>
<div class="footer">
<hr>Generated by GTK-Doc V1.25.1</div>
</body>
</html>