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