⚝
One Hat Cyber Team
⚝
Your IP:
216.73.216.83
Server IP:
157.245.101.34
Server:
Linux skvinfotech-website 5.4.0-131-generic #147-Ubuntu SMP Fri Oct 14 17:07:22 UTC 2022 x86_64
Server Software:
Apache/2.4.41 (Ubuntu)
PHP Version:
7.4.33
Buat File
|
Buat Folder
Eksekusi
Dir :
~
/
usr
/
share
/
doc
/
libglib2.0-doc
/
gio
/
View File Name :
GSimpleAction.html
<!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.32 (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_proto_type"> <col class="functions_proto_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"><span class="type">gboolean</span></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"> <span class="type">gchar</span> *</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"> <span class="type">GVariantType</span> *</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"> <span class="type">GVariant</span> *</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"> <span class="type">GVariantType</span> *</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="signal_proto_type"> <col width="300px" class="signal_proto_name"> <col width="200px" class="signal_proto_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">Run Last</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">Run Last</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="other_proto_type"> <col class="other_proto_name"> </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"> GObject <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 <gio/gio.h> </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 <span class="type">GtkAction</span>.</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 <span class="type">gchar</span> *name</code></em>, <em class="parameter"><code>const <span class="type">GVariantType</span> *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> to create an action that has state.</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 that will be passed to handlers for the <a class="link" href="GSimpleAction.html#GSimpleAction-activate" title="The “activate” signal"><span class="type">“activate”</span></a> signal, or <code class="literal">NULL</code> for no parameter. </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> <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 <span class="type">gchar</span> *name</code></em>, <em class="parameter"><code>const <span class="type">GVariantType</span> *parameter_type</code></em>, <em class="parameter"><code><span class="type">GVariant</span> *state</code></em>);</pre> <p>Creates a new stateful action.</p> <p>All future state values must have the same <span class="type">GVariantType</span> as the initial <em class="parameter"><code>state</code></em> .</p> <p>If the <em class="parameter"><code>state</code></em> <span class="type">GVariant</span> 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 that will be passed to handlers for the <a class="link" href="GSimpleAction.html#GSimpleAction-activate" title="The “activate” signal"><span class="type">“activate”</span></a> signal, or <code class="literal">NULL</code> for no parameter. </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> <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><span class="type">gboolean</span> 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><span class="type">GVariant</span> *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 <span class="type">GVariant</span> 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><span class="type">GVariant</span> *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 <span class="type">GVariant</span> representing the state hint. </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-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” <span class="type">gboolean</span></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>Owner: GSimpleAction</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” <span class="type">gchar</span> *</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>Owner: GSimpleAction</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” <span class="type">GVariantType</span> *</pre> <p>The type of the parameter that must be given when activating the action.</p> <p>Owner: GSimpleAction</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” <span class="type">GVariant</span> *</pre> <p>The state of the action, or <code class="literal">NULL</code> if the action is stateless.</p> <p>Owner: GSimpleAction</p> <p>Flags: Read / Write / Construct</p> <p>Allowed values: GVariant<*></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” <span class="type">GVariantType</span> *</pre> <p>The <span class="type">GVariantType</span> of the state that the action has, or <code class="literal">NULL</code> if the action is stateless.</p> <p>Owner: GSimpleAction</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, <span class="type">GVariant</span> *parameter, <span class="type">gpointer</span> 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, i.e. the parameter type specified when the action was created. If an incorrect type is given when activating the action, this signal is not 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 <code class="literal">NULL</code> 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, or <code class="literal">NULL</code> if it has no parameter. </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> <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: Run Last</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, <span class="type">GVariant</span> *value, <span class="type">gpointer</span> 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, i.e. the type of the initial state passed to <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>. If an incorrect type is given when requesting to change the state, this signal is not 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="k">static</span> <span class="kt">void</span> <span class="nf">change_volume_state</span> <span class="p">(</span><span class="n">GSimpleAction</span> <span class="o">*</span><span class="n">action</span><span class="p">,</span> <span class="n">GVariant</span> <span class="o">*</span><span class="n">value</span><span class="p">,</span> <span class="n">gpointer</span> <span class="n">user_data</span><span class="p">)</span> <span class="p">{</span> <span class="n">gint</span> <span class="n">requested</span><span class="p">;</span> <span class="n">requested</span> <span class="o">=</span> <span class="n">g_variant_get_int32</span> <span class="p">(</span><span class="n">value</span><span class="p">);</span> <span class="c1">// Volume only goes from 0 to 10</span> <span class="k">if</span> <span class="p">(</span><span class="mi">0</span> <span class="o"><=</span> <span class="n">requested</span> <span class="o">&&</span> <span class="n">requested</span> <span class="o"><=</span> <span class="mi">10</span><span class="p">)</span> <span class="n">g_simple_action_set_state</span> <span class="p">(</span><span class="n">action</span><span class="p">,</span> <span class="n">value</span><span class="p">);</span> <span class="p">}</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 may be passed as the value in, out, in-out; or as a return value."><span class="acronym">nullable</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: Run Last</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.32</div> </body> </html>