1 /* 2 * This file is part of gtkD. 3 * 4 * gtkD is free software; you can redistribute it and/or modify 5 * it under the terms of the GNU Lesser General Public License 6 * as published by the Free Software Foundation; either version 3 7 * of the License, or (at your option) any later version, with 8 * some exceptions, please read the COPYING file. 9 * 10 * gtkD is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU Lesser General Public License for more details. 14 * 15 * You should have received a copy of the GNU Lesser General Public License 16 * along with gtkD; if not, write to the Free Software 17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA 18 */ 19 20 // generated automatically - do not change 21 // find conversion definition on APILookup.txt 22 // implement new conversion functionalities on the wrap.utils pakage 23 24 /* 25 * Conversion parameters: 26 * inFile = GDBusConnection.html 27 * outPack = gio 28 * outFile = DBusConnection 29 * strct = GDBusConnection 30 * realStrct= 31 * ctorStrct= 32 * clss = DBusConnection 33 * interf = 34 * class Code: Yes 35 * interface Code: No 36 * template for: 37 * extend = GObject 38 * implements: 39 * - InitableIF 40 * - AsyncInitableIF 41 * prefixes: 42 * - g_dbus_connection_ 43 * - g_dbus_ 44 * omit structs: 45 * omit prefixes: 46 * omit code: 47 * - g_dbus_connection_new_finish 48 * - g_dbus_connection_new_for_address_finish 49 * omit signals: 50 * imports: 51 * - glib.Str 52 * - glib.ErrorG 53 * - glib.GException 54 * - glib.Variant 55 * - glib.VariantType 56 * - gio.ActionGroupIF 57 * - gio.AsyncResultIF 58 * - gio.Cancellable 59 * - gio.Credentials 60 * - gio.DBusAuthObserver 61 * - gio.DBusMessage 62 * - gio.DBusMethodInvocation 63 * - gio.IOStream 64 * - gio.MenuModel 65 * - gio.UnixFDList 66 * - gio.InitableT 67 * - gio.InitableIF 68 * - gio.AsyncInitableT 69 * - gio.AsyncInitableIF 70 * structWrap: 71 * - GAsyncResult* -> AsyncResultIF 72 * - GCancellable* -> Cancellable 73 * - GCredentials* -> Credentials 74 * - GDBusAuthObserver* -> DBusAuthObserver 75 * - GDBusConnection* -> DBusConnection 76 * - GDBusMessage* -> DBusMessage 77 * - GDBusMethodInvocation* -> DBusMethodInvocation 78 * - GIOStream* -> IOStream 79 * - GUnixFDList* -> UnixFDList 80 * - GVariant* -> Variant 81 * - GVariantType* -> VariantType 82 * module aliases: 83 * local aliases: 84 * overrides: 85 */ 86 87 module gio.DBusConnection; 88 89 public import gtkc.giotypes; 90 91 private import gtkc.gio; 92 private import glib.ConstructionException; 93 private import gobject.ObjectG; 94 95 private import gobject.Signals; 96 public import gtkc.gdktypes; 97 98 private import glib.Str; 99 private import glib.ErrorG; 100 private import glib.GException; 101 private import glib.Variant; 102 private import glib.VariantType; 103 private import gio.ActionGroupIF; 104 private import gio.AsyncResultIF; 105 private import gio.Cancellable; 106 private import gio.Credentials; 107 private import gio.DBusAuthObserver; 108 private import gio.DBusMessage; 109 private import gio.DBusMethodInvocation; 110 private import gio.IOStream; 111 private import gio.MenuModel; 112 private import gio.UnixFDList; 113 private import gio.InitableT; 114 private import gio.InitableIF; 115 private import gio.AsyncInitableT; 116 private import gio.AsyncInitableIF; 117 118 119 120 private import gobject.ObjectG; 121 122 /** 123 * The GDBusConnection type is used for D-Bus connections to remote 124 * peers such as a message buses. It is a low-level API that offers a 125 * lot of flexibility. For instance, it lets you establish a connection 126 * over any transport that can by represented as an GIOStream. 127 * 128 * This class is rarely used directly in D-Bus clients. If you are writing 129 * an D-Bus client, it is often easier to use the g_bus_own_name(), 130 * g_bus_watch_name() or g_dbus_proxy_new_for_bus() APIs. 131 * 132 * As an exception to the usual GLib rule that a particular object must not be 133 * used by two threads at the same time, GDBusConnection's methods may be 134 * called from any thread[1]. 135 * 136 * Most of the ways to obtain a GDBusConnection automatically initialize it 137 * (i.e. connect to D-Bus): for instance, g_dbus_connection_new() and 138 * g_bus_get(), and the synchronous versions of those methods, give you an 139 * initialized connection. Language bindings for GIO should use 140 * g_initable_new() or g_async_initable_new_async(), which also initialize the 141 * connection. 142 * 143 * If you construct an uninitialized GDBusConnection, such as via 144 * g_object_new(), you must initialize it via g_initable_init() or 145 * g_async_initable_init_async() before using its methods or properties. 146 * Calling methods or accessing properties on a GDBusConnection that has not 147 * completed initialization successfully is considered to be invalid, and leads 148 * to undefined behaviour. In particular, if initialization fails with a 149 * GError, the only valid thing you can do with that GDBusConnection is to 150 * free it with g_object_unref(). 151 * 152 * $(DDOC_COMMENT example) 153 * 154 * $(DDOC_COMMENT example) 155 * 156 * $(DDOC_COMMENT example) 157 * 158 * $(DDOC_COMMENT example) 159 */ 160 public class DBusConnection : ObjectG, InitableIF, AsyncInitableIF 161 { 162 163 /** the main Gtk struct */ 164 protected GDBusConnection* gDBusConnection; 165 166 167 public GDBusConnection* getDBusConnectionStruct() 168 { 169 return gDBusConnection; 170 } 171 172 173 /** the main Gtk struct as a void* */ 174 protected override void* getStruct() 175 { 176 return cast(void*)gDBusConnection; 177 } 178 179 /** 180 * Sets our main struct and passes it to the parent class 181 */ 182 public this (GDBusConnection* gDBusConnection) 183 { 184 super(cast(GObject*)gDBusConnection); 185 this.gDBusConnection = gDBusConnection; 186 } 187 188 protected override void setStruct(GObject* obj) 189 { 190 super.setStruct(obj); 191 gDBusConnection = cast(GDBusConnection*)obj; 192 } 193 194 // add the Initable capabilities 195 mixin InitableT!(DBusConnection); 196 197 // add the AsyncInitable capabilities 198 mixin AsyncInitableT!(DBusConnection); 199 200 /** 201 * Finishes an operation started with g_dbus_connection_new(). 202 * Since 2.26 203 * Params: 204 * res = A GAsyncResult obtained from the GAsyncReadyCallback 205 * passed to g_dbus_connection_new(). 206 * address = If true finish an address. 207 * Throws: GException on failure. 208 * Throws: ConstructionException GTK+ fails to create the object. 209 */ 210 public this (AsyncResultIF res, bool address = false) 211 { 212 // GDBusConnection * g_dbus_connection_new_finish (GAsyncResult *res, GError **error); 213 GError* err = null; 214 GDBusConnection* p; 215 216 if ( address ) 217 { 218 p = g_dbus_connection_new_for_address_finish((res is null) ? null : res.getAsyncResultTStruct(), &err); 219 } 220 else 221 { 222 p = g_dbus_connection_new_finish((res is null) ? null : res.getAsyncResultTStruct(), &err); 223 } 224 225 if (err !is null) 226 { 227 throw new GException( new ErrorG(err) ); 228 } 229 230 if(p is null) 231 { 232 throw new ConstructionException("null returned by g_dbus_connection_new_finish((res is null) ? null : res.getAsyncResultTStruct(), &err)"); 233 } 234 this(cast(GDBusConnection*) p); 235 } 236 237 /** 238 * These functions support exporting a GActionGroup on D-Bus. 239 * The D-Bus interface that is used is a private implementation 240 * detail. 241 * 242 * To access an exported GActionGroup remotely, use 243 * g_dbus_action_group_get() to obtain a GDBusActionGroup. 244 */ 245 246 /** 247 * These functions support exporting a GMenuModel on D-Bus. 248 * The D-Bus interface that is used is a private implementation 249 * detail. 250 * 251 * To access an exported GMenuModel remotely, use 252 * g_dbus_menu_model_get() to obtain a GDBusMenuModel. 253 */ 254 int[string] connectedSignals; 255 256 void delegate(gboolean, GError*, DBusConnection)[] onClosedListeners; 257 /** 258 * Emitted when the connection is closed. 259 * The cause of this event can be 260 * If g_dbus_connection_close() is called. In this case 261 * remote_peer_vanished is set to FALSE and error is NULL. 262 * If the remote peer closes the connection. In this case 263 * remote_peer_vanished is set to TRUE and error is set. 264 * If the remote peer sends invalid or malformed data. In this 265 * case remote_peer_vanished is set to FALSE and error 266 * is set. 267 * Upon receiving this signal, you should give up your reference to 268 * connection. You are guaranteed that this signal is emitted only 269 * once. 270 * TRUE if connection is closed because the 271 * remote peer closed its end of the connection. 272 * Since 2.26 273 * [1] 274 * This is so that g_bus_get() and g_bus_get_sync() can safely return the 275 * same GDBusConnection when called from any thread. 276 */ 277 void addOnClosed(void delegate(gboolean, GError*, DBusConnection) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 278 { 279 if ( !("closed" in connectedSignals) ) 280 { 281 Signals.connectData( 282 getStruct(), 283 "closed", 284 cast(GCallback)&callBackClosed, 285 cast(void*)this, 286 null, 287 connectFlags); 288 connectedSignals["closed"] = 1; 289 } 290 onClosedListeners ~= dlg; 291 } 292 extern(C) static void callBackClosed(GDBusConnection* connectionStruct, gboolean remotePeerVanished, GError* error, DBusConnection _dBusConnection) 293 { 294 foreach ( void delegate(gboolean, GError*, DBusConnection) dlg ; _dBusConnection.onClosedListeners ) 295 { 296 dlg(remotePeerVanished, error, _dBusConnection); 297 } 298 } 299 300 301 /** 302 * Asynchronously connects to the message bus specified by bus_type. 303 * When the operation is finished, callback will be invoked. You can 304 * then call g_bus_get_finish() to get the result of the operation. 305 * This is a asynchronous failable function. See g_bus_get_sync() for 306 * the synchronous version. 307 * Since 2.26 308 * Params: 309 * busType = A GBusType. 310 * cancellable = A GCancellable or NULL. [allow-none] 311 * callback = A GAsyncReadyCallback to call when the request is satisfied. 312 * userData = The data to pass to callback. 313 */ 314 public static void gBusGet(GBusType busType, Cancellable cancellable, GAsyncReadyCallback callback, void* userData) 315 { 316 // void g_bus_get (GBusType bus_type, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data); 317 g_bus_get(busType, (cancellable is null) ? null : cancellable.getCancellableStruct(), callback, userData); 318 } 319 320 /** 321 * Finishes an operation started with g_bus_get(). 322 * The returned object is a singleton, that is, shared with other 323 * callers of g_bus_get() and g_bus_get_sync() for bus_type. In the 324 * event that you need a private message bus connection, use 325 * g_dbus_address_get_for_bus_sync() and 326 * g_dbus_connection_new_for_address(). 327 * Note that the returned GDBusConnection object will (usually) have 328 * the "exit-on-close" property set to TRUE. 329 * Since 2.26 330 * Params: 331 * res = A GAsyncResult obtained from the GAsyncReadyCallback passed to g_bus_get(). 332 * Returns: A GDBusConnection or NULL if error is set. Free with g_object_unref(). [transfer full] 333 * Throws: GException on failure. 334 */ 335 public static DBusConnection gBusGetFinish(AsyncResultIF res) 336 { 337 // GDBusConnection * g_bus_get_finish (GAsyncResult *res, GError **error); 338 GError* err = null; 339 340 auto p = g_bus_get_finish((res is null) ? null : res.getAsyncResultTStruct(), &err); 341 342 if (err !is null) 343 { 344 throw new GException( new ErrorG(err) ); 345 } 346 347 348 if(p is null) 349 { 350 return null; 351 } 352 353 return ObjectG.getDObject!(DBusConnection)(cast(GDBusConnection*) p); 354 } 355 356 /** 357 * Synchronously connects to the message bus specified by bus_type. 358 * Note that the returned object may shared with other callers, 359 * e.g. if two separate parts of a process calls this function with 360 * the same bus_type, they will share the same object. 361 * This is a synchronous failable function. See g_bus_get() and 362 * g_bus_get_finish() for the asynchronous version. 363 * The returned object is a singleton, that is, shared with other 364 * callers of g_bus_get() and g_bus_get_sync() for bus_type. In the 365 * event that you need a private message bus connection, use 366 * g_dbus_address_get_for_bus_sync() and 367 * g_dbus_connection_new_for_address(). 368 * Note that the returned GDBusConnection object will (usually) have 369 * the "exit-on-close" property set to TRUE. 370 * Since 2.26 371 * Params: 372 * busType = A GBusType. 373 * cancellable = A GCancellable or NULL. [allow-none] 374 * Returns: A GDBusConnection or NULL if error is set. Free with g_object_unref(). [transfer full] 375 * Throws: GException on failure. 376 */ 377 public static DBusConnection gBusGetSync(GBusType busType, Cancellable cancellable) 378 { 379 // GDBusConnection * g_bus_get_sync (GBusType bus_type, GCancellable *cancellable, GError **error); 380 GError* err = null; 381 382 auto p = g_bus_get_sync(busType, (cancellable is null) ? null : cancellable.getCancellableStruct(), &err); 383 384 if (err !is null) 385 { 386 throw new GException( new ErrorG(err) ); 387 } 388 389 390 if(p is null) 391 { 392 return null; 393 } 394 395 return ObjectG.getDObject!(DBusConnection)(cast(GDBusConnection*) p); 396 } 397 398 /** 399 * Asynchronously sets up a D-Bus connection for exchanging D-Bus messages 400 * with the end represented by stream. 401 * If stream is a GSocketConnection, then the corresponding GSocket 402 * will be put into non-blocking mode. 403 * The D-Bus connection will interact with stream from a worker thread. 404 * As a result, the caller should not interact with stream after this 405 * method has been called, except by calling g_object_unref() on it. 406 * If observer is not NULL it may be used to control the 407 * authentication process. 408 * When the operation is finished, callback will be invoked. You can 409 * then call g_dbus_connection_new_finish() to get the result of the 410 * operation. 411 * This is a asynchronous failable constructor. See 412 * g_dbus_connection_new_sync() for the synchronous 413 * version. 414 * Since 2.26 415 * Params: 416 * stream = A GIOStream. 417 * guid = The GUID to use if a authenticating as a server or NULL. [allow-none] 418 * flags = Flags describing how to make the connection. 419 * observer = A GDBusAuthObserver or NULL. [allow-none] 420 * cancellable = A GCancellable or NULL. [allow-none] 421 * callback = A GAsyncReadyCallback to call when the request is satisfied. 422 * userData = The data to pass to callback. 423 */ 424 public static void newDBusConnection(IOStream stream, string guid, GDBusConnectionFlags flags, DBusAuthObserver observer, Cancellable cancellable, GAsyncReadyCallback callback, void* userData) 425 { 426 // void g_dbus_connection_new (GIOStream *stream, const gchar *guid, GDBusConnectionFlags flags, GDBusAuthObserver *observer, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data); 427 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); 428 } 429 430 /** 431 * Synchronously sets up a D-Bus connection for exchanging D-Bus messages 432 * with the end represented by stream. 433 * If stream is a GSocketConnection, then the corresponding GSocket 434 * will be put into non-blocking mode. 435 * The D-Bus connection will interact with stream from a worker thread. 436 * As a result, the caller should not interact with stream after this 437 * method has been called, except by calling g_object_unref() on it. 438 * If observer is not NULL it may be used to control the 439 * authentication process. 440 * This is a synchronous failable constructor. See 441 * g_dbus_connection_new() for the asynchronous version. 442 * Since 2.26 443 * Params: 444 * stream = A GIOStream. 445 * guid = The GUID to use if a authenticating as a server or NULL. [allow-none] 446 * flags = Flags describing how to make the connection. 447 * observer = A GDBusAuthObserver or NULL. [allow-none] 448 * cancellable = A GCancellable or NULL. [allow-none] 449 * Throws: GException on failure. 450 * Throws: ConstructionException GTK+ fails to create the object. 451 */ 452 public this (IOStream stream, string guid, GDBusConnectionFlags flags, DBusAuthObserver observer, Cancellable cancellable) 453 { 454 // GDBusConnection * g_dbus_connection_new_sync (GIOStream *stream, const gchar *guid, GDBusConnectionFlags flags, GDBusAuthObserver *observer, GCancellable *cancellable, GError **error); 455 GError* err = null; 456 457 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); 458 459 if (err !is null) 460 { 461 throw new GException( new ErrorG(err) ); 462 } 463 464 if(p is null) 465 { 466 throw new ConstructionException("null returned by 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)"); 467 } 468 this(cast(GDBusConnection*) p); 469 } 470 471 /** 472 * Asynchronously connects and sets up a D-Bus client connection for 473 * exchanging D-Bus messages with an endpoint specified by address 474 * which must be in the D-Bus address format. 475 * This constructor can only be used to initiate client-side 476 * connections - use g_dbus_connection_new() if you need to act as the 477 * server. In particular, flags cannot contain the 478 * G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_SERVER or 479 * G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_ALLOW_ANONYMOUS flags. 480 * When the operation is finished, callback will be invoked. You can 481 * then call g_dbus_connection_new_finish() to get the result of the 482 * operation. 483 * If observer is not NULL it may be used to control the 484 * authentication process. 485 * This is a asynchronous failable constructor. See 486 * g_dbus_connection_new_for_address_sync() for the synchronous 487 * version. 488 * Since 2.26 489 * Params: 490 * address = A D-Bus address. 491 * flags = Flags describing how to make the connection. 492 * observer = A GDBusAuthObserver or NULL. [allow-none] 493 * cancellable = A GCancellable or NULL. [allow-none] 494 * callback = A GAsyncReadyCallback to call when the request is satisfied. 495 * userData = The data to pass to callback. 496 */ 497 public static void newForAddress(string address, GDBusConnectionFlags flags, DBusAuthObserver observer, Cancellable cancellable, GAsyncReadyCallback callback, void* userData) 498 { 499 // void g_dbus_connection_new_for_address (const gchar *address, GDBusConnectionFlags flags, GDBusAuthObserver *observer, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data); 500 g_dbus_connection_new_for_address(Str.toStringz(address), flags, (observer is null) ? null : observer.getDBusAuthObserverStruct(), (cancellable is null) ? null : cancellable.getCancellableStruct(), callback, userData); 501 } 502 503 /** 504 * Synchronously connects and sets up a D-Bus client connection for 505 * exchanging D-Bus messages with an endpoint specified by address 506 * which must be in the D-Bus address format. 507 * This constructor can only be used to initiate client-side 508 * connections - use g_dbus_connection_new_sync() if you need to act 509 * as the server. In particular, flags cannot contain the 510 * G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_SERVER or 511 * G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_ALLOW_ANONYMOUS flags. 512 * This is a synchronous failable constructor. See 513 * g_dbus_connection_new_for_address() for the asynchronous version. 514 * If observer is not NULL it may be used to control the 515 * authentication process. 516 * Since 2.26 517 * Params: 518 * address = A D-Bus address. 519 * flags = Flags describing how to make the connection. 520 * observer = A GDBusAuthObserver or NULL. [allow-none] 521 * cancellable = A GCancellable or NULL. [allow-none] 522 * Throws: GException on failure. 523 * Throws: ConstructionException GTK+ fails to create the object. 524 */ 525 public this (string address, GDBusConnectionFlags flags, DBusAuthObserver observer, Cancellable cancellable) 526 { 527 // GDBusConnection * g_dbus_connection_new_for_address_sync (const gchar *address, GDBusConnectionFlags flags, GDBusAuthObserver *observer, GCancellable *cancellable, GError **error); 528 GError* err = null; 529 530 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); 531 532 if (err !is null) 533 { 534 throw new GException( new ErrorG(err) ); 535 } 536 537 if(p is null) 538 { 539 throw new ConstructionException("null returned by g_dbus_connection_new_for_address_sync(Str.toStringz(address), flags, (observer is null) ? null : observer.getDBusAuthObserverStruct(), (cancellable is null) ? null : cancellable.getCancellableStruct(), &err)"); 540 } 541 this(cast(GDBusConnection*) p); 542 } 543 544 /** 545 * If connection was created with 546 * G_DBUS_CONNECTION_FLAGS_DELAY_MESSAGE_PROCESSING, this method 547 * starts processing messages. Does nothing on if connection wasn't 548 * created with this flag or if the method has already been called. 549 * Since 2.26 550 */ 551 public void startMessageProcessing() 552 { 553 // void g_dbus_connection_start_message_processing (GDBusConnection *connection); 554 g_dbus_connection_start_message_processing(gDBusConnection); 555 } 556 557 /** 558 * Closes connection. Note that this never causes the process to 559 * exit (this might only happen if the other end of a shared message 560 * bus connection disconnects, see "exit-on-close"). 561 * Once the connection is closed, operations such as sending a message 562 * will return with the error G_IO_ERROR_CLOSED. Closing a connection 563 * will not automatically flush the connection so queued messages may 564 * be lost. Use g_dbus_connection_flush() if you need such guarantees. 565 * If connection is already closed, this method fails with 566 * G_IO_ERROR_CLOSED. 567 * When connection has been closed, the "closed" 568 * signal is emitted in the thread-default main 569 * loop of the thread that connection was constructed in. 570 * This is an asynchronous method. When the operation is finished, 571 * callback will be invoked in the thread-default main 572 * loop of the thread you are calling this method from. You can 573 * then call g_dbus_connection_close_finish() to get the result of the 574 * operation. See g_dbus_connection_close_sync() for the synchronous 575 * version. 576 * Since 2.26 577 * Params: 578 * cancellable = A GCancellable or NULL. [allow-none] 579 * callback = A GAsyncReadyCallback to call when the request is 580 * satisfied or NULL if you don't care about the result. [allow-none] 581 * userData = The data to pass to callback. 582 */ 583 public void close(Cancellable cancellable, GAsyncReadyCallback callback, void* userData) 584 { 585 // void g_dbus_connection_close (GDBusConnection *connection, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data); 586 g_dbus_connection_close(gDBusConnection, (cancellable is null) ? null : cancellable.getCancellableStruct(), callback, userData); 587 } 588 589 /** 590 * Finishes an operation started with g_dbus_connection_close(). 591 * Since 2.26 592 * Params: 593 * res = A GAsyncResult obtained from the GAsyncReadyCallback passed to g_dbus_connection_close(). 594 * Returns: TRUE if the operation succeeded, FALSE if error is set. 595 * Throws: GException on failure. 596 */ 597 public int closeFinish(AsyncResultIF res) 598 { 599 // gboolean g_dbus_connection_close_finish (GDBusConnection *connection, GAsyncResult *res, GError **error); 600 GError* err = null; 601 602 auto p = g_dbus_connection_close_finish(gDBusConnection, (res is null) ? null : res.getAsyncResultTStruct(), &err); 603 604 if (err !is null) 605 { 606 throw new GException( new ErrorG(err) ); 607 } 608 609 return p; 610 } 611 612 /** 613 * Synchronously closees connection. The calling thread is blocked 614 * until this is done. See g_dbus_connection_close() for the 615 * asynchronous version of this method and more details about what it 616 * does. 617 * Since 2.26 618 * Params: 619 * cancellable = A GCancellable or NULL. [allow-none] 620 * Returns: TRUE if the operation succeeded, FALSE if error is set. 621 * Throws: GException on failure. 622 */ 623 public int closeSync(Cancellable cancellable) 624 { 625 // gboolean g_dbus_connection_close_sync (GDBusConnection *connection, GCancellable *cancellable, GError **error); 626 GError* err = null; 627 628 auto p = g_dbus_connection_close_sync(gDBusConnection, (cancellable is null) ? null : cancellable.getCancellableStruct(), &err); 629 630 if (err !is null) 631 { 632 throw new GException( new ErrorG(err) ); 633 } 634 635 return p; 636 } 637 638 /** 639 * Gets whether connection is closed. 640 * Since 2.26 641 * Returns: TRUE if the connection is closed, FALSE otherwise. 642 */ 643 public int isClosed() 644 { 645 // gboolean g_dbus_connection_is_closed (GDBusConnection *connection); 646 return g_dbus_connection_is_closed(gDBusConnection); 647 } 648 649 /** 650 * Asynchronously flushes connection, that is, writes all queued 651 * outgoing message to the transport and then flushes the transport 652 * (using g_output_stream_flush_async()). This is useful in programs 653 * that wants to emit a D-Bus signal and then exit 654 * immediately. Without flushing the connection, there is no guarantee 655 * that the message has been sent to the networking buffers in the OS 656 * kernel. 657 * This is an asynchronous method. When the operation is finished, 658 * callback will be invoked in the thread-default main 659 * loop of the thread you are calling this method from. You can 660 * then call g_dbus_connection_flush_finish() to get the result of the 661 * operation. See g_dbus_connection_flush_sync() for the synchronous 662 * version. 663 * Since 2.26 664 * Params: 665 * cancellable = A GCancellable or NULL. [allow-none] 666 * callback = A GAsyncReadyCallback to call when the request is 667 * satisfied or NULL if you don't care about the result. [allow-none] 668 * userData = The data to pass to callback. 669 */ 670 public void flush(Cancellable cancellable, GAsyncReadyCallback callback, void* userData) 671 { 672 // void g_dbus_connection_flush (GDBusConnection *connection, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data); 673 g_dbus_connection_flush(gDBusConnection, (cancellable is null) ? null : cancellable.getCancellableStruct(), callback, userData); 674 } 675 676 /** 677 * Finishes an operation started with g_dbus_connection_flush(). 678 * Since 2.26 679 * Params: 680 * res = A GAsyncResult obtained from the GAsyncReadyCallback passed to g_dbus_connection_flush(). 681 * Returns: TRUE if the operation succeeded, FALSE if error is set. 682 * Throws: GException on failure. 683 */ 684 public int flushFinish(AsyncResultIF res) 685 { 686 // gboolean g_dbus_connection_flush_finish (GDBusConnection *connection, GAsyncResult *res, GError **error); 687 GError* err = null; 688 689 auto p = g_dbus_connection_flush_finish(gDBusConnection, (res is null) ? null : res.getAsyncResultTStruct(), &err); 690 691 if (err !is null) 692 { 693 throw new GException( new ErrorG(err) ); 694 } 695 696 return p; 697 } 698 699 /** 700 * Synchronously flushes connection. The calling thread is blocked 701 * until this is done. See g_dbus_connection_flush() for the 702 * asynchronous version of this method and more details about what it 703 * does. 704 * Since 2.26 705 * Params: 706 * cancellable = A GCancellable or NULL. [allow-none] 707 * Returns: TRUE if the operation succeeded, FALSE if error is set. 708 * Throws: GException on failure. 709 */ 710 public int flushSync(Cancellable cancellable) 711 { 712 // gboolean g_dbus_connection_flush_sync (GDBusConnection *connection, GCancellable *cancellable, GError **error); 713 GError* err = null; 714 715 auto p = g_dbus_connection_flush_sync(gDBusConnection, (cancellable is null) ? null : cancellable.getCancellableStruct(), &err); 716 717 if (err !is null) 718 { 719 throw new GException( new ErrorG(err) ); 720 } 721 722 return p; 723 } 724 725 /** 726 * Gets whether the process is terminated when connection is 727 * closed by the remote peer. See 728 * "exit-on-close" for more details. 729 * Since 2.26 730 * Returns: Whether the process is terminated when connection is closed by the remote peer. 731 */ 732 public int getExitOnClose() 733 { 734 // gboolean g_dbus_connection_get_exit_on_close (GDBusConnection *connection); 735 return g_dbus_connection_get_exit_on_close(gDBusConnection); 736 } 737 738 /** 739 * Sets whether the process should be terminated when connection is 740 * closed by the remote peer. See "exit-on-close" for 741 * more details. 742 * Note that this function should be used with care. Most modern UNIX 743 * desktops tie the notion of a user session the session bus, and expect 744 * all of a users applications to quit when their bus connection goes away. 745 * If you are setting exit_on_close to FALSE for the shared session 746 * bus connection, you should make sure that your application exits 747 * when the user session ends. 748 * Since 2.26 749 * Params: 750 * exitOnClose = Whether the process should be terminated 751 * when connection is closed by the remote peer. 752 */ 753 public void setExitOnClose(int exitOnClose) 754 { 755 // void g_dbus_connection_set_exit_on_close (GDBusConnection *connection, gboolean exit_on_close); 756 g_dbus_connection_set_exit_on_close(gDBusConnection, exitOnClose); 757 } 758 759 /** 760 * Gets the underlying stream used for IO. 761 * While the GDBusConnection is active, it will interact with this 762 * stream from a worker thread, so it is not safe to interact with 763 * the stream directly. 764 * Since 2.26 765 * Returns: the stream used for IO. [transfer none] 766 */ 767 public IOStream getStream() 768 { 769 // GIOStream * g_dbus_connection_get_stream (GDBusConnection *connection); 770 auto p = g_dbus_connection_get_stream(gDBusConnection); 771 772 if(p is null) 773 { 774 return null; 775 } 776 777 return ObjectG.getDObject!(IOStream)(cast(GIOStream*) p); 778 } 779 780 /** 781 * The GUID of the peer performing the role of server when 782 * authenticating. See "guid" for more details. 783 * Since 2.26 784 * Returns: The GUID. Do not free this string, it is owned by connection. 785 */ 786 public string getGuid() 787 { 788 // const gchar * g_dbus_connection_get_guid (GDBusConnection *connection); 789 return Str.toString(g_dbus_connection_get_guid(gDBusConnection)); 790 } 791 792 /** 793 * Gets the unique name of connection as assigned by the message 794 * bus. This can also be used to figure out if connection is a 795 * message bus connection. 796 * Since 2.26 797 * Returns: The unique name or NULL if connection is not a message bus connection. Do not free this string, it is owned by connection. 798 */ 799 public string getUniqueName() 800 { 801 // const gchar * g_dbus_connection_get_unique_name (GDBusConnection *connection); 802 return Str.toString(g_dbus_connection_get_unique_name(gDBusConnection)); 803 } 804 805 /** 806 * Gets the capabilities negotiated with the remote peer 807 * Since 2.26 808 * Returns: Zero or more flags from the GDBusCapabilityFlags enumeration. 809 */ 810 public GDBusCapabilityFlags getCapabilities() 811 { 812 // GDBusCapabilityFlags g_dbus_connection_get_capabilities (GDBusConnection *connection); 813 return g_dbus_connection_get_capabilities(gDBusConnection); 814 } 815 816 /** 817 * Gets the credentials of the authenticated peer. This will always 818 * return NULL unless connection acted as a server 819 * (e.g. G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_SERVER was passed) 820 * when set up and the client passed credentials as part of the 821 * authentication process. 822 * In a message bus setup, the message bus is always the server and 823 * each application is a client. So this method will always return 824 * NULL for message bus clients. 825 * Since 2.26 826 * Returns: A GCredentials or NULL if not available. Do not free this object, it is owned by connection. [transfer none] 827 */ 828 public Credentials getPeerCredentials() 829 { 830 // GCredentials * g_dbus_connection_get_peer_credentials (GDBusConnection *connection); 831 auto p = g_dbus_connection_get_peer_credentials(gDBusConnection); 832 833 if(p is null) 834 { 835 return null; 836 } 837 838 return ObjectG.getDObject!(Credentials)(cast(GCredentials*) p); 839 } 840 841 /** 842 * Retrieves the last serial number assigned to a GDBusMessage on 843 * the current thread. This includes messages sent via both low-level 844 * API such as g_dbus_connection_send_message() as well as 845 * high-level API such as g_dbus_connection_emit_signal(), 846 * g_dbus_connection_call() or g_dbus_proxy_call(). 847 * Since 2.34 848 * Returns: the last used serial or zero when no message has been sent within the current thread. 849 */ 850 public uint getLastSerial() 851 { 852 // guint32 g_dbus_connection_get_last_serial (GDBusConnection *connection); 853 return g_dbus_connection_get_last_serial(gDBusConnection); 854 } 855 856 /** 857 * Asynchronously invokes the method_name method on the 858 * interface_name D-Bus interface on the remote object at 859 * object_path owned by bus_name. 860 * If connection is closed then the operation will fail with 861 * G_IO_ERROR_CLOSED. If cancellable is canceled, the operation will 862 * fail with G_IO_ERROR_CANCELLED. If parameters contains a value 863 * not compatible with the D-Bus protocol, the operation fails with 864 * G_IO_ERROR_INVALID_ARGUMENT. 865 * If reply_type is non-NULL then the reply will be checked for having this type and an 866 * error will be raised if it does not match. Said another way, if you give a reply_type 867 * then any non-NULL return value will be of this type. 868 * If the parameters GVariant is floating, it is consumed. This allows 869 * Since 2.26 870 * Params: 871 * busName = A unique or well-known bus name or NULL if 872 * connection is not a message bus connection. [allow-none] 873 * objectPath = Path of remote object. 874 * interfaceName = D-Bus interface to invoke method on. 875 * methodName = The name of the method to invoke. 876 * parameters = A GVariant tuple with parameters for the method 877 * or NULL if not passing parameters. [allow-none] 878 * replyType = The expected type of the reply, or NULL. [allow-none] 879 * flags = Flags from the GDBusCallFlags enumeration. 880 * timeoutMsec = The timeout in milliseconds, -1 to use the default 881 * timeout or G_MAXINT for no timeout. 882 * cancellable = A GCancellable or NULL. [allow-none] 883 * callback = A GAsyncReadyCallback to call when the request is 884 * satisfied or NULL if you don't care about the result of the 885 * method invocation. [allow-none] 886 * userData = The data to pass to callback. 887 */ 888 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) 889 { 890 // void g_dbus_connection_call (GDBusConnection *connection, const gchar *bus_name, const gchar *object_path, const gchar *interface_name, const gchar *method_name, GVariant *parameters, const GVariantType *reply_type, GDBusCallFlags flags, gint timeout_msec, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data); 891 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); 892 } 893 894 /** 895 * Finishes an operation started with g_dbus_connection_call(). 896 * Since 2.26 897 * Params: 898 * res = A GAsyncResult obtained from the GAsyncReadyCallback passed to g_dbus_connection_call(). 899 * Returns: NULL if error is set. Otherwise a GVariant tuple with return values. Free with g_variant_unref(). 900 * Throws: GException on failure. 901 */ 902 public Variant callFinish(AsyncResultIF res) 903 { 904 // GVariant * g_dbus_connection_call_finish (GDBusConnection *connection, GAsyncResult *res, GError **error); 905 GError* err = null; 906 907 auto p = g_dbus_connection_call_finish(gDBusConnection, (res is null) ? null : res.getAsyncResultTStruct(), &err); 908 909 if (err !is null) 910 { 911 throw new GException( new ErrorG(err) ); 912 } 913 914 915 if(p is null) 916 { 917 return null; 918 } 919 920 return ObjectG.getDObject!(Variant)(cast(GVariant*) p); 921 } 922 923 /** 924 * Synchronously invokes the method_name method on the 925 * interface_name D-Bus interface on the remote object at 926 * object_path owned by bus_name. 927 * If connection is closed then the operation will fail with 928 * G_IO_ERROR_CLOSED. If cancellable is canceled, the 929 * operation will fail with G_IO_ERROR_CANCELLED. If parameters 930 * contains a value not compatible with the D-Bus protocol, the operation 931 * fails with G_IO_ERROR_INVALID_ARGUMENT. 932 * If reply_type is non-NULL then the reply will be checked for having 933 * this type and an error will be raised if it does not match. Said 934 * another way, if you give a reply_type then any non-NULL return 935 * value will be of this type. 936 * If the parameters GVariant is floating, it is consumed. 937 * Since 2.26 938 * Params: 939 * busName = A unique or well-known bus name or NULL if 940 * connection is not a message bus connection. [allow-none] 941 * objectPath = Path of remote object. 942 * interfaceName = D-Bus interface to invoke method on. 943 * methodName = The name of the method to invoke. 944 * parameters = A GVariant tuple with parameters for the method 945 * or NULL if not passing parameters. [allow-none] 946 * replyType = The expected type of the reply, or NULL. [allow-none] 947 * flags = Flags from the GDBusCallFlags enumeration. 948 * timeoutMsec = The timeout in milliseconds, -1 to use the default 949 * timeout or G_MAXINT for no timeout. 950 * cancellable = A GCancellable or NULL. [allow-none] 951 * Returns: NULL if error is set. Otherwise a GVariant tuple with return values. Free with g_variant_unref(). 952 * Throws: GException on failure. 953 */ 954 public Variant callSync(string busName, string objectPath, string interfaceName, string methodName, Variant parameters, VariantType replyType, GDBusCallFlags flags, int timeoutMsec, Cancellable cancellable) 955 { 956 // GVariant * g_dbus_connection_call_sync (GDBusConnection *connection, const gchar *bus_name, const gchar *object_path, const gchar *interface_name, const gchar *method_name, GVariant *parameters, const GVariantType *reply_type, GDBusCallFlags flags, gint timeout_msec, GCancellable *cancellable, GError **error); 957 GError* err = null; 958 959 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); 960 961 if (err !is null) 962 { 963 throw new GException( new ErrorG(err) ); 964 } 965 966 967 if(p is null) 968 { 969 return null; 970 } 971 972 return ObjectG.getDObject!(Variant)(cast(GVariant*) p); 973 } 974 975 /** 976 * Like g_dbus_connection_call() but also takes a GUnixFDList object. 977 * This method is only available on UNIX. 978 * Since 2.30 979 * Params: 980 * busName = A unique or well-known bus name or NULL if 981 * connection is not a message bus connection. [allow-none] 982 * objectPath = Path of remote object. 983 * interfaceName = D-Bus interface to invoke method on. 984 * methodName = The name of the method to invoke. 985 * parameters = A GVariant tuple with parameters for the method 986 * or NULL if not passing parameters. [allow-none] 987 * replyType = The expected type of the reply, or NULL. [allow-none] 988 * flags = Flags from the GDBusCallFlags enumeration. 989 * timeoutMsec = The timeout in milliseconds, -1 to use the default 990 * timeout or G_MAXINT for no timeout. 991 * fdList = A GUnixFDList or NULL. [allow-none] 992 * cancellable = A GCancellable or NULL. [allow-none] 993 * callback = A GAsyncReadyCallback to call when the request is 994 * satisfied or NULL if you don't * care about the result of the 995 * method invocation. [allow-none] 996 * userData = The data to pass to callback. 997 */ 998 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) 999 { 1000 // void g_dbus_connection_call_with_unix_fd_list (GDBusConnection *connection, const gchar *bus_name, const gchar *object_path, const gchar *interface_name, const gchar *method_name, GVariant *parameters, const GVariantType *reply_type, GDBusCallFlags flags, gint timeout_msec, GUnixFDList *fd_list, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data); 1001 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); 1002 } 1003 1004 /** 1005 * Finishes an operation started with g_dbus_connection_call_with_unix_fd_list(). 1006 * Since 2.30 1007 * Params: 1008 * outFdList = Return location for a GUnixFDList or NULL. [out][allow-none] 1009 * res = A GAsyncResult obtained from the GAsyncReadyCallback passed to g_dbus_connection_call_with_unix_fd_list(). 1010 * Returns: NULL if error is set. Otherwise a GVariant tuple with return values. Free with g_variant_unref(). 1011 * Throws: GException on failure. 1012 */ 1013 public Variant callWithUnixFdListFinish(out UnixFDList outFdList, AsyncResultIF res) 1014 { 1015 // GVariant * g_dbus_connection_call_with_unix_fd_list_finish (GDBusConnection *connection, GUnixFDList **out_fd_list, GAsyncResult *res, GError **error); 1016 GUnixFDList* outoutFdList = null; 1017 GError* err = null; 1018 1019 auto p = g_dbus_connection_call_with_unix_fd_list_finish(gDBusConnection, &outoutFdList, (res is null) ? null : res.getAsyncResultTStruct(), &err); 1020 1021 if (err !is null) 1022 { 1023 throw new GException( new ErrorG(err) ); 1024 } 1025 1026 outFdList = ObjectG.getDObject!(UnixFDList)(outoutFdList); 1027 1028 if(p is null) 1029 { 1030 return null; 1031 } 1032 1033 return ObjectG.getDObject!(Variant)(cast(GVariant*) p); 1034 } 1035 1036 /** 1037 * Like g_dbus_connection_call_sync() but also takes and returns GUnixFDList objects. 1038 * This method is only available on UNIX. 1039 * Since 2.30 1040 * Params: 1041 * busName = A unique or well-known bus name or NULL if 1042 * connection is not a message bus connection. [allow-none] 1043 * objectPath = Path of remote object. 1044 * interfaceName = D-Bus interface to invoke method on. 1045 * methodName = The name of the method to invoke. 1046 * parameters = A GVariant tuple with parameters for the method 1047 * or NULL if not passing parameters. [allow-none] 1048 * replyType = The expected type of the reply, or NULL. [allow-none] 1049 * flags = Flags from the GDBusCallFlags enumeration. 1050 * timeoutMsec = The timeout in milliseconds, -1 to use the default 1051 * timeout or G_MAXINT for no timeout. 1052 * fdList = A GUnixFDList or NULL. [allow-none] 1053 * outFdList = Return location for a GUnixFDList or NULL. [out][allow-none] 1054 * cancellable = A GCancellable or NULL. [allow-none] 1055 * Returns: NULL if error is set. Otherwise a GVariant tuple with return values. Free with g_variant_unref(). 1056 * Throws: GException on failure. 1057 */ 1058 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) 1059 { 1060 // GVariant * g_dbus_connection_call_with_unix_fd_list_sync (GDBusConnection *connection, const gchar *bus_name, const gchar *object_path, const gchar *interface_name, const gchar *method_name, GVariant *parameters, const GVariantType *reply_type, GDBusCallFlags flags, gint timeout_msec, GUnixFDList *fd_list, GUnixFDList **out_fd_list, GCancellable *cancellable, GError **error); 1061 GUnixFDList* outoutFdList = null; 1062 GError* err = null; 1063 1064 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); 1065 1066 if (err !is null) 1067 { 1068 throw new GException( new ErrorG(err) ); 1069 } 1070 1071 outFdList = ObjectG.getDObject!(UnixFDList)(outoutFdList); 1072 1073 if(p is null) 1074 { 1075 return null; 1076 } 1077 1078 return ObjectG.getDObject!(Variant)(cast(GVariant*) p); 1079 } 1080 1081 /** 1082 * Emits a signal. 1083 * If the parameters GVariant is floating, it is consumed. 1084 * This can only fail if parameters is not compatible with the D-Bus protocol. 1085 * Since 2.26 1086 * Params: 1087 * destinationBusName = The unique bus name for the destination 1088 * for the signal or NULL to emit to all listeners. [allow-none] 1089 * objectPath = Path of remote object. 1090 * interfaceName = D-Bus interface to emit a signal on. 1091 * signalName = The name of the signal to emit. 1092 * parameters = A GVariant tuple with parameters for the signal 1093 * or NULL if not passing parameters. [allow-none] 1094 * Returns: TRUE unless error is set. 1095 * Throws: GException on failure. 1096 */ 1097 public int emitSignal(string destinationBusName, string objectPath, string interfaceName, string signalName, Variant parameters) 1098 { 1099 // gboolean g_dbus_connection_emit_signal (GDBusConnection *connection, const gchar *destination_bus_name, const gchar *object_path, const gchar *interface_name, const gchar *signal_name, GVariant *parameters, GError **error); 1100 GError* err = null; 1101 1102 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); 1103 1104 if (err !is null) 1105 { 1106 throw new GException( new ErrorG(err) ); 1107 } 1108 1109 return p; 1110 } 1111 1112 /** 1113 * Subscribes to signals on connection and invokes callback with a 1114 * whenever the signal is received. Note that callback 1115 * will be invoked in the thread-default main 1116 * loop of the thread you are calling this method from. 1117 * If connection is not a message bus connection, sender must be 1118 * NULL. 1119 * If sender is a well-known name note that callback is invoked with 1120 * the unique name for the owner of sender, not the well-known name 1121 * as one would expect. This is because the message bus rewrites the 1122 * name. As such, to avoid certain race conditions, users should be 1123 * tracking the name owner of the well-known name and use that when 1124 * processing the received signal. 1125 * If one of G_DBUS_SIGNAL_FLAGS_MATCH_ARG0_NAMESPACE or 1126 * G_DBUS_SIGNAL_FLAGS_MATCH_ARG0_PATH are given, arg0 is 1127 * interpreted as part of a namespace or path. The first argument 1128 * of a signal is matched against that part as specified by D-Bus. 1129 * Since 2.26 1130 * Params: 1131 * sender = Sender name to match on (unique or well-known name) 1132 * or NULL to listen from all senders. [allow-none] 1133 * interfaceName = D-Bus interface name to match on or NULL to 1134 * match on all interfaces. [allow-none] 1135 * member = D-Bus signal name to match on or NULL to match on all signals. [allow-none] 1136 * objectPath = Object path to match on or NULL to match on all object paths. [allow-none] 1137 * arg0 = Contents of first string argument to match on or NULL 1138 * to match on all kinds of arguments. [allow-none] 1139 * flags = Flags describing how to subscribe to the signal (currently unused). 1140 * callback = Callback to invoke when there is a signal matching the requested data. 1141 * userData = User data to pass to callback. 1142 * userDataFreeFunc = Function to free user_data with when 1143 * subscription is removed or NULL. [allow-none] 1144 * Returns: A subscription identifier that can be used with g_dbus_connection_signal_unsubscribe(). 1145 */ 1146 public uint signalSubscribe(string sender, string interfaceName, string member, string objectPath, string arg0, GDBusSignalFlags flags, GDBusSignalCallback callback, void* userData, GDestroyNotify userDataFreeFunc) 1147 { 1148 // guint g_dbus_connection_signal_subscribe (GDBusConnection *connection, const gchar *sender, const gchar *interface_name, const gchar *member, const gchar *object_path, const gchar *arg0, GDBusSignalFlags flags, GDBusSignalCallback callback, gpointer user_data, GDestroyNotify user_data_free_func); 1149 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); 1150 } 1151 1152 /** 1153 * Unsubscribes from signals. 1154 * Since 2.26 1155 * Params: 1156 * subscriptionId = A subscription id obtained from g_dbus_connection_signal_subscribe(). 1157 */ 1158 public void signalUnsubscribe(uint subscriptionId) 1159 { 1160 // void g_dbus_connection_signal_unsubscribe (GDBusConnection *connection, guint subscription_id); 1161 g_dbus_connection_signal_unsubscribe(gDBusConnection, subscriptionId); 1162 } 1163 1164 /** 1165 * Asynchronously sends message to the peer represented by connection. 1166 * Unless flags contain the 1167 * G_DBUS_SEND_MESSAGE_FLAGS_PRESERVE_SERIAL flag, the serial number 1168 * will be assigned by connection and set on message via 1169 * g_dbus_message_set_serial(). If out_serial is not NULL, then the 1170 * serial number used will be written to this location prior to 1171 * submitting the message to the underlying transport. 1172 * If connection is closed then the operation will fail with 1173 * G_IO_ERROR_CLOSED. If message is not well-formed, 1174 * the operation fails with G_IO_ERROR_INVALID_ARGUMENT. 1175 * See Example 6, “D-Bus server example” and Example 8, “D-Bus UNIX File Descriptor example” for an example of how to use this 1176 * low-level API to send and receive UNIX file descriptors. 1177 * Note that message must be unlocked, unless flags contain the 1178 * G_DBUS_SEND_MESSAGE_FLAGS_PRESERVE_SERIAL flag. 1179 * Since 2.26 1180 * Params: 1181 * message = A GDBusMessage 1182 * flags = Flags affecting how the message is sent. 1183 * outSerial = Return location for serial number assigned 1184 * to message when sending it or NULL. [out][allow-none] 1185 * Returns: TRUE if the message was well-formed and queued for transmission, FALSE if error is set. 1186 * Throws: GException on failure. 1187 */ 1188 public int sendMessage(DBusMessage message, GDBusSendMessageFlags flags, out uint outSerial) 1189 { 1190 // gboolean g_dbus_connection_send_message (GDBusConnection *connection, GDBusMessage *message, GDBusSendMessageFlags flags, volatile guint32 *out_serial, GError **error); 1191 GError* err = null; 1192 1193 auto p = g_dbus_connection_send_message(gDBusConnection, (message is null) ? null : message.getDBusMessageStruct(), flags, &outSerial, &err); 1194 1195 if (err !is null) 1196 { 1197 throw new GException( new ErrorG(err) ); 1198 } 1199 1200 return p; 1201 } 1202 1203 /** 1204 * Asynchronously sends message to the peer represented by connection. 1205 * Unless flags contain the 1206 * G_DBUS_SEND_MESSAGE_FLAGS_PRESERVE_SERIAL flag, the serial number 1207 * will be assigned by connection and set on message via 1208 * g_dbus_message_set_serial(). If out_serial is not NULL, then the 1209 * serial number used will be written to this location prior to 1210 * submitting the message to the underlying transport. 1211 * If connection is closed then the operation will fail with 1212 * G_IO_ERROR_CLOSED. If cancellable is canceled, the operation will 1213 * fail with G_IO_ERROR_CANCELLED. If message is not well-formed, 1214 * the operation fails with G_IO_ERROR_INVALID_ARGUMENT. 1215 * This is an asynchronous method. When the operation is finished, callback will be invoked 1216 * in the thread-default main loop 1217 * of the thread you are calling this method from. You can then call 1218 * g_dbus_connection_send_message_with_reply_finish() to get the result of the operation. 1219 * See g_dbus_connection_send_message_with_reply_sync() for the synchronous version. 1220 * Note that message must be unlocked, unless flags contain the 1221 * G_DBUS_SEND_MESSAGE_FLAGS_PRESERVE_SERIAL flag. 1222 * See Example 6, “D-Bus server example” and Example 8, “D-Bus UNIX File Descriptor example” for an example of how to use this 1223 * low-level API to send and receive UNIX file descriptors. 1224 * Since 2.26 1225 * Params: 1226 * message = A GDBusMessage. 1227 * flags = Flags affecting how the message is sent. 1228 * timeoutMsec = The timeout in milliseconds, -1 to use the default 1229 * timeout or G_MAXINT for no timeout. 1230 * outSerial = Return location for serial number assigned 1231 * to message when sending it or NULL. [out][allow-none] 1232 * cancellable = A GCancellable or NULL. [allow-none] 1233 * callback = A GAsyncReadyCallback to call when the request is 1234 * satisfied or NULL if you don't care about the result. [allow-none] 1235 * userData = The data to pass to callback. 1236 */ 1237 public void sendMessageWithReply(DBusMessage message, GDBusSendMessageFlags flags, int timeoutMsec, out uint outSerial, Cancellable cancellable, GAsyncReadyCallback callback, void* userData) 1238 { 1239 // void g_dbus_connection_send_message_with_reply (GDBusConnection *connection, GDBusMessage *message, GDBusSendMessageFlags flags, gint timeout_msec, volatile guint32 *out_serial, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data); 1240 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); 1241 } 1242 1243 /** 1244 * Finishes an operation started with g_dbus_connection_send_message_with_reply(). 1245 * Note that error is only set if a local in-process error 1246 * occurred. That is to say that the returned GDBusMessage object may 1247 * be of type G_DBUS_MESSAGE_TYPE_ERROR. Use 1248 * g_dbus_message_to_gerror() to transcode this to a GError. 1249 * See Example 6, “D-Bus server example” and Example 8, “D-Bus UNIX File Descriptor example” for an example of how to use this 1250 * low-level API to send and receive UNIX file descriptors. 1251 * Since 2.26 1252 * Params: 1253 * res = A GAsyncResult obtained from the GAsyncReadyCallback passed to g_dbus_connection_send_message_with_reply(). 1254 * Returns: A locked GDBusMessage or NULL if error is set. [transfer full] 1255 * Throws: GException on failure. 1256 */ 1257 public DBusMessage sendMessageWithReplyFinish(AsyncResultIF res) 1258 { 1259 // GDBusMessage * g_dbus_connection_send_message_with_reply_finish (GDBusConnection *connection, GAsyncResult *res, GError **error); 1260 GError* err = null; 1261 1262 auto p = g_dbus_connection_send_message_with_reply_finish(gDBusConnection, (res is null) ? null : res.getAsyncResultTStruct(), &err); 1263 1264 if (err !is null) 1265 { 1266 throw new GException( new ErrorG(err) ); 1267 } 1268 1269 1270 if(p is null) 1271 { 1272 return null; 1273 } 1274 1275 return ObjectG.getDObject!(DBusMessage)(cast(GDBusMessage*) p); 1276 } 1277 1278 /** 1279 * Synchronously sends message to the peer represented by connection 1280 * and blocks the calling thread until a reply is received or the 1281 * timeout is reached. See g_dbus_connection_send_message_with_reply() 1282 * for the asynchronous version of this method. 1283 * Unless flags contain the 1284 * G_DBUS_SEND_MESSAGE_FLAGS_PRESERVE_SERIAL flag, the serial number 1285 * will be assigned by connection and set on message via 1286 * g_dbus_message_set_serial(). If out_serial is not NULL, then the 1287 * serial number used will be written to this location prior to 1288 * submitting the message to the underlying transport. 1289 * If connection is closed then the operation will fail with 1290 * G_IO_ERROR_CLOSED. If cancellable is canceled, the operation will 1291 * fail with G_IO_ERROR_CANCELLED. If message is not well-formed, 1292 * the operation fails with G_IO_ERROR_INVALID_ARGUMENT. 1293 * Note that error is only set if a local in-process error 1294 * occurred. That is to say that the returned GDBusMessage object may 1295 * be of type G_DBUS_MESSAGE_TYPE_ERROR. Use 1296 * g_dbus_message_to_gerror() to transcode this to a GError. 1297 * See Example 6, “D-Bus server example” and Example 8, “D-Bus UNIX File Descriptor example” for an example of how to use this 1298 * low-level API to send and receive UNIX file descriptors. 1299 * Note that message must be unlocked, unless flags contain the 1300 * G_DBUS_SEND_MESSAGE_FLAGS_PRESERVE_SERIAL flag. 1301 * Since 2.26 1302 * Params: 1303 * message = A GDBusMessage. 1304 * flags = Flags affecting how the message is sent. 1305 * timeoutMsec = The timeout in milliseconds, -1 to use the default 1306 * timeout or G_MAXINT for no timeout. 1307 * outSerial = Return location for serial number assigned 1308 * to message when sending it or NULL. [out][allow-none] 1309 * cancellable = A GCancellable or NULL. [allow-none] 1310 * Returns: A locked GDBusMessage that is the reply to message or NULL if error is set. [transfer full] 1311 * Throws: GException on failure. 1312 */ 1313 public DBusMessage sendMessageWithReplySync(DBusMessage message, GDBusSendMessageFlags flags, int timeoutMsec, out uint outSerial, Cancellable cancellable) 1314 { 1315 // GDBusMessage * g_dbus_connection_send_message_with_reply_sync (GDBusConnection *connection, GDBusMessage *message, GDBusSendMessageFlags flags, gint timeout_msec, volatile guint32 *out_serial, GCancellable *cancellable, GError **error); 1316 GError* err = null; 1317 1318 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); 1319 1320 if (err !is null) 1321 { 1322 throw new GException( new ErrorG(err) ); 1323 } 1324 1325 1326 if(p is null) 1327 { 1328 return null; 1329 } 1330 1331 return ObjectG.getDObject!(DBusMessage)(cast(GDBusMessage*) p); 1332 } 1333 1334 /** 1335 * Adds a message filter. Filters are handlers that are run on all 1336 * incoming and outgoing messages, prior to standard dispatch. Filters 1337 * are run in the order that they were added. The same handler can be 1338 * added as a filter more than once, in which case it will be run more 1339 * than once. Filters added during a filter callback won't be run on 1340 * the message being processed. Filter functions are allowed to modify 1341 * and even drop messages. 1342 * Note that filters are run in a dedicated message handling thread so 1343 * they can't block and, generally, can't do anything but signal a 1344 * worker thread. Also note that filters are rarely needed - use API 1345 * such as g_dbus_connection_send_message_with_reply(), 1346 * g_dbus_connection_signal_subscribe() or g_dbus_connection_call() instead. 1347 * If a filter consumes an incoming message the message is not 1348 * dispatched anywhere else - not even the standard dispatch machinery 1349 * (that API such as g_dbus_connection_signal_subscribe() and 1350 * g_dbus_connection_send_message_with_reply() relies on) will see the 1351 * message. Similary, if a filter consumes an outgoing message, the 1352 * message will not be sent to the other peer. 1353 * Since 2.26 1354 * Params: 1355 * filterFunction = A filter function. 1356 * userData = User data to pass to filter_function. 1357 * userDataFreeFunc = Function to free user_data with when filter 1358 * is removed or NULL. 1359 * Returns: A filter identifier that can be used with g_dbus_connection_remove_filter(). 1360 */ 1361 public uint addFilter(GDBusMessageFilterFunction filterFunction, void* userData, GDestroyNotify userDataFreeFunc) 1362 { 1363 // guint g_dbus_connection_add_filter (GDBusConnection *connection, GDBusMessageFilterFunction filter_function, gpointer user_data, GDestroyNotify user_data_free_func); 1364 return g_dbus_connection_add_filter(gDBusConnection, filterFunction, userData, userDataFreeFunc); 1365 } 1366 1367 /** 1368 * Removes a filter. 1369 * Since 2.26 1370 * Params: 1371 * filterId = an identifier obtained from g_dbus_connection_add_filter() 1372 */ 1373 public void removeFilter(uint filterId) 1374 { 1375 // void g_dbus_connection_remove_filter (GDBusConnection *connection, guint filter_id); 1376 g_dbus_connection_remove_filter(gDBusConnection, filterId); 1377 } 1378 1379 /** 1380 * Registers callbacks for exported objects at object_path with the 1381 * D-Bus interface that is described in interface_info. 1382 * Calls to functions in vtable (and user_data_free_func) will 1383 * happen in the thread-default main 1384 * loop of the thread you are calling this method from. 1385 * Note that all GVariant values passed to functions in vtable will match 1386 * the signature given in interface_info - if a remote caller passes 1387 * incorrect values, the org.freedesktop.DBus.Error.InvalidArgs 1388 * is returned to the remote caller. 1389 * Additionally, if the remote caller attempts to invoke methods or 1390 * access properties not mentioned in interface_info the 1391 * org.freedesktop.DBus.Error.UnknownMethod resp. 1392 * org.freedesktop.DBus.Error.InvalidArgs errors 1393 * are returned to the caller. 1394 * It is considered a programming error if the 1395 * GDBusInterfaceGetPropertyFunc function in vtable returns a 1396 * GVariant of incorrect type. 1397 * If an existing callback is already registered at object_path and 1398 * interface_name, then error is set to G_IO_ERROR_EXISTS. 1399 * GDBus automatically implements the standard D-Bus interfaces 1400 * org.freedesktop.DBus.Properties, org.freedesktop.DBus.Introspectable 1401 * and org.freedesktop.Peer, so you don't have to implement those for 1402 * the objects you export. You can implement 1403 * org.freedesktop.DBus.Properties yourself, e.g. to handle getting 1404 * and setting of properties asynchronously. 1405 * Note that the reference count on interface_info will be 1406 * incremented by 1 (unless allocated statically, e.g. if the 1407 * reference count is -1, see g_dbus_interface_info_ref()) for as long 1408 * as the object is exported. Also note that vtable will be copied. 1409 * See Example 6, “D-Bus server example” for an example of how to use this method. 1410 * Since 2.26 1411 * Params: 1412 * objectPath = The object path to register at. 1413 * interfaceInfo = Introspection data for the interface. 1414 * vtable = A GDBusInterfaceVTable to call into or NULL. [allow-none] 1415 * userData = Data to pass to functions in vtable. [allow-none] 1416 * userDataFreeFunc = Function to call when the object path is unregistered. 1417 * Returns: 0 if error is set, otherwise a registration id (never 0) that can be used with g_dbus_connection_unregister_object() . 1418 * Throws: GException on failure. 1419 */ 1420 public uint registerObject(string objectPath, GDBusInterfaceInfo* interfaceInfo, GDBusInterfaceVTable* vtable, void* userData, GDestroyNotify userDataFreeFunc) 1421 { 1422 // guint g_dbus_connection_register_object (GDBusConnection *connection, const gchar *object_path, GDBusInterfaceInfo *interface_info, const GDBusInterfaceVTable *vtable, gpointer user_data, GDestroyNotify user_data_free_func, GError **error); 1423 GError* err = null; 1424 1425 auto p = g_dbus_connection_register_object(gDBusConnection, Str.toStringz(objectPath), interfaceInfo, vtable, userData, userDataFreeFunc, &err); 1426 1427 if (err !is null) 1428 { 1429 throw new GException( new ErrorG(err) ); 1430 } 1431 1432 return p; 1433 } 1434 1435 /** 1436 * Unregisters an object. 1437 * Since 2.26 1438 * Params: 1439 * registrationId = A registration id obtained from g_dbus_connection_register_object(). 1440 * Returns: TRUE if the object was unregistered, FALSE otherwise. 1441 */ 1442 public int unregisterObject(uint registrationId) 1443 { 1444 // gboolean g_dbus_connection_unregister_object (GDBusConnection *connection, guint registration_id); 1445 return g_dbus_connection_unregister_object(gDBusConnection, registrationId); 1446 } 1447 1448 /** 1449 * Registers a whole subtree of “dynamic” objects. 1450 * The enumerate and introspection functions in vtable are used to 1451 * convey, to remote callers, what nodes exist in the subtree rooted 1452 * by object_path. 1453 * When handling remote calls into any node in the subtree, first the 1454 * enumerate function is used to check if the node exists. If the node exists 1455 * or the G_DBUS_SUBTREE_FLAGS_DISPATCH_TO_UNENUMERATED_NODES flag is set 1456 * the introspection function is used to check if the node supports the 1457 * requested method. If so, the dispatch function is used to determine 1458 * where to dispatch the call. The collected GDBusInterfaceVTable and 1459 * gpointer will be used to call into the interface vtable for processing 1460 * the request. 1461 * All calls into user-provided code will be invoked in the thread-default main 1462 * loop of the thread you are calling this method from. 1463 * If an existing subtree is already registered at object_path or 1464 * then error is set to G_IO_ERROR_EXISTS. 1465 * Note that it is valid to register regular objects (using 1466 * g_dbus_connection_register_object()) in a subtree registered with 1467 * g_dbus_connection_register_subtree() - if so, the subtree handler 1468 * is tried as the last resort. One way to think about a subtree 1469 * handler is to consider it a “fallback handler” 1470 * for object paths not registered via g_dbus_connection_register_object() 1471 * or other bindings. 1472 * Note that vtable will be copied so you cannot change it after 1473 * registration. 1474 * See Example 7, “D-Bus subtree example” for an example of how to use this method. 1475 * Since 2.26 1476 * Params: 1477 * objectPath = The object path to register the subtree at. 1478 * vtable = A GDBusSubtreeVTable to enumerate, introspect and dispatch nodes in the subtree. 1479 * flags = Flags used to fine tune the behavior of the subtree. 1480 * userData = Data to pass to functions in vtable. 1481 * userDataFreeFunc = Function to call when the subtree is unregistered. 1482 * Returns: 0 if error is set, otherwise a subtree registration id (never 0) that can be used with g_dbus_connection_unregister_subtree() . 1483 * Throws: GException on failure. 1484 */ 1485 public uint registerSubtree(string objectPath, GDBusSubtreeVTable* vtable, GDBusSubtreeFlags flags, void* userData, GDestroyNotify userDataFreeFunc) 1486 { 1487 // guint g_dbus_connection_register_subtree (GDBusConnection *connection, const gchar *object_path, const GDBusSubtreeVTable *vtable, GDBusSubtreeFlags flags, gpointer user_data, GDestroyNotify user_data_free_func, GError **error); 1488 GError* err = null; 1489 1490 auto p = g_dbus_connection_register_subtree(gDBusConnection, Str.toStringz(objectPath), vtable, flags, userData, userDataFreeFunc, &err); 1491 1492 if (err !is null) 1493 { 1494 throw new GException( new ErrorG(err) ); 1495 } 1496 1497 return p; 1498 } 1499 1500 /** 1501 * Unregisters a subtree. 1502 * Since 2.26 1503 * Params: 1504 * registrationId = A subtree registration id obtained from g_dbus_connection_register_subtree(). 1505 * Returns: TRUE if the subtree was unregistered, FALSE otherwise. 1506 */ 1507 public int unregisterSubtree(uint registrationId) 1508 { 1509 // gboolean g_dbus_connection_unregister_subtree (GDBusConnection *connection, guint registration_id); 1510 return g_dbus_connection_unregister_subtree(gDBusConnection, registrationId); 1511 } 1512 1513 /** 1514 * Exports action_group on connection at object_path. 1515 * The implemented D-Bus API should be considered private. It is 1516 * subject to change in the future. 1517 * A given object path can only have one action group exported on it. 1518 * If this constraint is violated, the export will fail and 0 will be 1519 * returned (with error set accordingly). 1520 * You can unexport the action group using 1521 * g_dbus_connection_unexport_action_group() with the return value of 1522 * this function. 1523 * The thread default main context is taken at the time of this call. 1524 * All incoming action activations and state change requests are 1525 * reported from this context. Any changes on the action group that 1526 * cause it to emit signals must also come from this same context. 1527 * Since incoming action activations and state change requests are 1528 * rather likely to cause changes on the action group, this effectively 1529 * limits a given action group to being exported from only one main 1530 * context. 1531 * Since 2.32 1532 * Params: 1533 * objectPath = a D-Bus object path 1534 * actionGroup = a GActionGroup 1535 * Returns: the ID of the export (never zero), or 0 in case of failure 1536 * Throws: GException on failure. 1537 */ 1538 public uint exportActionGroup(string objectPath, ActionGroupIF actionGroup) 1539 { 1540 // guint g_dbus_connection_export_action_group (GDBusConnection *connection, const gchar *object_path, GActionGroup *action_group, GError **error); 1541 GError* err = null; 1542 1543 auto p = g_dbus_connection_export_action_group(gDBusConnection, Str.toStringz(objectPath), (actionGroup is null) ? null : actionGroup.getActionGroupTStruct(), &err); 1544 1545 if (err !is null) 1546 { 1547 throw new GException( new ErrorG(err) ); 1548 } 1549 1550 return p; 1551 } 1552 1553 /** 1554 * Reverses the effect of a previous call to 1555 * g_dbus_connection_export_action_group(). 1556 * It is an error to call this function with an ID that wasn't returned 1557 * from g_dbus_connection_export_action_group() or to call it with the 1558 * same ID more than once. 1559 * Since 2.32 1560 * Params: 1561 * exportId = the ID from g_dbus_connection_export_action_group() 1562 */ 1563 public void unexportActionGroup(uint exportId) 1564 { 1565 // void g_dbus_connection_unexport_action_group (GDBusConnection *connection, guint export_id); 1566 g_dbus_connection_unexport_action_group(gDBusConnection, exportId); 1567 } 1568 1569 /** 1570 * Exports menu on connection at object_path. 1571 * The implemented D-Bus API should be considered private. 1572 * It is subject to change in the future. 1573 * An object path can only have one menu model exported on it. If this 1574 * constraint is violated, the export will fail and 0 will be 1575 * returned (with error set accordingly). 1576 * You can unexport the menu model using 1577 * g_dbus_connection_unexport_menu_model() with the return value of 1578 * this function. 1579 * Since 2.32 1580 * Params: 1581 * objectPath = a D-Bus object path 1582 * menu = a GMenuModel 1583 * Returns: the ID of the export (never zero), or 0 in case of failure 1584 * Throws: GException on failure. 1585 */ 1586 public uint exportMenuModel(string objectPath, MenuModel menu) 1587 { 1588 // guint g_dbus_connection_export_menu_model (GDBusConnection *connection, const gchar *object_path, GMenuModel *menu, GError **error); 1589 GError* err = null; 1590 1591 auto p = g_dbus_connection_export_menu_model(gDBusConnection, Str.toStringz(objectPath), (menu is null) ? null : menu.getMenuModelStruct(), &err); 1592 1593 if (err !is null) 1594 { 1595 throw new GException( new ErrorG(err) ); 1596 } 1597 1598 return p; 1599 } 1600 1601 /** 1602 * Reverses the effect of a previous call to 1603 * g_dbus_connection_export_menu_model(). 1604 * It is an error to call this function with an ID that wasn't returned 1605 * from g_dbus_connection_export_menu_model() or to call it with the 1606 * same ID more than once. 1607 * Since 2.32 1608 * Params: 1609 * exportId = the ID from g_dbus_connection_export_menu_model() 1610 */ 1611 public void unexportMenuModel(uint exportId) 1612 { 1613 // void g_dbus_connection_unexport_menu_model (GDBusConnection *connection, guint export_id); 1614 g_dbus_connection_unexport_menu_model(gDBusConnection, exportId); 1615 } 1616 }