Moving files to packaging and extracing new tarball.
[profile/ivi/glib2.git] / docs / reference / gio / html / GAction.html
1 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2 <html>
3 <head>
4 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
5 <title>GAction</title>
6 <meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
7 <link rel="home" href="index.html" title="GIO Reference Manual">
8 <link rel="up" href="application.html" title="Application support">
9 <link rel="prev" href="GSimpleActionGroup.html" title="GSimpleActionGroup">
10 <link rel="next" href="GSimpleAction.html" title="GSimpleAction">
11 <meta name="generator" content="GTK-Doc V1.18 (XML mode)">
12 <link rel="stylesheet" href="style.css" type="text/css">
13 </head>
14 <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
15 <table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2">
16 <tr valign="middle">
17 <td><a accesskey="p" href="GSimpleActionGroup.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td>
18 <td><a accesskey="u" href="application.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td>
19 <td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td>
20 <th width="100%" align="center">GIO Reference Manual</th>
21 <td><a accesskey="n" href="GSimpleAction.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td>
22 </tr>
23 <tr><td colspan="5" class="shortcuts">
24 <a href="#GAction.synopsis" class="shortcut">Top</a>
25                    | 
26                   <a href="#GAction.description" class="shortcut">Description</a>
27                    | 
28                   <a href="#GAction.object-hierarchy" class="shortcut">Object Hierarchy</a>
29                    | 
30                   <a href="#GAction.prerequisites" class="shortcut">Prerequisites</a>
31                    | 
32                   <a href="#GAction.implementations" class="shortcut">Known Implementations</a>
33                    | 
34                   <a href="#GAction.properties" class="shortcut">Properties</a>
35 </td></tr>
36 </table>
37 <div class="refentry">
38 <a name="GAction"></a><div class="titlepage"></div>
39 <div class="refnamediv"><table width="100%"><tr>
40 <td valign="top">
41 <h2><span class="refentrytitle"><a name="GAction.top_of_page"></a>GAction</span></h2>
42 <p>GAction — An action interface</p>
43 </td>
44 <td valign="top" align="right"></td>
45 </tr></table></div>
46 <div class="refsynopsisdiv">
47 <a name="GAction.synopsis"></a><h2>Synopsis</h2>
48 <pre class="synopsis">                    <a class="link" href="GAction.html#GAction-struct" title="GAction">GAction</a>;
49 struct              <a class="link" href="GAction.html#GActionInterface" title="struct GActionInterface">GActionInterface</a>;
50
51 const <a href="./../glib/glib/glib-Basic-Types.html#gchar"><span class="returnvalue">gchar</span></a> *       <a class="link" href="GAction.html#g-action-get-name" title="g_action_get_name ()">g_action_get_name</a>                   (<em class="parameter"><code><a class="link" href="GAction.html" title="GAction"><span class="type">GAction</span></a> *action</code></em>);
52 const <a href="./../glib/glib/glib-GVariantType.html#GVariantType"><span class="returnvalue">GVariantType</span></a> * <a class="link" href="GAction.html#g-action-get-parameter-type" title="g_action_get_parameter_type ()">g_action_get_parameter_type</a>        (<em class="parameter"><code><a class="link" href="GAction.html" title="GAction"><span class="type">GAction</span></a> *action</code></em>);
53 const <a href="./../glib/glib/glib-GVariantType.html#GVariantType"><span class="returnvalue">GVariantType</span></a> * <a class="link" href="GAction.html#g-action-get-state-type" title="g_action_get_state_type ()">g_action_get_state_type</a>            (<em class="parameter"><code><a class="link" href="GAction.html" title="GAction"><span class="type">GAction</span></a> *action</code></em>);
54 <a href="./../glib/glib/glib-GVariant.html#GVariant"><span class="returnvalue">GVariant</span></a> *          <a class="link" href="GAction.html#g-action-get-state-hint" title="g_action_get_state_hint ()">g_action_get_state_hint</a>             (<em class="parameter"><code><a class="link" href="GAction.html" title="GAction"><span class="type">GAction</span></a> *action</code></em>);
55
56 <a href="./../glib/glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>            <a class="link" href="GAction.html#g-action-get-enabled" title="g_action_get_enabled ()">g_action_get_enabled</a>                (<em class="parameter"><code><a class="link" href="GAction.html" title="GAction"><span class="type">GAction</span></a> *action</code></em>);
57 <a href="./../glib/glib/glib-GVariant.html#GVariant"><span class="returnvalue">GVariant</span></a> *          <a class="link" href="GAction.html#g-action-get-state" title="g_action_get_state ()">g_action_get_state</a>                  (<em class="parameter"><code><a class="link" href="GAction.html" title="GAction"><span class="type">GAction</span></a> *action</code></em>);
58
59 <span class="returnvalue">void</span>                <a class="link" href="GAction.html#g-action-change-state" title="g_action_change_state ()">g_action_change_state</a>               (<em class="parameter"><code><a class="link" href="GAction.html" title="GAction"><span class="type">GAction</span></a> *action</code></em>,
60                                                          <em class="parameter"><code><a href="./../glib/glib/glib-GVariant.html#GVariant"><span class="type">GVariant</span></a> *value</code></em>);
61 <span class="returnvalue">void</span>                <a class="link" href="GAction.html#g-action-activate" title="g_action_activate ()">g_action_activate</a>                   (<em class="parameter"><code><a class="link" href="GAction.html" title="GAction"><span class="type">GAction</span></a> *action</code></em>,
62                                                          <em class="parameter"><code><a href="./../glib/glib/glib-GVariant.html#GVariant"><span class="type">GVariant</span></a> *parameter</code></em>);
63 </pre>
64 </div>
65 <div class="refsect1">
66 <a name="GAction.object-hierarchy"></a><h2>Object Hierarchy</h2>
67 <pre class="synopsis">
68   GInterface
69    +----GAction
70 </pre>
71 </div>
72 <div class="refsect1">
73 <a name="GAction.prerequisites"></a><h2>Prerequisites</h2>
74 <p>
75 GAction requires
76  <a href="./../gobject/gobject/gobject-The-Base-Object-Type.html#GObject">GObject</a>.</p>
77 </div>
78 <div class="refsect1">
79 <a name="GAction.implementations"></a><h2>Known Implementations</h2>
80 <p>
81 GAction is implemented by
82  <a class="link" href="GSimpleAction.html" title="GSimpleAction">GSimpleAction</a>.</p>
83 </div>
84 <div class="refsect1">
85 <a name="GAction.properties"></a><h2>Properties</h2>
86 <pre class="synopsis">
87   "<a class="link" href="GAction.html#GAction--enabled" title='The "enabled" property'>enabled</a>"                  <a href="./../glib/glib/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a>              : Read
88   "<a class="link" href="GAction.html#GAction--name" title='The "name" property'>name</a>"                     <a href="./../glib/glib/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a>*                : Read
89   "<a class="link" href="GAction.html#GAction--parameter-type" title='The "parameter-type" property'>parameter-type</a>"           <a href="./../glib/glib/glib-GVariantType.html#GVariantType"><span class="type">GVariantType</span></a>*         : Read
90   "<a class="link" href="GAction.html#GAction--state" title='The "state" property'>state</a>"                    <a href="./../glib/glib/glib-GVariant.html#GVariant"><span class="type">GVariant</span></a>*             : Read
91   "<a class="link" href="GAction.html#GAction--state-type" title='The "state-type" property'>state-type</a>"               <a href="./../glib/glib/glib-GVariantType.html#GVariantType"><span class="type">GVariantType</span></a>*         : Read
92 </pre>
93 </div>
94 <div class="refsect1">
95 <a name="GAction.description"></a><h2>Description</h2>
96 <p>
97 <a class="link" href="GAction.html" title="GAction"><span class="type">GAction</span></a> represents a single named action.
98 </p>
99 <p>
100 The main interface to an action is that it can be activated with
101 <a class="link" href="GAction.html#g-action-activate" title="g_action_activate ()"><code class="function">g_action_activate()</code></a>.  This results in the 'activate' signal being
102 emitted.  An activation has a <a href="./../glib/glib/glib-GVariant.html#GVariant"><span class="type">GVariant</span></a> parameter (which may be
103 <a href="./../glib/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>).  The correct type for the parameter is determined by a static
104 parameter type (which is given at construction time).
105 </p>
106 <p>
107 An action may optionally have a state, in which case the state may be
108 set with <a class="link" href="GAction.html#g-action-change-state" title="g_action_change_state ()"><code class="function">g_action_change_state()</code></a>.  This call takes a <a href="./../glib/glib/glib-GVariant.html#GVariant"><span class="type">GVariant</span></a>.  The
109 correct type for the state is determined by a static state type
110 (which is given at construction time).
111 </p>
112 <p>
113 The state may have a hint associated with it, specifying its valid
114 range.
115 </p>
116 <p>
117 <a class="link" href="GAction.html" title="GAction"><span class="type">GAction</span></a> is merely the interface to the concept of an action, as
118 described above.  Various implementations of actions exist, including
119 <a class="link" href="GSimpleAction.html" title="GSimpleAction"><span class="type">GSimpleAction</span></a> and <a href="http://library.gnome.org/devel/gtk/GtkAction.html"><span class="type">GtkAction</span></a>.
120 </p>
121 <p>
122 In all cases, the implementing class is responsible for storing the
123 name of the action, the parameter type, the enabled state, the
124 optional state type and the state and emitting the appropriate
125 signals when these change.  The implementor responsible for filtering
126 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> for type
127 safety and for the state being enabled.
128 </p>
129 <p>
130 Probably the only useful thing to do with a <a class="link" href="GAction.html" title="GAction"><span class="type">GAction</span></a> is to put it
131 inside of a <a class="link" href="GSimpleActionGroup.html" title="GSimpleActionGroup"><span class="type">GSimpleActionGroup</span></a>.
132 </p>
133 </div>
134 <div class="refsect1">
135 <a name="GAction.details"></a><h2>Details</h2>
136 <div class="refsect2">
137 <a name="GAction-struct"></a><h3>GAction</h3>
138 <pre class="programlisting">typedef struct _GAction GAction;</pre>
139 </div>
140 <hr>
141 <div class="refsect2">
142 <a name="GActionInterface"></a><h3>struct GActionInterface</h3>
143 <pre class="programlisting">struct GActionInterface {
144   GTypeInterface g_iface;
145
146   /* virtual functions */
147   const gchar *        (* get_name)             (GAction  *action);
148   const GVariantType * (* get_parameter_type)   (GAction  *action);
149   const GVariantType * (* get_state_type)       (GAction  *action);
150   GVariant *           (* get_state_hint)       (GAction  *action);
151
152   gboolean             (* get_enabled)          (GAction  *action);
153   GVariant *           (* get_state)            (GAction  *action);
154
155   void                 (* change_state)         (GAction  *action,
156                                                  GVariant *value);
157   void                 (* activate)             (GAction  *action,
158                                                  GVariant *parameter);
159 };
160 </pre>
161 <p>
162 The virtual function table for <a class="link" href="GAction.html" title="GAction"><span class="type">GAction</span></a>.
163 </p>
164 <div class="variablelist"><table border="0">
165 <col align="left" valign="top">
166 <tbody>
167 <tr>
168 <td><p><span class="term"><a href="./../gobject/gobject/gobject-Type-Information.html#GTypeInterface"><span class="type">GTypeInterface</span></a> <em class="structfield"><code><a name="GActionInterface.g-iface"></a>g_iface</code></em>;</span></p></td>
169 <td></td>
170 </tr>
171 <tr>
172 <td><p><span class="term"><em class="structfield"><code><a name="GActionInterface.get-name"></a>get_name</code></em> ()</span></p></td>
173 <td>the virtual function pointer for <a class="link" href="GAction.html#g-action-get-name" title="g_action_get_name ()"><code class="function">g_action_get_name()</code></a>
174 </td>
175 </tr>
176 <tr>
177 <td><p><span class="term"><em class="structfield"><code><a name="GActionInterface.get-parameter-type"></a>get_parameter_type</code></em> ()</span></p></td>
178 <td>the virtual function pointer for <a class="link" href="GAction.html#g-action-get-parameter-type" title="g_action_get_parameter_type ()"><code class="function">g_action_get_parameter_type()</code></a>
179 </td>
180 </tr>
181 <tr>
182 <td><p><span class="term"><em class="structfield"><code><a name="GActionInterface.get-state-type"></a>get_state_type</code></em> ()</span></p></td>
183 <td>the virtual function pointer for <a class="link" href="GAction.html#g-action-get-state-type" title="g_action_get_state_type ()"><code class="function">g_action_get_state_type()</code></a>
184 </td>
185 </tr>
186 <tr>
187 <td><p><span class="term"><em class="structfield"><code><a name="GActionInterface.get-state-hint"></a>get_state_hint</code></em> ()</span></p></td>
188 <td>the virtual function pointer for <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>
189 </td>
190 </tr>
191 <tr>
192 <td><p><span class="term"><em class="structfield"><code><a name="GActionInterface.get-enabled"></a>get_enabled</code></em> ()</span></p></td>
193 <td>the virtual function pointer for <a class="link" href="GAction.html#g-action-get-enabled" title="g_action_get_enabled ()"><code class="function">g_action_get_enabled()</code></a>
194 </td>
195 </tr>
196 <tr>
197 <td><p><span class="term"><em class="structfield"><code><a name="GActionInterface.get-state"></a>get_state</code></em> ()</span></p></td>
198 <td>the virtual function pointer for <a class="link" href="GAction.html#g-action-get-state" title="g_action_get_state ()"><code class="function">g_action_get_state()</code></a>
199 </td>
200 </tr>
201 <tr>
202 <td><p><span class="term"><em class="structfield"><code><a name="GActionInterface.change-state"></a>change_state</code></em> ()</span></p></td>
203 <td>the virtual function pointer for <a class="link" href="GAction.html#g-action-change-state" title="g_action_change_state ()"><code class="function">g_action_change_state()</code></a>
204 </td>
205 </tr>
206 <tr>
207 <td><p><span class="term"><em class="structfield"><code><a name="GActionInterface.activate"></a>activate</code></em> ()</span></p></td>
208 <td>the virtual function pointer for <a class="link" href="GAction.html#g-action-activate" title="g_action_activate ()"><code class="function">g_action_activate()</code></a>.  Note that <a class="link" href="GAction.html" title="GAction"><span class="type">GAction</span></a> does not have an
209 'activate' signal but that implementations of it may have one.</td>
210 </tr>
211 </tbody>
212 </table></div>
213 <p class="since">Since 2.28</p>
214 </div>
215 <hr>
216 <div class="refsect2">
217 <a name="g-action-get-name"></a><h3>g_action_get_name ()</h3>
218 <pre class="programlisting">const <a href="./../glib/glib/glib-Basic-Types.html#gchar"><span class="returnvalue">gchar</span></a> *       g_action_get_name                   (<em class="parameter"><code><a class="link" href="GAction.html" title="GAction"><span class="type">GAction</span></a> *action</code></em>);</pre>
219 <p>
220 Queries the name of <em class="parameter"><code>action</code></em>.
221 </p>
222 <div class="variablelist"><table border="0">
223 <col align="left" valign="top">
224 <tbody>
225 <tr>
226 <td><p><span class="term"><em class="parameter"><code>action</code></em> :</span></p></td>
227 <td>a <a class="link" href="GAction.html" title="GAction"><span class="type">GAction</span></a>
228 </td>
229 </tr>
230 <tr>
231 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
232 <td>the name of the action</td>
233 </tr>
234 </tbody>
235 </table></div>
236 <p class="since">Since 2.28</p>
237 </div>
238 <hr>
239 <div class="refsect2">
240 <a name="g-action-get-parameter-type"></a><h3>g_action_get_parameter_type ()</h3>
241 <pre class="programlisting">const <a href="./../glib/glib/glib-GVariantType.html#GVariantType"><span class="returnvalue">GVariantType</span></a> * g_action_get_parameter_type        (<em class="parameter"><code><a class="link" href="GAction.html" title="GAction"><span class="type">GAction</span></a> *action</code></em>);</pre>
242 <p>
243 Queries the type of the parameter that must be given when activating
244 <em class="parameter"><code>action</code></em>.
245 </p>
246 <p>
247 When activating the action using <a class="link" href="GAction.html#g-action-activate" title="g_action_activate ()"><code class="function">g_action_activate()</code></a>, the <a href="./../glib/glib/glib-GVariant.html#GVariant"><span class="type">GVariant</span></a>
248 given to that function must be of the type returned by this function.
249 </p>
250 <p>
251 In the case that this function returns <a href="./../glib/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>, you must not give any
252 <a href="./../glib/glib/glib-GVariant.html#GVariant"><span class="type">GVariant</span></a>, but <a href="./../glib/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> instead.
253 </p>
254 <div class="variablelist"><table border="0">
255 <col align="left" valign="top">
256 <tbody>
257 <tr>
258 <td><p><span class="term"><em class="parameter"><code>action</code></em> :</span></p></td>
259 <td>a <a class="link" href="GAction.html" title="GAction"><span class="type">GAction</span></a>
260 </td>
261 </tr>
262 <tr>
263 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
264 <td>the parameter type. <span class="annotation">[<acronym title="NULL is ok, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span>
265 </td>
266 </tr>
267 </tbody>
268 </table></div>
269 <p class="since">Since 2.28</p>
270 </div>
271 <hr>
272 <div class="refsect2">
273 <a name="g-action-get-state-type"></a><h3>g_action_get_state_type ()</h3>
274 <pre class="programlisting">const <a href="./../glib/glib/glib-GVariantType.html#GVariantType"><span class="returnvalue">GVariantType</span></a> * g_action_get_state_type            (<em class="parameter"><code><a class="link" href="GAction.html" title="GAction"><span class="type">GAction</span></a> *action</code></em>);</pre>
275 <p>
276 Queries the type of the state of <em class="parameter"><code>action</code></em>.
277 </p>
278 <p>
279 If the action is stateful (e.g. created with
280 <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>) then this function returns the
281 <a href="./../glib/glib/glib-GVariantType.html#GVariantType"><span class="type">GVariantType</span></a> of the state.  This is the type of the initial value
282 given as the state. All calls to <a class="link" href="GAction.html#g-action-change-state" title="g_action_change_state ()"><code class="function">g_action_change_state()</code></a> must give a
283 <a href="./../glib/glib/glib-GVariant.html#GVariant"><span class="type">GVariant</span></a> of this type and <a class="link" href="GAction.html#g-action-get-state" title="g_action_get_state ()"><code class="function">g_action_get_state()</code></a> will return a
284 <a href="./../glib/glib/glib-GVariant.html#GVariant"><span class="type">GVariant</span></a> of the same type.
285 </p>
286 <p>
287 If the action is not stateful (e.g. created with <a class="link" href="GSimpleAction.html#g-simple-action-new" title="g_simple_action_new ()"><code class="function">g_simple_action_new()</code></a>)
288 then this function will return <a href="./../glib/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>. In that case, <a class="link" href="GAction.html#g-action-get-state" title="g_action_get_state ()"><code class="function">g_action_get_state()</code></a>
289 will return <a href="./../glib/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> and you must not 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>.
290 </p>
291 <div class="variablelist"><table border="0">
292 <col align="left" valign="top">
293 <tbody>
294 <tr>
295 <td><p><span class="term"><em class="parameter"><code>action</code></em> :</span></p></td>
296 <td>a <a class="link" href="GAction.html" title="GAction"><span class="type">GAction</span></a>
297 </td>
298 </tr>
299 <tr>
300 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
301 <td>the state type, if the action is stateful. <span class="annotation">[<acronym title="NULL is ok, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span>
302 </td>
303 </tr>
304 </tbody>
305 </table></div>
306 <p class="since">Since 2.28</p>
307 </div>
308 <hr>
309 <div class="refsect2">
310 <a name="g-action-get-state-hint"></a><h3>g_action_get_state_hint ()</h3>
311 <pre class="programlisting"><a href="./../glib/glib/glib-GVariant.html#GVariant"><span class="returnvalue">GVariant</span></a> *          g_action_get_state_hint             (<em class="parameter"><code><a class="link" href="GAction.html" title="GAction"><span class="type">GAction</span></a> *action</code></em>);</pre>
312 <p>
313 Requests a hint about the valid range of values for the state of
314 <em class="parameter"><code>action</code></em>.
315 </p>
316 <p>
317 If <a href="./../glib/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> is returned it either means that the action is not stateful
318 or that there is no hint about the valid range of values for the
319 state of the action.
320 </p>
321 <p>
322 If a <a href="./../glib/glib/glib-GVariant.html#GVariant"><span class="type">GVariant</span></a> array is returned then each item in the array is a
323 possible value for the state.  If a <a href="./../glib/glib/glib-GVariant.html#GVariant"><span class="type">GVariant</span></a> pair (ie: two-tuple) is
324 returned then the tuple specifies the inclusive lower and upper bound
325 of valid values for the state.
326 </p>
327 <p>
328 In any case, the information is merely a hint.  It may be possible to
329 have a state value outside of the hinted range and setting a value
330 within the range may fail.
331 </p>
332 <p>
333 The return value (if non-<a href="./../glib/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>) should be freed with
334 <a href="./../glib/glib/glib-GVariant.html#g-variant-unref"><code class="function">g_variant_unref()</code></a> when it is no longer required.
335 </p>
336 <div class="variablelist"><table border="0">
337 <col align="left" valign="top">
338 <tbody>
339 <tr>
340 <td><p><span class="term"><em class="parameter"><code>action</code></em> :</span></p></td>
341 <td>a <a class="link" href="GAction.html" title="GAction"><span class="type">GAction</span></a>
342 </td>
343 </tr>
344 <tr>
345 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
346 <td>the state range hint. <span class="annotation">[<acronym title="Free data after the code is done."><span class="acronym">transfer full</span></acronym>]</span>
347 </td>
348 </tr>
349 </tbody>
350 </table></div>
351 <p class="since">Since 2.28</p>
352 </div>
353 <hr>
354 <div class="refsect2">
355 <a name="g-action-get-enabled"></a><h3>g_action_get_enabled ()</h3>
356 <pre class="programlisting"><a href="./../glib/glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>            g_action_get_enabled                (<em class="parameter"><code><a class="link" href="GAction.html" title="GAction"><span class="type">GAction</span></a> *action</code></em>);</pre>
357 <p>
358 Checks if <em class="parameter"><code>action</code></em> is currently enabled.
359 </p>
360 <p>
361 An action must be enabled in order to be activated or in order to
362 have its state changed from outside callers.
363 </p>
364 <div class="variablelist"><table border="0">
365 <col align="left" valign="top">
366 <tbody>
367 <tr>
368 <td><p><span class="term"><em class="parameter"><code>action</code></em> :</span></p></td>
369 <td>a <a class="link" href="GAction.html" title="GAction"><span class="type">GAction</span></a>
370 </td>
371 </tr>
372 <tr>
373 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
374 <td>whether the action is enabled</td>
375 </tr>
376 </tbody>
377 </table></div>
378 <p class="since">Since 2.28</p>
379 </div>
380 <hr>
381 <div class="refsect2">
382 <a name="g-action-get-state"></a><h3>g_action_get_state ()</h3>
383 <pre class="programlisting"><a href="./../glib/glib/glib-GVariant.html#GVariant"><span class="returnvalue">GVariant</span></a> *          g_action_get_state                  (<em class="parameter"><code><a class="link" href="GAction.html" title="GAction"><span class="type">GAction</span></a> *action</code></em>);</pre>
384 <p>
385 Queries the current state of <em class="parameter"><code>action</code></em>.
386 </p>
387 <p>
388 If the action is not stateful then <a href="./../glib/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> will be returned.  If the
389 action is stateful then the type of the return value is the type
390 given by <a class="link" href="GAction.html#g-action-get-state-type" title="g_action_get_state_type ()"><code class="function">g_action_get_state_type()</code></a>.
391 </p>
392 <p>
393 The return value (if non-<a href="./../glib/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>) should be freed with
394 <a href="./../glib/glib/glib-GVariant.html#g-variant-unref"><code class="function">g_variant_unref()</code></a> when it is no longer required.
395 </p>
396 <div class="variablelist"><table border="0">
397 <col align="left" valign="top">
398 <tbody>
399 <tr>
400 <td><p><span class="term"><em class="parameter"><code>action</code></em> :</span></p></td>
401 <td>a <a class="link" href="GAction.html" title="GAction"><span class="type">GAction</span></a>
402 </td>
403 </tr>
404 <tr>
405 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
406 <td>the current state of the action. <span class="annotation">[<acronym title="Free data after the code is done."><span class="acronym">transfer full</span></acronym>]</span>
407 </td>
408 </tr>
409 </tbody>
410 </table></div>
411 <p class="since">Since 2.28</p>
412 </div>
413 <hr>
414 <div class="refsect2">
415 <a name="g-action-change-state"></a><h3>g_action_change_state ()</h3>
416 <pre class="programlisting"><span class="returnvalue">void</span>                g_action_change_state               (<em class="parameter"><code><a class="link" href="GAction.html" title="GAction"><span class="type">GAction</span></a> *action</code></em>,
417                                                          <em class="parameter"><code><a href="./../glib/glib/glib-GVariant.html#GVariant"><span class="type">GVariant</span></a> *value</code></em>);</pre>
418 <p>
419 Request for the state of <em class="parameter"><code>action</code></em> to be changed to <em class="parameter"><code>value</code></em>.
420 </p>
421 <p>
422 The action must be stateful and <em class="parameter"><code>value</code></em> must be of the correct type.
423 See <a class="link" href="GAction.html#g-action-get-state-type" title="g_action_get_state_type ()"><code class="function">g_action_get_state_type()</code></a>.
424 </p>
425 <p>
426 This call merely requests a change.  The action may refuse to change
427 its state or may change its state to something other than <em class="parameter"><code>value</code></em>.
428 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>.
429 </p>
430 <p>
431 If the <em class="parameter"><code>value</code></em> GVariant is floating, it is consumed.
432 </p>
433 <div class="variablelist"><table border="0">
434 <col align="left" valign="top">
435 <tbody>
436 <tr>
437 <td><p><span class="term"><em class="parameter"><code>action</code></em> :</span></p></td>
438 <td>a <a class="link" href="GAction.html" title="GAction"><span class="type">GAction</span></a>
439 </td>
440 </tr>
441 <tr>
442 <td><p><span class="term"><em class="parameter"><code>value</code></em> :</span></p></td>
443 <td>the new state</td>
444 </tr>
445 </tbody>
446 </table></div>
447 <p class="since">Since 2.30</p>
448 </div>
449 <hr>
450 <div class="refsect2">
451 <a name="g-action-activate"></a><h3>g_action_activate ()</h3>
452 <pre class="programlisting"><span class="returnvalue">void</span>                g_action_activate                   (<em class="parameter"><code><a class="link" href="GAction.html" title="GAction"><span class="type">GAction</span></a> *action</code></em>,
453                                                          <em class="parameter"><code><a href="./../glib/glib/glib-GVariant.html#GVariant"><span class="type">GVariant</span></a> *parameter</code></em>);</pre>
454 <p>
455 Activates the action.
456 </p>
457 <p>
458 <em class="parameter"><code>parameter</code></em> must be the correct type of parameter for the action (ie:
459 the parameter type given at construction time).  If the parameter
460 type was <a href="./../glib/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> then <em class="parameter"><code>parameter</code></em> must also be <a href="./../glib/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>.
461 </p>
462 <div class="variablelist"><table border="0">
463 <col align="left" valign="top">
464 <tbody>
465 <tr>
466 <td><p><span class="term"><em class="parameter"><code>action</code></em> :</span></p></td>
467 <td>a <a class="link" href="GAction.html" title="GAction"><span class="type">GAction</span></a>
468 </td>
469 </tr>
470 <tr>
471 <td><p><span class="term"><em class="parameter"><code>parameter</code></em> :</span></p></td>
472 <td>the parameter to the activation. <span class="annotation">[<acronym title="NULL is ok, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span>
473 </td>
474 </tr>
475 </tbody>
476 </table></div>
477 <p class="since">Since 2.28</p>
478 </div>
479 </div>
480 <div class="refsect1">
481 <a name="GAction.property-details"></a><h2>Property Details</h2>
482 <div class="refsect2">
483 <a name="GAction--enabled"></a><h3>The <code class="literal">"enabled"</code> property</h3>
484 <pre class="programlisting">  "enabled"                  <a href="./../glib/glib/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a>              : Read</pre>
485 <p>
486 If <em class="parameter"><code>action</code></em> is currently enabled.
487 </p>
488 <p>
489 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
490 <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.
491 </p>
492 <p>Default value: TRUE</p>
493 <p class="since">Since 2.28</p>
494 </div>
495 <hr>
496 <div class="refsect2">
497 <a name="GAction--name"></a><h3>The <code class="literal">"name"</code> property</h3>
498 <pre class="programlisting">  "name"                     <a href="./../glib/glib/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a>*                : Read</pre>
499 <p>
500 The name of the action.  This is mostly meaningful for identifying
501 the action once it has been added to a <a class="link" href="GActionGroup.html" title="GActionGroup"><span class="type">GActionGroup</span></a>.
502 </p>
503 <p>Default value: NULL</p>
504 <p class="since">Since 2.28</p>
505 </div>
506 <hr>
507 <div class="refsect2">
508 <a name="GAction--parameter-type"></a><h3>The <code class="literal">"parameter-type"</code> property</h3>
509 <pre class="programlisting">  "parameter-type"           <a href="./../glib/glib/glib-GVariantType.html#GVariantType"><span class="type">GVariantType</span></a>*         : Read</pre>
510 <p>
511 The type of the parameter that must be given when activating the
512 action.
513 </p>
514 <p class="since">Since 2.28</p>
515 </div>
516 <hr>
517 <div class="refsect2">
518 <a name="GAction--state"></a><h3>The <code class="literal">"state"</code> property</h3>
519 <pre class="programlisting">  "state"                    <a href="./../glib/glib/glib-GVariant.html#GVariant"><span class="type">GVariant</span></a>*             : Read</pre>
520 <p>
521 The state of the action, or <a href="./../glib/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> if the action is stateless.
522 </p>
523 <p>Allowed values: GVariant&lt;*&gt;</p>
524 <p>Default value: NULL</p>
525 <p class="since">Since 2.28</p>
526 </div>
527 <hr>
528 <div class="refsect2">
529 <a name="GAction--state-type"></a><h3>The <code class="literal">"state-type"</code> property</h3>
530 <pre class="programlisting">  "state-type"               <a href="./../glib/glib/glib-GVariantType.html#GVariantType"><span class="type">GVariantType</span></a>*         : Read</pre>
531 <p>
532 The <a href="./../glib/glib/glib-GVariantType.html#GVariantType"><span class="type">GVariantType</span></a> of the state that the action has, or <a href="./../glib/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> if the
533 action is stateless.
534 </p>
535 <p class="since">Since 2.28</p>
536 </div>
537 </div>
538 </div>
539 <div class="footer">
540 <hr>
541           Generated by GTK-Doc V1.18</div>
542 </body>
543 </html>