~ubuntu-branches/ubuntu/vivid/glib2.0/vivid-proposed

« back to all changes in this revision

Viewing changes to docs/reference/gio/html/GSimpleAction.html

  • Committer: Package Import Robot
  • Author(s): Andreas Henriksson
  • Date: 2014-03-24 20:58:34 UTC
  • mfrom: (1.66.13)
  • Revision ID: package-import@ubuntu.com-20140324205834-8hsgok8k36ftocqa
Tags: 2.40.0-1
New upstream release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
88
88
</colgroup>
89
89
<tbody>
90
90
<tr>
91
 
<td class="property_type"><a href="../glib/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a></td>
 
91
<td class="property_type"><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a></td>
92
92
<td class="property_name"><a class="link" href="GSimpleAction.html#GSimpleAction--enabled" title="The “enabled” property">enabled</a></td>
93
93
<td class="property_flags">Read / Write</td>
94
94
</tr>
95
95
<tr>
96
96
<td class="property_type">
97
 
<a href="../glib/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *</td>
 
97
<a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *</td>
98
98
<td class="property_name"><a class="link" href="GSimpleAction.html#GSimpleAction--name" title="The “name” property">name</a></td>
99
99
<td class="property_flags">Read / Write / Construct Only</td>
100
100
</tr>
101
101
<tr>
102
102
<td class="property_type">
103
 
<a href="../glib/glib-GVariantType.html#GVariantType"><span class="type">GVariantType</span></a> *</td>
 
103
<a href="http://library.gnome.org/devel/glib/unstable/glib-GVariantType.html#GVariantType"><span class="type">GVariantType</span></a> *</td>
104
104
<td class="property_name"><a class="link" href="GSimpleAction.html#GSimpleAction--parameter-type" title="The “parameter-type” property">parameter-type</a></td>
105
105
<td class="property_flags">Read / Write / Construct Only</td>
106
106
</tr>
107
107
<tr>
108
108
<td class="property_type">
109
 
<a href="../glib/glib-GVariant.html#GVariant"><span class="type">GVariant</span></a> *</td>
 
109
<a href="http://library.gnome.org/devel/glib/unstable/glib-GVariant.html#GVariant"><span class="type">GVariant</span></a> *</td>
110
110
<td class="property_name"><a class="link" href="GSimpleAction.html#GSimpleAction--state" title="The “state” property">state</a></td>
111
111
<td class="property_flags">Read / Write / Construct</td>
112
112
</tr>
113
113
<tr>
114
114
<td class="property_type">
115
 
<a href="../glib/glib-GVariantType.html#GVariantType"><span class="type">GVariantType</span></a> *</td>
 
115
<a href="http://library.gnome.org/devel/glib/unstable/glib-GVariantType.html#GVariantType"><span class="type">GVariantType</span></a> *</td>
116
116
<td class="property_name"><a class="link" href="GSimpleAction.html#GSimpleAction--state-type" title="The “state-type” property">state-type</a></td>
117
117
<td class="property_flags">Read</td>
118
118
</tr>
131
131
<tr>
132
132
<td class="signal_type"><span class="returnvalue">void</span></td>
133
133
<td class="signal_name"><a class="link" href="GSimpleAction.html#GSimpleAction-activate" title="The “activate” signal">activate</a></td>
134
 
<td class="signal_flags">Run Last</td>
 
134
<td class="signal_flags"><a href="http://library.gnome.org/devel/gobject/unstable/gobject-Signals.html#G-SIGNAL-RUN-LAST:CAPS">Run Last</a></td>
135
135
</tr>
136
136
<tr>
137
137
<td class="signal_type"><span class="returnvalue">void</span></td>
138
138
<td class="signal_name"><a class="link" href="GSimpleAction.html#GSimpleAction-change-state" title="The “change-state” signal">change-state</a></td>
139
 
<td class="signal_flags">Run Last</td>
 
139
<td class="signal_flags"><a href="http://library.gnome.org/devel/gobject/unstable/gobject-Signals.html#G-SIGNAL-RUN-LAST:CAPS">Run Last</a></td>
140
140
</tr>
141
141
</tbody>
142
142
</table></div>
156
156
</div>
157
157
<div class="refsect1">
158
158
<a name="GSimpleAction.object-hierarchy"></a><h2>Object Hierarchy</h2>
159
 
<pre class="screen">    <a href="../gobject/gobject-The-Base-Object-Type.html#GObject">GObject</a>
 
159
<pre class="screen">    <a href="http://library.gnome.org/devel/gobject/unstable/gobject-The-Base-Object-Type.html#GObject">GObject</a>
160
160
    <span class="lineart">╰──</span> GSimpleAction
161
161
</pre>
162
162
</div>
176
176
<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>
177
177
interface. This is the easiest way to create an action for purposes of
178
178
adding it to a <a class="link" href="GSimpleActionGroup.html" title="GSimpleActionGroup"><span class="type">GSimpleActionGroup</span></a>.</p>
179
 
<p>See also <span class="type">GtkAction</span>.</p>
 
179
<p>See also <a href="http://developer.gnome.org/gtk2/GtkAction.html"><span class="type">GtkAction</span></a>.</p>
180
180
</div>
181
181
<div class="refsect1">
182
182
<a name="GSimpleAction.functions_details"></a><h2>Functions</h2>
183
183
<div class="refsect2">
184
184
<a name="g-simple-action-new"></a><h3>g_simple_action_new ()</h3>
185
185
<pre class="programlisting"><a class="link" href="GSimpleAction.html" title="GSimpleAction"><span class="returnvalue">GSimpleAction</span></a> *
186
 
g_simple_action_new (<em class="parameter"><code>const <a href="../glib/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *name</code></em>,
187
 
                     <em class="parameter"><code>const <a href="../glib/glib-GVariantType.html#GVariantType"><span class="type">GVariantType</span></a> *parameter_type</code></em>);</pre>
 
186
g_simple_action_new (<em class="parameter"><code>const <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *name</code></em>,
 
187
                     <em class="parameter"><code>const <a href="http://library.gnome.org/devel/glib/unstable/glib-GVariantType.html#GVariantType"><span class="type">GVariantType</span></a> *parameter_type</code></em>);</pre>
188
188
<p>Creates a new action.</p>
189
189
<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>
190
190
<div class="refsect3">
220
220
<div class="refsect2">
221
221
<a name="g-simple-action-new-stateful"></a><h3>g_simple_action_new_stateful ()</h3>
222
222
<pre class="programlisting"><a class="link" href="GSimpleAction.html" title="GSimpleAction"><span class="returnvalue">GSimpleAction</span></a> *
223
 
g_simple_action_new_stateful (<em class="parameter"><code>const <a href="../glib/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *name</code></em>,
224
 
                              <em class="parameter"><code>const <a href="../glib/glib-GVariantType.html#GVariantType"><span class="type">GVariantType</span></a> *parameter_type</code></em>,
225
 
                              <em class="parameter"><code><a href="../glib/glib-GVariant.html#GVariant"><span class="type">GVariant</span></a> *state</code></em>);</pre>
 
223
g_simple_action_new_stateful (<em class="parameter"><code>const <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *name</code></em>,
 
224
                              <em class="parameter"><code>const <a href="http://library.gnome.org/devel/glib/unstable/glib-GVariantType.html#GVariantType"><span class="type">GVariantType</span></a> *parameter_type</code></em>,
 
225
                              <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-GVariant.html#GVariant"><span class="type">GVariant</span></a> *state</code></em>);</pre>
226
226
<p>Creates a new stateful action.</p>
227
227
<p><em class="parameter"><code>state</code></em>
228
228
 is the initial state of the action.  All future state values
229
 
must have the same <a href="../glib/glib-GVariantType.html#GVariantType"><span class="type">GVariantType</span></a> as the initial state.</p>
 
229
must have the same <a href="http://library.gnome.org/devel/glib/unstable/glib-GVariantType.html#GVariantType"><span class="type">GVariantType</span></a> as the initial state.</p>
230
230
<p>If the <em class="parameter"><code>state</code></em>
231
231
 GVariant is floating, it is consumed.</p>
232
232
<div class="refsect3">
268
268
<a name="g-simple-action-set-enabled"></a><h3>g_simple_action_set_enabled ()</h3>
269
269
<pre class="programlisting"><span class="returnvalue">void</span>
270
270
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>,
271
 
                             <em class="parameter"><code><a href="../glib/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a> enabled</code></em>);</pre>
 
271
                             <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a> enabled</code></em>);</pre>
272
272
<p>Sets the action as enabled or not.</p>
273
273
<p>An action must be enabled in order to be activated or in order to
274
274
have its state changed from outside callers.</p>
303
303
<a name="g-simple-action-set-state"></a><h3>g_simple_action_set_state ()</h3>
304
304
<pre class="programlisting"><span class="returnvalue">void</span>
305
305
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>,
306
 
                           <em class="parameter"><code><a href="../glib/glib-GVariant.html#GVariant"><span class="type">GVariant</span></a> *value</code></em>);</pre>
 
306
                           <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-GVariant.html#GVariant"><span class="type">GVariant</span></a> *value</code></em>);</pre>
307
307
<p>Sets the state of the action.</p>
308
308
<p>This directly updates the 'state' property to the given value.</p>
309
309
<p>This should only be called by the implementor of the action.  Users
328
328
</tr>
329
329
<tr>
330
330
<td class="parameter_name"><p>value</p></td>
331
 
<td class="parameter_description"><p>the new <a href="../glib/glib-GVariant.html#GVariant"><span class="type">GVariant</span></a> for the state</p></td>
 
331
<td class="parameter_description"><p>the new <a href="http://library.gnome.org/devel/glib/unstable/glib-GVariant.html#GVariant"><span class="type">GVariant</span></a> for the state</p></td>
332
332
<td class="parameter_annotations"> </td>
333
333
</tr>
334
334
</tbody>
348
348
<a name="GSimpleAction.property-details"></a><h2>Property Details</h2>
349
349
<div class="refsect2">
350
350
<a name="GSimpleAction--enabled"></a><h3>The <code class="literal">“enabled”</code> property</h3>
351
 
<pre class="programlisting">  “enabled”                  <a href="../glib/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a></pre>
 
351
<pre class="programlisting">  “enabled”                  <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a></pre>
352
352
<p>If <em class="parameter"><code>action</code></em>
353
353
 is currently enabled.</p>
354
354
<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
360
360
<hr>
361
361
<div class="refsect2">
362
362
<a name="GSimpleAction--name"></a><h3>The <code class="literal">“name”</code> property</h3>
363
 
<pre class="programlisting">  “name”                     <a href="../glib/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *</pre>
 
363
<pre class="programlisting">  “name”                     <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *</pre>
364
364
<p>The name of the action. This is mostly meaningful for identifying
365
365
the action once it has been added to a <a class="link" href="GSimpleActionGroup.html" title="GSimpleActionGroup"><span class="type">GSimpleActionGroup</span></a>.</p>
366
366
<p>Flags: Read / Write / Construct Only</p>
370
370
<hr>
371
371
<div class="refsect2">
372
372
<a name="GSimpleAction--parameter-type"></a><h3>The <code class="literal">“parameter-type”</code> property</h3>
373
 
<pre class="programlisting">  “parameter-type”           <a href="../glib/glib-GVariantType.html#GVariantType"><span class="type">GVariantType</span></a> *</pre>
 
373
<pre class="programlisting">  “parameter-type”           <a href="http://library.gnome.org/devel/glib/unstable/glib-GVariantType.html#GVariantType"><span class="type">GVariantType</span></a> *</pre>
374
374
<p>The type of the parameter that must be given when activating the
375
375
action.</p>
376
376
<p>Flags: Read / Write / Construct Only</p>
379
379
<hr>
380
380
<div class="refsect2">
381
381
<a name="GSimpleAction--state"></a><h3>The <code class="literal">“state”</code> property</h3>
382
 
<pre class="programlisting">  “state”                    <a href="../glib/glib-GVariant.html#GVariant"><span class="type">GVariant</span></a> *</pre>
383
 
<p>The state of the action, or <a href="../glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> if the action is stateless.</p>
 
382
<pre class="programlisting">  “state”                    <a href="http://library.gnome.org/devel/glib/unstable/glib-GVariant.html#GVariant"><span class="type">GVariant</span></a> *</pre>
 
383
<p>The state of the action, or <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> if the action is stateless.</p>
384
384
<p>Flags: Read / Write / Construct</p>
385
385
<p>Allowed values: GVariant&lt;*&gt;</p>
386
386
<p>Default value: NULL</p>
389
389
<hr>
390
390
<div class="refsect2">
391
391
<a name="GSimpleAction--state-type"></a><h3>The <code class="literal">“state-type”</code> property</h3>
392
 
<pre class="programlisting">  “state-type”               <a href="../glib/glib-GVariantType.html#GVariantType"><span class="type">GVariantType</span></a> *</pre>
393
 
<p>The <a href="../glib/glib-GVariantType.html#GVariantType"><span class="type">GVariantType</span></a> of the state that the action has, or <a href="../glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> if the
 
392
<pre class="programlisting">  “state-type”               <a href="http://library.gnome.org/devel/glib/unstable/glib-GVariantType.html#GVariantType"><span class="type">GVariantType</span></a> *</pre>
 
393
<p>The <a href="http://library.gnome.org/devel/glib/unstable/glib-GVariantType.html#GVariantType"><span class="type">GVariantType</span></a> of the state that the action has, or <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> if the
394
394
action is stateless.</p>
395
395
<p>Flags: Read</p>
396
396
<p class="since">Since 2.28</p>
402
402
<a name="GSimpleAction-activate"></a><h3>The <code class="literal">“activate”</code> signal</h3>
403
403
<pre class="programlisting"><span class="returnvalue">void</span>
404
404
user_function (<a class="link" href="GSimpleAction.html" title="GSimpleAction"><span class="type">GSimpleAction</span></a> *simple,
405
 
               <a href="../glib/glib-GVariant.html#GVariant"><span class="type">GVariant</span></a>      *parameter,
406
 
               <a href="../glib/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a>       user_data)</pre>
 
405
               <a href="http://library.gnome.org/devel/glib/unstable/glib-GVariant.html#GVariant"><span class="type">GVariant</span></a>      *parameter,
 
406
               <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a>       user_data)</pre>
407
407
<p>Indicates that the action was just activated.</p>
408
408
<p><em class="parameter"><code>parameter</code></em>
409
409
 will always be of the expected type.  In the event that
410
410
an incorrect type was given, no signal will be emitted.</p>
411
411
<p>Since GLib 2.40, if no handler is connected to this signal then the
412
 
default behaviour for boolean-stated actions with a <a href="../glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> parameter
 
412
default behaviour for boolean-stated actions with a <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> parameter
413
413
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.
414
414
For stateful actions where the state type is equal to the parameter
415
415
type, the default is to forward them directly to
442
442
</tbody>
443
443
</table></div>
444
444
</div>
445
 
<p>Flags: Run Last</p>
 
445
<p>Flags: <a href="http://library.gnome.org/devel/gobject/unstable/gobject-Signals.html#G-SIGNAL-RUN-LAST:CAPS">Run Last</a></p>
446
446
<p class="since">Since 2.28</p>
447
447
</div>
448
448
<hr>
450
450
<a name="GSimpleAction-change-state"></a><h3>The <code class="literal">“change-state”</code> signal</h3>
451
451
<pre class="programlisting"><span class="returnvalue">void</span>
452
452
user_function (<a class="link" href="GSimpleAction.html" title="GSimpleAction"><span class="type">GSimpleAction</span></a> *simple,
453
 
               <a href="../glib/glib-GVariant.html#GVariant"><span class="type">GVariant</span></a>      *value,
454
 
               <a href="../glib/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a>       user_data)</pre>
 
453
               <a href="http://library.gnome.org/devel/glib/unstable/glib-GVariant.html#GVariant"><span class="type">GVariant</span></a>      *value,
 
454
               <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a>       user_data)</pre>
455
455
<p>Indicates that the action just received a request to change its
456
456
state.</p>
457
457
<p><em class="parameter"><code>value</code></em>
487
487
<span class="gtkdoc opt">{</span>
488
488
  gint requested<span class="gtkdoc opt">;</span>
489
489
 
490
 
  requested <span class="gtkdoc opt">=</span> <span class="function"><a href="../glib/glib-GVariant.html#g-variant-get-int32">g_variant_get_int32</a></span> <span class="gtkdoc opt">(</span>value<span class="gtkdoc opt">);</span>
 
490
  requested <span class="gtkdoc opt">=</span> <span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-GVariant.html#g-variant-get-int32">g_variant_get_int32</a></span> <span class="gtkdoc opt">(</span>value<span class="gtkdoc opt">);</span>
491
491
 
492
492
  <span class="gtkdoc slc">// Volume only goes from 0 to 10</span>
493
493
  <span class="keyword">if</span> <span class="gtkdoc opt">(</span><span class="number">0</span> <span class="gtkdoc opt">&lt;=</span> requested <span class="gtkdoc opt">&amp;&amp;</span> requested <span class="gtkdoc opt">&lt;=</span> <span class="number">10</span><span class="gtkdoc opt">)</span>
528
528
</tbody>
529
529
</table></div>
530
530
</div>
531
 
<p>Flags: Run Last</p>
 
531
<p>Flags: <a href="http://library.gnome.org/devel/gobject/unstable/gobject-Signals.html#G-SIGNAL-RUN-LAST:CAPS">Run Last</a></p>
532
532
<p class="since">Since 2.30</p>
533
533
</div>
534
534
</div>