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 module gio.DBusObjectManagerClient; 26 27 private import gio.AsyncInitableIF; 28 private import gio.AsyncInitableT; 29 private import gio.Cancellable; 30 private import gio.DBusConnection; 31 private import gio.DBusObjectManagerIF; 32 private import gio.DBusObjectManagerT; 33 private import gio.DBusObjectProxy; 34 private import gio.DBusProxy; 35 private import gio.InitableIF; 36 private import gio.InitableT; 37 private import glib.ConstructionException; 38 private import glib.ErrorG; 39 private import glib.GException; 40 private import glib.Str; 41 private import glib.Variant; 42 private import gobject.ObjectG; 43 private import gobject.Signals; 44 public import gtkc.gdktypes; 45 private import gtkc.gio; 46 public import gtkc.giotypes; 47 private import std.algorithm; 48 49 50 /** 51 * #GDBusObjectManagerClient is used to create, monitor and delete object 52 * proxies for remote objects exported by a #GDBusObjectManagerServer (or any 53 * code implementing the 54 * [org.freedesktop.DBus.ObjectManager](http://dbus.freedesktop.org/doc/dbus-specification.html#standard-interfaces-objectmanager) 55 * interface). 56 * 57 * Once an instance of this type has been created, you can connect to 58 * the #GDBusObjectManager::object-added and 59 * #GDBusObjectManager::object-removed signals and inspect the 60 * #GDBusObjectProxy objects returned by 61 * g_dbus_object_manager_get_objects(). 62 * 63 * If the name for a #GDBusObjectManagerClient is not owned by anyone at 64 * object construction time, the default behavior is to request the 65 * message bus to launch an owner for the name. This behavior can be 66 * disabled using the %G_DBUS_OBJECT_MANAGER_CLIENT_FLAGS_DO_NOT_AUTO_START 67 * flag. It's also worth noting that this only works if the name of 68 * interest is activatable in the first place. E.g. in some cases it 69 * is not possible to launch an owner for the requested name. In this 70 * case, #GDBusObjectManagerClient object construction still succeeds but 71 * there will be no object proxies 72 * (e.g. g_dbus_object_manager_get_objects() returns the empty list) and 73 * the #GDBusObjectManagerClient:name-owner property is %NULL. 74 * 75 * The owner of the requested name can come and go (for example 76 * consider a system service being restarted) – #GDBusObjectManagerClient 77 * handles this case too; simply connect to the #GObject::notify 78 * signal to watch for changes on the #GDBusObjectManagerClient:name-owner 79 * property. When the name owner vanishes, the behavior is that 80 * #GDBusObjectManagerClient:name-owner is set to %NULL (this includes 81 * emission of the #GObject::notify signal) and then 82 * #GDBusObjectManager::object-removed signals are synthesized 83 * for all currently existing object proxies. Since 84 * #GDBusObjectManagerClient:name-owner is %NULL when this happens, you can 85 * use this information to disambiguate a synthesized signal from a 86 * genuine signal caused by object removal on the remote 87 * #GDBusObjectManager. Similarly, when a new name owner appears, 88 * #GDBusObjectManager::object-added signals are synthesized 89 * while #GDBusObjectManagerClient:name-owner is still %NULL. Only when all 90 * object proxies have been added, the #GDBusObjectManagerClient:name-owner 91 * is set to the new name owner (this includes emission of the 92 * #GObject::notify signal). Furthermore, you are guaranteed that 93 * #GDBusObjectManagerClient:name-owner will alternate between a name owner 94 * (e.g. `:1.42`) and %NULL even in the case where 95 * the name of interest is atomically replaced 96 * 97 * Ultimately, #GDBusObjectManagerClient is used to obtain #GDBusProxy 98 * instances. All signals (including the 99 * org.freedesktop.DBus.Properties::PropertiesChanged signal) 100 * delivered to #GDBusProxy instances are guaranteed to originate 101 * from the name owner. This guarantee along with the behavior 102 * described above, means that certain race conditions including the 103 * "half the proxy is from the old owner and the other half is from 104 * the new owner" problem cannot happen. 105 * 106 * To avoid having the application connect to signals on the returned 107 * #GDBusObjectProxy and #GDBusProxy objects, the 108 * #GDBusObject::interface-added, 109 * #GDBusObject::interface-removed, 110 * #GDBusProxy::g-properties-changed and 111 * #GDBusProxy::g-signal signals 112 * are also emitted on the #GDBusObjectManagerClient instance managing these 113 * objects. The signals emitted are 114 * #GDBusObjectManager::interface-added, 115 * #GDBusObjectManager::interface-removed, 116 * #GDBusObjectManagerClient::interface-proxy-properties-changed and 117 * #GDBusObjectManagerClient::interface-proxy-signal. 118 * 119 * Note that all callbacks and signals are emitted in the 120 * [thread-default main context][g-main-context-push-thread-default] 121 * that the #GDBusObjectManagerClient object was constructed 122 * in. Additionally, the #GDBusObjectProxy and #GDBusProxy objects 123 * originating from the #GDBusObjectManagerClient object will be created in 124 * the same context and, consequently, will deliver signals in the 125 * same main loop. 126 * 127 * Since: 2.30 128 */ 129 public class DBusObjectManagerClient : ObjectG, AsyncInitableIF, DBusObjectManagerIF, InitableIF 130 { 131 /** the main Gtk struct */ 132 protected GDBusObjectManagerClient* gDBusObjectManagerClient; 133 134 /** Get the main Gtk struct */ 135 public GDBusObjectManagerClient* getDBusObjectManagerClientStruct() 136 { 137 return gDBusObjectManagerClient; 138 } 139 140 /** the main Gtk struct as a void* */ 141 protected override void* getStruct() 142 { 143 return cast(void*)gDBusObjectManagerClient; 144 } 145 146 protected override void setStruct(GObject* obj) 147 { 148 gDBusObjectManagerClient = cast(GDBusObjectManagerClient*)obj; 149 super.setStruct(obj); 150 } 151 152 /** 153 * Sets our main struct and passes it to the parent class. 154 */ 155 public this (GDBusObjectManagerClient* gDBusObjectManagerClient, bool ownedRef = false) 156 { 157 this.gDBusObjectManagerClient = gDBusObjectManagerClient; 158 super(cast(GObject*)gDBusObjectManagerClient, ownedRef); 159 } 160 161 // add the AsyncInitable capabilities 162 mixin AsyncInitableT!(GDBusObjectManagerClient); 163 164 // add the DBusObjectManager capabilities 165 mixin DBusObjectManagerT!(GDBusObjectManagerClient); 166 167 // add the Initable capabilities 168 mixin InitableT!(GDBusObjectManagerClient); 169 170 /** 171 * Finishes an operation started with g_dbus_object_manager_client_new(). 172 * 173 * Params: 174 * res = A GAsyncResult obtained from the GAsyncReadyCallback passed to the DBusObjectManager constructor. 175 * forBus = If true finish an address. 176 * 177 * Throws: GException on failure. 178 * Throws: ConstructionException GTK+ fails to create the object. 179 * 180 * Since: 2.30 181 */ 182 public this (AsyncResultIF res, bool forBus = false) 183 { 184 GError* err = null; 185 GDBusObjectManager* p; 186 187 if ( forBus ) 188 { 189 p = g_dbus_object_manager_client_new_for_bus_finish((res is null) ? null : res.getAsyncResultStruct(), &err); 190 } 191 else 192 { 193 p = g_dbus_object_manager_client_new_finish((res is null) ? null : res.getAsyncResultStruct(), &err); 194 } 195 196 if (err !is null) 197 { 198 throw new GException( new ErrorG(err) ); 199 } 200 201 if(p is null) 202 { 203 throw new ConstructionException("null returned by g_dbus_object_manager_client_new_finish((res is null) ? null : res.getAsyncResultStruct(), &err)"); 204 } 205 this(cast(GDBusObjectManagerClient*) p, true); 206 } 207 208 /** 209 */ 210 211 /** */ 212 public static GType getType() 213 { 214 return g_dbus_object_manager_client_get_type(); 215 } 216 217 /** 218 * Like g_dbus_object_manager_client_new_sync() but takes a #GBusType instead 219 * of a #GDBusConnection. 220 * 221 * This is a synchronous failable constructor - the calling thread is 222 * blocked until a reply is received. See g_dbus_object_manager_client_new_for_bus() 223 * for the asynchronous version. 224 * 225 * Params: 226 * busType = A #GBusType. 227 * flags = Zero or more flags from the #GDBusObjectManagerClientFlags enumeration. 228 * name = The owner of the control object (unique or well-known name). 229 * objectPath = The object path of the control object. 230 * getProxyTypeFunc = A #GDBusProxyTypeFunc function or %NULL to always construct #GDBusProxy proxies. 231 * getProxyTypeUserData = User data to pass to @get_proxy_type_func. 232 * getProxyTypeDestroyNotify = Free function for @get_proxy_type_user_data or %NULL. 233 * cancellable = A #GCancellable or %NULL 234 * 235 * Return: A 236 * #GDBusObjectManagerClient object or %NULL if @error is set. Free 237 * with g_object_unref(). 238 * 239 * Since: 2.30 240 * 241 * Throws: GException on failure. 242 * Throws: ConstructionException GTK+ fails to create the object. 243 */ 244 public this(GBusType busType, GDBusObjectManagerClientFlags flags, string name, string objectPath, GDBusProxyTypeFunc getProxyTypeFunc, void* getProxyTypeUserData, GDestroyNotify getProxyTypeDestroyNotify, Cancellable cancellable) 245 { 246 GError* err = null; 247 248 auto p = g_dbus_object_manager_client_new_for_bus_sync(busType, flags, Str.toStringz(name), Str.toStringz(objectPath), getProxyTypeFunc, getProxyTypeUserData, getProxyTypeDestroyNotify, (cancellable is null) ? null : cancellable.getCancellableStruct(), &err); 249 250 if (err !is null) 251 { 252 throw new GException( new ErrorG(err) ); 253 } 254 255 if(p is null) 256 { 257 throw new ConstructionException("null returned by new_for_bus_sync"); 258 } 259 260 this(cast(GDBusObjectManagerClient*) p, true); 261 } 262 263 /** 264 * Creates a new #GDBusObjectManagerClient object. 265 * 266 * This is a synchronous failable constructor - the calling thread is 267 * blocked until a reply is received. See g_dbus_object_manager_client_new() 268 * for the asynchronous version. 269 * 270 * Params: 271 * connection = A #GDBusConnection. 272 * flags = Zero or more flags from the #GDBusObjectManagerClientFlags enumeration. 273 * name = The owner of the control object (unique or well-known name), or %NULL when not using a message bus connection. 274 * objectPath = The object path of the control object. 275 * getProxyTypeFunc = A #GDBusProxyTypeFunc function or %NULL to always construct #GDBusProxy proxies. 276 * getProxyTypeUserData = User data to pass to @get_proxy_type_func. 277 * getProxyTypeDestroyNotify = Free function for @get_proxy_type_user_data or %NULL. 278 * cancellable = A #GCancellable or %NULL 279 * 280 * Return: A 281 * #GDBusObjectManagerClient object or %NULL if @error is set. Free 282 * with g_object_unref(). 283 * 284 * Since: 2.30 285 * 286 * Throws: GException on failure. 287 * Throws: ConstructionException GTK+ fails to create the object. 288 */ 289 public this(DBusConnection connection, GDBusObjectManagerClientFlags flags, string name, string objectPath, GDBusProxyTypeFunc getProxyTypeFunc, void* getProxyTypeUserData, GDestroyNotify getProxyTypeDestroyNotify, Cancellable cancellable) 290 { 291 GError* err = null; 292 293 auto p = g_dbus_object_manager_client_new_sync((connection is null) ? null : connection.getDBusConnectionStruct(), flags, Str.toStringz(name), Str.toStringz(objectPath), getProxyTypeFunc, getProxyTypeUserData, getProxyTypeDestroyNotify, (cancellable is null) ? null : cancellable.getCancellableStruct(), &err); 294 295 if (err !is null) 296 { 297 throw new GException( new ErrorG(err) ); 298 } 299 300 if(p is null) 301 { 302 throw new ConstructionException("null returned by new_sync"); 303 } 304 305 this(cast(GDBusObjectManagerClient*) p, true); 306 } 307 308 /** 309 * Asynchronously creates a new #GDBusObjectManagerClient object. 310 * 311 * This is an asynchronous failable constructor. When the result is 312 * ready, @callback will be invoked in the 313 * [thread-default main context][g-main-context-push-thread-default] 314 * of the thread you are calling this method from. You can 315 * then call g_dbus_object_manager_client_new_finish() to get the result. See 316 * g_dbus_object_manager_client_new_sync() for the synchronous version. 317 * 318 * Params: 319 * connection = A #GDBusConnection. 320 * flags = Zero or more flags from the #GDBusObjectManagerClientFlags enumeration. 321 * name = The owner of the control object (unique or well-known name). 322 * objectPath = The object path of the control object. 323 * getProxyTypeFunc = A #GDBusProxyTypeFunc function or %NULL to always construct #GDBusProxy proxies. 324 * getProxyTypeUserData = User data to pass to @get_proxy_type_func. 325 * getProxyTypeDestroyNotify = Free function for @get_proxy_type_user_data or %NULL. 326 * cancellable = A #GCancellable or %NULL 327 * callback = A #GAsyncReadyCallback to call when the request is satisfied. 328 * userData = The data to pass to @callback. 329 * 330 * Since: 2.30 331 */ 332 public static void newObjectManagerClient(DBusConnection connection, GDBusObjectManagerClientFlags flags, string name, string objectPath, GDBusProxyTypeFunc getProxyTypeFunc, void* getProxyTypeUserData, GDestroyNotify getProxyTypeDestroyNotify, Cancellable cancellable, GAsyncReadyCallback callback, void* userData) 333 { 334 g_dbus_object_manager_client_new((connection is null) ? null : connection.getDBusConnectionStruct(), flags, Str.toStringz(name), Str.toStringz(objectPath), getProxyTypeFunc, getProxyTypeUserData, getProxyTypeDestroyNotify, (cancellable is null) ? null : cancellable.getCancellableStruct(), callback, userData); 335 } 336 337 /** 338 * Like g_dbus_object_manager_client_new() but takes a #GBusType instead of a 339 * #GDBusConnection. 340 * 341 * This is an asynchronous failable constructor. When the result is 342 * ready, @callback will be invoked in the 343 * [thread-default main loop][g-main-context-push-thread-default] 344 * of the thread you are calling this method from. You can 345 * then call g_dbus_object_manager_client_new_for_bus_finish() to get the result. See 346 * g_dbus_object_manager_client_new_for_bus_sync() for the synchronous version. 347 * 348 * Params: 349 * busType = A #GBusType. 350 * flags = Zero or more flags from the #GDBusObjectManagerClientFlags enumeration. 351 * name = The owner of the control object (unique or well-known name). 352 * objectPath = The object path of the control object. 353 * getProxyTypeFunc = A #GDBusProxyTypeFunc function or %NULL to always construct #GDBusProxy proxies. 354 * getProxyTypeUserData = User data to pass to @get_proxy_type_func. 355 * getProxyTypeDestroyNotify = Free function for @get_proxy_type_user_data or %NULL. 356 * cancellable = A #GCancellable or %NULL 357 * callback = A #GAsyncReadyCallback to call when the request is satisfied. 358 * userData = The data to pass to @callback. 359 * 360 * Since: 2.30 361 */ 362 public static void newForBus(GBusType busType, GDBusObjectManagerClientFlags flags, string name, string objectPath, GDBusProxyTypeFunc getProxyTypeFunc, void* getProxyTypeUserData, GDestroyNotify getProxyTypeDestroyNotify, Cancellable cancellable, GAsyncReadyCallback callback, void* userData) 363 { 364 g_dbus_object_manager_client_new_for_bus(busType, flags, Str.toStringz(name), Str.toStringz(objectPath), getProxyTypeFunc, getProxyTypeUserData, getProxyTypeDestroyNotify, (cancellable is null) ? null : cancellable.getCancellableStruct(), callback, userData); 365 } 366 367 /** 368 * Gets the #GDBusConnection used by @manager. 369 * 370 * Return: A #GDBusConnection object. Do not free, 371 * the object belongs to @manager. 372 * 373 * Since: 2.30 374 */ 375 public DBusConnection getConnection() 376 { 377 auto p = g_dbus_object_manager_client_get_connection(gDBusObjectManagerClient); 378 379 if(p is null) 380 { 381 return null; 382 } 383 384 return ObjectG.getDObject!(DBusConnection)(cast(GDBusConnection*) p); 385 } 386 387 /** 388 * Gets the flags that @manager was constructed with. 389 * 390 * Return: Zero of more flags from the #GDBusObjectManagerClientFlags 391 * enumeration. 392 * 393 * Since: 2.30 394 */ 395 public GDBusObjectManagerClientFlags getFlags() 396 { 397 return g_dbus_object_manager_client_get_flags(gDBusObjectManagerClient); 398 } 399 400 /** 401 * Gets the name that @manager is for, or %NULL if not a message bus 402 * connection. 403 * 404 * Return: A unique or well-known name. Do not free, the string 405 * belongs to @manager. 406 * 407 * Since: 2.30 408 */ 409 public string getName() 410 { 411 return Str.toString(g_dbus_object_manager_client_get_name(gDBusObjectManagerClient)); 412 } 413 414 /** 415 * The unique name that owns the name that @manager is for or %NULL if 416 * no-one currently owns that name. You can connect to the 417 * #GObject::notify signal to track changes to the 418 * #GDBusObjectManagerClient:name-owner property. 419 * 420 * Return: The name owner or %NULL if no name owner 421 * exists. Free with g_free(). 422 * 423 * Since: 2.30 424 */ 425 public string getNameOwner() 426 { 427 auto retStr = g_dbus_object_manager_client_get_name_owner(gDBusObjectManagerClient); 428 429 scope(exit) Str.freeString(retStr); 430 return Str.toString(retStr); 431 } 432 433 protected class OnInterfaceProxyPropertiesChangedDelegateWrapper 434 { 435 void delegate(DBusObjectProxy, DBusProxy, Variant, string[], DBusObjectManagerClient) dlg; 436 gulong handlerId; 437 ConnectFlags flags; 438 this(void delegate(DBusObjectProxy, DBusProxy, Variant, string[], DBusObjectManagerClient) dlg, gulong handlerId, ConnectFlags flags) 439 { 440 this.dlg = dlg; 441 this.handlerId = handlerId; 442 this.flags = flags; 443 } 444 } 445 protected OnInterfaceProxyPropertiesChangedDelegateWrapper[] onInterfaceProxyPropertiesChangedListeners; 446 447 /** 448 * Emitted when one or more D-Bus properties on proxy changes. The 449 * local cache has already been updated when this signal fires. Note 450 * that both @changed_properties and @invalidated_properties are 451 * guaranteed to never be %NULL (either may be empty though). 452 * 453 * This signal exists purely as a convenience to avoid having to 454 * connect signals to all interface proxies managed by @manager. 455 * 456 * This signal is emitted in the 457 * [thread-default main context][g-main-context-push-thread-default] 458 * that @manager was constructed in. 459 * 460 * Params: 461 * objectProxy = The #GDBusObjectProxy on which an interface has properties that are changing. 462 * interfaceProxy = The #GDBusProxy that has properties that are changing. 463 * changedProperties = A #GVariant containing the properties that changed. 464 * invalidatedProperties = A %NULL terminated array of properties that was invalidated. 465 * 466 * Since: 2.30 467 */ 468 gulong addOnInterfaceProxyPropertiesChanged(void delegate(DBusObjectProxy, DBusProxy, Variant, string[], DBusObjectManagerClient) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 469 { 470 onInterfaceProxyPropertiesChangedListeners ~= new OnInterfaceProxyPropertiesChangedDelegateWrapper(dlg, 0, connectFlags); 471 onInterfaceProxyPropertiesChangedListeners[onInterfaceProxyPropertiesChangedListeners.length - 1].handlerId = Signals.connectData( 472 this, 473 "interface-proxy-properties-changed", 474 cast(GCallback)&callBackInterfaceProxyPropertiesChanged, 475 cast(void*)onInterfaceProxyPropertiesChangedListeners[onInterfaceProxyPropertiesChangedListeners.length - 1], 476 cast(GClosureNotify)&callBackInterfaceProxyPropertiesChangedDestroy, 477 connectFlags); 478 return onInterfaceProxyPropertiesChangedListeners[onInterfaceProxyPropertiesChangedListeners.length - 1].handlerId; 479 } 480 481 extern(C) static void callBackInterfaceProxyPropertiesChanged(GDBusObjectManagerClient* dbusobjectmanagerclientStruct, GDBusObjectProxy* objectProxy, GDBusProxy* interfaceProxy, GVariant* changedProperties, char** invalidatedProperties,OnInterfaceProxyPropertiesChangedDelegateWrapper wrapper) 482 { 483 wrapper.dlg(ObjectG.getDObject!(DBusObjectProxy)(objectProxy), ObjectG.getDObject!(DBusProxy)(interfaceProxy), new Variant(changedProperties), Str.toStringArray(invalidatedProperties), wrapper.outer); 484 } 485 486 extern(C) static void callBackInterfaceProxyPropertiesChangedDestroy(OnInterfaceProxyPropertiesChangedDelegateWrapper wrapper, GClosure* closure) 487 { 488 wrapper.outer.internalRemoveOnInterfaceProxyPropertiesChanged(wrapper); 489 } 490 491 protected void internalRemoveOnInterfaceProxyPropertiesChanged(OnInterfaceProxyPropertiesChangedDelegateWrapper source) 492 { 493 foreach(index, wrapper; onInterfaceProxyPropertiesChangedListeners) 494 { 495 if (wrapper.dlg == source.dlg && wrapper.flags == source.flags && wrapper.handlerId == source.handlerId) 496 { 497 onInterfaceProxyPropertiesChangedListeners[index] = null; 498 onInterfaceProxyPropertiesChangedListeners = std.algorithm.remove(onInterfaceProxyPropertiesChangedListeners, index); 499 break; 500 } 501 } 502 } 503 504 505 protected class OnInterfaceProxySignalDelegateWrapper 506 { 507 void delegate(DBusObjectProxy, DBusProxy, string, string, Variant, DBusObjectManagerClient) dlg; 508 gulong handlerId; 509 ConnectFlags flags; 510 this(void delegate(DBusObjectProxy, DBusProxy, string, string, Variant, DBusObjectManagerClient) dlg, gulong handlerId, ConnectFlags flags) 511 { 512 this.dlg = dlg; 513 this.handlerId = handlerId; 514 this.flags = flags; 515 } 516 } 517 protected OnInterfaceProxySignalDelegateWrapper[] onInterfaceProxySignalListeners; 518 519 /** 520 * Emitted when a D-Bus signal is received on @interface_proxy. 521 * 522 * This signal exists purely as a convenience to avoid having to 523 * connect signals to all interface proxies managed by @manager. 524 * 525 * This signal is emitted in the 526 * [thread-default main context][g-main-context-push-thread-default] 527 * that @manager was constructed in. 528 * 529 * Params: 530 * objectProxy = The #GDBusObjectProxy on which an interface is emitting a D-Bus signal. 531 * interfaceProxy = The #GDBusProxy that is emitting a D-Bus signal. 532 * senderName = The sender of the signal or NULL if the connection is not a bus connection. 533 * signalName = The signal name. 534 * parameters = A #GVariant tuple with parameters for the signal. 535 * 536 * Since: 2.30 537 */ 538 gulong addOnInterfaceProxySignal(void delegate(DBusObjectProxy, DBusProxy, string, string, Variant, DBusObjectManagerClient) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 539 { 540 onInterfaceProxySignalListeners ~= new OnInterfaceProxySignalDelegateWrapper(dlg, 0, connectFlags); 541 onInterfaceProxySignalListeners[onInterfaceProxySignalListeners.length - 1].handlerId = Signals.connectData( 542 this, 543 "interface-proxy-signal", 544 cast(GCallback)&callBackInterfaceProxySignal, 545 cast(void*)onInterfaceProxySignalListeners[onInterfaceProxySignalListeners.length - 1], 546 cast(GClosureNotify)&callBackInterfaceProxySignalDestroy, 547 connectFlags); 548 return onInterfaceProxySignalListeners[onInterfaceProxySignalListeners.length - 1].handlerId; 549 } 550 551 extern(C) static void callBackInterfaceProxySignal(GDBusObjectManagerClient* dbusobjectmanagerclientStruct, GDBusObjectProxy* objectProxy, GDBusProxy* interfaceProxy, char* senderName, char* signalName, GVariant* parameters,OnInterfaceProxySignalDelegateWrapper wrapper) 552 { 553 wrapper.dlg(ObjectG.getDObject!(DBusObjectProxy)(objectProxy), ObjectG.getDObject!(DBusProxy)(interfaceProxy), Str.toString(senderName), Str.toString(signalName), new Variant(parameters), wrapper.outer); 554 } 555 556 extern(C) static void callBackInterfaceProxySignalDestroy(OnInterfaceProxySignalDelegateWrapper wrapper, GClosure* closure) 557 { 558 wrapper.outer.internalRemoveOnInterfaceProxySignal(wrapper); 559 } 560 561 protected void internalRemoveOnInterfaceProxySignal(OnInterfaceProxySignalDelegateWrapper source) 562 { 563 foreach(index, wrapper; onInterfaceProxySignalListeners) 564 { 565 if (wrapper.dlg == source.dlg && wrapper.flags == source.flags && wrapper.handlerId == source.handlerId) 566 { 567 onInterfaceProxySignalListeners[index] = null; 568 onInterfaceProxySignalListeners = std.algorithm.remove(onInterfaceProxySignalListeners, index); 569 break; 570 } 571 } 572 } 573 574 }