summaryrefstree
path: root/usr/share/gtk-doc/html/gio/GApplication.html
blob: a4d816169097e7493f328ecab1a954bd32f373ee (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
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>GApplication</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="application.html" title="Application support">
<link rel="next" href="GApplicationCommandLine.html" title="GApplicationCommandLine">
<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="application.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="GApplicationCommandLine.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td>
</tr>
<tr><td colspan="5" class="shortcuts">
<a href="#GApplication.synopsis" class="shortcut">Top</a>
                   | 
                  <a href="#GApplication.description" class="shortcut">Description</a>
                   | 
                  <a href="#GApplication.object-hierarchy" class="shortcut">Object Hierarchy</a>
                   | 
                  <a href="#GApplication.implemented-interfaces" class="shortcut">Implemented Interfaces</a>
                   | 
                  <a href="#GApplication.properties" class="shortcut">Properties</a>
                   | 
                  <a href="#GApplication.signals" class="shortcut">Signals</a>
</td></tr>
</table>
<div class="refentry">
<a name="GApplication"></a><div class="titlepage"></div>
<div class="refnamediv"><table width="100%"><tr>
<td valign="top">
<h2><span class="refentrytitle"><a name="GApplication.top_of_page"></a>GApplication</span></h2>
<p>GApplication — Core application class</p>
</td>
<td valign="top" align="right"></td>
</tr></table></div>
<div class="refsynopsisdiv">
<a name="GApplication.synopsis"></a><h2>Synopsis</h2>
<a name="GApplicationFlags"></a><pre class="synopsis">                    <a class="link" href="GApplication.html#GApplication-struct" title="GApplication">GApplication</a>;
struct              <a class="link" href="GApplication.html#GApplicationClass" title="struct GApplicationClass">GApplicationClass</a>;

enum                <a class="link" href="GApplication.html#GApplicationFlags-enum" title="enum GApplicationFlags">GApplicationFlags</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="GApplication.html#g-application-id-is-valid" title="g_application_id_is_valid ()">g_application_id_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> *application_id</code></em>);
<a class="link" href="GApplication.html" title="GApplication"><span class="returnvalue">GApplication</span></a> *      <a class="link" href="GApplication.html#g-application-new" title="g_application_new ()">g_application_new</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> *application_id</code></em>,
                                                         <em class="parameter"><code><a class="link" href="GApplication.html#GApplicationFlags"><span class="type">GApplicationFlags</span></a> flags</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="GApplication.html#g-application-get-application-id" title="g_application_get_application_id ()">g_application_get_application_id</a>    (<em class="parameter"><code><a class="link" href="GApplication.html" title="GApplication"><span class="type">GApplication</span></a> *application</code></em>);
<span class="returnvalue">void</span>                <a class="link" href="GApplication.html#g-application-set-application-id" title="g_application_set_application_id ()">g_application_set_application_id</a>    (<em class="parameter"><code><a class="link" href="GApplication.html" title="GApplication"><span class="type">GApplication</span></a> *application</code></em>,
                                                         <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> *application_id</code></em>);

<a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#guint"><span class="returnvalue">guint</span></a>               <a class="link" href="GApplication.html#g-application-get-inactivity-timeout" title="g_application_get_inactivity_timeout ()">g_application_get_inactivity_timeout</a>
                                                        (<em class="parameter"><code><a class="link" href="GApplication.html" title="GApplication"><span class="type">GApplication</span></a> *application</code></em>);
<span class="returnvalue">void</span>                <a class="link" href="GApplication.html#g-application-set-inactivity-timeout" title="g_application_set_inactivity_timeout ()">g_application_set_inactivity_timeout</a>
                                                        (<em class="parameter"><code><a class="link" href="GApplication.html" title="GApplication"><span class="type">GApplication</span></a> *application</code></em>,
                                                         <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#guint"><span class="type">guint</span></a> inactivity_timeout</code></em>);

<a class="link" href="GApplication.html#GApplicationFlags"><span class="returnvalue">GApplicationFlags</span></a>   <a class="link" href="GApplication.html#g-application-get-flags" title="g_application_get_flags ()">g_application_get_flags</a>             (<em class="parameter"><code><a class="link" href="GApplication.html" title="GApplication"><span class="type">GApplication</span></a> *application</code></em>);
<span class="returnvalue">void</span>                <a class="link" href="GApplication.html#g-application-set-flags" title="g_application_set_flags ()">g_application_set_flags</a>             (<em class="parameter"><code><a class="link" href="GApplication.html" title="GApplication"><span class="type">GApplication</span></a> *application</code></em>,
                                                         <em class="parameter"><code><a class="link" href="GApplication.html#GApplicationFlags"><span class="type">GApplicationFlags</span></a> flags</code></em>);

<a class="link" href="GDBusConnection.html" title="GDBusConnection"><span class="returnvalue">GDBusConnection</span></a> *   <a class="link" href="GApplication.html#g-application-get-dbus-connection" title="g_application_get_dbus_connection ()">g_application_get_dbus_connection</a>   (<em class="parameter"><code><a class="link" href="GApplication.html" title="GApplication"><span class="type">GApplication</span></a> *application</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="GApplication.html#g-application-get-dbus-object-path" title="g_application_get_dbus_object_path ()">g_application_get_dbus_object_path</a>  (<em class="parameter"><code><a class="link" href="GApplication.html" title="GApplication"><span class="type">GApplication</span></a> *application</code></em>);

<span class="returnvalue">void</span>                <a class="link" href="GApplication.html#g-application-set-action-group" title="g_application_set_action_group ()">g_application_set_action_group</a>      (<em class="parameter"><code><a class="link" href="GApplication.html" title="GApplication"><span class="type">GApplication</span></a> *application</code></em>,
                                                         <em class="parameter"><code><a class="link" href="GActionGroup.html" title="GActionGroup"><span class="type">GActionGroup</span></a> *action_group</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="GApplication.html#g-application-get-is-registered" title="g_application_get_is_registered ()">g_application_get_is_registered</a>     (<em class="parameter"><code><a class="link" href="GApplication.html" title="GApplication"><span class="type">GApplication</span></a> *application</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="GApplication.html#g-application-get-is-remote" title="g_application_get_is_remote ()">g_application_get_is_remote</a>         (<em class="parameter"><code><a class="link" href="GApplication.html" title="GApplication"><span class="type">GApplication</span></a> *application</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="GApplication.html#g-application-register" title="g_application_register ()">g_application_register</a>              (<em class="parameter"><code><a class="link" href="GApplication.html" title="GApplication"><span class="type">GApplication</span></a> *application</code></em>,
                                                         <em class="parameter"><code><a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a> *cancellable</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>);

<span class="returnvalue">void</span>                <a class="link" href="GApplication.html#g-application-hold" title="g_application_hold ()">g_application_hold</a>                  (<em class="parameter"><code><a class="link" href="GApplication.html" title="GApplication"><span class="type">GApplication</span></a> *application</code></em>);
<span class="returnvalue">void</span>                <a class="link" href="GApplication.html#g-application-release" title="g_application_release ()">g_application_release</a>               (<em class="parameter"><code><a class="link" href="GApplication.html" title="GApplication"><span class="type">GApplication</span></a> *application</code></em>);
<span class="returnvalue">void</span>                <a class="link" href="GApplication.html#g-application-quit" title="g_application_quit ()">g_application_quit</a>                  (<em class="parameter"><code><a class="link" href="GApplication.html" title="GApplication"><span class="type">GApplication</span></a> *application</code></em>);

<span class="returnvalue">void</span>                <a class="link" href="GApplication.html#g-application-activate" title="g_application_activate ()">g_application_activate</a>              (<em class="parameter"><code><a class="link" href="GApplication.html" title="GApplication"><span class="type">GApplication</span></a> *application</code></em>);
<span class="returnvalue">void</span>                <a class="link" href="GApplication.html#g-application-open" title="g_application_open ()">g_application_open</a>                  (<em class="parameter"><code><a class="link" href="GApplication.html" title="GApplication"><span class="type">GApplication</span></a> *application</code></em>,
                                                         <em class="parameter"><code><a class="link" href="GFile.html" title="GFile"><span class="type">GFile</span></a> **files</code></em>,
                                                         <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gint"><span class="type">gint</span></a> n_files</code></em>,
                                                         <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> *hint</code></em>);

<span class="returnvalue">int</span>                 <a class="link" href="GApplication.html#g-application-run" title="g_application_run ()">g_application_run</a>                   (<em class="parameter"><code><a class="link" href="GApplication.html" title="GApplication"><span class="type">GApplication</span></a> *application</code></em>,
                                                         <em class="parameter"><code><span class="type">int</span> argc</code></em>,
                                                         <em class="parameter"><code><span class="type">char</span> **argv</code></em>);
<span class="returnvalue">void</span>                <a class="link" href="GApplication.html#g-application-set-default" title="g_application_set_default ()">g_application_set_default</a>           (<em class="parameter"><code><a class="link" href="GApplication.html" title="GApplication"><span class="type">GApplication</span></a> *application</code></em>);
<a class="link" href="GApplication.html" title="GApplication"><span class="returnvalue">GApplication</span></a> *      <a class="link" href="GApplication.html#g-application-get-default" title="g_application_get_default ()">g_application_get_default</a>           (<em class="parameter"><code><span class="type">void</span></code></em>);

<span class="returnvalue">void</span>                <a class="link" href="GApplication.html#g-application-mark-busy" title="g_application_mark_busy ()">g_application_mark_busy</a>             (<em class="parameter"><code><a class="link" href="GApplication.html" title="GApplication"><span class="type">GApplication</span></a> *application</code></em>);
<span class="returnvalue">void</span>                <a class="link" href="GApplication.html#g-application-unmark-busy" title="g_application_unmark_busy ()">g_application_unmark_busy</a>           (<em class="parameter"><code><a class="link" href="GApplication.html" title="GApplication"><span class="type">GApplication</span></a> *application</code></em>);
</pre>
</div>
<div class="refsect1">
<a name="GApplication.object-hierarchy"></a><h2>Object Hierarchy</h2>
<pre class="synopsis">
  <a href="http://library.gnome.org/devel/gobject/unstable/gobject-The-Base-Object-Type.html#GObject">GObject</a>
   +----GApplication
</pre>
<pre class="synopsis">
  GFlags
   +----GApplicationFlags
</pre>
</div>
<div class="refsect1">
<a name="GApplication.implemented-interfaces"></a><h2>Implemented Interfaces</h2>
<p>
GApplication implements
 <a class="link" href="GActionGroup.html" title="GActionGroup">GActionGroup</a> and  <a class="link" href="GActionMap.html" title="GActionMap">GActionMap</a>.</p>
</div>
<div class="refsect1">
<a name="GApplication.properties"></a><h2>Properties</h2>
<pre class="synopsis">
  "<a class="link" href="GApplication.html#GApplication--action-group" title='The "action-group" property'>action-group</a>"             <a class="link" href="GActionGroup.html" title="GActionGroup"><span class="type">GActionGroup</span></a>*         : Write
  "<a class="link" href="GApplication.html#GApplication--application-id" title='The "application-id" property'>application-id</a>"           <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a>*                : Read / Write / Construct
  "<a class="link" href="GApplication.html#GApplication--flags" title='The "flags" property'>flags</a>"                    <a class="link" href="GApplication.html#GApplicationFlags"><span class="type">GApplicationFlags</span></a>     : Read / Write
  "<a class="link" href="GApplication.html#GApplication--inactivity-timeout" title='The "inactivity-timeout" property'>inactivity-timeout</a>"       <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#guint"><span class="type">guint</span></a>                 : Read / Write
  "<a class="link" href="GApplication.html#GApplication--is-registered" title='The "is-registered" property'>is-registered</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="GApplication.html#GApplication--is-remote" title='The "is-remote" property'>is-remote</a>"                <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a>              : Read
</pre>
</div>
<div class="refsect1">
<a name="GApplication.signals"></a><h2>Signals</h2>
<pre class="synopsis">
  "<a class="link" href="GApplication.html#GApplication-activate" title='The "activate" signal'>activate</a>"                                       : <a href="http://library.gnome.org/devel/gobject/unstable/gobject-Signals.html#G-SIGNAL-RUN-LAST:CAPS"><code class="literal">Run Last</code></a>
  "<a class="link" href="GApplication.html#GApplication-command-line" title='The "command-line" signal'>command-line</a>"                                   : <a href="http://library.gnome.org/devel/gobject/unstable/gobject-Signals.html#G-SIGNAL-RUN-LAST:CAPS"><code class="literal">Run Last</code></a>
  "<a class="link" href="GApplication.html#GApplication-open" title='The "open" signal'>open</a>"                                           : <a href="http://library.gnome.org/devel/gobject/unstable/gobject-Signals.html#G-SIGNAL-RUN-LAST:CAPS"><code class="literal">Run Last</code></a>
  "<a class="link" href="GApplication.html#GApplication-shutdown" title='The "shutdown" signal'>shutdown</a>"                                       : <a href="http://library.gnome.org/devel/gobject/unstable/gobject-Signals.html#G-SIGNAL-RUN-LAST:CAPS"><code class="literal">Run Last</code></a>
  "<a class="link" href="GApplication.html#GApplication-startup" title='The "startup" signal'>startup</a>"                                        : <a href="http://library.gnome.org/devel/gobject/unstable/gobject-Signals.html#G-SIGNAL-RUN-FIRST:CAPS"><code class="literal">Run First</code></a>
</pre>
</div>
<div class="refsect1">
<a name="GApplication.description"></a><h2>Description</h2>
<p>
A <a class="link" href="GApplication.html" title="GApplication"><span class="type">GApplication</span></a> is the foundation of an application.  It wraps some
low-level platform-specific services and is intended to act as the
foundation for higher-level application classes such as
<a href="http://developer.gnome.org/gtk2/GtkApplication.html"><span class="type">GtkApplication</span></a> or <span class="type">MxApplication</span>.  In general, you should not use
this class outside of a higher level framework.
</p>
<p>
GApplication provides convenient life cycle management by maintaining
a <em class="firstterm">use count</em> for the primary application instance.
The use count can be changed using <a class="link" href="GApplication.html#g-application-hold" title="g_application_hold ()"><code class="function">g_application_hold()</code></a> and
<a class="link" href="GApplication.html#g-application-release" title="g_application_release ()"><code class="function">g_application_release()</code></a>. If it drops to zero, the application exits.
Higher-level classes such as <a href="http://developer.gnome.org/gtk2/GtkApplication.html"><span class="type">GtkApplication</span></a> employ the use count to
ensure that the application stays alive as long as it has any opened
windows.
</p>
<p>
Another feature that GApplication (optionally) provides is process
uniqueness.  Applications can make use of this functionality by
providing a unique application ID.  If given, only one application
with this ID can be running at a time per session.  The session
concept is platform-dependent, but corresponds roughly to a graphical
desktop login.  When your application is launched again, its
arguments are passed through platform communication to the already
running program.  The already running instance of the program is
called the <em class="firstterm">primary instance</em>; for non-unique
applications this is the always the current instance.
On Linux, the D-Bus session bus is used for communication.
</p>
<p>
The use of <a class="link" href="GApplication.html" title="GApplication"><span class="type">GApplication</span></a> differs from some other commonly-used
uniqueness libraries (such as libunique) in important ways.  The
application is not expected to manually register itself and check if
it is the primary instance.  Instead, the <code class="code"><code class="function">main()</code></code>
function of a <a class="link" href="GApplication.html" title="GApplication"><span class="type">GApplication</span></a> should do very little more than
instantiating the application instance, possibly connecting signal
handlers, then calling <a class="link" href="GApplication.html#g-application-run" title="g_application_run ()"><code class="function">g_application_run()</code></a>.  All checks for
uniqueness are done internally.  If the application is the primary
instance then the startup signal is emitted and the mainloop runs.
If the application is not the primary instance then a signal is sent
to the primary instance and <a class="link" href="GApplication.html#g-application-run" title="g_application_run ()"><code class="function">g_application_run()</code></a> promptly returns.
See the code examples below.
</p>
<p>
If used, the expected form of an application identifier is very close
to that of of a
<a class="ulink" href="http://dbus.freedesktop.org/doc/dbus-specification.html#message-protocol-names-interface" target="_top">DBus bus name</a>.
Examples include: "com.example.MyApp", "org.example.internal-apps.Calculator".
For details on valid application identifiers, see <a class="link" href="GApplication.html#g-application-id-is-valid" title="g_application_id_is_valid ()"><code class="function">g_application_id_is_valid()</code></a>.
</p>
<p>
On Linux, the application identifier is claimed as a well-known bus name
on the user's session bus.  This means that the uniqueness of your
application is scoped to the current session.  It also means that your
application may provide additional services (through registration of other
object paths) at that bus name.  The registration of these object paths
should be done with the shared GDBus session bus.  Note that due to the
internal architecture of GDBus, method calls can be dispatched at any time
(even if a main loop is not running).  For this reason, you must ensure that
any object paths that you wish to register are registered before <a class="link" href="GApplication.html" title="GApplication"><span class="type">GApplication</span></a>
attempts to acquire the bus name of your application (which happens in
<a class="link" href="GApplication.html#g-application-register" title="g_application_register ()"><code class="function">g_application_register()</code></a>).  Unfortunately, this means that you cannot use
<a class="link" href="GApplication.html#g-application-get-is-remote" title="g_application_get_is_remote ()"><code class="function">g_application_get_is_remote()</code></a> to decide if you want to register object paths.
</p>
<p>
GApplication also implements the <a class="link" href="GActionGroup.html" title="GActionGroup"><span class="type">GActionGroup</span></a> and <a class="link" href="GActionMap.html" title="GActionMap"><span class="type">GActionMap</span></a>
interfaces and lets you easily export actions by adding them with
<a class="link" href="GActionMap.html#g-action-map-add-action" title="g_action_map_add_action ()"><code class="function">g_action_map_add_action()</code></a>. When invoking an action by calling
<a class="link" href="GActionGroup.html#g-action-group-activate-action" title="g_action_group_activate_action ()"><code class="function">g_action_group_activate_action()</code></a> on the application, it is always
invoked in the primary instance. The actions are also exported on
the session bus, and GIO provides the <a class="link" href="GDBusActionGroup.html" title="GDBusActionGroup"><span class="type">GDBusActionGroup</span></a> wrapper to
conveniently access them remotely. GIO provides a <a class="link" href="GDBusMenuModel.html" title="GDBusMenuModel"><span class="type">GDBusMenuModel</span></a> wrapper
for remote access to exported <a href="GMenuModel.html"><span class="type">GMenuModels</span></a>.
</p>
<p>
There is a number of different entry points into a GApplication:
</p>
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">via 'Activate' (i.e. just starting the application)</li>
<li class="listitem">via 'Open' (i.e. opening some files)</li>
<li class="listitem">by handling a command-line</li>
<li class="listitem">via activating an action</li>
</ul></div>
<p>
The <a class="link" href="GApplication.html#GApplication-startup" title='The "startup" signal'><span class="type">"startup"</span></a> signal lets you handle the application
initialization for all of these in a single place.
</p>
<p>
Regardless of which of these entry points is used to start the application,
GApplication passes some <em class="firstterm"><a name="platform-data"></a>platform
data</em> from the launching instance to the primary instance,
in the form of a <a href="http://library.gnome.org/devel/glib/unstable/glib-GVariant.html#GVariant"><span class="type">GVariant</span></a> dictionary mapping strings to variants.
To use platform data, override the <em class="parameter"><code>before_emit</code></em> or <em class="parameter"><code>after_emit</code></em> virtual
functions in your <a class="link" href="GApplication.html" title="GApplication"><span class="type">GApplication</span></a> subclass. When dealing with
<a class="link" href="GApplicationCommandLine.html" title="GApplicationCommandLine"><span class="type">GApplicationCommandLine</span></a> objects, the platform data is directly
available via <a class="link" href="GApplicationCommandLine.html#g-application-command-line-get-cwd" title="g_application_command_line_get_cwd ()"><code class="function">g_application_command_line_get_cwd()</code></a>,
<a class="link" href="GApplicationCommandLine.html#g-application-command-line-get-environ" title="g_application_command_line_get_environ ()"><code class="function">g_application_command_line_get_environ()</code></a> and
<a class="link" href="GApplicationCommandLine.html#g-application-command-line-get-platform-data" title="g_application_command_line_get_platform_data ()"><code class="function">g_application_command_line_get_platform_data()</code></a>.
</p>
<p>
As the name indicates, the platform data may vary depending on the
operating system, but it always includes the current directory (key
"cwd"), and optionally the environment (ie the set of environment
variables and their values) of the calling process (key "environ").
The environment is only added to the platform data if the
<a class="link" href="GApplication.html#G-APPLICATION-SEND-ENVIRONMENT:CAPS"><code class="literal">G_APPLICATION_SEND_ENVIRONMENT</code></a> flag is set. <a class="link" href="GApplication.html" title="GApplication"><span class="type">GApplication</span></a> subclasses
can add their own platform data by overriding the <em class="parameter"><code>add_platform_data</code></em>
virtual function. For instance, <a href="http://developer.gnome.org/gtk2/GtkApplication.html"><span class="type">GtkApplication</span></a> adds startup notification
data in this way.
</p>
<p>
To parse commandline arguments you may handle the
<a class="link" href="GApplication.html#GApplication-command-line" title='The "command-line" signal'><span class="type">"command-line"</span></a> signal or override the <code class="function">local_command_line()</code>
vfunc, to parse them in either the primary instance or the local instance,
respectively.
</p>
<p>
</p>
<div class="example">
<a name="gapplication-example-open"></a><p class="title"><b>Example 18. Opening files with a GApplication</b></p>
<div class="example-contents">
  <table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
    <tbody>
      <tr>
        <td class="listing_lines" align="right"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
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</pre></td>
        <td class="listing_code"><pre class="programlisting"><span class="preproc">#include</span><span class="normal"> </span><span class="string">&lt;gio/gio.h&gt;</span>
<span class="preproc">#include</span><span class="normal"> </span><span class="string">&lt;stdlib.h&gt;</span>
<span class="preproc">#include</span><span class="normal"> </span><span class="string">&lt;string.h&gt;</span>

<span class="keyword">static</span><span class="normal"> </span><span class="type">void</span>
<span class="function">activate</span><span class="normal"> </span><span class="symbol">(</span><span class="usertype">GApplication</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">application</span><span class="symbol">)</span>
<span class="cbracket">{</span>
<span class="normal">  </span><span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-Warnings-and-Assertions.html#g-print">g_print</a></span><span class="normal"> </span><span class="symbol">(</span><span class="string">"activated</span><span class="specialchar">\n</span><span class="string">"</span><span class="symbol">);</span>

<span class="normal">  </span><span class="comment">/* Note: when doing a longer-lasting action here that returns</span>
<span class="comment">   * to the mainloop, you should use g_application_hold() and</span>
<span class="comment">   * g_application_release() to keep the application alive until</span>
<span class="comment">   * the action is completed.</span>
<span class="comment">   */</span>
<span class="cbracket">}</span>

<span class="keyword">static</span><span class="normal"> </span><span class="type">void</span>
<span class="function">open</span><span class="normal"> </span><span class="symbol">(</span><span class="usertype">GApplication</span><span class="normal">  </span><span class="symbol">*</span><span class="normal">application</span><span class="symbol">,</span>
<span class="normal">      </span><span class="usertype">GFile</span><span class="normal">        </span><span class="symbol">**</span><span class="normal">files</span><span class="symbol">,</span>
<span class="normal">      </span><span class="usertype">gint</span><span class="normal">           n_files</span><span class="symbol">,</span>
<span class="normal">      </span><span class="keyword">const</span><span class="normal"> </span><span class="usertype">gchar</span><span class="normal">   </span><span class="symbol">*</span><span class="normal">hint</span><span class="symbol">)</span>
<span class="cbracket">{</span>
<span class="normal">  </span><span class="usertype">gint</span><span class="normal"> i</span><span class="symbol">;</span>

<span class="normal">  </span><span class="keyword">for</span><span class="normal"> </span><span class="symbol">(</span><span class="normal">i </span><span class="symbol">=</span><span class="normal"> </span><span class="number">0</span><span class="symbol">;</span><span class="normal"> i </span><span class="symbol">&lt;</span><span class="normal"> n_files</span><span class="symbol">;</span><span class="normal"> i</span><span class="symbol">++)</span>
<span class="normal">    </span><span class="cbracket">{</span>
<span class="normal">      </span><span class="usertype">gchar</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">uri </span><span class="symbol">=</span><span class="normal"> </span><span class="function"><a href="GFile.html#g-file-get-uri">g_file_get_uri</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">files</span><span class="symbol">[</span><span class="normal">i</span><span class="symbol">]);</span>
<span class="normal">      </span><span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-Warnings-and-Assertions.html#g-print">g_print</a></span><span class="normal"> </span><span class="symbol">(</span><span class="string">"open %s</span><span class="specialchar">\n</span><span class="string">"</span><span class="symbol">,</span><span class="normal"> uri</span><span class="symbol">);</span>
<span class="normal">      </span><span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-Memory-Allocation.html#g-free">g_free</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">uri</span><span class="symbol">);</span>
<span class="normal">    </span><span class="cbracket">}</span>

<span class="normal">  </span><span class="comment">/* Note: when doing a longer-lasting action here that returns</span>
<span class="comment">   * to the mainloop, you should use g_application_hold() and</span>
<span class="comment">   * g_application_release() to keep the application alive until</span>
<span class="comment">   * the action is completed.</span>
<span class="comment">   */</span>
<span class="cbracket">}</span>

<span class="type">int</span>
<span class="function">main</span><span class="normal"> </span><span class="symbol">(</span><span class="type">int</span><span class="normal"> argc</span><span class="symbol">,</span><span class="normal"> </span><span class="type">char</span><span class="normal"> </span><span class="symbol">**</span><span class="normal">argv</span><span class="symbol">)</span>
<span class="cbracket">{</span>
<span class="normal">  </span><span class="usertype">GApplication</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">app</span><span class="symbol">;</span>
<span class="normal">  </span><span class="type">int</span><span class="normal"> status</span><span class="symbol">;</span>

<span class="normal">  app </span><span class="symbol">=</span><span class="normal"> </span><span class="function"><a href="GApplication.html#g-application-new">g_application_new</a></span><span class="normal"> </span><span class="symbol">(</span><span class="string">"org.gtk.TestApplication"</span><span class="symbol">,</span>
<span class="normal">                           <a href="GApplication.html#G-APPLICATION-HANDLES-OPEN:CAPS">G_APPLICATION_HANDLES_OPEN</a></span><span class="symbol">);</span>
<span class="normal">  </span><span class="function"><a href="http://library.gnome.org/devel/gobject/unstable/gobject-Signals.html#g-signal-connect">g_signal_connect</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">app</span><span class="symbol">,</span><span class="normal"> </span><span class="string">"activate"</span><span class="symbol">,</span><span class="normal"> </span><span class="function"><a href="http://library.gnome.org/devel/gobject/unstable/gobject-Closures.html#G-CALLBACK:CAPS">G_CALLBACK</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">activate</span><span class="symbol">),</span><span class="normal"> <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS">NULL</a></span><span class="symbol">);</span>
<span class="normal">  </span><span class="function"><a href="http://library.gnome.org/devel/gobject/unstable/gobject-Signals.html#g-signal-connect">g_signal_connect</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">app</span><span class="symbol">,</span><span class="normal"> </span><span class="string">"open"</span><span class="symbol">,</span><span class="normal"> </span><span class="function"><a href="http://library.gnome.org/devel/gobject/unstable/gobject-Closures.html#G-CALLBACK:CAPS">G_CALLBACK</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">open</span><span class="symbol">),</span><span class="normal"> <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS">NULL</a></span><span class="symbol">);</span>
<span class="normal">  </span><span class="function"><a href="GApplication.html#g-application-set-inactivity-timeout">g_application_set_inactivity_timeout</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">app</span><span class="symbol">,</span><span class="normal"> </span><span class="number">10000</span><span class="symbol">);</span>

<span class="normal">  status </span><span class="symbol">=</span><span class="normal"> </span><span class="function"><a href="GApplication.html#g-application-run">g_application_run</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">app</span><span class="symbol">,</span><span class="normal"> argc</span><span class="symbol">,</span><span class="normal"> argv</span><span class="symbol">);</span>

<span class="normal">  </span><span class="function"><a href="http://library.gnome.org/devel/gobject/unstable/gobject-The-Base-Object-Type.html#g-object-unref">g_object_unref</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">app</span><span class="symbol">);</span>

<span class="normal">  </span><span class="keyword">return</span><span class="normal"> status</span><span class="symbol">;</span>
<span class="cbracket">}</span></pre></td>
      </tr>
    </tbody>
  </table>
</div>

</div>
<p><br class="example-break">
</p>
<p>
</p>
<div class="example">
<a name="gapplication-example-actions"></a><p class="title"><b>Example 19. A GApplication with actions</b></p>
<div class="example-contents">
  <table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
    <tbody>
      <tr>
        <td class="listing_lines" align="right"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
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</pre></td>
        <td class="listing_code"><pre class="programlisting"><span class="preproc">#include</span><span class="normal"> </span><span class="string">&lt;gio/gio.h&gt;</span>
<span class="preproc">#include</span><span class="normal"> </span><span class="string">&lt;stdlib.h&gt;</span>
<span class="preproc">#include</span><span class="normal"> </span><span class="string">&lt;string.h&gt;</span>

<span class="keyword">static</span><span class="normal"> </span><span class="type">void</span>
<span class="function">activate</span><span class="normal"> </span><span class="symbol">(</span><span class="usertype">GApplication</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">application</span><span class="symbol">)</span>
<span class="cbracket">{</span>
<span class="normal">  </span><span class="function"><a href="GApplication.html#g-application-hold">g_application_hold</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">application</span><span class="symbol">);</span>
<span class="normal">  </span><span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-Warnings-and-Assertions.html#g-print">g_print</a></span><span class="normal"> </span><span class="symbol">(</span><span class="string">"activated</span><span class="specialchar">\n</span><span class="string">"</span><span class="symbol">);</span>
<span class="normal">  </span><span class="function"><a href="GApplication.html#g-application-release">g_application_release</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">application</span><span class="symbol">);</span>
<span class="cbracket">}</span>

<span class="keyword">static</span><span class="normal"> </span><span class="type">void</span>
<span class="function">activate_action</span><span class="normal"> </span><span class="symbol">(</span><span class="usertype">GAction</span><span class="normal">  </span><span class="symbol">*</span><span class="normal">action</span><span class="symbol">,</span>
<span class="normal">                 </span><span class="usertype">GVariant</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">parameter</span><span class="symbol">,</span>
<span class="normal">                 </span><span class="usertype">gpointer</span><span class="normal">  data</span><span class="symbol">)</span>
<span class="cbracket">{</span>
<span class="normal">  </span><span class="usertype">GApplication</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">application </span><span class="symbol">=</span><span class="normal"> </span><span class="function">G_APPLICATION</span><span class="normal"> </span><span class="symbol">(</span><span class="normal">data</span><span class="symbol">);</span>

<span class="normal">  </span><span class="function"><a href="GApplication.html#g-application-hold">g_application_hold</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">application</span><span class="symbol">);</span>
<span class="normal">  </span><span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-Warnings-and-Assertions.html#g-print">g_print</a></span><span class="normal"> </span><span class="symbol">(</span><span class="string">"action %s activated</span><span class="specialchar">\n</span><span class="string">"</span><span class="symbol">,</span><span class="normal"> </span><span class="function"><a href="GAction.html#g-action-get-name">g_action_get_name</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">action</span><span class="symbol">));</span>
<span class="normal">  </span><span class="function"><a href="GApplication.html#g-application-release">g_application_release</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">application</span><span class="symbol">);</span>
<span class="cbracket">}</span>

<span class="keyword">static</span><span class="normal"> </span><span class="type">void</span>
<span class="function">activate_toggle_action</span><span class="normal"> </span><span class="symbol">(</span><span class="usertype">GSimpleAction</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">action</span><span class="symbol">,</span>
<span class="normal">                        </span><span class="usertype">GVariant</span><span class="normal">      </span><span class="symbol">*</span><span class="normal">parameter</span><span class="symbol">,</span>
<span class="normal">                        </span><span class="usertype">gpointer</span><span class="normal">       data</span><span class="symbol">)</span>
<span class="cbracket">{</span>
<span class="normal">  </span><span class="usertype">GApplication</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">application </span><span class="symbol">=</span><span class="normal"> </span><span class="function">G_APPLICATION</span><span class="normal"> </span><span class="symbol">(</span><span class="normal">data</span><span class="symbol">);</span>
<span class="normal">  </span><span class="usertype">GVariant</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">state</span><span class="symbol">;</span>
<span class="normal">  </span><span class="usertype">gboolean</span><span class="normal"> b</span><span class="symbol">;</span>

<span class="normal">  </span><span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-Warnings-and-Assertions.html#g-print">g_print</a></span><span class="normal"> </span><span class="symbol">(</span><span class="string">"action %s activated</span><span class="specialchar">\n</span><span class="string">"</span><span class="symbol">,</span><span class="normal"> </span><span class="function"><a href="GAction.html#g-action-get-name">g_action_get_name</a></span><span class="normal"> </span><span class="symbol">(</span><span class="function">G_ACTION</span><span class="normal"> </span><span class="symbol">(</span><span class="normal">action</span><span class="symbol">)));</span>

<span class="normal">  </span><span class="function"><a href="GApplication.html#g-application-hold">g_application_hold</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">application</span><span class="symbol">);</span>
<span class="normal">  state </span><span class="symbol">=</span><span class="normal"> </span><span class="function"><a href="GAction.html#g-action-get-state">g_action_get_state</a></span><span class="normal"> </span><span class="symbol">(</span><span class="function">G_ACTION</span><span class="normal"> </span><span class="symbol">(</span><span class="normal">action</span><span class="symbol">));</span>
<span class="normal">  b </span><span class="symbol">=</span><span class="normal"> </span><span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-GVariant.html#g-variant-get-boolean">g_variant_get_boolean</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">state</span><span class="symbol">);</span>
<span class="normal">  </span><span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-GVariant.html#g-variant-unref">g_variant_unref</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">state</span><span class="symbol">);</span>
<span class="normal">  </span><span class="function"><a href="GSimpleAction.html#g-simple-action-set-state">g_simple_action_set_state</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">action</span><span class="symbol">,</span><span class="normal"> </span><span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-GVariant.html#g-variant-new-boolean">g_variant_new_boolean</a></span><span class="normal"> </span><span class="symbol">(!</span><span class="normal">b</span><span class="symbol">));</span>
<span class="normal">  </span><span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-Warnings-and-Assertions.html#g-print">g_print</a></span><span class="normal"> </span><span class="symbol">(</span><span class="string">"state change %d -&gt; %d</span><span class="specialchar">\n</span><span class="string">"</span><span class="symbol">,</span><span class="normal"> b</span><span class="symbol">,</span><span class="normal"> </span><span class="symbol">!</span><span class="normal">b</span><span class="symbol">);</span>
<span class="normal">  </span><span class="function"><a href="GApplication.html#g-application-release">g_application_release</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">application</span><span class="symbol">);</span>
<span class="cbracket">}</span>

<span class="keyword">static</span><span class="normal"> </span><span class="type">void</span>
<span class="function">add_actions</span><span class="normal"> </span><span class="symbol">(</span><span class="usertype">GApplication</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">app</span><span class="symbol">)</span>
<span class="cbracket">{</span>
<span class="normal">  </span><span class="usertype">GSimpleAction</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">action</span><span class="symbol">;</span>

<span class="normal">  action </span><span class="symbol">=</span><span class="normal"> </span><span class="function"><a href="GSimpleAction.html#g-simple-action-new">g_simple_action_new</a></span><span class="normal"> </span><span class="symbol">(</span><span class="string">"simple-action"</span><span class="symbol">,</span><span class="normal"> <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS">NULL</a></span><span class="symbol">);</span>
<span class="normal">  </span><span class="function"><a href="http://library.gnome.org/devel/gobject/unstable/gobject-Signals.html#g-signal-connect">g_signal_connect</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">action</span><span class="symbol">,</span><span class="normal"> </span><span class="string">"activate"</span><span class="symbol">,</span><span class="normal"> </span><span class="function"><a href="http://library.gnome.org/devel/gobject/unstable/gobject-Closures.html#G-CALLBACK:CAPS">G_CALLBACK</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">activate_action</span><span class="symbol">),</span><span class="normal"> app</span><span class="symbol">);</span>
<span class="normal">  </span><span class="function"><a href="GActionMap.html#g-action-map-add-action">g_action_map_add_action</a></span><span class="normal"> </span><span class="symbol">(</span><span class="function">G_ACTION_MAP</span><span class="normal"> </span><span class="symbol">(</span><span class="normal">app</span><span class="symbol">),</span><span class="normal"> </span><span class="function">G_ACTION</span><span class="normal"> </span><span class="symbol">(</span><span class="normal">action</span><span class="symbol">));</span>
<span class="normal">  </span><span class="function"><a href="http://library.gnome.org/devel/gobject/unstable/gobject-The-Base-Object-Type.html#g-object-unref">g_object_unref</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">action</span><span class="symbol">);</span>

<span class="normal">  action </span><span class="symbol">=</span><span class="normal"> </span><span class="function"><a href="GSimpleAction.html#g-simple-action-new-stateful">g_simple_action_new_stateful</a></span><span class="normal"> </span><span class="symbol">(</span><span class="string">"toggle-action"</span><span class="symbol">,</span><span class="normal"> <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS">NULL</a></span><span class="symbol">,</span>
<span class="normal">                                         </span><span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-GVariant.html#g-variant-new-boolean">g_variant_new_boolean</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal"><a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#FALSE:CAPS">FALSE</a></span><span class="symbol">));</span>
<span class="normal">  </span><span class="function"><a href="http://library.gnome.org/devel/gobject/unstable/gobject-Signals.html#g-signal-connect">g_signal_connect</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">action</span><span class="symbol">,</span><span class="normal"> </span><span class="string">"activate"</span><span class="symbol">,</span><span class="normal"> </span><span class="function"><a href="http://library.gnome.org/devel/gobject/unstable/gobject-Closures.html#G-CALLBACK:CAPS">G_CALLBACK</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">activate_toggle_action</span><span class="symbol">),</span><span class="normal"> app</span><span class="symbol">);</span>
<span class="normal">  </span><span class="function"><a href="GActionMap.html#g-action-map-add-action">g_action_map_add_action</a></span><span class="normal"> </span><span class="symbol">(</span><span class="function">G_ACTION_MAP</span><span class="normal"> </span><span class="symbol">(</span><span class="normal">app</span><span class="symbol">),</span><span class="normal"> </span><span class="function">G_ACTION</span><span class="normal"> </span><span class="symbol">(</span><span class="normal">action</span><span class="symbol">));</span>
<span class="normal">  </span><span class="function"><a href="http://library.gnome.org/devel/gobject/unstable/gobject-The-Base-Object-Type.html#g-object-unref">g_object_unref</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">action</span><span class="symbol">);</span>
<span class="cbracket">}</span>

<span class="keyword">static</span><span class="normal"> </span><span class="type">void</span>
<span class="function">describe_and_activate_action</span><span class="normal"> </span><span class="symbol">(</span><span class="usertype">GActionGroup</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">group</span><span class="symbol">,</span>
<span class="normal">                              </span><span class="keyword">const</span><span class="normal"> </span><span class="usertype">gchar</span><span class="normal">  </span><span class="symbol">*</span><span class="normal">name</span><span class="symbol">)</span>
<span class="cbracket">{</span>
<span class="normal">  </span><span class="keyword">const</span><span class="normal"> </span><span class="usertype">GVariantType</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">param_type</span><span class="symbol">;</span>
<span class="normal">  </span><span class="usertype">GVariant</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">state</span><span class="symbol">;</span>
<span class="normal">  </span><span class="usertype">gboolean</span><span class="normal"> enabled</span><span class="symbol">;</span>
<span class="normal">  </span><span class="usertype">gchar</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">tmp</span><span class="symbol">;</span>

<span class="normal">  param_type </span><span class="symbol">=</span><span class="normal"> </span><span class="function"><a href="GActionGroup.html#g-action-group-get-action-parameter-type">g_action_group_get_action_parameter_type</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">group</span><span class="symbol">,</span><span class="normal"> name</span><span class="symbol">);</span>
<span class="normal">  state </span><span class="symbol">=</span><span class="normal"> </span><span class="function"><a href="GActionGroup.html#g-action-group-get-action-state">g_action_group_get_action_state</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">group</span><span class="symbol">,</span><span class="normal"> name</span><span class="symbol">);</span>
<span class="normal">  enabled </span><span class="symbol">=</span><span class="normal"> </span><span class="function"><a href="GActionGroup.html#g-action-group-get-action-enabled">g_action_group_get_action_enabled</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">group</span><span class="symbol">,</span><span class="normal"> name</span><span class="symbol">);</span>

<span class="normal">  </span><span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-Warnings-and-Assertions.html#g-print">g_print</a></span><span class="normal"> </span><span class="symbol">(</span><span class="string">"action name:      %s</span><span class="specialchar">\n</span><span class="string">"</span><span class="symbol">,</span><span class="normal"> name</span><span class="symbol">);</span>
<span class="normal">  tmp </span><span class="symbol">=</span><span class="normal"> param_type </span><span class="symbol">?</span><span class="normal"> </span><span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-GVariantType.html#g-variant-type-dup-string">g_variant_type_dup_string</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">param_type</span><span class="symbol">)</span><span class="normal"> </span><span class="symbol">:</span><span class="normal"> <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS">NULL</a></span><span class="symbol">;</span>
<span class="normal">  </span><span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-Warnings-and-Assertions.html#g-print">g_print</a></span><span class="normal"> </span><span class="symbol">(</span><span class="string">"parameter type:   %s</span><span class="specialchar">\n</span><span class="string">"</span><span class="symbol">,</span><span class="normal"> tmp </span><span class="symbol">?</span><span class="normal"> tmp </span><span class="symbol">:</span><span class="normal"> </span><span class="string">"&lt;none&gt;"</span><span class="symbol">);</span>
<span class="normal">  </span><span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-Memory-Allocation.html#g-free">g_free</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">tmp</span><span class="symbol">);</span>
<span class="normal">  </span><span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-Warnings-and-Assertions.html#g-print">g_print</a></span><span class="normal"> </span><span class="symbol">(</span><span class="string">"state type:       %s</span><span class="specialchar">\n</span><span class="string">"</span><span class="symbol">,</span>
<span class="normal">           state </span><span class="symbol">?</span><span class="normal"> </span><span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-GVariant.html#g-variant-get-type-string">g_variant_get_type_string</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">state</span><span class="symbol">)</span><span class="normal"> </span><span class="symbol">:</span><span class="normal"> </span><span class="string">"&lt;none&gt;"</span><span class="symbol">);</span>
<span class="normal">  tmp </span><span class="symbol">=</span><span class="normal"> state </span><span class="symbol">?</span><span class="normal"> </span><span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-GVariant.html#g-variant-print">g_variant_print</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">state</span><span class="symbol">,</span><span class="normal"> <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#FALSE:CAPS">FALSE</a></span><span class="symbol">)</span><span class="normal"> </span><span class="symbol">:</span><span class="normal"> <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS">NULL</a></span><span class="symbol">;</span>
<span class="normal">  </span><span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-Warnings-and-Assertions.html#g-print">g_print</a></span><span class="normal"> </span><span class="symbol">(</span><span class="string">"state:            %s</span><span class="specialchar">\n</span><span class="string">"</span><span class="symbol">,</span><span class="normal"> tmp </span><span class="symbol">?</span><span class="normal"> tmp </span><span class="symbol">:</span><span class="normal"> </span><span class="string">"&lt;none&gt;"</span><span class="symbol">);</span>
<span class="normal">  </span><span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-Memory-Allocation.html#g-free">g_free</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">tmp</span><span class="symbol">);</span>
<span class="normal">  </span><span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-Warnings-and-Assertions.html#g-print">g_print</a></span><span class="normal"> </span><span class="symbol">(</span><span class="string">"enabled:          %s</span><span class="specialchar">\n</span><span class="string">"</span><span class="symbol">,</span><span class="normal"> enabled </span><span class="symbol">?</span><span class="normal"> </span><span class="string">"true"</span><span class="normal"> </span><span class="symbol">:</span><span class="normal"> </span><span class="string">"false"</span><span class="symbol">);</span>

<span class="normal">  </span><span class="keyword">if</span><span class="normal"> </span><span class="symbol">(</span><span class="normal">state </span><span class="symbol">!=</span><span class="normal"> <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS">NULL</a></span><span class="symbol">)</span>
<span class="normal">    </span><span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-GVariant.html#g-variant-unref">g_variant_unref</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">state</span><span class="symbol">);</span>

<span class="normal">  </span><span class="function"><a href="GActionGroup.html#g-action-group-activate-action">g_action_group_activate_action</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">group</span><span class="symbol">,</span><span class="normal"> name</span><span class="symbol">,</span><span class="normal"> <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS">NULL</a></span><span class="symbol">);</span>
<span class="cbracket">}</span>

<span class="type">int</span>
<span class="function">main</span><span class="normal"> </span><span class="symbol">(</span><span class="type">int</span><span class="normal"> argc</span><span class="symbol">,</span><span class="normal"> </span><span class="type">char</span><span class="normal"> </span><span class="symbol">**</span><span class="normal">argv</span><span class="symbol">)</span>
<span class="cbracket">{</span>
<span class="normal">  </span><span class="usertype">GApplication</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">app</span><span class="symbol">;</span>
<span class="normal">  </span><span class="type">int</span><span class="normal"> status</span><span class="symbol">;</span>

<span class="normal">  app </span><span class="symbol">=</span><span class="normal"> </span><span class="function"><a href="GApplication.html#g-application-new">g_application_new</a></span><span class="normal"> </span><span class="symbol">(</span><span class="string">"org.gtk.TestApplication"</span><span class="symbol">,</span><span class="normal"> </span><span class="number">0</span><span class="symbol">);</span>
<span class="normal">  </span><span class="function"><a href="http://library.gnome.org/devel/gobject/unstable/gobject-Signals.html#g-signal-connect">g_signal_connect</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">app</span><span class="symbol">,</span><span class="normal"> </span><span class="string">"activate"</span><span class="symbol">,</span><span class="normal"> </span><span class="function"><a href="http://library.gnome.org/devel/gobject/unstable/gobject-Closures.html#G-CALLBACK:CAPS">G_CALLBACK</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">activate</span><span class="symbol">),</span><span class="normal"> <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS">NULL</a></span><span class="symbol">);</span>
<span class="normal">  </span><span class="function"><a href="GApplication.html#g-application-set-inactivity-timeout">g_application_set_inactivity_timeout</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">app</span><span class="symbol">,</span><span class="normal"> </span><span class="number">10000</span><span class="symbol">);</span>

<span class="normal">  </span><span class="function">add_actions</span><span class="normal"> </span><span class="symbol">(</span><span class="normal">app</span><span class="symbol">);</span>

<span class="normal">  </span><span class="keyword">if</span><span class="normal"> </span><span class="symbol">(</span><span class="normal">argc </span><span class="symbol">&gt;</span><span class="normal"> </span><span class="number">1</span><span class="normal"> </span><span class="symbol">&amp;&amp;</span><span class="normal"> </span><span class="function">strcmp</span><span class="normal"> </span><span class="symbol">(</span><span class="normal">argv</span><span class="symbol">[</span><span class="number">1</span><span class="symbol">],</span><span class="normal"> </span><span class="string">"--simple-action"</span><span class="symbol">)</span><span class="normal"> </span><span class="symbol">==</span><span class="normal"> </span><span class="number">0</span><span class="symbol">)</span>
<span class="normal">    </span><span class="cbracket">{</span>
<span class="normal">      </span><span class="function"><a href="GApplication.html#g-application-register">g_application_register</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">app</span><span class="symbol">,</span><span class="normal"> <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS">NULL</a></span><span class="symbol">,</span><span class="normal"> <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS">NULL</a></span><span class="symbol">);</span>
<span class="normal">      </span><span class="function">describe_and_activate_action</span><span class="normal"> </span><span class="symbol">(</span><span class="function">G_ACTION_GROUP</span><span class="normal"> </span><span class="symbol">(</span><span class="normal">app</span><span class="symbol">),</span><span class="normal"> </span><span class="string">"simple-action"</span><span class="symbol">);</span>
<span class="normal">      </span><span class="function">exit</span><span class="normal"> </span><span class="symbol">(</span><span class="number">0</span><span class="symbol">);</span>
<span class="normal">    </span><span class="cbracket">}</span>
<span class="normal">  </span><span class="keyword">else</span><span class="normal"> </span><span class="keyword">if</span><span class="normal"> </span><span class="symbol">(</span><span class="normal">argc </span><span class="symbol">&gt;</span><span class="normal"> </span><span class="number">1</span><span class="normal"> </span><span class="symbol">&amp;&amp;</span><span class="normal"> </span><span class="function">strcmp</span><span class="normal"> </span><span class="symbol">(</span><span class="normal">argv</span><span class="symbol">[</span><span class="number">1</span><span class="symbol">],</span><span class="normal"> </span><span class="string">"--toggle-action"</span><span class="symbol">)</span><span class="normal"> </span><span class="symbol">==</span><span class="normal"> </span><span class="number">0</span><span class="symbol">)</span>
<span class="normal">    </span><span class="cbracket">{</span>
<span class="normal">      </span><span class="function"><a href="GApplication.html#g-application-register">g_application_register</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">app</span><span class="symbol">,</span><span class="normal"> <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS">NULL</a></span><span class="symbol">,</span><span class="normal"> <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS">NULL</a></span><span class="symbol">);</span>
<span class="normal">      </span><span class="function">describe_and_activate_action</span><span class="normal"> </span><span class="symbol">(</span><span class="function">G_ACTION_GROUP</span><span class="normal"> </span><span class="symbol">(</span><span class="normal">app</span><span class="symbol">),</span><span class="normal"> </span><span class="string">"toggle-action"</span><span class="symbol">);</span>
<span class="normal">      </span><span class="function">exit</span><span class="normal"> </span><span class="symbol">(</span><span class="number">0</span><span class="symbol">);</span>
<span class="normal">    </span><span class="cbracket">}</span>

<span class="normal">  status </span><span class="symbol">=</span><span class="normal"> </span><span class="function"><a href="GApplication.html#g-application-run">g_application_run</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">app</span><span class="symbol">,</span><span class="normal"> argc</span><span class="symbol">,</span><span class="normal"> argv</span><span class="symbol">);</span>

<span class="normal">  </span><span class="function"><a href="http://library.gnome.org/devel/gobject/unstable/gobject-The-Base-Object-Type.html#g-object-unref">g_object_unref</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">app</span><span class="symbol">);</span>

<span class="normal">  </span><span class="keyword">return</span><span class="normal"> status</span><span class="symbol">;</span>
<span class="cbracket">}</span></pre></td>
      </tr>
    </tbody>
  </table>
</div>

</div>
<p><br class="example-break">
</p>
<p>
</p>
<div class="example">
<a name="gapplication-example-menu"></a><p class="title"><b>Example 20. A GApplication with menus</b></p>
<div class="example-contents">
  <table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
    <tbody>
      <tr>
        <td class="listing_lines" align="right"><pre>1</pre></td>
        <td class="listing_code"><pre class="programlisting"><span class="normal">FIXME</span><span class="symbol">:</span><span class="normal"> MISSING XINCLUDE CONTENT</span></pre></td>
      </tr>
    </tbody>
  </table>
</div>

</div>
<p><br class="example-break">
</p>
<p>
</p>
<div class="example">
<a name="gapplication-example-dbushooks"></a><p class="title"><b>Example 21. Using extra D-Bus hooks with a GApplication</b></p>
<div class="example-contents">
  <table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
    <tbody>
      <tr>
        <td class="listing_lines" align="right"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
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</pre></td>
        <td class="listing_code"><pre class="programlisting"><span class="preproc">#include</span><span class="normal"> </span><span class="string">&lt;gio/gio.h&gt;</span>
<span class="preproc">#include</span><span class="normal"> </span><span class="string">&lt;stdlib.h&gt;</span>
<span class="preproc">#include</span><span class="normal"> </span><span class="string">&lt;string.h&gt;</span>

<span class="keyword">static</span><span class="normal"> </span><span class="type">void</span>
<span class="function">activate</span><span class="normal"> </span><span class="symbol">(</span><span class="usertype">GApplication</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">application</span><span class="symbol">)</span>
<span class="cbracket">{</span>
<span class="normal">  </span><span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-Warnings-and-Assertions.html#g-print">g_print</a></span><span class="normal"> </span><span class="symbol">(</span><span class="string">"activated</span><span class="specialchar">\n</span><span class="string">"</span><span class="symbol">);</span>

<span class="normal">  </span><span class="comment">/* Note: when doing a longer-lasting action here that returns</span>
<span class="comment">   * to the mainloop, you should use g_application_hold() and</span>
<span class="comment">   * g_application_release() to keep the application alive until</span>
<span class="comment">   * the action is completed.</span>
<span class="comment">   */</span>
<span class="cbracket">}</span>

<span class="keyword">typedef</span><span class="normal"> </span><span class="usertype">GApplication</span><span class="normal"> TestApplication</span><span class="symbol">;</span>
<span class="keyword">typedef</span><span class="normal"> </span><span class="usertype">GApplicationClass</span><span class="normal"> TestApplicationClass</span><span class="symbol">;</span>

<span class="keyword">static</span><span class="normal"> </span><span class="usertype">GType</span><span class="normal"> </span><span class="function">test_application_get_type</span><span class="normal"> </span><span class="symbol">(</span><span class="type">void</span><span class="symbol">);</span>
<span class="function"><a href="http://library.gnome.org/devel/gobject/unstable/gobject-Type-Information.html#G-DEFINE-TYPE:CAPS">G_DEFINE_TYPE</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">TestApplication</span><span class="symbol">,</span><span class="normal"> test_application</span><span class="symbol">,</span><span class="normal"> G_TYPE_APPLICATION</span><span class="symbol">)</span>

<span class="keyword">static</span><span class="normal"> <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gboolean">gboolean</a></span>
<span class="function">test_application_dbus_register</span><span class="normal"> </span><span class="symbol">(</span><span class="usertype">GApplication</span><span class="normal">    </span><span class="symbol">*</span><span class="normal">application</span><span class="symbol">,</span>
<span class="normal">                                </span><span class="usertype">GDBusConnection</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">connection</span><span class="symbol">,</span>
<span class="normal">                                </span><span class="keyword">const</span><span class="normal"> </span><span class="usertype">gchar</span><span class="normal">     </span><span class="symbol">*</span><span class="normal">object_path</span><span class="symbol">,</span>
<span class="normal">                                </span><span class="usertype">GError</span><span class="normal">         </span><span class="symbol">**</span><span class="normal">error</span><span class="symbol">)</span>
<span class="cbracket">{</span>
<span class="normal">  </span><span class="comment">/* We must chain up to the parent class */</span>
<span class="normal">  </span><span class="keyword">if</span><span class="normal"> </span><span class="symbol">(!</span><span class="function">G_APPLICATION_CLASS</span><span class="normal"> </span><span class="symbol">(</span><span class="normal">test_application_parent_class</span><span class="symbol">)-&gt;</span><span class="function">dbus_register</span><span class="normal"> </span><span class="symbol">(</span><span class="normal">application</span><span class="symbol">,</span>
<span class="normal">                                                                           connection</span><span class="symbol">,</span>
<span class="normal">                                                                           object_path</span><span class="symbol">,</span>
<span class="normal">                                                                           error</span><span class="symbol">))</span>
<span class="normal">    </span><span class="keyword">return</span><span class="normal"> <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#FALSE:CAPS">FALSE</a></span><span class="symbol">;</span>

<span class="normal">  </span><span class="comment">/* Now we can do our own stuff here. For example, we could export some D-Bus objects */</span>
<span class="normal">  </span><span class="keyword">return</span><span class="normal"> <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#TRUE:CAPS">TRUE</a></span><span class="symbol">;</span>
<span class="cbracket">}</span>

<span class="keyword">static</span><span class="normal"> </span><span class="type">void</span>
<span class="function">test_application_dbus_unregister</span><span class="normal"> </span><span class="symbol">(</span><span class="usertype">GApplication</span><span class="normal">    </span><span class="symbol">*</span><span class="normal">application</span><span class="symbol">,</span>
<span class="normal">                                  </span><span class="usertype">GDBusConnection</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">connection</span><span class="symbol">,</span>
<span class="normal">                                  </span><span class="keyword">const</span><span class="normal"> </span><span class="usertype">gchar</span><span class="normal">     </span><span class="symbol">*</span><span class="normal">object_path</span><span class="symbol">)</span>
<span class="cbracket">{</span>
<span class="normal">  </span><span class="comment">/* Do our own stuff here, e.g. unexport any D-Bus objects we exported in the dbus_register</span>
<span class="comment">   * hook above. Be sure to check that we actually did export them, since the hook</span>
<span class="comment">   * above might have returned early due to the parent class' hook returning FALSE!</span>
<span class="comment">   */</span>

<span class="normal">  </span><span class="comment">/* Lastly, we must chain up to the parent class */</span>
<span class="normal">  </span><span class="function">G_APPLICATION_CLASS</span><span class="normal"> </span><span class="symbol">(</span><span class="normal">test_application_parent_class</span><span class="symbol">)-&gt;</span><span class="function">dbus_unregister</span><span class="normal"> </span><span class="symbol">(</span><span class="normal">application</span><span class="symbol">,</span>
<span class="normal">                                                                        connection</span><span class="symbol">,</span>
<span class="normal">                                                                        object_path</span><span class="symbol">);</span>
<span class="cbracket">}</span>

<span class="keyword">static</span><span class="normal"> </span><span class="type">void</span>
<span class="function">test_application_init</span><span class="normal"> </span><span class="symbol">(</span><span class="usertype">TestApplication</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">app</span><span class="symbol">)</span>
<span class="cbracket">{</span>
<span class="cbracket">}</span>

<span class="keyword">static</span><span class="normal"> </span><span class="type">void</span>
<span class="function">test_application_class_init</span><span class="normal"> </span><span class="symbol">(</span><span class="usertype">TestApplicationClass</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">class</span><span class="symbol">)</span>
<span class="cbracket">{</span>
<span class="normal">  </span><span class="usertype">GApplicationClass</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">g_application_class </span><span class="symbol">=</span><span class="normal"> </span><span class="function">G_APPLICATION_CLASS</span><span class="normal"> </span><span class="symbol">(</span><span class="normal">class</span><span class="symbol">);</span>

<span class="normal">  g_application_class</span><span class="symbol">-&gt;</span><span class="normal">dbus_register </span><span class="symbol">=</span><span class="normal"> test_application_dbus_register</span><span class="symbol">;</span>
<span class="normal">  g_application_class</span><span class="symbol">-&gt;</span><span class="normal">dbus_unregister </span><span class="symbol">=</span><span class="normal"> test_application_dbus_unregister</span><span class="symbol">;</span>
<span class="cbracket">}</span>

<span class="keyword">static</span><span class="normal"> <a href="GApplication.html">GApplication</a> </span><span class="symbol">*</span>
<span class="function">test_application_new</span><span class="normal"> </span><span class="symbol">(</span><span class="keyword">const</span><span class="normal"> </span><span class="usertype">gchar</span><span class="normal">       </span><span class="symbol">*</span><span class="normal">application_id</span><span class="symbol">,</span>
<span class="normal">                      </span><span class="usertype">GApplicationFlags</span><span class="normal">  flags</span><span class="symbol">)</span>
<span class="cbracket">{</span>
<span class="normal">  </span><span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-Warnings-and-Assertions.html#g-return-val-if-fail">g_return_val_if_fail</a></span><span class="normal"> </span><span class="symbol">(</span><span class="function"><a href="GApplication.html#g-application-id-is-valid">g_application_id_is_valid</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">application_id</span><span class="symbol">),</span><span class="normal"> <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS">NULL</a></span><span class="symbol">);</span>

<span class="normal">  </span><span class="keyword">return</span><span class="normal"> </span><span class="function"><a href="http://library.gnome.org/devel/gobject/unstable/gobject-The-Base-Object-Type.html#g-object-new">g_object_new</a></span><span class="normal"> </span><span class="symbol">(</span><span class="function">test_application_get_type</span><span class="normal"> </span><span class="symbol">(),</span>
<span class="normal">                       </span><span class="string">"application-id"</span><span class="symbol">,</span><span class="normal"> application_id</span><span class="symbol">,</span>
<span class="normal">                       </span><span class="string">"flags"</span><span class="symbol">,</span><span class="normal"> flags</span><span class="symbol">,</span>
<span class="normal">                       <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS">NULL</a></span><span class="symbol">);</span>
<span class="cbracket">}</span>

<span class="type">int</span>
<span class="function">main</span><span class="normal"> </span><span class="symbol">(</span><span class="type">int</span><span class="normal"> argc</span><span class="symbol">,</span><span class="normal"> </span><span class="type">char</span><span class="normal"> </span><span class="symbol">**</span><span class="normal">argv</span><span class="symbol">)</span>
<span class="cbracket">{</span>
<span class="normal">  </span><span class="usertype">GApplication</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">app</span><span class="symbol">;</span>
<span class="normal">  </span><span class="type">int</span><span class="normal"> status</span><span class="symbol">;</span>

<span class="normal">  app </span><span class="symbol">=</span><span class="normal"> </span><span class="function">test_application_new</span><span class="normal"> </span><span class="symbol">(</span><span class="string">"org.gtk.TestApplication"</span><span class="symbol">,</span><span class="normal"> </span><span class="number">0</span><span class="symbol">);</span>
<span class="normal">  </span><span class="function"><a href="http://library.gnome.org/devel/gobject/unstable/gobject-Signals.html#g-signal-connect">g_signal_connect</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">app</span><span class="symbol">,</span><span class="normal"> </span><span class="string">"activate"</span><span class="symbol">,</span><span class="normal"> </span><span class="function"><a href="http://library.gnome.org/devel/gobject/unstable/gobject-Closures.html#G-CALLBACK:CAPS">G_CALLBACK</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">activate</span><span class="symbol">),</span><span class="normal"> <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS">NULL</a></span><span class="symbol">);</span>
<span class="normal">  </span><span class="function"><a href="GApplication.html#g-application-set-inactivity-timeout">g_application_set_inactivity_timeout</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">app</span><span class="symbol">,</span><span class="normal"> </span><span class="number">10000</span><span class="symbol">);</span>

<span class="normal">  status </span><span class="symbol">=</span><span class="normal"> </span><span class="function"><a href="GApplication.html#g-application-run">g_application_run</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">app</span><span class="symbol">,</span><span class="normal"> argc</span><span class="symbol">,</span><span class="normal"> argv</span><span class="symbol">);</span>

<span class="normal">  </span><span class="function"><a href="http://library.gnome.org/devel/gobject/unstable/gobject-The-Base-Object-Type.html#g-object-unref">g_object_unref</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">app</span><span class="symbol">);</span>

<span class="normal">  </span><span class="keyword">return</span><span class="normal"> status</span><span class="symbol">;</span>
<span class="cbracket">}</span></pre></td>
      </tr>
    </tbody>
  </table>
</div>

</div>
<p><br class="example-break">
</p>
</div>
<div class="refsect1">
<a name="GApplication.details"></a><h2>Details</h2>
<div class="refsect2">
<a name="GApplication-struct"></a><h3>GApplication</h3>
<pre class="programlisting">typedef struct _GApplication GApplication;</pre>
<p class="since">Since 2.28</p>
</div>
<hr>
<div class="refsect2">
<a name="GApplicationClass"></a><h3>struct GApplicationClass</h3>
<pre class="programlisting">struct GApplicationClass {
  /* signals */
  void                      (* startup)             (GApplication              *application);

  void                      (* activate)            (GApplication              *application);

  void                      (* open)                (GApplication              *application,
                                                     GFile                    **files,
                                                     gint                       n_files,
                                                     const gchar               *hint);

  int                       (* command_line)        (GApplication              *application,
                                                     GApplicationCommandLine   *command_line);

  /* vfuncs */

  /**
   * GApplicationClass::local_command_line:
   * @application: a #GApplication
   * @arguments: (inout) (array zero-terminated=1): array of command line arguments
   * @exit_status: (out): exit status to fill after processing the command line.
   *
   * This virtual function is always invoked in the local instance. It
   * gets passed a pointer to a %NULL-terminated copy of @argv and is
   * expected to remove arguments that it handled (shifting up remaining
   * arguments).
   *
   * The last argument to local_command_line() is a pointer to the @status
   * variable which can used to set the exit status that is returned from
   * g_application_run().
   *
   * See g_application_run() for more details on #GApplication startup.
   *
   * Returns: %TRUE if the commandline has been completely handled
   */
  gboolean                  (* local_command_line)  (GApplication              *application,
                                                     gchar                   ***arguments,
                                                     int                       *exit_status);

  void                      (* before_emit)         (GApplication              *application,
                                                     GVariant                  *platform_data);
  void                      (* after_emit)          (GApplication              *application,
                                                     GVariant                  *platform_data);
  void                      (* add_platform_data)   (GApplication              *application,
                                                     GVariantBuilder           *builder);
  void                      (* quit_mainloop)       (GApplication              *application);
  void                      (* run_mainloop)        (GApplication              *application);
  void                      (* shutdown)            (GApplication              *application);

  gboolean                  (* dbus_register)       (GApplication              *application,
                                                     GDBusConnection           *connection,
                                                     const gchar               *object_path,
                                                     GError                   **error);
  void                      (* dbus_unregister)     (GApplication              *application,
                                                     GDBusConnection           *connection,
                                                     const gchar               *object_path);
};
</pre>
<p>
Virtual function table for <a class="link" href="GApplication.html" title="GApplication"><span class="type">GApplication</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"><em class="structfield"><code><a name="GApplicationClass.startup"></a>startup</code></em> ()</span></p></td>
<td>invoked on the primary instance immediately after registration</td>
</tr>
<tr>
<td><p><span class="term"><em class="structfield"><code><a name="GApplicationClass.activate"></a>activate</code></em> ()</span></p></td>
<td>invoked on the primary instance when an activation occurs</td>
</tr>
<tr>
<td><p><span class="term"><em class="structfield"><code><a name="GApplicationClass.open"></a>open</code></em> ()</span></p></td>
<td>invoked on the primary instance when there are files to open</td>
</tr>
<tr>
<td><p><span class="term"><em class="structfield"><code><a name="GApplicationClass.command-line"></a>command_line</code></em> ()</span></p></td>
<td>invoked on the primary instance when a command-line is
not handled locally</td>
</tr>
<tr>
<td><p><span class="term"><em class="structfield"><code><a name="GApplicationClass.local-command-line"></a>local_command_line</code></em> ()</span></p></td>
<td>invoked (locally) when the process has been invoked
via commandline execution (as opposed to, say, D-Bus activation - which
is not currently supported by GApplication). The virtual function has
the chance to inspect (and possibly replace) the list of command line
arguments. See <a class="link" href="GApplication.html#g-application-run" title="g_application_run ()"><code class="function">g_application_run()</code></a> for more information.</td>
</tr>
<tr>
<td><p><span class="term"><em class="structfield"><code><a name="GApplicationClass.before-emit"></a>before_emit</code></em> ()</span></p></td>
<td>invoked on the primary instance before 'activate', 'open',
'command-line' or any action invocation, gets the 'platform data' from
the calling instance</td>
</tr>
<tr>
<td><p><span class="term"><em class="structfield"><code><a name="GApplicationClass.after-emit"></a>after_emit</code></em> ()</span></p></td>
<td>invoked on the primary instance after 'activate', 'open',
'command-line' or any action invocation, gets the 'platform data' from
the calling instance</td>
</tr>
<tr>
<td><p><span class="term"><em class="structfield"><code><a name="GApplicationClass.add-platform-data"></a>add_platform_data</code></em> ()</span></p></td>
<td>invoked (locally) to add 'platform data' to be sent to
the primary instance when activating, opening or invoking actions</td>
</tr>
<tr>
<td><p><span class="term"><em class="structfield"><code><a name="GApplicationClass.quit-mainloop"></a>quit_mainloop</code></em> ()</span></p></td>
<td>Used to be invoked on the primary instance when the use
count of the application drops to zero (and after any inactivity
timeout, if requested). Not used anymore since 2.32</td>
</tr>
<tr>
<td><p><span class="term"><em class="structfield"><code><a name="GApplicationClass.run-mainloop"></a>run_mainloop</code></em> ()</span></p></td>
<td>Used to be invoked on the primary instance from
<a class="link" href="GApplication.html#g-application-run" title="g_application_run ()"><code class="function">g_application_run()</code></a> if the use-count is non-zero. Since 2.32,
GApplication is iterating the main context directly and is not
using <em class="parameter"><code>run_mainloop</code></em> anymore</td>
</tr>
<tr>
<td><p><span class="term"><em class="structfield"><code><a name="GApplicationClass.shutdown"></a>shutdown</code></em> ()</span></p></td>
<td>invoked only on the registered primary instance immediately
after the main loop terminates</td>
</tr>
<tr>
<td><p><span class="term"><em class="structfield"><code><a name="GApplicationClass.dbus-register"></a>dbus_register</code></em> ()</span></p></td>
<td>invoked locally during registration, if the application is
using its D-Bus backend. You can use this to export extra objects on the
bus, that need to exist before the application tries to own the bus name.
The function is passed the <a class="link" href="GDBusConnection.html" title="GDBusConnection"><span class="type">GDBusConnection</span></a> to to session bus, and the
object path that <a class="link" href="GApplication.html" title="GApplication"><span class="type">GApplication</span></a> will use to export is D-Bus API.
If this function returns <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a>, registration will proceed; otherwise
registration will abort. Since: 2.34</td>
</tr>
<tr>
<td><p><span class="term"><em class="structfield"><code><a name="GApplicationClass.dbus-unregister"></a>dbus_unregister</code></em> ()</span></p></td>
<td>invoked locally during unregistration, if the application
is using its D-Bus backend. Use this to undo anything done by the
<em class="parameter"><code>dbus_register</code></em> vfunc. Since: 2.34</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.28</p>
</div>
<hr>
<div class="refsect2">
<a name="GApplicationFlags-enum"></a><h3>enum GApplicationFlags</h3>
<pre class="programlisting">typedef enum {
  G_APPLICATION_FLAGS_NONE,
  G_APPLICATION_IS_SERVICE  =          (1 &lt;&lt; 0),
  G_APPLICATION_IS_LAUNCHER =          (1 &lt;&lt; 1),

  G_APPLICATION_HANDLES_OPEN =         (1 &lt;&lt; 2),
  G_APPLICATION_HANDLES_COMMAND_LINE = (1 &lt;&lt; 3),
  G_APPLICATION_SEND_ENVIRONMENT    =  (1 &lt;&lt; 4),

  G_APPLICATION_NON_UNIQUE =           (1 &lt;&lt; 5)
} GApplicationFlags;
</pre>
<p>
Flags used to define the behaviour of a <a class="link" href="GApplication.html" title="GApplication"><span class="type">GApplication</span></a>.
</p>
<div class="variablelist"><table border="0" class="variablelist">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody>
<tr>
<td><p><a name="G-APPLICATION-FLAGS-NONE:CAPS"></a><span class="term"><code class="literal">G_APPLICATION_FLAGS_NONE</code></span></p></td>
<td>Default
</td>
</tr>
<tr>
<td><p><a name="G-APPLICATION-IS-SERVICE:CAPS"></a><span class="term"><code class="literal">G_APPLICATION_IS_SERVICE</code></span></p></td>
<td>Run as a service. In this mode, registration
     fails if the service is already running, and the application
     will initially wait up to 10 seconds for an initial activation
     message to arrive.
</td>
</tr>
<tr>
<td><p><a name="G-APPLICATION-IS-LAUNCHER:CAPS"></a><span class="term"><code class="literal">G_APPLICATION_IS_LAUNCHER</code></span></p></td>
<td>Don't try to become the primary instance.
</td>
</tr>
<tr>
<td><p><a name="G-APPLICATION-HANDLES-OPEN:CAPS"></a><span class="term"><code class="literal">G_APPLICATION_HANDLES_OPEN</code></span></p></td>
<td>This application handles opening files (in
    the primary instance). Note that this flag only affects the default
    implementation of <code class="function">local_command_line()</code>, and has no effect if
    <a class="link" href="GApplication.html#G-APPLICATION-HANDLES-COMMAND-LINE:CAPS"><code class="literal">G_APPLICATION_HANDLES_COMMAND_LINE</code></a> is given.
    See <a class="link" href="GApplication.html#g-application-run" title="g_application_run ()"><code class="function">g_application_run()</code></a> for details.
</td>
</tr>
<tr>
<td><p><a name="G-APPLICATION-HANDLES-COMMAND-LINE:CAPS"></a><span class="term"><code class="literal">G_APPLICATION_HANDLES_COMMAND_LINE</code></span></p></td>
<td>This application handles command line
    arguments (in the primary instance). Note that this flag only affect
    the default implementation of <code class="function">local_command_line()</code>.
    See <a class="link" href="GApplication.html#g-application-run" title="g_application_run ()"><code class="function">g_application_run()</code></a> for details.
</td>
</tr>
<tr>
<td><p><a name="G-APPLICATION-SEND-ENVIRONMENT:CAPS"></a><span class="term"><code class="literal">G_APPLICATION_SEND_ENVIRONMENT</code></span></p></td>
<td>Send the environment of the
    launching process to the primary instance. Set this flag if your
    application is expected to behave differently depending on certain
    environment variables. For instance, an editor might be expected
    to use the <code class="envar">GIT_COMMITTER_NAME</code> environment variable
    when editing a git commit message. The environment is available
    to the <a class="link" href="GApplication.html#GApplication-command-line" title='The "command-line" signal'><span class="type">"command-line"</span></a> signal handler, via
    <a class="link" href="GApplicationCommandLine.html#g-application-command-line-getenv" title="g_application_command_line_getenv ()"><code class="function">g_application_command_line_getenv()</code></a>.
</td>
</tr>
<tr>
<td><p><a name="G-APPLICATION-NON-UNIQUE:CAPS"></a><span class="term"><code class="literal">G_APPLICATION_NON_UNIQUE</code></span></p></td>
<td>Make no attempts to do any of the typical
    single-instance application negotiation, even if the application
    ID is given.  The application neither attempts to become the
    owner of the application ID nor does it check if an existing
    owner already exists.  Everything occurs in the local process.
    Since: 2.30.
</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.28</p>
</div>
<hr>
<div class="refsect2">
<a name="g-application-id-is-valid"></a><h3>g_application_id_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_application_id_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> *application_id</code></em>);</pre>
<p>
Checks if <em class="parameter"><code>application_id</code></em> is a valid application identifier.
</p>
<p>
A valid ID is required for calls to <a class="link" href="GApplication.html#g-application-new" title="g_application_new ()"><code class="function">g_application_new()</code></a> and
<a class="link" href="GApplication.html#g-application-set-application-id" title="g_application_set_application_id ()"><code class="function">g_application_set_application_id()</code></a>.
</p>
<p>
For convenience, the restrictions on application identifiers are
reproduced here:
</p>
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">Application identifiers must contain only the ASCII characters "[A-Z][a-z][0-9]_-." and must not begin with a digit.</li>
<li class="listitem">Application identifiers must contain at least one '.' (period) character (and thus at least three elements).</li>
<li class="listitem">Application identifiers must not begin or end with a '.' (period) character.</li>
<li class="listitem">Application identifiers must not contain consecutive '.' (period) characters.</li>
<li class="listitem">Application identifiers must not exceed 255 characters.</li>
</ul></div>
<p>
</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>application_id</code></em> :</span></p></td>
<td>a potential application identifier</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>application_id</code></em> is valid</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="g-application-new"></a><h3>g_application_new ()</h3>
<pre class="programlisting"><a class="link" href="GApplication.html" title="GApplication"><span class="returnvalue">GApplication</span></a> *      g_application_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> *application_id</code></em>,
                                                         <em class="parameter"><code><a class="link" href="GApplication.html#GApplicationFlags"><span class="type">GApplicationFlags</span></a> flags</code></em>);</pre>
<p>
Creates a new <a class="link" href="GApplication.html" title="GApplication"><span class="type">GApplication</span></a> instance.
</p>
<p>
If non-<a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>, the application id must be valid.  See
<a class="link" href="GApplication.html#g-application-id-is-valid" title="g_application_id_is_valid ()"><code class="function">g_application_id_is_valid()</code></a>.
</p>
<p>
If no application ID is given then some features of <a class="link" href="GApplication.html" title="GApplication"><span class="type">GApplication</span></a>
(most notably application uniqueness) will be disabled.
</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>application_id</code></em> :</span></p></td>
<td>the application id. <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"><em class="parameter"><code>flags</code></em> :</span></p></td>
<td>the application flags</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>a new <a class="link" href="GApplication.html" title="GApplication"><span class="type">GApplication</span></a> instance</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="g-application-get-application-id"></a><h3>g_application_get_application_id ()</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_application_get_application_id    (<em class="parameter"><code><a class="link" href="GApplication.html" title="GApplication"><span class="type">GApplication</span></a> *application</code></em>);</pre>
<p>
Gets the unique identifier for <em class="parameter"><code>application</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>application</code></em> :</span></p></td>
<td>a <a class="link" href="GApplication.html" title="GApplication"><span class="type">GApplication</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>the identifier for <em class="parameter"><code>application</code></em>, owned by <em class="parameter"><code>application</code></em>
</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.28</p>
</div>
<hr>
<div class="refsect2">
<a name="g-application-set-application-id"></a><h3>g_application_set_application_id ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>                g_application_set_application_id    (<em class="parameter"><code><a class="link" href="GApplication.html" title="GApplication"><span class="type">GApplication</span></a> *application</code></em>,
                                                         <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> *application_id</code></em>);</pre>
<p>
Sets the unique identifier for <em class="parameter"><code>application</code></em>.
</p>
<p>
The application id can only be modified if <em class="parameter"><code>application</code></em> has not yet
been registered.
</p>
<p>
If non-<a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>, the application id must be valid.  See
<a class="link" href="GApplication.html#g-application-id-is-valid" title="g_application_id_is_valid ()"><code class="function">g_application_id_is_valid()</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>application</code></em> :</span></p></td>
<td>a <a class="link" href="GApplication.html" title="GApplication"><span class="type">GApplication</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>application_id</code></em> :</span></p></td>
<td>the identifier for <em class="parameter"><code>application</code></em>. <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-application-get-inactivity-timeout"></a><h3>g_application_get_inactivity_timeout ()</h3>
<pre class="programlisting"><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#guint"><span class="returnvalue">guint</span></a>               g_application_get_inactivity_timeout
                                                        (<em class="parameter"><code><a class="link" href="GApplication.html" title="GApplication"><span class="type">GApplication</span></a> *application</code></em>);</pre>
<p>
Gets the current inactivity timeout for the application.
</p>
<p>
This is the amount of time (in milliseconds) after the last call to
<a class="link" href="GApplication.html#g-application-release" title="g_application_release ()"><code class="function">g_application_release()</code></a> before the application stops running.
</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>application</code></em> :</span></p></td>
<td>a <a class="link" href="GApplication.html" title="GApplication"><span class="type">GApplication</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>the timeout, in milliseconds</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.28</p>
</div>
<hr>
<div class="refsect2">
<a name="g-application-set-inactivity-timeout"></a><h3>g_application_set_inactivity_timeout ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>                g_application_set_inactivity_timeout
                                                        (<em class="parameter"><code><a class="link" href="GApplication.html" title="GApplication"><span class="type">GApplication</span></a> *application</code></em>,
                                                         <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#guint"><span class="type">guint</span></a> inactivity_timeout</code></em>);</pre>
<p>
Sets the current inactivity timeout for the application.
</p>
<p>
This is the amount of time (in milliseconds) after the last call to
<a class="link" href="GApplication.html#g-application-release" title="g_application_release ()"><code class="function">g_application_release()</code></a> before the application stops running.
</p>
<p>
This call has no side effects of its own.  The value set here is only
used for next time <a class="link" href="GApplication.html#g-application-release" title="g_application_release ()"><code class="function">g_application_release()</code></a> drops the use count to
zero.  Any timeouts currently in progress are not impacted.
</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>application</code></em> :</span></p></td>
<td>a <a class="link" href="GApplication.html" title="GApplication"><span class="type">GApplication</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>inactivity_timeout</code></em> :</span></p></td>
<td>the timeout, in milliseconds</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.28</p>
</div>
<hr>
<div class="refsect2">
<a name="g-application-get-flags"></a><h3>g_application_get_flags ()</h3>
<pre class="programlisting"><a class="link" href="GApplication.html#GApplicationFlags"><span class="returnvalue">GApplicationFlags</span></a>   g_application_get_flags             (<em class="parameter"><code><a class="link" href="GApplication.html" title="GApplication"><span class="type">GApplication</span></a> *application</code></em>);</pre>
<p>
Gets the flags for <em class="parameter"><code>application</code></em>.
</p>
<p>
See <a class="link" href="GApplication.html#GApplicationFlags"><span class="type">GApplicationFlags</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"><em class="parameter"><code>application</code></em> :</span></p></td>
<td>a <a class="link" href="GApplication.html" title="GApplication"><span class="type">GApplication</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>the flags for <em class="parameter"><code>application</code></em>
</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.28</p>
</div>
<hr>
<div class="refsect2">
<a name="g-application-set-flags"></a><h3>g_application_set_flags ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>                g_application_set_flags             (<em class="parameter"><code><a class="link" href="GApplication.html" title="GApplication"><span class="type">GApplication</span></a> *application</code></em>,
                                                         <em class="parameter"><code><a class="link" href="GApplication.html#GApplicationFlags"><span class="type">GApplicationFlags</span></a> flags</code></em>);</pre>
<p>
Sets the flags for <em class="parameter"><code>application</code></em>.
</p>
<p>
The flags can only be modified if <em class="parameter"><code>application</code></em> has not yet been
registered.
</p>
<p>
See <a class="link" href="GApplication.html#GApplicationFlags"><span class="type">GApplicationFlags</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"><em class="parameter"><code>application</code></em> :</span></p></td>
<td>a <a class="link" href="GApplication.html" title="GApplication"><span class="type">GApplication</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>flags</code></em> :</span></p></td>
<td>the flags for <em class="parameter"><code>application</code></em>
</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.28</p>
</div>
<hr>
<div class="refsect2">
<a name="g-application-get-dbus-connection"></a><h3>g_application_get_dbus_connection ()</h3>
<pre class="programlisting"><a class="link" href="GDBusConnection.html" title="GDBusConnection"><span class="returnvalue">GDBusConnection</span></a> *   g_application_get_dbus_connection   (<em class="parameter"><code><a class="link" href="GApplication.html" title="GApplication"><span class="type">GApplication</span></a> *application</code></em>);</pre>
<p>
Gets the <a class="link" href="GDBusConnection.html" title="GDBusConnection"><span class="type">GDBusConnection</span></a> being used by the application, or <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>.
</p>
<p>
If <a class="link" href="GApplication.html" title="GApplication"><span class="type">GApplication</span></a> is using its D-Bus backend then this function will
return the <a class="link" href="GDBusConnection.html" title="GDBusConnection"><span class="type">GDBusConnection</span></a> being used for uniqueness and
communication with the desktop environment and other instances of the
application.
</p>
<p>
If <a class="link" href="GApplication.html" title="GApplication"><span class="type">GApplication</span></a> is not using D-Bus 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>.  This includes the situation where the D-Bus backend would
normally be in use but we were unable to connect to the bus.
</p>
<p>
This function must not be called before the application has been
registered.  See <a class="link" href="GApplication.html#g-application-get-is-registered" title="g_application_get_is_registered ()"><code class="function">g_application_get_is_registered()</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>application</code></em> :</span></p></td>
<td>a <a class="link" href="GApplication.html" title="GApplication"><span class="type">GApplication</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>a <a class="link" href="GDBusConnection.html" title="GDBusConnection"><span class="type">GDBusConnection</span></a>, 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="Don't free data after the code is done."><span class="acronym">transfer none</span></acronym>]</span>
</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.34</p>
</div>
<hr>
<div class="refsect2">
<a name="g-application-get-dbus-object-path"></a><h3>g_application_get_dbus_object_path ()</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_application_get_dbus_object_path  (<em class="parameter"><code><a class="link" href="GApplication.html" title="GApplication"><span class="type">GApplication</span></a> *application</code></em>);</pre>
<p>
Gets the D-Bus object path being used by the application, or <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>.
</p>
<p>
If <a class="link" href="GApplication.html" title="GApplication"><span class="type">GApplication</span></a> is using its D-Bus backend then this function will
return the D-Bus object path that <a class="link" href="GApplication.html" title="GApplication"><span class="type">GApplication</span></a> is using.  If the
application is the primary instance then there is an object published
at this path.  If the application is not the primary instance then
the result of this function is undefined.
</p>
<p>
If <a class="link" href="GApplication.html" title="GApplication"><span class="type">GApplication</span></a> is not using D-Bus 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>.  This includes the situation where the D-Bus backend would
normally be in use but we were unable to connect to the bus.
</p>
<p>
This function must not be called before the application has been
registered.  See <a class="link" href="GApplication.html#g-application-get-is-registered" title="g_application_get_is_registered ()"><code class="function">g_application_get_is_registered()</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>application</code></em> :</span></p></td>
<td>a <a class="link" href="GApplication.html" title="GApplication"><span class="type">GApplication</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>the object path, or <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>
</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.34</p>
</div>
<hr>
<div class="refsect2">
<a name="g-application-set-action-group"></a><h3>g_application_set_action_group ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>                g_application_set_action_group      (<em class="parameter"><code><a class="link" href="GApplication.html" title="GApplication"><span class="type">GApplication</span></a> *application</code></em>,
                                                         <em class="parameter"><code><a class="link" href="GActionGroup.html" title="GActionGroup"><span class="type">GActionGroup</span></a> *action_group</code></em>);</pre>
<div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;">
<h3 class="title">Warning</h3>
<p><code class="literal">g_application_set_action_group</code> has been deprecated since version 2.32 and should not be used in newly-written code. Use the <a class="link" href="GActionMap.html" title="GActionMap"><span class="type">GActionMap</span></a> interface instead.  Never ever
mix use of this API with use of <a class="link" href="GActionMap.html" title="GActionMap"><span class="type">GActionMap</span></a> on the same <em class="parameter"><code>application</code></em>
or things will go very badly wrong.  This function is known to
introduce buggy behaviour (ie: signals not emitted on changes to the
action group), so you should really use <a class="link" href="GActionMap.html" title="GActionMap"><span class="type">GActionMap</span></a> instead.</p>
</div>
<p>
This used to be how actions were associated with a <a class="link" href="GApplication.html" title="GApplication"><span class="type">GApplication</span></a>.
Now there is <a class="link" href="GActionMap.html" title="GActionMap"><span class="type">GActionMap</span></a> for that.
</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>application</code></em> :</span></p></td>
<td>a <a class="link" href="GApplication.html" title="GApplication"><span class="type">GApplication</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>action_group</code></em> :</span></p></td>
<td>a <a class="link" href="GActionGroup.html" title="GActionGroup"><span class="type">GActionGroup</span></a>, 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>
</tbody>
</table></div>
<p class="since">Since 2.28</p>
</div>
<hr>
<div class="refsect2">
<a name="g-application-get-is-registered"></a><h3>g_application_get_is_registered ()</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_application_get_is_registered     (<em class="parameter"><code><a class="link" href="GApplication.html" title="GApplication"><span class="type">GApplication</span></a> *application</code></em>);</pre>
<p>
Checks if <em class="parameter"><code>application</code></em> is registered.
</p>
<p>
An application is registered if <a class="link" href="GApplication.html#g-application-register" title="g_application_register ()"><code class="function">g_application_register()</code></a> has been
successfully called.
</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>application</code></em> :</span></p></td>
<td>a <a class="link" href="GApplication.html" title="GApplication"><span class="type">GApplication</span></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 <em class="parameter"><code>application</code></em> is registered</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.28</p>
</div>
<hr>
<div class="refsect2">
<a name="g-application-get-is-remote"></a><h3>g_application_get_is_remote ()</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_application_get_is_remote         (<em class="parameter"><code><a class="link" href="GApplication.html" title="GApplication"><span class="type">GApplication</span></a> *application</code></em>);</pre>
<p>
Checks if <em class="parameter"><code>application</code></em> is remote.
</p>
<p>
If <em class="parameter"><code>application</code></em> is remote then it means that another instance of
application already exists (the 'primary' instance).  Calls to
perform actions on <em class="parameter"><code>application</code></em> will result in the actions being
performed by the primary instance.
</p>
<p>
The value of this property cannot be accessed before
<a class="link" href="GApplication.html#g-application-register" title="g_application_register ()"><code class="function">g_application_register()</code></a> has been called.  See
<a class="link" href="GApplication.html#g-application-get-is-registered" title="g_application_get_is_registered ()"><code class="function">g_application_get_is_registered()</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>application</code></em> :</span></p></td>
<td>a <a class="link" href="GApplication.html" title="GApplication"><span class="type">GApplication</span></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 <em class="parameter"><code>application</code></em> is remote</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.28</p>
</div>
<hr>
<div class="refsect2">
<a name="g-application-register"></a><h3>g_application_register ()</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_application_register              (<em class="parameter"><code><a class="link" href="GApplication.html" title="GApplication"><span class="type">GApplication</span></a> *application</code></em>,
                                                         <em class="parameter"><code><a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a> *cancellable</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>
Attempts registration of the application.
</p>
<p>
This is the point at which the application discovers if it is the
primary instance or merely acting as a remote for an already-existing
primary instance.  This is implemented by attempting to acquire the
application identifier as a unique bus name on the session bus using
GDBus.
</p>
<p>
If there is no application ID or if <a class="link" href="GApplication.html#G-APPLICATION-NON-UNIQUE:CAPS"><code class="literal">G_APPLICATION_NON_UNIQUE</code></a> was
given, then this process will always become the primary instance.
</p>
<p>
Due to the internal architecture of GDBus, method calls can be
dispatched at any time (even if a main loop is not running).  For
this reason, you must ensure that any object paths that you wish to
register are registered before calling this function.
</p>
<p>
If the application has already been registered then <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> is
returned with no work performed.
</p>
<p>
The <a class="link" href="GApplication.html#GApplication-startup" title='The "startup" signal'><span class="type">"startup"</span></a> signal is emitted if registration succeeds
and <em class="parameter"><code>application</code></em> is the primary instance (including the non-unique
case).
</p>
<p>
In the event of an error (such as <em class="parameter"><code>cancellable</code></em> being cancelled, or a
failure to connect to the session bus), <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> is returned and <em class="parameter"><code>error</code></em>
is set appropriately.
</p>
<p>
Note: the return value of this function is not an indicator that this
instance is or is not the primary instance of the application.  See
<a class="link" href="GApplication.html#g-application-get-is-remote" title="g_application_get_is_remote ()"><code class="function">g_application_get_is_remote()</code></a> for that.
</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>application</code></em> :</span></p></td>
<td>a <a class="link" href="GApplication.html" title="GApplication"><span class="type">GApplication</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>cancellable</code></em> :</span></p></td>
<td>a <a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a>, 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"><em class="parameter"><code>error</code></em> :</span></p></td>
<td>a pointer to a NULL <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 registration succeeded</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.28</p>
</div>
<hr>
<div class="refsect2">
<a name="g-application-hold"></a><h3>g_application_hold ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>                g_application_hold                  (<em class="parameter"><code><a class="link" href="GApplication.html" title="GApplication"><span class="type">GApplication</span></a> *application</code></em>);</pre>
<p>
Increases the use count of <em class="parameter"><code>application</code></em>.
</p>
<p>
Use this function to indicate that the application has a reason to
continue to run.  For example, <a class="link" href="GApplication.html#g-application-hold" title="g_application_hold ()"><code class="function">g_application_hold()</code></a> is called by GTK+
when a toplevel window is on the screen.
</p>
<p>
To cancel the hold, call <a class="link" href="GApplication.html#g-application-release" title="g_application_release ()"><code class="function">g_application_release()</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>application</code></em> :</span></p></td>
<td>a <a class="link" href="GApplication.html" title="GApplication"><span class="type">GApplication</span></a>
</td>
</tr></tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="g-application-release"></a><h3>g_application_release ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>                g_application_release               (<em class="parameter"><code><a class="link" href="GApplication.html" title="GApplication"><span class="type">GApplication</span></a> *application</code></em>);</pre>
<p>
Decrease the use count of <em class="parameter"><code>application</code></em>.
</p>
<p>
When the use count reaches zero, the application will stop running.
</p>
<p>
Never call this function except to cancel the effect of a previous
call to <a class="link" href="GApplication.html#g-application-hold" title="g_application_hold ()"><code class="function">g_application_hold()</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>application</code></em> :</span></p></td>
<td>a <a class="link" href="GApplication.html" title="GApplication"><span class="type">GApplication</span></a>
</td>
</tr></tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="g-application-quit"></a><h3>g_application_quit ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>                g_application_quit                  (<em class="parameter"><code><a class="link" href="GApplication.html" title="GApplication"><span class="type">GApplication</span></a> *application</code></em>);</pre>
<p>
Immediately quits the application.
</p>
<p>
Upon return to the mainloop, <a class="link" href="GApplication.html#g-application-run" title="g_application_run ()"><code class="function">g_application_run()</code></a> will return,
calling only the 'shutdown' function before doing so.
</p>
<p>
The hold count is ignored.
</p>
<p>
The result of calling <a class="link" href="GApplication.html#g-application-run" title="g_application_run ()"><code class="function">g_application_run()</code></a> again after it returns is
unspecified.
</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>application</code></em> :</span></p></td>
<td>a <a class="link" href="GApplication.html" title="GApplication"><span class="type">GApplication</span></a>
</td>
</tr></tbody>
</table></div>
<p class="since">Since 2.32</p>
</div>
<hr>
<div class="refsect2">
<a name="g-application-activate"></a><h3>g_application_activate ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>                g_application_activate              (<em class="parameter"><code><a class="link" href="GApplication.html" title="GApplication"><span class="type">GApplication</span></a> *application</code></em>);</pre>
<p>
Activates the application.
</p>
<p>
In essence, this results in the <a class="link" href="GApplication.html#GApplication-activate" title='The "activate" signal'><span class="type">"activate"</span></a> signal being
emitted in the primary instance.
</p>
<p>
The application must be registered before calling 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>application</code></em> :</span></p></td>
<td>a <a class="link" href="GApplication.html" title="GApplication"><span class="type">GApplication</span></a>
</td>
</tr></tbody>
</table></div>
<p class="since">Since 2.28</p>
</div>
<hr>
<div class="refsect2">
<a name="g-application-open"></a><h3>g_application_open ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>                g_application_open                  (<em class="parameter"><code><a class="link" href="GApplication.html" title="GApplication"><span class="type">GApplication</span></a> *application</code></em>,
                                                         <em class="parameter"><code><a class="link" href="GFile.html" title="GFile"><span class="type">GFile</span></a> **files</code></em>,
                                                         <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gint"><span class="type">gint</span></a> n_files</code></em>,
                                                         <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> *hint</code></em>);</pre>
<p>
Opens the given files.
</p>
<p>
In essence, this results in the <a class="link" href="GApplication.html#GApplication-open" title='The "open" signal'><span class="type">"open"</span></a> signal being emitted
in the primary instance.
</p>
<p>
<em class="parameter"><code>n_files</code></em> must be greater than zero.
</p>
<p>
<em class="parameter"><code>hint</code></em> is simply passed through to the ::open signal.  It is
intended to be used by applications that have multiple modes for
opening files (eg: "view" vs "edit", etc).  Unless you have a need
for this functionality, you should use "".
</p>
<p>
The application must be registered before calling this function
and it must have the <a class="link" href="GApplication.html#G-APPLICATION-HANDLES-OPEN:CAPS"><code class="literal">G_APPLICATION_HANDLES_OPEN</code></a> flag set.
</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>application</code></em> :</span></p></td>
<td>a <a class="link" href="GApplication.html" title="GApplication"><span class="type">GApplication</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>files</code></em> :</span></p></td>
<td>an array of <a href="GFile.html"><span class="type">GFiles</span></a> to open. <span class="annotation">[<acronym title="Parameter points to an array of items."><span class="acronym">array</span></acronym> length=n_files]</span>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>n_files</code></em> :</span></p></td>
<td>the length of the <em class="parameter"><code>files</code></em> array</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>hint</code></em> :</span></p></td>
<td>a hint (or ""), but never <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>
</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.28</p>
</div>
<hr>
<div class="refsect2">
<a name="g-application-run"></a><h3>g_application_run ()</h3>
<pre class="programlisting"><span class="returnvalue">int</span>                 g_application_run                   (<em class="parameter"><code><a class="link" href="GApplication.html" title="GApplication"><span class="type">GApplication</span></a> *application</code></em>,
                                                         <em class="parameter"><code><span class="type">int</span> argc</code></em>,
                                                         <em class="parameter"><code><span class="type">char</span> **argv</code></em>);</pre>
<p>
Runs the application.
</p>
<p>
This function is intended to be run from <code class="function">main()</code> and its return value
is intended to be returned by <code class="function">main()</code>. Although you are expected to pass
the <em class="parameter"><code>argc</code></em>, <em class="parameter"><code>argv</code></em> parameters from <code class="function">main()</code> to this function, it is possible
to pass <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> if <em class="parameter"><code>argv</code></em> is not available or commandline handling is not
required.
</p>
<p>
First, the <code class="function">local_command_line()</code> virtual function is invoked.
This function always runs on the local instance. It gets passed 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>-terminated copy of <em class="parameter"><code>argv</code></em> and is expected to remove the arguments
that it handled (shifting up remaining arguments). See
<a class="xref" href="GApplicationCommandLine.html#gapplication-example-cmdline2" title="Example 23. Split commandline handling">Example 23, “Split commandline handling”</a> for an example of
parsing <em class="parameter"><code>argv</code></em> manually. Alternatively, you may use the <a href="http://library.gnome.org/devel/glib/unstable/glib-Commandline-option-parser.html#GOptionContext"><span class="type">GOptionContext</span></a> API,
after setting <code class="literal">argc = g_strv_length (argv);</code>.
</p>
<p>
The last argument to <code class="function">local_command_line()</code> is a pointer to the <em class="parameter"><code>status</code></em>
variable which can used to set the exit status that is returned from
<a class="link" href="GApplication.html#g-application-run" title="g_application_run ()"><code class="function">g_application_run()</code></a>.
</p>
<p>
If <code class="function">local_command_line()</code> returns <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a>, the command line is expected
to be completely handled, including possibly registering as the primary
instance, calling <a class="link" href="GApplication.html#g-application-activate" title="g_application_activate ()"><code class="function">g_application_activate()</code></a> or <a class="link" href="GApplication.html#g-application-open" title="g_application_open ()"><code class="function">g_application_open()</code></a>, etc.
</p>
<p>
If <code class="function">local_command_line()</code> returns <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> then the application is registered
and the <a class="link" href="GApplication.html#GApplication-command-line" title='The "command-line" signal'><span class="type">"command-line"</span></a> signal is emitted in the primary
instance (which may or may not be this instance). The signal handler
gets passed a <a class="link" href="GApplicationCommandLine.html" title="GApplicationCommandLine"><span class="type">GApplicationCommandLine</span></a> object that (among other things)
contains the remaining commandline arguments that have not been handled
by <code class="function">local_command_line()</code>.
</p>
<p>
If the application has the <a class="link" href="GApplication.html#G-APPLICATION-HANDLES-COMMAND-LINE:CAPS"><code class="literal">G_APPLICATION_HANDLES_COMMAND_LINE</code></a>
flag set then the default implementation of <code class="function">local_command_line()</code>
always returns <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> immediately, resulting in the commandline
always being handled in the primary instance.
</p>
<p>
Otherwise, the default implementation of <code class="function">local_command_line()</code> tries
to do a couple of things that are probably reasonable for most
applications.  First, <a class="link" href="GApplication.html#g-application-register" title="g_application_register ()"><code class="function">g_application_register()</code></a> is called to attempt
to register the application.  If that works, then the command line
arguments are inspected.  If no commandline arguments are given, then
<a class="link" href="GApplication.html#g-application-activate" title="g_application_activate ()"><code class="function">g_application_activate()</code></a> is called.  If commandline arguments are
given and the <a class="link" href="GApplication.html#G-APPLICATION-HANDLES-OPEN:CAPS"><code class="literal">G_APPLICATION_HANDLES_OPEN</code></a> flag is set then they
are assumed to be filenames and <a class="link" href="GApplication.html#g-application-open" title="g_application_open ()"><code class="function">g_application_open()</code></a> is called.
</p>
<p>
If you need to handle commandline arguments that are not filenames,
and you don't mind commandline handling to happen in the primary
instance, you should set <a class="link" href="GApplication.html#G-APPLICATION-HANDLES-COMMAND-LINE:CAPS"><code class="literal">G_APPLICATION_HANDLES_COMMAND_LINE</code></a> and
process the commandline arguments in your <a class="link" href="GApplication.html#GApplication-command-line" title='The "command-line" signal'><span class="type">"command-line"</span></a>
signal handler, either manually or using the <a href="http://library.gnome.org/devel/glib/unstable/glib-Commandline-option-parser.html#GOptionContext"><span class="type">GOptionContext</span></a> API.
</p>
<p>
If you are interested in doing more complicated local handling of the
commandline then you should implement your own <a class="link" href="GApplication.html" title="GApplication"><span class="type">GApplication</span></a> subclass
and override <code class="function">local_command_line()</code>. In this case, you most likely want
to return <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> from your <code class="function">local_command_line()</code> implementation to
suppress the default handling. See
<a class="xref" href="GApplicationCommandLine.html#gapplication-example-cmdline2" title="Example 23. Split commandline handling">Example 23, “Split commandline handling”</a> for an example.
</p>
<p>
If, after the above is done, the use count of the application is zero
then the exit status is returned immediately.  If the use count is
non-zero then the default main context is iterated until the use count
falls to zero, at which point 0 is returned.
</p>
<p>
If the <a class="link" href="GApplication.html#G-APPLICATION-IS-SERVICE:CAPS"><code class="literal">G_APPLICATION_IS_SERVICE</code></a> flag is set, then the service will
run for as much as 10 seconds with a use count of zero while waiting
for the message that caused the activation to arrive.  After that,
if the use count falls to zero the application will exit immediately,
except in the case that <a class="link" href="GApplication.html#g-application-set-inactivity-timeout" title="g_application_set_inactivity_timeout ()"><code class="function">g_application_set_inactivity_timeout()</code></a> is in
use.
</p>
<p>
This function sets the prgname (<a href="http://library.gnome.org/devel/glib/unstable/glib-Miscellaneous-Utility-Functions.html#g-set-prgname"><code class="function">g_set_prgname()</code></a>), if not already set,
to the basename of argv[0].  Since 2.38, if <a class="link" href="GApplication.html#G-APPLICATION-IS-SERVICE:CAPS"><code class="literal">G_APPLICATION_IS_SERVICE</code></a>
is specified, the prgname is set to the application ID.  The main
impact of this is is that the wmclass of windows created by Gtk+ will
be set accordingly, which helps the window manager determine which
application is showing the window.
</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>application</code></em> :</span></p></td>
<td>a <a class="link" href="GApplication.html" title="GApplication"><span class="type">GApplication</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>argc</code></em> :</span></p></td>
<td>the argc from <code class="function">main()</code> (or 0 if <em class="parameter"><code>argv</code></em> is <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"><em class="parameter"><code>argv</code></em> :</span></p></td>
<td>the argv from <code class="function">main()</code>, 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="Parameter points to an array of items."><span class="acronym">array</span></acronym> length=argc][<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>the exit status</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.28</p>
</div>
<hr>
<div class="refsect2">
<a name="g-application-set-default"></a><h3>g_application_set_default ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>                g_application_set_default           (<em class="parameter"><code><a class="link" href="GApplication.html" title="GApplication"><span class="type">GApplication</span></a> *application</code></em>);</pre>
<p>
Sets or unsets the default application for the process, as returned
by <a class="link" href="GApplication.html#g-application-get-default" title="g_application_get_default ()"><code class="function">g_application_get_default()</code></a>.
</p>
<p>
This function does not take its own reference on <em class="parameter"><code>application</code></em>.  If
<em class="parameter"><code>application</code></em> is destroyed then the default application will revert
back to <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>application</code></em> :</span></p></td>
<td>the application to set as default, 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></tbody>
</table></div>
<p class="since">Since 2.32</p>
</div>
<hr>
<div class="refsect2">
<a name="g-application-get-default"></a><h3>g_application_get_default ()</h3>
<pre class="programlisting"><a class="link" href="GApplication.html" title="GApplication"><span class="returnvalue">GApplication</span></a> *      g_application_get_default           (<em class="parameter"><code><span class="type">void</span></code></em>);</pre>
<p>
Returns the default <a class="link" href="GApplication.html" title="GApplication"><span class="type">GApplication</span></a> instance for this process.
</p>
<p>
Normally there is only one <a class="link" href="GApplication.html" title="GApplication"><span class="type">GApplication</span></a> per process and it becomes
the default when it is created.  You can exercise more control over
this by using <a class="link" href="GApplication.html#g-application-set-default" title="g_application_set_default ()"><code class="function">g_application_set_default()</code></a>.
</p>
<p>
If there is no default application then <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> is returned.
</p>
<div class="variablelist"><table border="0" class="variablelist">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody><tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>the default application for this process, 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="Don't free data after the code is done."><span class="acronym">transfer none</span></acronym>]</span>
</td>
</tr></tbody>
</table></div>
<p class="since">Since 2.32</p>
</div>
<hr>
<div class="refsect2">
<a name="g-application-mark-busy"></a><h3>g_application_mark_busy ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>                g_application_mark_busy             (<em class="parameter"><code><a class="link" href="GApplication.html" title="GApplication"><span class="type">GApplication</span></a> *application</code></em>);</pre>
<p>
Increases the busy count of <em class="parameter"><code>application</code></em>.
</p>
<p>
Use this function to indicate that the application is busy, for instance
while a long running operation is pending.
</p>
<p>
The busy state will be exposed to other processes, so a session shell will
use that information to indicate the state to the user (e.g. with a
spinner).
</p>
<p>
To cancel the busy indication, use <a class="link" href="GApplication.html#g-application-unmark-busy" title="g_application_unmark_busy ()"><code class="function">g_application_unmark_busy()</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>application</code></em> :</span></p></td>
<td>a <a class="link" href="GApplication.html" title="GApplication"><span class="type">GApplication</span></a>
</td>
</tr></tbody>
</table></div>
<p class="since">Since 2.38</p>
</div>
<hr>
<div class="refsect2">
<a name="g-application-unmark-busy"></a><h3>g_application_unmark_busy ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>                g_application_unmark_busy           (<em class="parameter"><code><a class="link" href="GApplication.html" title="GApplication"><span class="type">GApplication</span></a> *application</code></em>);</pre>
<p>
Decreases the busy count of <em class="parameter"><code>application</code></em>.
</p>
<p>
When the busy count reaches zero, the new state will be propagated
to other processes.
</p>
<p>
This function must only be called to cancel the effect of a previous
call to <a class="link" href="GApplication.html#g-application-mark-busy" title="g_application_mark_busy ()"><code class="function">g_application_mark_busy()</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>application</code></em> :</span></p></td>
<td>a <a class="link" href="GApplication.html" title="GApplication"><span class="type">GApplication</span></a>
</td>
</tr></tbody>
</table></div>
<p class="since">Since 2.38</p>
</div>
</div>
<div class="refsect1">
<a name="GApplication.property-details"></a><h2>Property Details</h2>
<div class="refsect2">
<a name="GApplication--action-group"></a><h3>The <code class="literal">"action-group"</code> property</h3>
<pre class="programlisting">  "action-group"             <a class="link" href="GActionGroup.html" title="GActionGroup"><span class="type">GActionGroup</span></a>*         : Write</pre>
<p>The group of actions that the application exports.</p>
</div>
<hr>
<div class="refsect2">
<a name="GApplication--application-id"></a><h3>The <code class="literal">"application-id"</code> property</h3>
<pre class="programlisting">  "application-id"           <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a>*                : Read / Write / Construct</pre>
<p>The unique identifier for the application.</p>
<p>Default value: NULL</p>
</div>
<hr>
<div class="refsect2">
<a name="GApplication--flags"></a><h3>The <code class="literal">"flags"</code> property</h3>
<pre class="programlisting">  "flags"                    <a class="link" href="GApplication.html#GApplicationFlags"><span class="type">GApplicationFlags</span></a>     : Read / Write</pre>
<p>Flags specifying the behaviour of the application.</p>
</div>
<hr>
<div class="refsect2">
<a name="GApplication--inactivity-timeout"></a><h3>The <code class="literal">"inactivity-timeout"</code> property</h3>
<pre class="programlisting">  "inactivity-timeout"       <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#guint"><span class="type">guint</span></a>                 : Read / Write</pre>
<p>Time (ms) to stay alive after becoming idle.</p>
<p>Default value: 0</p>
</div>
<hr>
<div class="refsect2">
<a name="GApplication--is-registered"></a><h3>The <code class="literal">"is-registered"</code> property</h3>
<pre class="programlisting">  "is-registered"            <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a>              : Read</pre>
<p>If g_application_register() has been called.</p>
<p>Default value: FALSE</p>
</div>
<hr>
<div class="refsect2">
<a name="GApplication--is-remote"></a><h3>The <code class="literal">"is-remote"</code> property</h3>
<pre class="programlisting">  "is-remote"                <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a>              : Read</pre>
<p>If this application instance is remote.</p>
<p>Default value: FALSE</p>
</div>
</div>
<div class="refsect1">
<a name="GApplication.signal-details"></a><h2>Signal Details</h2>
<div class="refsect2">
<a name="GApplication-activate"></a><h3>The <code class="literal">"activate"</code> signal</h3>
<pre class="programlisting"><span class="returnvalue">void</span>                user_function                      (<a class="link" href="GApplication.html" title="GApplication"><span class="type">GApplication</span></a> *application,
                                                        <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a>      user_data)        : <a href="http://library.gnome.org/devel/gobject/unstable/gobject-Signals.html#G-SIGNAL-RUN-LAST:CAPS"><code class="literal">Run Last</code></a></pre>
<p>
The ::activate signal is emitted on the primary instance when an
activation occurs. See <a class="link" href="GApplication.html#g-application-activate" title="g_application_activate ()"><code class="function">g_application_activate()</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>application</code></em> :</span></p></td>
<td>the application</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>user_data</code></em> :</span></p></td>
<td>user data set when the signal handler was connected.</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="GApplication-command-line"></a><h3>The <code class="literal">"command-line"</code> signal</h3>
<pre class="programlisting"><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gint"><span class="returnvalue">gint</span></a>                user_function                      (<a class="link" href="GApplication.html" title="GApplication"><span class="type">GApplication</span></a>            *application,
                                                        <a class="link" href="GApplicationCommandLine.html" title="GApplicationCommandLine"><span class="type">GApplicationCommandLine</span></a> *command_line,
                                                        <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a>                 user_data)         : <a href="http://library.gnome.org/devel/gobject/unstable/gobject-Signals.html#G-SIGNAL-RUN-LAST:CAPS"><code class="literal">Run Last</code></a></pre>
<p>
The ::command-line signal is emitted on the primary instance when
a commandline is not handled locally. See <a class="link" href="GApplication.html#g-application-run" title="g_application_run ()"><code class="function">g_application_run()</code></a> and
the <a class="link" href="GApplicationCommandLine.html" title="GApplicationCommandLine"><span class="type">GApplicationCommandLine</span></a> documentation for more information.
</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>application</code></em> :</span></p></td>
<td>the application</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>command_line</code></em> :</span></p></td>
<td>a <a class="link" href="GApplicationCommandLine.html" title="GApplicationCommandLine"><span class="type">GApplicationCommandLine</span></a> representing the
passed commandline</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>user_data</code></em> :</span></p></td>
<td>user data set when the signal handler was connected.</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>An integer that is set as the exit status for the calling
process. See <a class="link" href="GApplicationCommandLine.html#g-application-command-line-set-exit-status" title="g_application_command_line_set_exit_status ()"><code class="function">g_application_command_line_set_exit_status()</code></a>.</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="GApplication-open"></a><h3>The <code class="literal">"open"</code> signal</h3>
<pre class="programlisting"><span class="returnvalue">void</span>                user_function                      (<a class="link" href="GApplication.html" title="GApplication"><span class="type">GApplication</span></a> *application,
                                                        <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a>      files,
                                                        <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gint"><span class="type">gint</span></a>          n_files,
                                                        <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a>        *hint,
                                                        <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a>      user_data)        : <a href="http://library.gnome.org/devel/gobject/unstable/gobject-Signals.html#G-SIGNAL-RUN-LAST:CAPS"><code class="literal">Run Last</code></a></pre>
<p>
The ::open signal is emitted on the primary instance when there are
files to open. See <a class="link" href="GApplication.html#g-application-open" title="g_application_open ()"><code class="function">g_application_open()</code></a> for more information.
</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>application</code></em> :</span></p></td>
<td>the application</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>files</code></em> :</span></p></td>
<td>an array of <a href="GFile.html"><span class="type">GFiles</span></a>. <span class="annotation">[<acronym title="Parameter points to an array of items."><span class="acronym">array</span></acronym> length=n_files][<acronym title="Generics and defining elements of containers and arrays."><span class="acronym">element-type</span></acronym> GFile]</span>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>n_files</code></em> :</span></p></td>
<td>the length of <em class="parameter"><code>files</code></em>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>hint</code></em> :</span></p></td>
<td>a hint provided by the calling instance</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>user_data</code></em> :</span></p></td>
<td>user data set when the signal handler was connected.</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="GApplication-shutdown"></a><h3>The <code class="literal">"shutdown"</code> signal</h3>
<pre class="programlisting"><span class="returnvalue">void</span>                user_function                      (<a class="link" href="GApplication.html" title="GApplication"><span class="type">GApplication</span></a> *application,
                                                        <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a>      user_data)        : <a href="http://library.gnome.org/devel/gobject/unstable/gobject-Signals.html#G-SIGNAL-RUN-LAST:CAPS"><code class="literal">Run Last</code></a></pre>
<p>
The ::shutdown signal is emitted only on the registered primary instance
immediately after the main loop terminates.
</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>application</code></em> :</span></p></td>
<td>the application</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>user_data</code></em> :</span></p></td>
<td>user data set when the signal handler was connected.</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="GApplication-startup"></a><h3>The <code class="literal">"startup"</code> signal</h3>
<pre class="programlisting"><span class="returnvalue">void</span>                user_function                      (<a class="link" href="GApplication.html" title="GApplication"><span class="type">GApplication</span></a> *application,
                                                        <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a>      user_data)        : <a href="http://library.gnome.org/devel/gobject/unstable/gobject-Signals.html#G-SIGNAL-RUN-FIRST:CAPS"><code class="literal">Run First</code></a></pre>
<p>
The ::startup signal is emitted on the primary instance immediately
after registration. See <a class="link" href="GApplication.html#g-application-register" title="g_application_register ()"><code class="function">g_application_register()</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>application</code></em> :</span></p></td>
<td>the application</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>user_data</code></em> :</span></p></td>
<td>user data set when the signal handler was connected.</td>
</tr>
</tbody>
</table></div>
</div>
</div>
</div>
<div class="footer">
<hr>
          Generated by GTK-Doc V1.19</div>
</body>
</html>