This file is indexed.

/usr/include/d/gtkd-3/gio/DBusConnection.d is in libgtkd-3-dev 3.7.5-2build1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

   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
/*
 * This file is part of gtkD.
 *
 * gtkD is free software; you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License
 * as published by the Free Software Foundation; either version 3
 * of the License, or (at your option) any later version, with
 * some exceptions, please read the COPYING file.
 *
 * gtkD is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with gtkD; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
 */

// generated automatically - do not change
// find conversion definition on APILookup.txt
// implement new conversion functionalities on the wrap.utils pakage


module gio.DBusConnection;

private import gio.ActionGroupIF;
private import gio.AsyncInitableIF;
private import gio.AsyncInitableT;
private import gio.AsyncResultIF;
private import gio.Cancellable;
private import gio.Credentials;
private import gio.DBusAuthObserver;
private import gio.DBusInterfaceInfo;
private import gio.DBusMessage;
private import gio.IOStream;
private import gio.InitableIF;
private import gio.InitableT;
private import gio.MenuModel;
private import gio.UnixFDList;
private import gio.c.functions;
public  import gio.c.types;
private import glib.ConstructionException;
private import glib.ErrorG;
private import glib.GException;
private import glib.Str;
private import glib.Variant;
private import glib.VariantType;
private import gobject.Closure;
private import gobject.ObjectG;
private import gobject.Signals;
public  import gtkc.giotypes;
private import std.algorithm;


/**
 * The #GDBusConnection type is used for D-Bus connections to remote
 * peers such as a message buses. It is a low-level API that offers a
 * lot of flexibility. For instance, it lets you establish a connection
 * over any transport that can by represented as an #GIOStream.
 * 
 * This class is rarely used directly in D-Bus clients. If you are writing
 * a D-Bus client, it is often easier to use the g_bus_own_name(),
 * g_bus_watch_name() or g_dbus_proxy_new_for_bus() APIs.
 * 
 * As an exception to the usual GLib rule that a particular object must not
 * be used by two threads at the same time, #GDBusConnection's methods may be
 * called from any thread. This is so that g_bus_get() and g_bus_get_sync()
 * can safely return the same #GDBusConnection when called from any thread.
 * 
 * Most of the ways to obtain a #GDBusConnection automatically initialize it
 * (i.e. connect to D-Bus): for instance, g_dbus_connection_new() and
 * g_bus_get(), and the synchronous versions of those methods, give you an
 * initialized connection. Language bindings for GIO should use
 * g_initable_new() or g_async_initable_new_async(), which also initialize the
 * connection.
 * 
 * If you construct an uninitialized #GDBusConnection, such as via
 * g_object_new(), you must initialize it via g_initable_init() or
 * g_async_initable_init_async() before using its methods or properties.
 * Calling methods or accessing properties on a #GDBusConnection that has not
 * completed initialization successfully is considered to be invalid, and leads
 * to undefined behaviour. In particular, if initialization fails with a
 * #GError, the only valid thing you can do with that #GDBusConnection is to
 * free it with g_object_unref().
 * 
 * ## An example D-Bus server # {#gdbus-server}
 * 
 * Here is an example for a D-Bus server:
 * [gdbus-example-server.c](https://git.gnome.org/browse/glib/tree/gio/tests/gdbus-example-server.c)
 * 
 * ## An example for exporting a subtree # {#gdbus-subtree-server}
 * 
 * Here is an example for exporting a subtree:
 * [gdbus-example-subtree.c](https://git.gnome.org/browse/glib/tree/gio/tests/gdbus-example-subtree.c)
 * 
 * ## An example for file descriptor passing # {#gdbus-unix-fd-client}
 * 
 * Here is an example for passing UNIX file descriptors:
 * [gdbus-unix-fd-client.c](https://git.gnome.org/browse/glib/tree/gio/tests/gdbus-unix-fd-client.c)
 * 
 * ## An example for exporting a GObject # {#gdbus-export}
 * 
 * Here is an example for exporting a #GObject:
 * [gdbus-example-export.c](https://git.gnome.org/browse/glib/tree/gio/tests/gdbus-example-export.c)
 *
 * Since: 2.26
 */
public class DBusConnection : ObjectG, AsyncInitableIF, InitableIF
{
	/** the main Gtk struct */
	protected GDBusConnection* gDBusConnection;

	/** Get the main Gtk struct */
	public GDBusConnection* getDBusConnectionStruct(bool transferOwnership = false)
	{
		if (transferOwnership)
			ownedRef = false;
		return gDBusConnection;
	}

	/** the main Gtk struct as a void* */
	protected override void* getStruct()
	{
		return cast(void*)gDBusConnection;
	}

	protected override void setStruct(GObject* obj)
	{
		gDBusConnection = cast(GDBusConnection*)obj;
		super.setStruct(obj);
	}

	/**
	 * Sets our main struct and passes it to the parent class.
	 */
	public this (GDBusConnection* gDBusConnection, bool ownedRef = false)
	{
		this.gDBusConnection = gDBusConnection;
		super(cast(GObject*)gDBusConnection, ownedRef);
	}

	// add the AsyncInitable capabilities
	mixin AsyncInitableT!(GDBusConnection);

	// add the Initable capabilities
	mixin InitableT!(GDBusConnection);

	/**
	 * Finishes an operation started with g_dbus_connection_new().
	 *
	 * Params:
	 *     res    = A GAsyncResult obtained from the GAsyncReadyCallback
	 *               passed to g_dbus_connection_new().
	 *     address = If true finish an address.
	 *
	 * Throws: GException on failure.
	 * Throws: ConstructionException GTK+ fails to create the object.
	 *
	 * Since: 2.26
	 */
	public this (AsyncResultIF res, bool address = false)
	{
		GError* err = null;
		GDBusConnection* p;

		if ( address )
		{
			p = g_dbus_connection_new_for_address_finish((res is null) ? null : res.getAsyncResultStruct(), &err);
		}
		else
		{
			p = g_dbus_connection_new_finish((res is null) ? null : res.getAsyncResultStruct(), &err);
		}

		if (err !is null)
		{
			throw new GException( new ErrorG(err) );
		}

		if(p is null)
		{
			throw new ConstructionException("null returned by g_dbus_connection_new_finish((res is null) ? null : res.getAsyncResultStruct(), &err)");
		}
		this(p, true);
	}

	/**
	 */

	/** */
	public static GType getType()
	{
		return g_dbus_connection_get_type();
	}

	/**
	 * Synchronously connects and sets up a D-Bus client connection for
	 * exchanging D-Bus messages with an endpoint specified by @address
	 * which must be in the
	 * [D-Bus address format](https://dbus.freedesktop.org/doc/dbus-specification.html#addresses).
	 *
	 * This constructor can only be used to initiate client-side
	 * connections - use g_dbus_connection_new_sync() if you need to act
	 * as the server. In particular, @flags cannot contain the
	 * %G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_SERVER or
	 * %G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_ALLOW_ANONYMOUS flags.
	 *
	 * This is a synchronous failable constructor. See
	 * g_dbus_connection_new_for_address() for the asynchronous version.
	 *
	 * If @observer is not %NULL it may be used to control the
	 * authentication process.
	 *
	 * Params:
	 *     address = a D-Bus address
	 *     flags = flags describing how to make the connection
	 *     observer = a #GDBusAuthObserver or %NULL
	 *     cancellable = a #GCancellable or %NULL
	 *
	 * Returns: a #GDBusConnection or %NULL if @error is set. Free with
	 *     g_object_unref().
	 *
	 * Since: 2.26
	 *
	 * Throws: GException on failure.
	 * Throws: ConstructionException GTK+ fails to create the object.
	 */
	public this(string address, GDBusConnectionFlags flags, DBusAuthObserver observer, Cancellable cancellable)
	{
		GError* err = null;

		auto p = g_dbus_connection_new_for_address_sync(Str.toStringz(address), flags, (observer is null) ? null : observer.getDBusAuthObserverStruct(), (cancellable is null) ? null : cancellable.getCancellableStruct(), &err);

		if (err !is null)
		{
			throw new GException( new ErrorG(err) );
		}

		if(p is null)
		{
			throw new ConstructionException("null returned by new_for_address_sync");
		}

		this(cast(GDBusConnection*) p, true);
	}

	/**
	 * Synchronously sets up a D-Bus connection for exchanging D-Bus messages
	 * with the end represented by @stream.
	 *
	 * If @stream is a #GSocketConnection, then the corresponding #GSocket
	 * will be put into non-blocking mode.
	 *
	 * The D-Bus connection will interact with @stream from a worker thread.
	 * As a result, the caller should not interact with @stream after this
	 * method has been called, except by calling g_object_unref() on it.
	 *
	 * If @observer is not %NULL it may be used to control the
	 * authentication process.
	 *
	 * This is a synchronous failable constructor. See
	 * g_dbus_connection_new() for the asynchronous version.
	 *
	 * Params:
	 *     stream = a #GIOStream
	 *     guid = the GUID to use if a authenticating as a server or %NULL
	 *     flags = flags describing how to make the connection
	 *     observer = a #GDBusAuthObserver or %NULL
	 *     cancellable = a #GCancellable or %NULL
	 *
	 * Returns: a #GDBusConnection or %NULL if @error is set. Free with g_object_unref().
	 *
	 * Since: 2.26
	 *
	 * Throws: GException on failure.
	 * Throws: ConstructionException GTK+ fails to create the object.
	 */
	public this(IOStream stream, string guid, GDBusConnectionFlags flags, DBusAuthObserver observer, Cancellable cancellable)
	{
		GError* err = null;

		auto p = g_dbus_connection_new_sync((stream is null) ? null : stream.getIOStreamStruct(), Str.toStringz(guid), flags, (observer is null) ? null : observer.getDBusAuthObserverStruct(), (cancellable is null) ? null : cancellable.getCancellableStruct(), &err);

		if (err !is null)
		{
			throw new GException( new ErrorG(err) );
		}

		if(p is null)
		{
			throw new ConstructionException("null returned by new_sync");
		}

		this(cast(GDBusConnection*) p, true);
	}

	/**
	 * Asynchronously sets up a D-Bus connection for exchanging D-Bus messages
	 * with the end represented by @stream.
	 *
	 * If @stream is a #GSocketConnection, then the corresponding #GSocket
	 * will be put into non-blocking mode.
	 *
	 * The D-Bus connection will interact with @stream from a worker thread.
	 * As a result, the caller should not interact with @stream after this
	 * method has been called, except by calling g_object_unref() on it.
	 *
	 * If @observer is not %NULL it may be used to control the
	 * authentication process.
	 *
	 * When the operation is finished, @callback will be invoked. You can
	 * then call g_dbus_connection_new_finish() to get the result of the
	 * operation.
	 *
	 * This is a asynchronous failable constructor. See
	 * g_dbus_connection_new_sync() for the synchronous
	 * version.
	 *
	 * Params:
	 *     stream = a #GIOStream
	 *     guid = the GUID to use if a authenticating as a server or %NULL
	 *     flags = flags describing how to make the connection
	 *     observer = a #GDBusAuthObserver or %NULL
	 *     cancellable = a #GCancellable or %NULL
	 *     callback = a #GAsyncReadyCallback to call when the request is satisfied
	 *     userData = the data to pass to @callback
	 *
	 * Since: 2.26
	 */
	public static void newConnection(IOStream stream, string guid, GDBusConnectionFlags flags, DBusAuthObserver observer, Cancellable cancellable, GAsyncReadyCallback callback, void* userData)
	{
		g_dbus_connection_new((stream is null) ? null : stream.getIOStreamStruct(), Str.toStringz(guid), flags, (observer is null) ? null : observer.getDBusAuthObserverStruct(), (cancellable is null) ? null : cancellable.getCancellableStruct(), callback, userData);
	}

	/**
	 * Asynchronously connects and sets up a D-Bus client connection for
	 * exchanging D-Bus messages with an endpoint specified by @address
	 * which must be in the
	 * [D-Bus address format](https://dbus.freedesktop.org/doc/dbus-specification.html#addresses).
	 *
	 * This constructor can only be used to initiate client-side
	 * connections - use g_dbus_connection_new() if you need to act as the
	 * server. In particular, @flags cannot contain the
	 * %G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_SERVER or
	 * %G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_ALLOW_ANONYMOUS flags.
	 *
	 * When the operation is finished, @callback will be invoked. You can
	 * then call g_dbus_connection_new_finish() to get the result of the
	 * operation.
	 *
	 * If @observer is not %NULL it may be used to control the
	 * authentication process.
	 *
	 * This is a asynchronous failable constructor. See
	 * g_dbus_connection_new_for_address_sync() for the synchronous
	 * version.
	 *
	 * Params:
	 *     address = a D-Bus address
	 *     flags = flags describing how to make the connection
	 *     observer = a #GDBusAuthObserver or %NULL
	 *     cancellable = a #GCancellable or %NULL
	 *     callback = a #GAsyncReadyCallback to call when the request is satisfied
	 *     userData = the data to pass to @callback
	 *
	 * Since: 2.26
	 */
	public static void newForAddress(string address, GDBusConnectionFlags flags, DBusAuthObserver observer, Cancellable cancellable, GAsyncReadyCallback callback, void* userData)
	{
		g_dbus_connection_new_for_address(Str.toStringz(address), flags, (observer is null) ? null : observer.getDBusAuthObserverStruct(), (cancellable is null) ? null : cancellable.getCancellableStruct(), callback, userData);
	}

	/**
	 * Adds a message filter. Filters are handlers that are run on all
	 * incoming and outgoing messages, prior to standard dispatch. Filters
	 * are run in the order that they were added.  The same handler can be
	 * added as a filter more than once, in which case it will be run more
	 * than once.  Filters added during a filter callback won't be run on
	 * the message being processed. Filter functions are allowed to modify
	 * and even drop messages.
	 *
	 * Note that filters are run in a dedicated message handling thread so
	 * they can't block and, generally, can't do anything but signal a
	 * worker thread. Also note that filters are rarely needed - use API
	 * such as g_dbus_connection_send_message_with_reply(),
	 * g_dbus_connection_signal_subscribe() or g_dbus_connection_call() instead.
	 *
	 * If a filter consumes an incoming message the message is not
	 * dispatched anywhere else - not even the standard dispatch machinery
	 * (that API such as g_dbus_connection_signal_subscribe() and
	 * g_dbus_connection_send_message_with_reply() relies on) will see the
	 * message. Similary, if a filter consumes an outgoing message, the
	 * message will not be sent to the other peer.
	 *
	 * If @user_data_free_func is non-%NULL, it will be called (in the
	 * thread-default main context of the thread you are calling this
	 * method from) at some point after @user_data is no longer
	 * needed. (It is not guaranteed to be called synchronously when the
	 * filter is removed, and may be called after @connection has been
	 * destroyed.)
	 *
	 * Params:
	 *     filterFunction = a filter function
	 *     userData = user data to pass to @filter_function
	 *     userDataFreeFunc = function to free @user_data with when filter
	 *         is removed or %NULL
	 *
	 * Returns: a filter identifier that can be used with
	 *     g_dbus_connection_remove_filter()
	 *
	 * Since: 2.26
	 */
	public uint addFilter(GDBusMessageFilterFunction filterFunction, void* userData, GDestroyNotify userDataFreeFunc)
	{
		return g_dbus_connection_add_filter(gDBusConnection, filterFunction, userData, userDataFreeFunc);
	}

	/**
	 * Asynchronously invokes the @method_name method on the
	 * @interface_name D-Bus interface on the remote object at
	 * @object_path owned by @bus_name.
	 *
	 * If @connection is closed then the operation will fail with
	 * %G_IO_ERROR_CLOSED. If @cancellable is canceled, the operation will
	 * fail with %G_IO_ERROR_CANCELLED. If @parameters contains a value
	 * not compatible with the D-Bus protocol, the operation fails with
	 * %G_IO_ERROR_INVALID_ARGUMENT.
	 *
	 * If @reply_type is non-%NULL then the reply will be checked for having this type and an
	 * error will be raised if it does not match.  Said another way, if you give a @reply_type
	 * then any non-%NULL return value will be of this type.
	 *
	 * If the @parameters #GVariant is floating, it is consumed. This allows
	 * convenient 'inline' use of g_variant_new(), e.g.:
	 * |[<!-- language="C" -->
	 * g_dbus_connection_call (connection,
	 * "org.freedesktop.StringThings",
	 * "/org/freedesktop/StringThings",
	 * "org.freedesktop.StringThings",
	 * "TwoStrings",
	 * g_variant_new ("(ss)",
	 * "Thing One",
	 * "Thing Two"),
	 * NULL,
	 * G_DBUS_CALL_FLAGS_NONE,
	 * -1,
	 * NULL,
	 * (GAsyncReadyCallback) two_strings_done,
	 * NULL);
	 * ]|
	 *
	 * This is an asynchronous method. When the operation is finished,
	 * @callback will be invoked in the
	 * [thread-default main context][g-main-context-push-thread-default]
	 * of the thread you are calling this method from. You can then call
	 * g_dbus_connection_call_finish() to get the result of the operation.
	 * See g_dbus_connection_call_sync() for the synchronous version of this
	 * function.
	 *
	 * If @callback is %NULL then the D-Bus method call message will be sent with
	 * the %G_DBUS_MESSAGE_FLAGS_NO_REPLY_EXPECTED flag set.
	 *
	 * Params:
	 *     busName = a unique or well-known bus name or %NULL if
	 *         @connection is not a message bus connection
	 *     objectPath = path of remote object
	 *     interfaceName = D-Bus interface to invoke method on
	 *     methodName = the name of the method to invoke
	 *     parameters = a #GVariant tuple with parameters for the method
	 *         or %NULL if not passing parameters
	 *     replyType = the expected type of the reply, or %NULL
	 *     flags = flags from the #GDBusCallFlags enumeration
	 *     timeoutMsec = the timeout in milliseconds, -1 to use the default
	 *         timeout or %G_MAXINT for no timeout
	 *     cancellable = a #GCancellable or %NULL
	 *     callback = a #GAsyncReadyCallback to call when the request
	 *         is satisfied or %NULL if you don't care about the result of the
	 *         method invocation
	 *     userData = the data to pass to @callback
	 *
	 * Since: 2.26
	 */
	public void call(string busName, string objectPath, string interfaceName, string methodName, Variant parameters, VariantType replyType, GDBusCallFlags flags, int timeoutMsec, Cancellable cancellable, GAsyncReadyCallback callback, void* userData)
	{
		g_dbus_connection_call(gDBusConnection, Str.toStringz(busName), Str.toStringz(objectPath), Str.toStringz(interfaceName), Str.toStringz(methodName), (parameters is null) ? null : parameters.getVariantStruct(), (replyType is null) ? null : replyType.getVariantTypeStruct(), flags, timeoutMsec, (cancellable is null) ? null : cancellable.getCancellableStruct(), callback, userData);
	}

	/**
	 * Finishes an operation started with g_dbus_connection_call().
	 *
	 * Params:
	 *     res = a #GAsyncResult obtained from the #GAsyncReadyCallback passed to g_dbus_connection_call()
	 *
	 * Returns: %NULL if @error is set. Otherwise a #GVariant tuple with
	 *     return values. Free with g_variant_unref().
	 *
	 * Since: 2.26
	 *
	 * Throws: GException on failure.
	 */
	public Variant callFinish(AsyncResultIF res)
	{
		GError* err = null;

		auto p = g_dbus_connection_call_finish(gDBusConnection, (res is null) ? null : res.getAsyncResultStruct(), &err);

		if (err !is null)
		{
			throw new GException( new ErrorG(err) );
		}

		if(p is null)
		{
			return null;
		}

		return new Variant(cast(GVariant*) p, true);
	}

	/**
	 * Synchronously invokes the @method_name method on the
	 * @interface_name D-Bus interface on the remote object at
	 * @object_path owned by @bus_name.
	 *
	 * If @connection is closed then the operation will fail with
	 * %G_IO_ERROR_CLOSED. If @cancellable is canceled, the
	 * operation will fail with %G_IO_ERROR_CANCELLED. If @parameters
	 * contains a value not compatible with the D-Bus protocol, the operation
	 * fails with %G_IO_ERROR_INVALID_ARGUMENT.
	 *
	 * If @reply_type is non-%NULL then the reply will be checked for having
	 * this type and an error will be raised if it does not match.  Said
	 * another way, if you give a @reply_type then any non-%NULL return
	 * value will be of this type.
	 *
	 * If the @parameters #GVariant is floating, it is consumed.
	 * This allows convenient 'inline' use of g_variant_new(), e.g.:
	 * |[<!-- language="C" -->
	 * g_dbus_connection_call_sync (connection,
	 * "org.freedesktop.StringThings",
	 * "/org/freedesktop/StringThings",
	 * "org.freedesktop.StringThings",
	 * "TwoStrings",
	 * g_variant_new ("(ss)",
	 * "Thing One",
	 * "Thing Two"),
	 * NULL,
	 * G_DBUS_CALL_FLAGS_NONE,
	 * -1,
	 * NULL,
	 * &error);
	 * ]|
	 *
	 * The calling thread is blocked until a reply is received. See
	 * g_dbus_connection_call() for the asynchronous version of
	 * this method.
	 *
	 * Params:
	 *     busName = a unique or well-known bus name or %NULL if
	 *         @connection is not a message bus connection
	 *     objectPath = path of remote object
	 *     interfaceName = D-Bus interface to invoke method on
	 *     methodName = the name of the method to invoke
	 *     parameters = a #GVariant tuple with parameters for the method
	 *         or %NULL if not passing parameters
	 *     replyType = the expected type of the reply, or %NULL
	 *     flags = flags from the #GDBusCallFlags enumeration
	 *     timeoutMsec = the timeout in milliseconds, -1 to use the default
	 *         timeout or %G_MAXINT for no timeout
	 *     cancellable = a #GCancellable or %NULL
	 *
	 * Returns: %NULL if @error is set. Otherwise a #GVariant tuple with
	 *     return values. Free with g_variant_unref().
	 *
	 * Since: 2.26
	 *
	 * Throws: GException on failure.
	 */
	public Variant callSync(string busName, string objectPath, string interfaceName, string methodName, Variant parameters, VariantType replyType, GDBusCallFlags flags, int timeoutMsec, Cancellable cancellable)
	{
		GError* err = null;

		auto p = g_dbus_connection_call_sync(gDBusConnection, Str.toStringz(busName), Str.toStringz(objectPath), Str.toStringz(interfaceName), Str.toStringz(methodName), (parameters is null) ? null : parameters.getVariantStruct(), (replyType is null) ? null : replyType.getVariantTypeStruct(), flags, timeoutMsec, (cancellable is null) ? null : cancellable.getCancellableStruct(), &err);

		if (err !is null)
		{
			throw new GException( new ErrorG(err) );
		}

		if(p is null)
		{
			return null;
		}

		return new Variant(cast(GVariant*) p, true);
	}

	/**
	 * Like g_dbus_connection_call() but also takes a #GUnixFDList object.
	 *
	 * This method is only available on UNIX.
	 *
	 * Params:
	 *     busName = a unique or well-known bus name or %NULL if
	 *         @connection is not a message bus connection
	 *     objectPath = path of remote object
	 *     interfaceName = D-Bus interface to invoke method on
	 *     methodName = the name of the method to invoke
	 *     parameters = a #GVariant tuple with parameters for the method
	 *         or %NULL if not passing parameters
	 *     replyType = the expected type of the reply, or %NULL
	 *     flags = flags from the #GDBusCallFlags enumeration
	 *     timeoutMsec = the timeout in milliseconds, -1 to use the default
	 *         timeout or %G_MAXINT for no timeout
	 *     fdList = a #GUnixFDList or %NULL
	 *     cancellable = a #GCancellable or %NULL
	 *     callback = a #GAsyncReadyCallback to call when the request is
	 *         satisfied or %NULL if you don't * care about the result of the
	 *         method invocation
	 *     userData = The data to pass to @callback.
	 *
	 * Since: 2.30
	 */
	public void callWithUnixFdList(string busName, string objectPath, string interfaceName, string methodName, Variant parameters, VariantType replyType, GDBusCallFlags flags, int timeoutMsec, UnixFDList fdList, Cancellable cancellable, GAsyncReadyCallback callback, void* userData)
	{
		g_dbus_connection_call_with_unix_fd_list(gDBusConnection, Str.toStringz(busName), Str.toStringz(objectPath), Str.toStringz(interfaceName), Str.toStringz(methodName), (parameters is null) ? null : parameters.getVariantStruct(), (replyType is null) ? null : replyType.getVariantTypeStruct(), flags, timeoutMsec, (fdList is null) ? null : fdList.getUnixFDListStruct(), (cancellable is null) ? null : cancellable.getCancellableStruct(), callback, userData);
	}

	/**
	 * Finishes an operation started with g_dbus_connection_call_with_unix_fd_list().
	 *
	 * Params:
	 *     outFdList = return location for a #GUnixFDList or %NULL
	 *     res = a #GAsyncResult obtained from the #GAsyncReadyCallback passed to
	 *         g_dbus_connection_call_with_unix_fd_list()
	 *
	 * Returns: %NULL if @error is set. Otherwise a #GVariant tuple with
	 *     return values. Free with g_variant_unref().
	 *
	 * Since: 2.30
	 *
	 * Throws: GException on failure.
	 */
	public Variant callWithUnixFdListFinish(out UnixFDList outFdList, AsyncResultIF res)
	{
		GUnixFDList* outoutFdList = null;
		GError* err = null;

		auto p = g_dbus_connection_call_with_unix_fd_list_finish(gDBusConnection, &outoutFdList, (res is null) ? null : res.getAsyncResultStruct(), &err);

		if (err !is null)
		{
			throw new GException( new ErrorG(err) );
		}

		outFdList = ObjectG.getDObject!(UnixFDList)(outoutFdList);

		if(p is null)
		{
			return null;
		}

		return new Variant(cast(GVariant*) p, true);
	}

	/**
	 * Like g_dbus_connection_call_sync() but also takes and returns #GUnixFDList objects.
	 *
	 * This method is only available on UNIX.
	 *
	 * Params:
	 *     busName = a unique or well-known bus name or %NULL
	 *         if @connection is not a message bus connection
	 *     objectPath = path of remote object
	 *     interfaceName = D-Bus interface to invoke method on
	 *     methodName = the name of the method to invoke
	 *     parameters = a #GVariant tuple with parameters for
	 *         the method or %NULL if not passing parameters
	 *     replyType = the expected type of the reply, or %NULL
	 *     flags = flags from the #GDBusCallFlags enumeration
	 *     timeoutMsec = the timeout in milliseconds, -1 to use the default
	 *         timeout or %G_MAXINT for no timeout
	 *     fdList = a #GUnixFDList or %NULL
	 *     outFdList = return location for a #GUnixFDList or %NULL
	 *     cancellable = a #GCancellable or %NULL
	 *
	 * Returns: %NULL if @error is set. Otherwise a #GVariant tuple with
	 *     return values. Free with g_variant_unref().
	 *
	 * Since: 2.30
	 *
	 * Throws: GException on failure.
	 */
	public Variant callWithUnixFdListSync(string busName, string objectPath, string interfaceName, string methodName, Variant parameters, VariantType replyType, GDBusCallFlags flags, int timeoutMsec, UnixFDList fdList, out UnixFDList outFdList, Cancellable cancellable)
	{
		GUnixFDList* outoutFdList = null;
		GError* err = null;

		auto p = g_dbus_connection_call_with_unix_fd_list_sync(gDBusConnection, Str.toStringz(busName), Str.toStringz(objectPath), Str.toStringz(interfaceName), Str.toStringz(methodName), (parameters is null) ? null : parameters.getVariantStruct(), (replyType is null) ? null : replyType.getVariantTypeStruct(), flags, timeoutMsec, (fdList is null) ? null : fdList.getUnixFDListStruct(), &outoutFdList, (cancellable is null) ? null : cancellable.getCancellableStruct(), &err);

		if (err !is null)
		{
			throw new GException( new ErrorG(err) );
		}

		outFdList = ObjectG.getDObject!(UnixFDList)(outoutFdList);

		if(p is null)
		{
			return null;
		}

		return new Variant(cast(GVariant*) p, true);
	}

	/**
	 * Closes @connection. Note that this never causes the process to
	 * exit (this might only happen if the other end of a shared message
	 * bus connection disconnects, see #GDBusConnection:exit-on-close).
	 *
	 * Once the connection is closed, operations such as sending a message
	 * will return with the error %G_IO_ERROR_CLOSED. Closing a connection
	 * will not automatically flush the connection so queued messages may
	 * be lost. Use g_dbus_connection_flush() if you need such guarantees.
	 *
	 * If @connection is already closed, this method fails with
	 * %G_IO_ERROR_CLOSED.
	 *
	 * When @connection has been closed, the #GDBusConnection::closed
	 * signal is emitted in the
	 * [thread-default main context][g-main-context-push-thread-default]
	 * of the thread that @connection was constructed in.
	 *
	 * This is an asynchronous method. When the operation is finished,
	 * @callback will be invoked in the
	 * [thread-default main context][g-main-context-push-thread-default]
	 * of the thread you are calling this method from. You can
	 * then call g_dbus_connection_close_finish() to get the result of the
	 * operation. See g_dbus_connection_close_sync() for the synchronous
	 * version.
	 *
	 * Params:
	 *     cancellable = a #GCancellable or %NULL
	 *     callback = a #GAsyncReadyCallback to call when the request is
	 *         satisfied or %NULL if you don't care about the result
	 *     userData = The data to pass to @callback
	 *
	 * Since: 2.26
	 */
	public void close(Cancellable cancellable, GAsyncReadyCallback callback, void* userData)
	{
		g_dbus_connection_close(gDBusConnection, (cancellable is null) ? null : cancellable.getCancellableStruct(), callback, userData);
	}

	/**
	 * Finishes an operation started with g_dbus_connection_close().
	 *
	 * Params:
	 *     res = a #GAsyncResult obtained from the #GAsyncReadyCallback passed
	 *         to g_dbus_connection_close()
	 *
	 * Returns: %TRUE if the operation succeeded, %FALSE if @error is set
	 *
	 * Since: 2.26
	 *
	 * Throws: GException on failure.
	 */
	public bool closeFinish(AsyncResultIF res)
	{
		GError* err = null;

		auto p = g_dbus_connection_close_finish(gDBusConnection, (res is null) ? null : res.getAsyncResultStruct(), &err) != 0;

		if (err !is null)
		{
			throw new GException( new ErrorG(err) );
		}

		return p;
	}

	/**
	 * Synchronously closees @connection. The calling thread is blocked
	 * until this is done. See g_dbus_connection_close() for the
	 * asynchronous version of this method and more details about what it
	 * does.
	 *
	 * Params:
	 *     cancellable = a #GCancellable or %NULL
	 *
	 * Returns: %TRUE if the operation succeeded, %FALSE if @error is set
	 *
	 * Since: 2.26
	 *
	 * Throws: GException on failure.
	 */
	public bool closeSync(Cancellable cancellable)
	{
		GError* err = null;

		auto p = g_dbus_connection_close_sync(gDBusConnection, (cancellable is null) ? null : cancellable.getCancellableStruct(), &err) != 0;

		if (err !is null)
		{
			throw new GException( new ErrorG(err) );
		}

		return p;
	}

	/**
	 * Emits a signal.
	 *
	 * If the parameters GVariant is floating, it is consumed.
	 *
	 * This can only fail if @parameters is not compatible with the D-Bus protocol.
	 *
	 * Params:
	 *     destinationBusName = the unique bus name for the destination
	 *         for the signal or %NULL to emit to all listeners
	 *     objectPath = path of remote object
	 *     interfaceName = D-Bus interface to emit a signal on
	 *     signalName = the name of the signal to emit
	 *     parameters = a #GVariant tuple with parameters for the signal
	 *         or %NULL if not passing parameters
	 *
	 * Returns: %TRUE unless @error is set
	 *
	 * Since: 2.26
	 *
	 * Throws: GException on failure.
	 */
	public bool emitSignal(string destinationBusName, string objectPath, string interfaceName, string signalName, Variant parameters)
	{
		GError* err = null;

		auto p = g_dbus_connection_emit_signal(gDBusConnection, Str.toStringz(destinationBusName), Str.toStringz(objectPath), Str.toStringz(interfaceName), Str.toStringz(signalName), (parameters is null) ? null : parameters.getVariantStruct(), &err) != 0;

		if (err !is null)
		{
			throw new GException( new ErrorG(err) );
		}

		return p;
	}

	/**
	 * Exports @action_group on @connection at @object_path.
	 *
	 * The implemented D-Bus API should be considered private.  It is
	 * subject to change in the future.
	 *
	 * A given object path can only have one action group exported on it.
	 * If this constraint is violated, the export will fail and 0 will be
	 * returned (with @error set accordingly).
	 *
	 * You can unexport the action group using
	 * g_dbus_connection_unexport_action_group() with the return value of
	 * this function.
	 *
	 * The thread default main context is taken at the time of this call.
	 * All incoming action activations and state change requests are
	 * reported from this context.  Any changes on the action group that
	 * cause it to emit signals must also come from this same context.
	 * Since incoming action activations and state change requests are
	 * rather likely to cause changes on the action group, this effectively
	 * limits a given action group to being exported from only one main
	 * context.
	 *
	 * Params:
	 *     objectPath = a D-Bus object path
	 *     actionGroup = a #GActionGroup
	 *
	 * Returns: the ID of the export (never zero), or 0 in case of failure
	 *
	 * Since: 2.32
	 *
	 * Throws: GException on failure.
	 */
	public uint exportActionGroup(string objectPath, ActionGroupIF actionGroup)
	{
		GError* err = null;

		auto p = g_dbus_connection_export_action_group(gDBusConnection, Str.toStringz(objectPath), (actionGroup is null) ? null : actionGroup.getActionGroupStruct(), &err);

		if (err !is null)
		{
			throw new GException( new ErrorG(err) );
		}

		return p;
	}

	/**
	 * Exports @menu on @connection at @object_path.
	 *
	 * The implemented D-Bus API should be considered private.
	 * It is subject to change in the future.
	 *
	 * An object path can only have one menu model exported on it. If this
	 * constraint is violated, the export will fail and 0 will be
	 * returned (with @error set accordingly).
	 *
	 * You can unexport the menu model using
	 * g_dbus_connection_unexport_menu_model() with the return value of
	 * this function.
	 *
	 * Params:
	 *     objectPath = a D-Bus object path
	 *     menu = a #GMenuModel
	 *
	 * Returns: the ID of the export (never zero), or 0 in case of failure
	 *
	 * Since: 2.32
	 *
	 * Throws: GException on failure.
	 */
	public uint exportMenuModel(string objectPath, MenuModel menu)
	{
		GError* err = null;

		auto p = g_dbus_connection_export_menu_model(gDBusConnection, Str.toStringz(objectPath), (menu is null) ? null : menu.getMenuModelStruct(), &err);

		if (err !is null)
		{
			throw new GException( new ErrorG(err) );
		}

		return p;
	}

	/**
	 * Asynchronously flushes @connection, that is, writes all queued
	 * outgoing message to the transport and then flushes the transport
	 * (using g_output_stream_flush_async()). This is useful in programs
	 * that wants to emit a D-Bus signal and then exit immediately. Without
	 * flushing the connection, there is no guaranteed that the message has
	 * been sent to the networking buffers in the OS kernel.
	 *
	 * This is an asynchronous method. When the operation is finished,
	 * @callback will be invoked in the
	 * [thread-default main context][g-main-context-push-thread-default]
	 * of the thread you are calling this method from. You can
	 * then call g_dbus_connection_flush_finish() to get the result of the
	 * operation. See g_dbus_connection_flush_sync() for the synchronous
	 * version.
	 *
	 * Params:
	 *     cancellable = a #GCancellable or %NULL
	 *     callback = a #GAsyncReadyCallback to call when the
	 *         request is satisfied or %NULL if you don't care about the result
	 *     userData = The data to pass to @callback
	 *
	 * Since: 2.26
	 */
	public void flush(Cancellable cancellable, GAsyncReadyCallback callback, void* userData)
	{
		g_dbus_connection_flush(gDBusConnection, (cancellable is null) ? null : cancellable.getCancellableStruct(), callback, userData);
	}

	/**
	 * Finishes an operation started with g_dbus_connection_flush().
	 *
	 * Params:
	 *     res = a #GAsyncResult obtained from the #GAsyncReadyCallback passed
	 *         to g_dbus_connection_flush()
	 *
	 * Returns: %TRUE if the operation succeeded, %FALSE if @error is set
	 *
	 * Since: 2.26
	 *
	 * Throws: GException on failure.
	 */
	public bool flushFinish(AsyncResultIF res)
	{
		GError* err = null;

		auto p = g_dbus_connection_flush_finish(gDBusConnection, (res is null) ? null : res.getAsyncResultStruct(), &err) != 0;

		if (err !is null)
		{
			throw new GException( new ErrorG(err) );
		}

		return p;
	}

	/**
	 * Synchronously flushes @connection. The calling thread is blocked
	 * until this is done. See g_dbus_connection_flush() for the
	 * asynchronous version of this method and more details about what it
	 * does.
	 *
	 * Params:
	 *     cancellable = a #GCancellable or %NULL
	 *
	 * Returns: %TRUE if the operation succeeded, %FALSE if @error is set
	 *
	 * Since: 2.26
	 *
	 * Throws: GException on failure.
	 */
	public bool flushSync(Cancellable cancellable)
	{
		GError* err = null;

		auto p = g_dbus_connection_flush_sync(gDBusConnection, (cancellable is null) ? null : cancellable.getCancellableStruct(), &err) != 0;

		if (err !is null)
		{
			throw new GException( new ErrorG(err) );
		}

		return p;
	}

	/**
	 * Gets the capabilities negotiated with the remote peer
	 *
	 * Returns: zero or more flags from the #GDBusCapabilityFlags enumeration
	 *
	 * Since: 2.26
	 */
	public GDBusCapabilityFlags getCapabilities()
	{
		return g_dbus_connection_get_capabilities(gDBusConnection);
	}

	/**
	 * Gets whether the process is terminated when @connection is
	 * closed by the remote peer. See
	 * #GDBusConnection:exit-on-close for more details.
	 *
	 * Returns: whether the process is terminated when @connection is
	 *     closed by the remote peer
	 *
	 * Since: 2.26
	 */
	public bool getExitOnClose()
	{
		return g_dbus_connection_get_exit_on_close(gDBusConnection) != 0;
	}

	/**
	 * The GUID of the peer performing the role of server when
	 * authenticating. See #GDBusConnection:guid for more details.
	 *
	 * Returns: The GUID. Do not free this string, it is owned by
	 *     @connection.
	 *
	 * Since: 2.26
	 */
	public string getGuid()
	{
		return Str.toString(g_dbus_connection_get_guid(gDBusConnection));
	}

	/**
	 * Retrieves the last serial number assigned to a #GDBusMessage on
	 * the current thread. This includes messages sent via both low-level
	 * API such as g_dbus_connection_send_message() as well as
	 * high-level API such as g_dbus_connection_emit_signal(),
	 * g_dbus_connection_call() or g_dbus_proxy_call().
	 *
	 * Returns: the last used serial or zero when no message has been sent
	 *     within the current thread
	 *
	 * Since: 2.34
	 */
	public uint getLastSerial()
	{
		return g_dbus_connection_get_last_serial(gDBusConnection);
	}

	/**
	 * Gets the credentials of the authenticated peer. This will always
	 * return %NULL unless @connection acted as a server
	 * (e.g. %G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_SERVER was passed)
	 * when set up and the client passed credentials as part of the
	 * authentication process.
	 *
	 * In a message bus setup, the message bus is always the server and
	 * each application is a client. So this method will always return
	 * %NULL for message bus clients.
	 *
	 * Returns: a #GCredentials or %NULL if not
	 *     available. Do not free this object, it is owned by @connection.
	 *
	 * Since: 2.26
	 */
	public Credentials getPeerCredentials()
	{
		auto p = g_dbus_connection_get_peer_credentials(gDBusConnection);

		if(p is null)
		{
			return null;
		}

		return ObjectG.getDObject!(Credentials)(cast(GCredentials*) p);
	}

	/**
	 * Gets the underlying stream used for IO.
	 *
	 * While the #GDBusConnection is active, it will interact with this
	 * stream from a worker thread, so it is not safe to interact with
	 * the stream directly.
	 *
	 * Returns: the stream used for IO
	 *
	 * Since: 2.26
	 */
	public IOStream getStream()
	{
		auto p = g_dbus_connection_get_stream(gDBusConnection);

		if(p is null)
		{
			return null;
		}

		return ObjectG.getDObject!(IOStream)(cast(GIOStream*) p);
	}

	/**
	 * Gets the unique name of @connection as assigned by the message
	 * bus. This can also be used to figure out if @connection is a
	 * message bus connection.
	 *
	 * Returns: the unique name or %NULL if @connection is not a message
	 *     bus connection. Do not free this string, it is owned by
	 *     @connection.
	 *
	 * Since: 2.26
	 */
	public string getUniqueName()
	{
		return Str.toString(g_dbus_connection_get_unique_name(gDBusConnection));
	}

	/**
	 * Gets whether @connection is closed.
	 *
	 * Returns: %TRUE if the connection is closed, %FALSE otherwise
	 *
	 * Since: 2.26
	 */
	public bool isClosed()
	{
		return g_dbus_connection_is_closed(gDBusConnection) != 0;
	}

	/**
	 * Registers callbacks for exported objects at @object_path with the
	 * D-Bus interface that is described in @interface_info.
	 *
	 * Calls to functions in @vtable (and @user_data_free_func) will happen
	 * in the
	 * [thread-default main context][g-main-context-push-thread-default]
	 * of the thread you are calling this method from.
	 *
	 * Note that all #GVariant values passed to functions in @vtable will match
	 * the signature given in @interface_info - if a remote caller passes
	 * incorrect values, the `org.freedesktop.DBus.Error.InvalidArgs`
	 * is returned to the remote caller.
	 *
	 * Additionally, if the remote caller attempts to invoke methods or
	 * access properties not mentioned in @interface_info the
	 * `org.freedesktop.DBus.Error.UnknownMethod` resp.
	 * `org.freedesktop.DBus.Error.InvalidArgs` errors
	 * are returned to the caller.
	 *
	 * It is considered a programming error if the
	 * #GDBusInterfaceGetPropertyFunc function in @vtable returns a
	 * #GVariant of incorrect type.
	 *
	 * If an existing callback is already registered at @object_path and
	 * @interface_name, then @error is set to #G_IO_ERROR_EXISTS.
	 *
	 * GDBus automatically implements the standard D-Bus interfaces
	 * org.freedesktop.DBus.Properties, org.freedesktop.DBus.Introspectable
	 * and org.freedesktop.Peer, so you don't have to implement those for the
	 * objects you export. You can implement org.freedesktop.DBus.Properties
	 * yourself, e.g. to handle getting and setting of properties asynchronously.
	 *
	 * Note that the reference count on @interface_info will be
	 * incremented by 1 (unless allocated statically, e.g. if the
	 * reference count is -1, see g_dbus_interface_info_ref()) for as long
	 * as the object is exported. Also note that @vtable will be copied.
	 *
	 * See this [server][gdbus-server] for an example of how to use this method.
	 *
	 * Params:
	 *     objectPath = the object path to register at
	 *     interfaceInfo = introspection data for the interface
	 *     vtable = a #GDBusInterfaceVTable to call into or %NULL
	 *     userData = data to pass to functions in @vtable
	 *     userDataFreeFunc = function to call when the object path is unregistered
	 *
	 * Returns: 0 if @error is set, otherwise a registration id (never 0)
	 *     that can be used with g_dbus_connection_unregister_object()
	 *
	 * Since: 2.26
	 *
	 * Throws: GException on failure.
	 */
	public uint registerObject(string objectPath, DBusInterfaceInfo interfaceInfo, GDBusInterfaceVTable* vtable, void* userData, GDestroyNotify userDataFreeFunc)
	{
		GError* err = null;

		auto p = g_dbus_connection_register_object(gDBusConnection, Str.toStringz(objectPath), (interfaceInfo is null) ? null : interfaceInfo.getDBusInterfaceInfoStruct(), vtable, userData, userDataFreeFunc, &err);

		if (err !is null)
		{
			throw new GException( new ErrorG(err) );
		}

		return p;
	}

	/**
	 * Version of g_dbus_connection_register_object() using closures instead of a
	 * #GDBusInterfaceVTable for easier binding in other languages.
	 *
	 * Params:
	 *     objectPath = The object path to register at.
	 *     interfaceInfo = Introspection data for the interface.
	 *     methodCallClosure = #GClosure for handling incoming method calls.
	 *     getPropertyClosure = #GClosure for getting a property.
	 *     setPropertyClosure = #GClosure for setting a property.
	 *
	 * Returns: 0 if @error is set, otherwise a registration id (never 0)
	 *     that can be used with g_dbus_connection_unregister_object() .
	 *
	 * Since: 2.46
	 *
	 * Throws: GException on failure.
	 */
	public uint registerObjectWithClosures(string objectPath, DBusInterfaceInfo interfaceInfo, Closure methodCallClosure, Closure getPropertyClosure, Closure setPropertyClosure)
	{
		GError* err = null;

		auto p = g_dbus_connection_register_object_with_closures(gDBusConnection, Str.toStringz(objectPath), (interfaceInfo is null) ? null : interfaceInfo.getDBusInterfaceInfoStruct(), (methodCallClosure is null) ? null : methodCallClosure.getClosureStruct(), (getPropertyClosure is null) ? null : getPropertyClosure.getClosureStruct(), (setPropertyClosure is null) ? null : setPropertyClosure.getClosureStruct(), &err);

		if (err !is null)
		{
			throw new GException( new ErrorG(err) );
		}

		return p;
	}

	/**
	 * Registers a whole subtree of dynamic objects.
	 *
	 * The @enumerate and @introspection functions in @vtable are used to
	 * convey, to remote callers, what nodes exist in the subtree rooted
	 * by @object_path.
	 *
	 * When handling remote calls into any node in the subtree, first the
	 * @enumerate function is used to check if the node exists. If the node exists
	 * or the #G_DBUS_SUBTREE_FLAGS_DISPATCH_TO_UNENUMERATED_NODES flag is set
	 * the @introspection function is used to check if the node supports the
	 * requested method. If so, the @dispatch function is used to determine
	 * where to dispatch the call. The collected #GDBusInterfaceVTable and
	 * #gpointer will be used to call into the interface vtable for processing
	 * the request.
	 *
	 * All calls into user-provided code will be invoked in the
	 * [thread-default main context][g-main-context-push-thread-default]
	 * of the thread you are calling this method from.
	 *
	 * If an existing subtree is already registered at @object_path or
	 * then @error is set to #G_IO_ERROR_EXISTS.
	 *
	 * Note that it is valid to register regular objects (using
	 * g_dbus_connection_register_object()) in a subtree registered with
	 * g_dbus_connection_register_subtree() - if so, the subtree handler
	 * is tried as the last resort. One way to think about a subtree
	 * handler is to consider it a fallback handler for object paths not
	 * registered via g_dbus_connection_register_object() or other bindings.
	 *
	 * Note that @vtable will be copied so you cannot change it after
	 * registration.
	 *
	 * See this [server][gdbus-subtree-server] for an example of how to use
	 * this method.
	 *
	 * Params:
	 *     objectPath = the object path to register the subtree at
	 *     vtable = a #GDBusSubtreeVTable to enumerate, introspect and
	 *         dispatch nodes in the subtree
	 *     flags = flags used to fine tune the behavior of the subtree
	 *     userData = data to pass to functions in @vtable
	 *     userDataFreeFunc = function to call when the subtree is unregistered
	 *
	 * Returns: 0 if @error is set, otherwise a subtree registration id (never 0)
	 *     that can be used with g_dbus_connection_unregister_subtree() .
	 *
	 * Since: 2.26
	 *
	 * Throws: GException on failure.
	 */
	public uint registerSubtree(string objectPath, GDBusSubtreeVTable* vtable, GDBusSubtreeFlags flags, void* userData, GDestroyNotify userDataFreeFunc)
	{
		GError* err = null;

		auto p = g_dbus_connection_register_subtree(gDBusConnection, Str.toStringz(objectPath), vtable, flags, userData, userDataFreeFunc, &err);

		if (err !is null)
		{
			throw new GException( new ErrorG(err) );
		}

		return p;
	}

	/**
	 * Removes a filter.
	 *
	 * Note that since filters run in a different thread, there is a race
	 * condition where it is possible that the filter will be running even
	 * after calling g_dbus_connection_remove_filter(), so you cannot just
	 * free data that the filter might be using. Instead, you should pass
	 * a #GDestroyNotify to g_dbus_connection_add_filter(), which will be
	 * called when it is guaranteed that the data is no longer needed.
	 *
	 * Params:
	 *     filterId = an identifier obtained from g_dbus_connection_add_filter()
	 *
	 * Since: 2.26
	 */
	public void removeFilter(uint filterId)
	{
		g_dbus_connection_remove_filter(gDBusConnection, filterId);
	}

	/**
	 * Asynchronously sends @message to the peer represented by @connection.
	 *
	 * Unless @flags contain the
	 * %G_DBUS_SEND_MESSAGE_FLAGS_PRESERVE_SERIAL flag, the serial number
	 * will be assigned by @connection and set on @message via
	 * g_dbus_message_set_serial(). If @out_serial is not %NULL, then the
	 * serial number used will be written to this location prior to
	 * submitting the message to the underlying transport.
	 *
	 * If @connection is closed then the operation will fail with
	 * %G_IO_ERROR_CLOSED. If @message is not well-formed,
	 * the operation fails with %G_IO_ERROR_INVALID_ARGUMENT.
	 *
	 * See this [server][gdbus-server] and [client][gdbus-unix-fd-client]
	 * for an example of how to use this low-level API to send and receive
	 * UNIX file descriptors.
	 *
	 * Note that @message must be unlocked, unless @flags contain the
	 * %G_DBUS_SEND_MESSAGE_FLAGS_PRESERVE_SERIAL flag.
	 *
	 * Params:
	 *     message = a #GDBusMessage
	 *     flags = flags affecting how the message is sent
	 *     outSerial = return location for serial number assigned
	 *         to @message when sending it or %NULL
	 *
	 * Returns: %TRUE if the message was well-formed and queued for
	 *     transmission, %FALSE if @error is set
	 *
	 * Since: 2.26
	 *
	 * Throws: GException on failure.
	 */
	public bool sendMessage(DBusMessage message, GDBusSendMessageFlags flags, out uint outSerial)
	{
		GError* err = null;

		auto p = g_dbus_connection_send_message(gDBusConnection, (message is null) ? null : message.getDBusMessageStruct(), flags, &outSerial, &err) != 0;

		if (err !is null)
		{
			throw new GException( new ErrorG(err) );
		}

		return p;
	}

	/**
	 * Asynchronously sends @message to the peer represented by @connection.
	 *
	 * Unless @flags contain the
	 * %G_DBUS_SEND_MESSAGE_FLAGS_PRESERVE_SERIAL flag, the serial number
	 * will be assigned by @connection and set on @message via
	 * g_dbus_message_set_serial(). If @out_serial is not %NULL, then the
	 * serial number used will be written to this location prior to
	 * submitting the message to the underlying transport.
	 *
	 * If @connection is closed then the operation will fail with
	 * %G_IO_ERROR_CLOSED. If @cancellable is canceled, the operation will
	 * fail with %G_IO_ERROR_CANCELLED. If @message is not well-formed,
	 * the operation fails with %G_IO_ERROR_INVALID_ARGUMENT.
	 *
	 * This is an asynchronous method. When the operation is finished, @callback
	 * will be invoked in the
	 * [thread-default main context][g-main-context-push-thread-default]
	 * of the thread you are calling this method from. You can then call
	 * g_dbus_connection_send_message_with_reply_finish() to get the result of the operation.
	 * See g_dbus_connection_send_message_with_reply_sync() for the synchronous version.
	 *
	 * Note that @message must be unlocked, unless @flags contain the
	 * %G_DBUS_SEND_MESSAGE_FLAGS_PRESERVE_SERIAL flag.
	 *
	 * See this [server][gdbus-server] and [client][gdbus-unix-fd-client]
	 * for an example of how to use this low-level API to send and receive
	 * UNIX file descriptors.
	 *
	 * Params:
	 *     message = a #GDBusMessage
	 *     flags = flags affecting how the message is sent
	 *     timeoutMsec = the timeout in milliseconds, -1 to use the default
	 *         timeout or %G_MAXINT for no timeout
	 *     outSerial = return location for serial number assigned
	 *         to @message when sending it or %NULL
	 *     cancellable = a #GCancellable or %NULL
	 *     callback = a #GAsyncReadyCallback to call when the request
	 *         is satisfied or %NULL if you don't care about the result
	 *     userData = The data to pass to @callback
	 *
	 * Since: 2.26
	 */
	public void sendMessageWithReply(DBusMessage message, GDBusSendMessageFlags flags, int timeoutMsec, out uint outSerial, Cancellable cancellable, GAsyncReadyCallback callback, void* userData)
	{
		g_dbus_connection_send_message_with_reply(gDBusConnection, (message is null) ? null : message.getDBusMessageStruct(), flags, timeoutMsec, &outSerial, (cancellable is null) ? null : cancellable.getCancellableStruct(), callback, userData);
	}

	/**
	 * Finishes an operation started with g_dbus_connection_send_message_with_reply().
	 *
	 * Note that @error is only set if a local in-process error
	 * occurred. That is to say that the returned #GDBusMessage object may
	 * be of type %G_DBUS_MESSAGE_TYPE_ERROR. Use
	 * g_dbus_message_to_gerror() to transcode this to a #GError.
	 *
	 * See this [server][gdbus-server] and [client][gdbus-unix-fd-client]
	 * for an example of how to use this low-level API to send and receive
	 * UNIX file descriptors.
	 *
	 * Params:
	 *     res = a #GAsyncResult obtained from the #GAsyncReadyCallback passed to
	 *         g_dbus_connection_send_message_with_reply()
	 *
	 * Returns: a locked #GDBusMessage or %NULL if @error is set
	 *
	 * Since: 2.26
	 *
	 * Throws: GException on failure.
	 */
	public DBusMessage sendMessageWithReplyFinish(AsyncResultIF res)
	{
		GError* err = null;

		auto p = g_dbus_connection_send_message_with_reply_finish(gDBusConnection, (res is null) ? null : res.getAsyncResultStruct(), &err);

		if (err !is null)
		{
			throw new GException( new ErrorG(err) );
		}

		if(p is null)
		{
			return null;
		}

		return ObjectG.getDObject!(DBusMessage)(cast(GDBusMessage*) p, true);
	}

	/**
	 * Synchronously sends @message to the peer represented by @connection
	 * and blocks the calling thread until a reply is received or the
	 * timeout is reached. See g_dbus_connection_send_message_with_reply()
	 * for the asynchronous version of this method.
	 *
	 * Unless @flags contain the
	 * %G_DBUS_SEND_MESSAGE_FLAGS_PRESERVE_SERIAL flag, the serial number
	 * will be assigned by @connection and set on @message via
	 * g_dbus_message_set_serial(). If @out_serial is not %NULL, then the
	 * serial number used will be written to this location prior to
	 * submitting the message to the underlying transport.
	 *
	 * If @connection is closed then the operation will fail with
	 * %G_IO_ERROR_CLOSED. If @cancellable is canceled, the operation will
	 * fail with %G_IO_ERROR_CANCELLED. If @message is not well-formed,
	 * the operation fails with %G_IO_ERROR_INVALID_ARGUMENT.
	 *
	 * Note that @error is only set if a local in-process error
	 * occurred. That is to say that the returned #GDBusMessage object may
	 * be of type %G_DBUS_MESSAGE_TYPE_ERROR. Use
	 * g_dbus_message_to_gerror() to transcode this to a #GError.
	 *
	 * See this [server][gdbus-server] and [client][gdbus-unix-fd-client]
	 * for an example of how to use this low-level API to send and receive
	 * UNIX file descriptors.
	 *
	 * Note that @message must be unlocked, unless @flags contain the
	 * %G_DBUS_SEND_MESSAGE_FLAGS_PRESERVE_SERIAL flag.
	 *
	 * Params:
	 *     message = a #GDBusMessage
	 *     flags = flags affecting how the message is sent.
	 *     timeoutMsec = the timeout in milliseconds, -1 to use the default
	 *         timeout or %G_MAXINT for no timeout
	 *     outSerial = return location for serial number
	 *         assigned to @message when sending it or %NULL
	 *     cancellable = a #GCancellable or %NULL
	 *
	 * Returns: a locked #GDBusMessage that is the reply
	 *     to @message or %NULL if @error is set
	 *
	 * Since: 2.26
	 *
	 * Throws: GException on failure.
	 */
	public DBusMessage sendMessageWithReplySync(DBusMessage message, GDBusSendMessageFlags flags, int timeoutMsec, out uint outSerial, Cancellable cancellable)
	{
		GError* err = null;

		auto p = g_dbus_connection_send_message_with_reply_sync(gDBusConnection, (message is null) ? null : message.getDBusMessageStruct(), flags, timeoutMsec, &outSerial, (cancellable is null) ? null : cancellable.getCancellableStruct(), &err);

		if (err !is null)
		{
			throw new GException( new ErrorG(err) );
		}

		if(p is null)
		{
			return null;
		}

		return ObjectG.getDObject!(DBusMessage)(cast(GDBusMessage*) p, true);
	}

	/**
	 * Sets whether the process should be terminated when @connection is
	 * closed by the remote peer. See #GDBusConnection:exit-on-close for
	 * more details.
	 *
	 * Note that this function should be used with care. Most modern UNIX
	 * desktops tie the notion of a user session the session bus, and expect
	 * all of a users applications to quit when their bus connection goes away.
	 * If you are setting @exit_on_close to %FALSE for the shared session
	 * bus connection, you should make sure that your application exits
	 * when the user session ends.
	 *
	 * Params:
	 *     exitOnClose = whether the process should be terminated
	 *         when @connection is closed by the remote peer
	 *
	 * Since: 2.26
	 */
	public void setExitOnClose(bool exitOnClose)
	{
		g_dbus_connection_set_exit_on_close(gDBusConnection, exitOnClose);
	}

	/**
	 * Subscribes to signals on @connection and invokes @callback with a whenever
	 * the signal is received. Note that @callback will be invoked in the
	 * [thread-default main context][g-main-context-push-thread-default]
	 * of the thread you are calling this method from.
	 *
	 * If @connection is not a message bus connection, @sender must be
	 * %NULL.
	 *
	 * If @sender is a well-known name note that @callback is invoked with
	 * the unique name for the owner of @sender, not the well-known name
	 * as one would expect. This is because the message bus rewrites the
	 * name. As such, to avoid certain race conditions, users should be
	 * tracking the name owner of the well-known name and use that when
	 * processing the received signal.
	 *
	 * If one of %G_DBUS_SIGNAL_FLAGS_MATCH_ARG0_NAMESPACE or
	 * %G_DBUS_SIGNAL_FLAGS_MATCH_ARG0_PATH are given, @arg0 is
	 * interpreted as part of a namespace or path.  The first argument
	 * of a signal is matched against that part as specified by D-Bus.
	 *
	 * If @user_data_free_func is non-%NULL, it will be called (in the
	 * thread-default main context of the thread you are calling this
	 * method from) at some point after @user_data is no longer
	 * needed. (It is not guaranteed to be called synchronously when the
	 * signal is unsubscribed from, and may be called after @connection
	 * has been destroyed.)
	 *
	 * Params:
	 *     sender = sender name to match on (unique or well-known name)
	 *         or %NULL to listen from all senders
	 *     interfaceName = D-Bus interface name to match on or %NULL to
	 *         match on all interfaces
	 *     member = D-Bus signal name to match on or %NULL to match on
	 *         all signals
	 *     objectPath = object path to match on or %NULL to match on
	 *         all object paths
	 *     arg0 = contents of first string argument to match on or %NULL
	 *         to match on all kinds of arguments
	 *     flags = #GDBusSignalFlags describing how arg0 is used in subscribing to the
	 *         signal
	 *     callback = callback to invoke when there is a signal matching the requested data
	 *     userData = user data to pass to @callback
	 *     userDataFreeFunc = function to free @user_data with when
	 *         subscription is removed or %NULL
	 *
	 * Returns: a subscription identifier that can be used with g_dbus_connection_signal_unsubscribe()
	 *
	 * Since: 2.26
	 */
	public uint signalSubscribe(string sender, string interfaceName, string member, string objectPath, string arg0, GDBusSignalFlags flags, GDBusSignalCallback callback, void* userData, GDestroyNotify userDataFreeFunc)
	{
		return g_dbus_connection_signal_subscribe(gDBusConnection, Str.toStringz(sender), Str.toStringz(interfaceName), Str.toStringz(member), Str.toStringz(objectPath), Str.toStringz(arg0), flags, callback, userData, userDataFreeFunc);
	}

	/**
	 * Unsubscribes from signals.
	 *
	 * Params:
	 *     subscriptionId = a subscription id obtained from
	 *         g_dbus_connection_signal_subscribe()
	 *
	 * Since: 2.26
	 */
	public void signalUnsubscribe(uint subscriptionId)
	{
		g_dbus_connection_signal_unsubscribe(gDBusConnection, subscriptionId);
	}

	/**
	 * If @connection was created with
	 * %G_DBUS_CONNECTION_FLAGS_DELAY_MESSAGE_PROCESSING, this method
	 * starts processing messages. Does nothing on if @connection wasn't
	 * created with this flag or if the method has already been called.
	 *
	 * Since: 2.26
	 */
	public void startMessageProcessing()
	{
		g_dbus_connection_start_message_processing(gDBusConnection);
	}

	/**
	 * Reverses the effect of a previous call to
	 * g_dbus_connection_export_action_group().
	 *
	 * It is an error to call this function with an ID that wasn't returned
	 * from g_dbus_connection_export_action_group() or to call it with the
	 * same ID more than once.
	 *
	 * Params:
	 *     exportId = the ID from g_dbus_connection_export_action_group()
	 *
	 * Since: 2.32
	 */
	public void unexportActionGroup(uint exportId)
	{
		g_dbus_connection_unexport_action_group(gDBusConnection, exportId);
	}

	/**
	 * Reverses the effect of a previous call to
	 * g_dbus_connection_export_menu_model().
	 *
	 * It is an error to call this function with an ID that wasn't returned
	 * from g_dbus_connection_export_menu_model() or to call it with the
	 * same ID more than once.
	 *
	 * Params:
	 *     exportId = the ID from g_dbus_connection_export_menu_model()
	 *
	 * Since: 2.32
	 */
	public void unexportMenuModel(uint exportId)
	{
		g_dbus_connection_unexport_menu_model(gDBusConnection, exportId);
	}

	/**
	 * Unregisters an object.
	 *
	 * Params:
	 *     registrationId = a registration id obtained from
	 *         g_dbus_connection_register_object()
	 *
	 * Returns: %TRUE if the object was unregistered, %FALSE otherwise
	 *
	 * Since: 2.26
	 */
	public bool unregisterObject(uint registrationId)
	{
		return g_dbus_connection_unregister_object(gDBusConnection, registrationId) != 0;
	}

	/**
	 * Unregisters a subtree.
	 *
	 * Params:
	 *     registrationId = a subtree registration id obtained from
	 *         g_dbus_connection_register_subtree()
	 *
	 * Returns: %TRUE if the subtree was unregistered, %FALSE otherwise
	 *
	 * Since: 2.26
	 */
	public bool unregisterSubtree(uint registrationId)
	{
		return g_dbus_connection_unregister_subtree(gDBusConnection, registrationId) != 0;
	}

	protected class OnClosedDelegateWrapper
	{
		void delegate(bool, ErrorG, DBusConnection) dlg;
		gulong handlerId;

		this(void delegate(bool, ErrorG, DBusConnection) dlg)
		{
			this.dlg = dlg;
			onClosedListeners ~= this;
		}

		void remove(OnClosedDelegateWrapper source)
		{
			foreach(index, wrapper; onClosedListeners)
			{
				if (wrapper.handlerId == source.handlerId)
				{
					onClosedListeners[index] = null;
					onClosedListeners = std.algorithm.remove(onClosedListeners, index);
					break;
				}
			}
		}
	}
	OnClosedDelegateWrapper[] onClosedListeners;

	/**
	 * Emitted when the connection is closed.
	 *
	 * The cause of this event can be
	 *
	 * - If g_dbus_connection_close() is called. In this case
	 * @remote_peer_vanished is set to %FALSE and @error is %NULL.
	 *
	 * - If the remote peer closes the connection. In this case
	 * @remote_peer_vanished is set to %TRUE and @error is set.
	 *
	 * - If the remote peer sends invalid or malformed data. In this
	 * case @remote_peer_vanished is set to %FALSE and @error is set.
	 *
	 * Upon receiving this signal, you should give up your reference to
	 * @connection. You are guaranteed that this signal is emitted only
	 * once.
	 *
	 * Params:
	 *     remotePeerVanished = %TRUE if @connection is closed because the
	 *         remote peer closed its end of the connection
	 *     error = a #GError with more details about the event or %NULL
	 *
	 * Since: 2.26
	 */
	gulong addOnClosed(void delegate(bool, ErrorG, DBusConnection) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
	{
		auto wrapper = new OnClosedDelegateWrapper(dlg);
		wrapper.handlerId = Signals.connectData(
			this,
			"closed",
			cast(GCallback)&callBackClosed,
			cast(void*)wrapper,
			cast(GClosureNotify)&callBackClosedDestroy,
			connectFlags);
		return wrapper.handlerId;
	}

	extern(C) static void callBackClosed(GDBusConnection* dbusconnectionStruct, bool remotePeerVanished, GError* error, OnClosedDelegateWrapper wrapper)
	{
		wrapper.dlg(remotePeerVanished, new ErrorG(error), wrapper.outer);
	}

	extern(C) static void callBackClosedDestroy(OnClosedDelegateWrapper wrapper, GClosure* closure)
	{
		wrapper.remove(wrapper);
	}

	/**
	 * Asynchronously connects to the message bus specified by @bus_type.
	 *
	 * When the operation is finished, @callback will be invoked. You can
	 * then call g_bus_get_finish() to get the result of the operation.
	 *
	 * This is a asynchronous failable function. See g_bus_get_sync() for
	 * the synchronous version.
	 *
	 * Params:
	 *     busType = a #GBusType
	 *     cancellable = a #GCancellable or %NULL
	 *     callback = a #GAsyncReadyCallback to call when the request is satisfied
	 *     userData = the data to pass to @callback
	 *
	 * Since: 2.26
	 */
	public static void get(GBusType busType, Cancellable cancellable, GAsyncReadyCallback callback, void* userData)
	{
		g_bus_get(busType, (cancellable is null) ? null : cancellable.getCancellableStruct(), callback, userData);
	}

	/**
	 * Finishes an operation started with g_bus_get().
	 *
	 * The returned object is a singleton, that is, shared with other
	 * callers of g_bus_get() and g_bus_get_sync() for @bus_type. In the
	 * event that you need a private message bus connection, use
	 * g_dbus_address_get_for_bus_sync() and
	 * g_dbus_connection_new_for_address().
	 *
	 * Note that the returned #GDBusConnection object will (usually) have
	 * the #GDBusConnection:exit-on-close property set to %TRUE.
	 *
	 * Params:
	 *     res = a #GAsyncResult obtained from the #GAsyncReadyCallback passed
	 *         to g_bus_get()
	 *
	 * Returns: a #GDBusConnection or %NULL if @error is set.
	 *     Free with g_object_unref().
	 *
	 * Since: 2.26
	 *
	 * Throws: GException on failure.
	 */
	public static DBusConnection getFinish(AsyncResultIF res)
	{
		GError* err = null;

		auto p = g_bus_get_finish((res is null) ? null : res.getAsyncResultStruct(), &err);

		if (err !is null)
		{
			throw new GException( new ErrorG(err) );
		}

		if(p is null)
		{
			return null;
		}

		return ObjectG.getDObject!(DBusConnection)(cast(GDBusConnection*) p, true);
	}

	/**
	 * Synchronously connects to the message bus specified by @bus_type.
	 * Note that the returned object may shared with other callers,
	 * e.g. if two separate parts of a process calls this function with
	 * the same @bus_type, they will share the same object.
	 *
	 * This is a synchronous failable function. See g_bus_get() and
	 * g_bus_get_finish() for the asynchronous version.
	 *
	 * The returned object is a singleton, that is, shared with other
	 * callers of g_bus_get() and g_bus_get_sync() for @bus_type. In the
	 * event that you need a private message bus connection, use
	 * g_dbus_address_get_for_bus_sync() and
	 * g_dbus_connection_new_for_address().
	 *
	 * Note that the returned #GDBusConnection object will (usually) have
	 * the #GDBusConnection:exit-on-close property set to %TRUE.
	 *
	 * Params:
	 *     busType = a #GBusType
	 *     cancellable = a #GCancellable or %NULL
	 *
	 * Returns: a #GDBusConnection or %NULL if @error is set.
	 *     Free with g_object_unref().
	 *
	 * Since: 2.26
	 *
	 * Throws: GException on failure.
	 */
	public static DBusConnection getSync(GBusType busType, Cancellable cancellable)
	{
		GError* err = null;

		auto p = g_bus_get_sync(busType, (cancellable is null) ? null : cancellable.getCancellableStruct(), &err);

		if (err !is null)
		{
			throw new GException( new ErrorG(err) );
		}

		if(p is null)
		{
			return null;
		}

		return ObjectG.getDObject!(DBusConnection)(cast(GDBusConnection*) p, true);
	}
}