summaryrefstree
path: root/usr/share/gtk-doc/html/gio/GAction.html
blob: c496d79ea9f6925e6446b544dccb971f8c6347d1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>GAction</title>
<meta name="generator" content="DocBook XSL Stylesheets V1.78.1">
<link rel="home" href="index.html" title="GIO Reference Manual">
<link rel="up" href="application.html" title="Application support">
<link rel="prev" href="GSimpleActionGroup.html" title="GSimpleActionGroup">
<link rel="next" href="GSimpleAction.html" title="GSimpleAction">
<meta name="generator" content="GTK-Doc V1.19 (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="2">
<tr valign="middle">
<td><a accesskey="p" href="GSimpleActionGroup.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td>
<td><a accesskey="u" href="application.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td>
<td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td>
<th width="100%" align="center">GIO Reference Manual</th>
<td><a accesskey="n" href="GSimpleAction.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td>
</tr>
<tr><td colspan="5" class="shortcuts">
<a href="#GAction.synopsis" class="shortcut">Top</a>
                   | 
                  <a href="#GAction.description" class="shortcut">Description</a>
                   | 
                  <a href="#GAction.object-hierarchy" class="shortcut">Object Hierarchy</a>
                   | 
                  <a href="#GAction.prerequisites" class="shortcut">Prerequisites</a>
                   | 
                  <a href="#GAction.implementations" class="shortcut">Known Implementations</a>
                   | 
                  <a href="#GAction.properties" class="shortcut">Properties</a>
</td></tr>
</table>
<div class="refentry">
<a name="GAction"></a><div class="titlepage"></div>
<div class="refnamediv"><table width="100%"><tr>
<td valign="top">
<h2><span class="refentrytitle"><a name="GAction.top_of_page"></a>GAction</span></h2>
<p>GAction — An action interface</p>
</td>
<td valign="top" align="right"></td>
</tr></table></div>
<div class="refsynopsisdiv">
<a name="GAction.synopsis"></a><h2>Synopsis</h2>
<pre class="synopsis">                    <a class="link" href="GAction.html#GAction-struct" title="GAction">GAction</a>;
struct              <a class="link" href="GAction.html#GActionInterface" title="struct GActionInterface">GActionInterface</a>;

<a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>            <a class="link" href="GAction.html#g-action-name-is-valid" title="g_action_name_is_valid ()">g_action_name_is_valid</a>              (<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> *action_name</code></em>);
const <a href="http://library.gnome.org/devel/glib/unstable/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>);
const <a href="http://library.gnome.org/devel/glib/unstable/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>);
const <a href="http://library.gnome.org/devel/glib/unstable/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>);
<a href="http://library.gnome.org/devel/glib/unstable/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>);

<a href="http://library.gnome.org/devel/glib/unstable/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>);
<a href="http://library.gnome.org/devel/glib/unstable/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>);

<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>,
                                                         <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>);
<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>,
                                                         <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-GVariant.html#GVariant"><span class="type">GVariant</span></a> *parameter</code></em>);

<a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>            <a class="link" href="GAction.html#g-action-parse-detailed-name" title="g_action_parse_detailed_name ()">g_action_parse_detailed_name</a>        (<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> *detailed_name</code></em>,
                                                         <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> **action_name</code></em>,
                                                         <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-GVariant.html#GVariant"><span class="type">GVariant</span></a> **target_value</code></em>,
                                                         <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);
<a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar"><span class="returnvalue">gchar</span></a> *             <a class="link" href="GAction.html#g-action-print-detailed-name" title="g_action_print_detailed_name ()">g_action_print_detailed_name</a>        (<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> *action_name</code></em>,
                                                         <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-GVariant.html#GVariant"><span class="type">GVariant</span></a> *parameter</code></em>);
</pre>
</div>
<div class="refsect1">
<a name="GAction.object-hierarchy"></a><h2>Object Hierarchy</h2>
<pre class="synopsis">
  GInterface
   +----GAction
</pre>
</div>
<div class="refsect1">
<a name="GAction.prerequisites"></a><h2>Prerequisites</h2>
<p>
GAction requires
 <a href="http://library.gnome.org/devel/gobject/unstable/gobject-The-Base-Object-Type.html#GObject">GObject</a>.</p>
</div>
<div class="refsect1">
<a name="GAction.implementations"></a><h2>Known Implementations</h2>
<p>
GAction is implemented by
 <a class="link" href="GSimpleAction.html" title="GSimpleAction">GSimpleAction</a>.</p>
</div>
<div class="refsect1">
<a name="GAction.properties"></a><h2>Properties</h2>
<pre class="synopsis">
  "<a class="link" href="GAction.html#GAction--enabled" title='The "enabled" property'>enabled</a>"                  <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a>              : Read
  "<a class="link" href="GAction.html#GAction--name" title='The "name" property'>name</a>"                     <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a>*                : Read
  "<a class="link" href="GAction.html#GAction--parameter-type" title='The "parameter-type" property'>parameter-type</a>"           <a href="http://library.gnome.org/devel/glib/unstable/glib-GVariantType.html#GVariantType"><span class="type">GVariantType</span></a>*         : Read
  "<a class="link" href="GAction.html#GAction--state" title='The "state" property'>state</a>"                    <a href="http://library.gnome.org/devel/glib/unstable/glib-GVariant.html#GVariant"><span class="type">GVariant</span></a>*             : Read
  "<a class="link" href="GAction.html#GAction--state-type" title='The "state-type" property'>state-type</a>"               <a href="http://library.gnome.org/devel/glib/unstable/glib-GVariantType.html#GVariantType"><span class="type">GVariantType</span></a>*         : Read
</pre>
</div>
<div class="refsect1">
<a name="GAction.description"></a><h2>Description</h2>
<p>
<a class="link" href="GAction.html" title="GAction"><span class="type">GAction</span></a> represents a single named action.
</p>
<p>
The main interface to an action is that it can be activated with
<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
emitted.  An activation has a <a href="http://library.gnome.org/devel/glib/unstable/glib-GVariant.html#GVariant"><span class="type">GVariant</span></a> parameter (which may be
<a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>).  The correct type for the parameter is determined by a static
parameter type (which is given at construction time).
</p>
<p>
An action may optionally have a state, in which case the state may be
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="http://library.gnome.org/devel/glib/unstable/glib-GVariant.html#GVariant"><span class="type">GVariant</span></a>.  The
correct type for the state is determined by a static state type
(which is given at construction time).
</p>
<p>
The state may have a hint associated with it, specifying its valid
range.
</p>
<p>
<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
described above.  Various implementations of actions exist, including
<a class="link" href="GSimpleAction.html" title="GSimpleAction"><span class="type">GSimpleAction</span></a> and <a href="http://developer.gnome.org/gtk2/GtkAction.html"><span class="type">GtkAction</span></a>.
</p>
<p>
In all cases, the implementing class is responsible for storing the
name of the action, the parameter type, the enabled state, the
optional state type and the state and emitting the appropriate
signals when these change.  The implementor responsible for filtering
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
safety and for the state being enabled.
</p>
<p>
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
inside of a <a class="link" href="GSimpleActionGroup.html" title="GSimpleActionGroup"><span class="type">GSimpleActionGroup</span></a>.
</p>
</div>
<div class="refsect1">
<a name="GAction.details"></a><h2>Details</h2>
<div class="refsect2">
<a name="GAction-struct"></a><h3>GAction</h3>
<pre class="programlisting">typedef struct _GAction GAction;</pre>
</div>
<hr>
<div class="refsect2">
<a name="GActionInterface"></a><h3>struct GActionInterface</h3>
<pre class="programlisting">struct GActionInterface {
  GTypeInterface g_iface;

  /* virtual functions */
  const gchar *        (* get_name)             (GAction  *action);
  const GVariantType * (* get_parameter_type)   (GAction  *action);
  const GVariantType * (* get_state_type)       (GAction  *action);
  GVariant *           (* get_state_hint)       (GAction  *action);

  gboolean             (* get_enabled)          (GAction  *action);
  GVariant *           (* get_state)            (GAction  *action);

  void                 (* change_state)         (GAction  *action,
                                                 GVariant *value);
  void                 (* activate)             (GAction  *action,
                                                 GVariant *parameter);
};
</pre>
<p>
The virtual function table for <a class="link" href="GAction.html" title="GAction"><span class="type">GAction</span></a>.
</p>
<div class="variablelist"><table border="0" class="variablelist">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody>
<tr>
<td><p><span class="term"><a href="http://library.gnome.org/devel/gobject/unstable/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>
<td></td>
</tr>
<tr>
<td><p><span class="term"><em class="structfield"><code><a name="GActionInterface.get-name"></a>get_name</code></em> ()</span></p></td>
<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>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="structfield"><code><a name="GActionInterface.get-parameter-type"></a>get_parameter_type</code></em> ()</span></p></td>
<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>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="structfield"><code><a name="GActionInterface.get-state-type"></a>get_state_type</code></em> ()</span></p></td>
<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>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="structfield"><code><a name="GActionInterface.get-state-hint"></a>get_state_hint</code></em> ()</span></p></td>
<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>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="structfield"><code><a name="GActionInterface.get-enabled"></a>get_enabled</code></em> ()</span></p></td>
<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>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="structfield"><code><a name="GActionInterface.get-state"></a>get_state</code></em> ()</span></p></td>
<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>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="structfield"><code><a name="GActionInterface.change-state"></a>change_state</code></em> ()</span></p></td>
<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>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="structfield"><code><a name="GActionInterface.activate"></a>activate</code></em> ()</span></p></td>
<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
'activate' signal but that implementations of it may have one.</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.28</p>
</div>
<hr>
<div class="refsect2">
<a name="g-action-name-is-valid"></a><h3>g_action_name_is_valid ()</h3>
<pre class="programlisting"><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>            g_action_name_is_valid              (<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> *action_name</code></em>);</pre>
<p>
Checks if <em class="parameter"><code>action_name</code></em> is valid.
</p>
<p>
<em class="parameter"><code>action_name</code></em> is valid if it consists only of alphanumeric characters,
plus '-' and '.'.  The empty string is not a valid action name.
</p>
<p>
It is an error to call this function with a non-utf8 <em class="parameter"><code>action_name</code></em>.
<em class="parameter"><code>action_name</code></em> must not be <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>.
</p>
<div class="variablelist"><table border="0" class="variablelist">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>action_name</code></em> :</span></p></td>
<td>an potential action name</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>
<a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if <em class="parameter"><code>action_name</code></em> is valid</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.38</p>
</div>
<hr>
<div class="refsect2">
<a name="g-action-get-name"></a><h3>g_action_get_name ()</h3>
<pre class="programlisting">const <a href="http://library.gnome.org/devel/glib/unstable/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>
<p>
Queries the name of <em class="parameter"><code>action</code></em>.
</p>
<div class="variablelist"><table border="0" class="variablelist">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>action</code></em> :</span></p></td>
<td>a <a class="link" href="GAction.html" title="GAction"><span class="type">GAction</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>the name of the action</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.28</p>
</div>
<hr>
<div class="refsect2">
<a name="g-action-get-parameter-type"></a><h3>g_action_get_parameter_type ()</h3>
<pre class="programlisting">const <a href="http://library.gnome.org/devel/glib/unstable/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>
<p>
Queries the type of the parameter that must be given when activating
<em class="parameter"><code>action</code></em>.
</p>
<p>
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="http://library.gnome.org/devel/glib/unstable/glib-GVariant.html#GVariant"><span class="type">GVariant</span></a>
given to that function must be of the type returned by this function.
</p>
<p>
In the case that this function returns <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>, you must not give any
<a href="http://library.gnome.org/devel/glib/unstable/glib-GVariant.html#GVariant"><span class="type">GVariant</span></a>, but <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> instead.
</p>
<div class="variablelist"><table border="0" class="variablelist">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>action</code></em> :</span></p></td>
<td>a <a class="link" href="GAction.html" title="GAction"><span class="type">GAction</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<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>
</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.28</p>
</div>
<hr>
<div class="refsect2">
<a name="g-action-get-state-type"></a><h3>g_action_get_state_type ()</h3>
<pre class="programlisting">const <a href="http://library.gnome.org/devel/glib/unstable/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>
<p>
Queries the type of the state of <em class="parameter"><code>action</code></em>.
</p>
<p>
If the action is stateful (e.g. created with
<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
<a href="http://library.gnome.org/devel/glib/unstable/glib-GVariantType.html#GVariantType"><span class="type">GVariantType</span></a> of the state.  This is the type of the initial value
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
<a href="http://library.gnome.org/devel/glib/unstable/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
<a href="http://library.gnome.org/devel/glib/unstable/glib-GVariant.html#GVariant"><span class="type">GVariant</span></a> of the same type.
</p>
<p>
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>)
then this function will return <a href="http://library.gnome.org/devel/glib/unstable/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>
will return <a href="http://library.gnome.org/devel/glib/unstable/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>.
</p>
<div class="variablelist"><table border="0" class="variablelist">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>action</code></em> :</span></p></td>
<td>a <a class="link" href="GAction.html" title="GAction"><span class="type">GAction</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<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>
</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.28</p>
</div>
<hr>
<div class="refsect2">
<a name="g-action-get-state-hint"></a><h3>g_action_get_state_hint ()</h3>
<pre class="programlisting"><a href="http://library.gnome.org/devel/glib/unstable/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>
<p>
Requests a hint about the valid range of values for the state of
<em class="parameter"><code>action</code></em>.
</p>
<p>
If <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> is returned it either means that the action is not stateful
or that there is no hint about the valid range of values for the
state of the action.
</p>
<p>
If a <a href="http://library.gnome.org/devel/glib/unstable/glib-GVariant.html#GVariant"><span class="type">GVariant</span></a> array is returned then each item in the array is a
possible value for the state.  If a <a href="http://library.gnome.org/devel/glib/unstable/glib-GVariant.html#GVariant"><span class="type">GVariant</span></a> pair (ie: two-tuple) is
returned then the tuple specifies the inclusive lower and upper bound
of valid values for the state.
</p>
<p>
In any case, the information is merely a hint.  It may be possible to
have a state value outside of the hinted range and setting a value
within the range may fail.
</p>
<p>
The return value (if non-<a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>) should be freed with
<a href="http://library.gnome.org/devel/glib/unstable/glib-GVariant.html#g-variant-unref"><code class="function">g_variant_unref()</code></a> when it is no longer required.
</p>
<div class="variablelist"><table border="0" class="variablelist">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>action</code></em> :</span></p></td>
<td>a <a class="link" href="GAction.html" title="GAction"><span class="type">GAction</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<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>
</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.28</p>
</div>
<hr>
<div class="refsect2">
<a name="g-action-get-enabled"></a><h3>g_action_get_enabled ()</h3>
<pre class="programlisting"><a href="http://library.gnome.org/devel/glib/unstable/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>
<p>
Checks if <em class="parameter"><code>action</code></em> is currently enabled.
</p>
<p>
An action must be enabled in order to be activated or in order to
have its state changed from outside callers.
</p>
<div class="variablelist"><table border="0" class="variablelist">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>action</code></em> :</span></p></td>
<td>a <a class="link" href="GAction.html" title="GAction"><span class="type">GAction</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>whether the action is enabled</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.28</p>
</div>
<hr>
<div class="refsect2">
<a name="g-action-get-state"></a><h3>g_action_get_state ()</h3>
<pre class="programlisting"><a href="http://library.gnome.org/devel/glib/unstable/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>
<p>
Queries the current state of <em class="parameter"><code>action</code></em>.
</p>
<p>
If the action is not stateful then <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> will be returned.  If the
action is stateful then the type of the return value is the type
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>.
</p>
<p>
The return value (if non-<a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>) should be freed with
<a href="http://library.gnome.org/devel/glib/unstable/glib-GVariant.html#g-variant-unref"><code class="function">g_variant_unref()</code></a> when it is no longer required.
</p>
<div class="variablelist"><table border="0" class="variablelist">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>action</code></em> :</span></p></td>
<td>a <a class="link" href="GAction.html" title="GAction"><span class="type">GAction</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<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>
</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.28</p>
</div>
<hr>
<div class="refsect2">
<a name="g-action-change-state"></a><h3>g_action_change_state ()</h3>
<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>,
                                                         <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>
<p>
Request for the state of <em class="parameter"><code>action</code></em> to be changed to <em class="parameter"><code>value</code></em>.
</p>
<p>
The action must be stateful and <em class="parameter"><code>value</code></em> must be of the correct type.
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>.
</p>
<p>
This call merely requests a change.  The action may refuse to change
its state or may change its state to something other than <em class="parameter"><code>value</code></em>.
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>.
</p>
<p>
If the <em class="parameter"><code>value</code></em> GVariant is floating, it is consumed.
</p>
<div class="variablelist"><table border="0" class="variablelist">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>action</code></em> :</span></p></td>
<td>a <a class="link" href="GAction.html" title="GAction"><span class="type">GAction</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>value</code></em> :</span></p></td>
<td>the new state</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.30</p>
</div>
<hr>
<div class="refsect2">
<a name="g-action-activate"></a><h3>g_action_activate ()</h3>
<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>,
                                                         <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-GVariant.html#GVariant"><span class="type">GVariant</span></a> *parameter</code></em>);</pre>
<p>
Activates the action.
</p>
<p>
<em class="parameter"><code>parameter</code></em> must be the correct type of parameter for the action (ie:
the parameter type given at construction time).  If the parameter
type was <a href="http://library.gnome.org/devel/glib/unstable/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="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>.
</p>
<p>
If the <em class="parameter"><code>parameter</code></em> GVariant is floating, it is consumed.
</p>
<div class="variablelist"><table border="0" class="variablelist">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>action</code></em> :</span></p></td>
<td>a <a class="link" href="GAction.html" title="GAction"><span class="type">GAction</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>parameter</code></em> :</span></p></td>
<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>
</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.28</p>
</div>
<hr>
<div class="refsect2">
<a name="g-action-parse-detailed-name"></a><h3>g_action_parse_detailed_name ()</h3>
<pre class="programlisting"><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>            g_action_parse_detailed_name        (<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> *detailed_name</code></em>,
                                                         <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> **action_name</code></em>,
                                                         <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-GVariant.html#GVariant"><span class="type">GVariant</span></a> **target_value</code></em>,
                                                         <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);</pre>
<p>
Parses a detailed action name into its separate name and target
components.
</p>
<p>
Detailed action names can have three formats.
</p>
<p>
The first format is used to represent an action name with no target
value and consists of just an action name containing no whitespace
nor the characters ':', '(' or ')'.  For example: "app.action".
</p>
<p>
The second format is used to represent an action with a target value
that is a non-empty string consisting only of alphanumerics, plus '-'
and '.'.  In that case, the action name and target value are
separated by a double colon ("::").  For example:
"app.action::target".
</p>
<p>
The third format is used to represent an action with any type of
target value, including strings.  The target value follows the action
name, surrounded in parens.  For example: "app.action(42)".  The
target value is parsed using <a href="http://library.gnome.org/devel/glib/unstable/glib-GVariant.html#g-variant-parse"><code class="function">g_variant_parse()</code></a>.  If a tuple-typed
value is desired, it must be specified in the same way, resulting in
two sets of parens, for example: "app.action((1,2,3))".  A string
target can be specified this way as well: "app.action('target')".
For strings, this third format must be used if * target value is
empty or contains characters other than alphanumerics, '-' and '.'.
</p>
<div class="variablelist"><table border="0" class="variablelist">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>detailed_name</code></em> :</span></p></td>
<td>a detailed action name</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>action_name</code></em> :</span></p></td>
<td>the action name. <span class="annotation">[<acronym title="Parameter for returning results. Default is transfer full."><span class="acronym">out</span></acronym>]</span>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>target_value</code></em> :</span></p></td>
<td>the target value, or <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> for no target. <span class="annotation">[<acronym title="Parameter for returning results. Default is transfer full."><span class="acronym">out</span></acronym>]</span>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>error</code></em> :</span></p></td>
<td>a pointer to a <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> <a href="http://library.gnome.org/devel/glib/unstable/glib-Error-Reporting.html#GError"><span class="type">GError</span></a>, or <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>
<a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if successful, else <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> with <em class="parameter"><code>error</code></em> set</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.38</p>
</div>
<hr>
<div class="refsect2">
<a name="g-action-print-detailed-name"></a><h3>g_action_print_detailed_name ()</h3>
<pre class="programlisting"><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar"><span class="returnvalue">gchar</span></a> *             g_action_print_detailed_name        (<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> *action_name</code></em>,
                                                         <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-GVariant.html#GVariant"><span class="type">GVariant</span></a> *parameter</code></em>);</pre>
<p>
Formats a detailed action name from <em class="parameter"><code>action_name</code></em> and <em class="parameter"><code>target_value</code></em>.
</p>
<p>
It is an error to call this function with an invalid action name.
</p>
<p>
This function is the opposite of
<code class="function">g_action_parse_detailed_action_name()</code>.  It will produce a string that
can be parsed back to the <em class="parameter"><code>action_name</code></em> and <em class="parameter"><code>target_value</code></em> by that
function.
</p>
<p>
See that function for the types of strings that will be printed by
this function.
</p>
<div class="variablelist"><table border="0" class="variablelist">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>action_name</code></em> :</span></p></td>
<td>a valid action name</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>target_value</code></em> :</span></p></td>
<td>a <a href="http://library.gnome.org/devel/glib/unstable/glib-GVariant.html#GVariant"><span class="type">GVariant</span></a> target value, or <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>. <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><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>a detailed format string</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.38</p>
</div>
</div>
<div class="refsect1">
<a name="GAction.property-details"></a><h2>Property Details</h2>
<div class="refsect2">
<a name="GAction--enabled"></a><h3>The <code class="literal">"enabled"</code> property</h3>
<pre class="programlisting">  "enabled"                  <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a>              : Read</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>Default value: TRUE</p>
<p class="since">Since 2.28</p>
</div>
<hr>
<div class="refsect2">
<a name="GAction--name"></a><h3>The <code class="literal">"name"</code> property</h3>
<pre class="programlisting">  "name"                     <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a>*                : Read</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="GActionGroup.html" title="GActionGroup"><span class="type">GActionGroup</span></a>.
</p>
<p>Default value: NULL</p>
<p class="since">Since 2.28</p>
</div>
<hr>
<div class="refsect2">
<a name="GAction--parameter-type"></a><h3>The <code class="literal">"parameter-type"</code> property</h3>
<pre class="programlisting">  "parameter-type"           <a href="http://library.gnome.org/devel/glib/unstable/glib-GVariantType.html#GVariantType"><span class="type">GVariantType</span></a>*         : Read</pre>
<p>
The type of the parameter that must be given when activating the
action.
</p>
<p class="since">Since 2.28</p>
</div>
<hr>
<div class="refsect2">
<a name="GAction--state"></a><h3>The <code class="literal">"state"</code> property</h3>
<pre class="programlisting">  "state"                    <a href="http://library.gnome.org/devel/glib/unstable/glib-GVariant.html#GVariant"><span class="type">GVariant</span></a>*             : Read</pre>
<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>
<p>Allowed values: GVariant&lt;*&gt;</p>
<p>Default value: NULL</p>
<p class="since">Since 2.28</p>
</div>
<hr>
<div class="refsect2">
<a name="GAction--state-type"></a><h3>The <code class="literal">"state-type"</code> property</h3>
<pre class="programlisting">  "state-type"               <a href="http://library.gnome.org/devel/glib/unstable/glib-GVariantType.html#GVariantType"><span class="type">GVariantType</span></a>*         : Read</pre>
<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
action is stateless.
</p>
<p class="since">Since 2.28</p>
</div>
</div>
</div>
<div class="footer">
<hr>
          Generated by GTK-Doc V1.19</div>
</body>
</html>