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 gobject.ObjectG; 26 27 private import core.memory; 28 private import glib.ConstructionException; 29 private import glib.Str; 30 private import gobject.Binding; 31 private import gobject.Closure; 32 private import gobject.ObjectG; 33 private import gobject.ParamSpec; 34 private import gobject.Signals; 35 private import gobject.TypeInterface; 36 private import gobject.Value; 37 private import gobject.c.functions; 38 public import gobject.c.types; 39 public import gtkc.gobjecttypes; 40 private import gtkd.Loader; 41 private import std.algorithm; 42 private import std.traits; 43 44 45 /** 46 * All the fields in the GObject structure are private 47 * to the #GObject implementation and should never be accessed directly. 48 */ 49 public class ObjectG 50 { 51 /** the main Gtk struct */ 52 protected GObject* gObject; 53 protected bool ownedRef; 54 55 /** Get the main Gtk struct */ 56 public GObject* getObjectGStruct(bool transferOwnership = false) 57 { 58 if (transferOwnership) 59 ownedRef = false; 60 return gObject; 61 } 62 63 /** the main Gtk struct as a void* */ 64 protected void* getStruct() 65 { 66 return cast(void*)gObject; 67 } 68 69 protected bool isGcRoot; 70 71 /** 72 * Sets our main struct and passes store it on the gobject. 73 * Add a gabage collector root to the gtk+ struct so it doesn't get collect 74 */ 75 public this (GObject* gObject, bool ownedRef = false) 76 { 77 this.gObject = gObject; 78 if ( gObject !is null ) 79 { 80 setDataFull("GObject", cast(void*)this, cast(GDestroyNotify)&destroyNotify); 81 addToggleRef(cast(GToggleNotify)&toggleNotify, cast(void*)this); 82 83 //If the refCount is larger then 1 toggleNotify isn't called 84 if (gObject.refCount > 1 && !isGcRoot) 85 { 86 GC.addRoot(cast(void*)this); 87 isGcRoot = true; 88 } 89 90 //Remove the floating reference if there is one. 91 if ( isFloating() ) 92 { 93 refSink(); 94 unref(); 95 } 96 //If we already owned this reference remove the one added by addToggleRef. 97 else if ( ownedRef ) 98 { 99 unref(); 100 } 101 } 102 } 103 104 extern(C) 105 { 106 static void destroyNotify(ObjectG obj) 107 { 108 if ( obj.isGcRoot ) 109 { 110 GC.removeRoot(cast(void*)obj); 111 obj.isGcRoot = false; 112 } 113 114 if ( obj.gObject.refCount > 0 ) 115 obj.removeToggleRef(cast(GToggleNotify)&toggleNotify, cast(void*)obj); 116 117 obj.gObject = null; 118 } 119 120 static void toggleNotify(ObjectG obj, GObject* object, int isLastRef) 121 { 122 if ( isLastRef && obj.isGcRoot ) 123 { 124 GC.removeRoot(cast(void*)obj); 125 obj.isGcRoot = false; 126 } 127 else if ( !obj.isGcRoot ) 128 { 129 GC.addRoot(cast(void*)obj); 130 obj.isGcRoot = true; 131 } 132 } 133 } 134 135 ~this() 136 { 137 static if ( isPointer!(typeof(g_object_steal_data)) ) 138 bool libLoaded = Linker.isLoaded(LIBRARY_GOBJECT); 139 else 140 enum libLoaded = true; 141 142 if ( libLoaded && gObject !is null ) 143 { 144 // Remove the GDestroyNotify callback, 145 // for when the D object is destroyed before the C one. 146 g_object_steal_data(gObject, cast(char*)"GObject"); 147 148 if ( isGcRoot ) 149 { 150 GC.removeRoot(cast(void*)this); 151 isGcRoot = false; 152 } 153 154 unref(); 155 } 156 } 157 158 /** */ 159 T opCast(T)() 160 { 161 static if ( is(T : ObjectG) 162 && !is(T == interface) 163 && is(typeof(new T(cast(typeof(T.tupleof[0]))gObject, false))) ) 164 { 165 //If a regular cast works, return the result. 166 if ( auto r = cast(T)super ) 167 return r; 168 169 //Prints a warning if the cast is invalid. 170 //g_type_check_instance_cast(cast(GTypeInstance*)gObject, T.getType()); 171 172 //Can we cast this type to T. 173 if ( !g_type_is_a(gObject.gTypeInstance.gClass.gType, T.getType()) ) 174 return null; 175 176 //Remove the GDestroyNotify callback for the original d object. 177 g_object_steal_data(gObject, "GObject"); 178 //Remove the original object as a GC root if needed. 179 if ( isGcRoot ) 180 { 181 GC.removeRoot(cast(void*)this); 182 isGcRoot = false; 183 } 184 //Add a reference for the original D object before we remove the toggle reference. 185 g_object_ref(gObject); 186 g_object_remove_toggle_ref(gObject, cast(GToggleNotify)&toggleNotify, cast(void*)this); 187 188 //The new object handles the memory management. 189 return new T(cast(typeof(T.tupleof[0]))gObject, false); 190 } 191 else static if ( is(T == interface) 192 && hasStaticMember!(T, "getType") 193 && is(ReturnType!(T.getType) == GType) ) 194 { 195 //If a regular cast works, return the result. 196 if ( auto r = cast(T)super ) 197 return r; 198 199 //Do we implement interface T. 200 if ( !g_type_is_a(gObject.gTypeInstance.gClass.gType, T.getType()) ) 201 return null; 202 203 return getInterfaceInstance!T(gObject); 204 } 205 else 206 return cast(T)super; 207 } 208 209 /** 210 * Gets a D Object from the objects table of associations. 211 * Params: 212 * obj = GObject containing the associations. 213 * Returns: the D Object if found, or a newly constructed object if no such Object exists. 214 */ 215 public static RT getDObject(T, RT=T, U)(U obj, bool ownedRef = false) 216 { 217 if ( obj is null ) 218 { 219 return null; 220 } 221 222 static if ( is(T : ObjectG) && !is(RT == interface) ) 223 { 224 auto p = g_object_get_data(cast(GObject*)obj, Str.toStringz("GObject")); 225 226 if ( p !is null ) 227 return cast(RT)cast(ObjectG)p; 228 else 229 return new T(obj, ownedRef); 230 } 231 else static if ( is(RT == interface) && hasStaticMember!(RT, "getType") && is(ReturnType!(RT.getType) == GType) ) 232 { 233 auto p = g_object_get_data(cast(GObject*)obj, Str.toStringz("GObject")); 234 235 if ( p !is null ) 236 return cast(RT)cast(ObjectG)p; 237 else 238 return getInterfaceInstance!RT(cast(GObject*)obj); 239 } 240 else 241 { 242 return new T(obj, ownedRef); 243 } 244 } 245 246 private static I getInterfaceInstance(I)(GObject* instance) 247 { 248 static class Impl: ObjectG, I 249 { 250 public this (GObject* gObject, bool ownedRef = false) 251 { 252 super(gObject, ownedRef); 253 } 254 255 /** the main Gtk struct as a void* */ 256 protected override void* getStruct() 257 { 258 return cast(void*)gObject; 259 } 260 261 // add the interface capabilities 262 mixin("import "~ moduleName!I[0..$-2] ~"T;import "~ moduleName!I ~"; mixin "~ __traits(identifier, I)[0..$-2] ~"T!("~__traits(identifier, Impl)~");"); 263 } 264 265 ClassInfo ci = Impl.classinfo; 266 Impl iface; 267 void* p; 268 269 //Skip all the setup for the memory management, 270 //and only add an extra reference for the instance returned. 271 p = GC.malloc(ci.initializer.length, GC.BlkAttr.FINALIZE, ci); 272 p[0..ci.initializer.length] = ci.initializer; 273 iface = cast(Impl)p; 274 iface.gObject = instance; 275 iface.doref(); 276 277 return iface; 278 } 279 280 /** */ 281 public void setProperty(T)(string propertyName, T value) 282 { 283 setProperty(propertyName, new Value(value)); 284 } 285 286 deprecated("Use the member function") 287 public static void unref(ObjectG obj) 288 { 289 obj.unref(); 290 } 291 292 deprecated("Use the member function") 293 public static ObjectG doref(ObjectG obj) 294 { 295 return obj.doref(); 296 } 297 298 protected class OnNotifyDelegateWrapper 299 { 300 void delegate(ParamSpec, ObjectG) dlg; 301 gulong handlerId; 302 303 this(void delegate(ParamSpec, ObjectG) dlg) 304 { 305 this.dlg = dlg; 306 onNotifyListeners ~= this; 307 } 308 309 void remove(OnNotifyDelegateWrapper source) 310 { 311 foreach(index, wrapper; onNotifyListeners) 312 { 313 if (wrapper.handlerId == source.handlerId) 314 { 315 onNotifyListeners[index] = null; 316 onNotifyListeners = std.algorithm.remove(onNotifyListeners, index); 317 break; 318 } 319 } 320 } 321 } 322 OnNotifyDelegateWrapper[] onNotifyListeners; 323 324 /** 325 * The notify signal is emitted on an object when one of its 326 * properties has been changed. Note that getting this signal 327 * doesn't guarantee that the value of the property has actually 328 * changed, it may also be emitted when the setter for the property 329 * is called to reinstate the previous value. 330 * 331 * This signal is typically used to obtain change notification for a 332 * single property. 333 * 334 * It is important to note that you must use 335 * canonical parameter names for the property. 336 * 337 * Params: 338 * dlg = The callback. 339 * property = Set this if you only want to receive the signal for a specific property. 340 * connectFlags = The behavior of the signal's connection. 341 */ 342 gulong addOnNotify(void delegate(ParamSpec, ObjectG) dlg, string property = "", ConnectFlags connectFlags=cast(ConnectFlags)0) 343 { 344 string signalName; 345 346 if ( property == "" ) 347 signalName = "notify"; 348 else 349 signalName = "notify::"~ property; 350 351 auto wrapper = new OnNotifyDelegateWrapper(dlg); 352 wrapper.handlerId = Signals.connectData( 353 this, 354 signalName, 355 cast(GCallback)&callBackNotify, 356 cast(void*)wrapper, 357 cast(GClosureNotify)&callBackNotifyDestroy, 358 connectFlags); 359 return wrapper.handlerId; 360 } 361 362 extern(C) static void callBackNotify(GObject* objectgStruct, GParamSpec* pspec,OnNotifyDelegateWrapper wrapper) 363 { 364 wrapper.dlg(ObjectG.getDObject!(ParamSpec)(pspec), wrapper.outer); 365 } 366 367 extern(C) static void callBackNotifyDestroy(OnNotifyDelegateWrapper wrapper, GClosure* closure) 368 { 369 wrapper.remove(wrapper); 370 } 371 372 /** 373 */ 374 375 /** */ 376 public static GType getType() 377 { 378 return g_initially_unowned_get_type(); 379 } 380 381 /** 382 * Creates a new instance of a #GObject subtype and sets its properties. 383 * 384 * Construction parameters (see #G_PARAM_CONSTRUCT, #G_PARAM_CONSTRUCT_ONLY) 385 * which are not explicitly specified are set to their default values. 386 * 387 * Params: 388 * objectType = the type id of the #GObject subtype to instantiate 389 * firstPropertyName = the name of the first property 390 * varArgs = the value of the first property, followed optionally by more 391 * name/value pairs, followed by %NULL 392 * 393 * Returns: a new instance of @object_type 394 * 395 * Throws: ConstructionException GTK+ fails to create the object. 396 */ 397 public this(GType objectType, string firstPropertyName, void* varArgs) 398 { 399 auto p = g_object_new_valist(objectType, Str.toStringz(firstPropertyName), varArgs); 400 401 if(p is null) 402 { 403 throw new ConstructionException("null returned by new_valist"); 404 } 405 406 this(cast(GObject*) p, true); 407 } 408 409 /** 410 * Creates a new instance of a #GObject subtype and sets its properties using 411 * the provided arrays. Both arrays must have exactly @n_properties elements, 412 * and the names and values correspond by index. 413 * 414 * Construction parameters (see %G_PARAM_CONSTRUCT, %G_PARAM_CONSTRUCT_ONLY) 415 * which are not explicitly specified are set to their default values. 416 * 417 * Params: 418 * objectType = the object type to instantiate 419 * names = the names of each property to be set 420 * values = the values of each property to be set 421 * 422 * Returns: a new instance of 423 * @object_type 424 * 425 * Since: 2.54 426 * 427 * Throws: ConstructionException GTK+ fails to create the object. 428 */ 429 public this(GType objectType, string[] names, Value[] values) 430 { 431 GValue[] valuesArray = new GValue[values.length]; 432 for ( int i = 0; i < values.length; i++ ) 433 { 434 valuesArray[i] = *(values[i].getValueStruct()); 435 } 436 437 auto p = g_object_new_with_properties(objectType, cast(uint)values.length, Str.toStringzArray(names), valuesArray.ptr); 438 439 if(p is null) 440 { 441 throw new ConstructionException("null returned by new_with_properties"); 442 } 443 444 this(cast(GObject*) p, true); 445 } 446 447 /** 448 * Creates a new instance of a #GObject subtype and sets its properties. 449 * 450 * Construction parameters (see #G_PARAM_CONSTRUCT, #G_PARAM_CONSTRUCT_ONLY) 451 * which are not explicitly specified are set to their default values. 452 * 453 * Deprecated: Use g_object_new_with_properties() instead. 454 * deprecated. See #GParameter for more information. 455 * 456 * Params: 457 * objectType = the type id of the #GObject subtype to instantiate 458 * parameters = an array of #GParameter 459 * 460 * Returns: a new instance of 461 * @object_type 462 * 463 * Throws: ConstructionException GTK+ fails to create the object. 464 */ 465 public this(GType objectType, GParameter[] parameters) 466 { 467 auto p = g_object_newv(objectType, cast(uint)parameters.length, parameters.ptr); 468 469 if(p is null) 470 { 471 throw new ConstructionException("null returned by newv"); 472 } 473 474 this(cast(GObject*) p, true); 475 } 476 477 /** */ 478 public static size_t compatControl(size_t what, void* data) 479 { 480 return g_object_compat_control(what, data); 481 } 482 483 /** 484 * Find the #GParamSpec with the given name for an 485 * interface. Generally, the interface vtable passed in as @g_iface 486 * will be the default vtable from g_type_default_interface_ref(), or, 487 * if you know the interface has already been loaded, 488 * g_type_default_interface_peek(). 489 * 490 * Params: 491 * gIface = any interface vtable for the 492 * interface, or the default vtable for the interface 493 * propertyName = name of a property to lookup. 494 * 495 * Returns: the #GParamSpec for the property of the 496 * interface with the name @property_name, or %NULL if no 497 * such property exists. 498 * 499 * Since: 2.4 500 */ 501 public static ParamSpec interfaceFindProperty(TypeInterface gIface, string propertyName) 502 { 503 auto p = g_object_interface_find_property((gIface is null) ? null : gIface.getTypeInterfaceStruct(), Str.toStringz(propertyName)); 504 505 if(p is null) 506 { 507 return null; 508 } 509 510 return ObjectG.getDObject!(ParamSpec)(cast(GParamSpec*) p); 511 } 512 513 /** 514 * Add a property to an interface; this is only useful for interfaces 515 * that are added to GObject-derived types. Adding a property to an 516 * interface forces all objects classes with that interface to have a 517 * compatible property. The compatible property could be a newly 518 * created #GParamSpec, but normally 519 * g_object_class_override_property() will be used so that the object 520 * class only needs to provide an implementation and inherits the 521 * property description, default value, bounds, and so forth from the 522 * interface property. 523 * 524 * This function is meant to be called from the interface's default 525 * vtable initialization function (the @class_init member of 526 * #GTypeInfo.) It must not be called after after @class_init has 527 * been called for any object types implementing this interface. 528 * 529 * Params: 530 * gIface = any interface vtable for the 531 * interface, or the default 532 * vtable for the interface. 533 * pspec = the #GParamSpec for the new property 534 * 535 * Since: 2.4 536 */ 537 public static void interfaceInstallProperty(TypeInterface gIface, ParamSpec pspec) 538 { 539 g_object_interface_install_property((gIface is null) ? null : gIface.getTypeInterfaceStruct(), (pspec is null) ? null : pspec.getParamSpecStruct()); 540 } 541 542 /** 543 * Lists the properties of an interface.Generally, the interface 544 * vtable passed in as @g_iface will be the default vtable from 545 * g_type_default_interface_ref(), or, if you know the interface has 546 * already been loaded, g_type_default_interface_peek(). 547 * 548 * Params: 549 * gIface = any interface vtable for the 550 * interface, or the default vtable for the interface 551 * 552 * Returns: a 553 * pointer to an array of pointers to #GParamSpec 554 * structures. The paramspecs are owned by GLib, but the 555 * array should be freed with g_free() when you are done with 556 * it. 557 * 558 * Since: 2.4 559 */ 560 public static ParamSpec[] interfaceListProperties(TypeInterface gIface) 561 { 562 uint nPropertiesP; 563 564 auto p = g_object_interface_list_properties((gIface is null) ? null : gIface.getTypeInterfaceStruct(), &nPropertiesP); 565 566 if(p is null) 567 { 568 return null; 569 } 570 571 ParamSpec[] arr = new ParamSpec[nPropertiesP]; 572 for(int i = 0; i < nPropertiesP; i++) 573 { 574 arr[i] = ObjectG.getDObject!(ParamSpec)(cast(GParamSpec*) p[i]); 575 } 576 577 return arr; 578 } 579 580 /** 581 * Increases the reference count of the object by one and sets a 582 * callback to be called when all other references to the object are 583 * dropped, or when this is already the last reference to the object 584 * and another reference is established. 585 * 586 * This functionality is intended for binding @object to a proxy 587 * object managed by another memory manager. This is done with two 588 * paired references: the strong reference added by 589 * g_object_add_toggle_ref() and a reverse reference to the proxy 590 * object which is either a strong reference or weak reference. 591 * 592 * The setup is that when there are no other references to @object, 593 * only a weak reference is held in the reverse direction from @object 594 * to the proxy object, but when there are other references held to 595 * @object, a strong reference is held. The @notify callback is called 596 * when the reference from @object to the proxy object should be 597 * "toggled" from strong to weak (@is_last_ref true) or weak to strong 598 * (@is_last_ref false). 599 * 600 * Since a (normal) reference must be held to the object before 601 * calling g_object_add_toggle_ref(), the initial state of the reverse 602 * link is always strong. 603 * 604 * Multiple toggle references may be added to the same gobject, 605 * however if there are multiple toggle references to an object, none 606 * of them will ever be notified until all but one are removed. For 607 * this reason, you should only ever use a toggle reference if there 608 * is important state in the proxy object. 609 * 610 * Params: 611 * notify = a function to call when this reference is the 612 * last reference to the object, or is no longer 613 * the last reference. 614 * data = data to pass to @notify 615 * 616 * Since: 2.8 617 */ 618 public void addToggleRef(GToggleNotify notify, void* data) 619 { 620 g_object_add_toggle_ref(gObject, notify, data); 621 } 622 623 /** 624 * Adds a weak reference from weak_pointer to @object to indicate that 625 * the pointer located at @weak_pointer_location is only valid during 626 * the lifetime of @object. When the @object is finalized, 627 * @weak_pointer will be set to %NULL. 628 * 629 * Note that as with g_object_weak_ref(), the weak references created by 630 * this method are not thread-safe: they cannot safely be used in one 631 * thread if the object's last g_object_unref() might happen in another 632 * thread. Use #GWeakRef if thread-safety is required. 633 * 634 * Params: 635 * weakPointerLocation = The memory address 636 * of a pointer. 637 */ 638 public void addWeakPointer(ref void* weakPointerLocation) 639 { 640 g_object_add_weak_pointer(gObject, &weakPointerLocation); 641 } 642 643 /** 644 * Creates a binding between @source_property on @source and @target_property 645 * on @target. Whenever the @source_property is changed the @target_property is 646 * updated using the same value. For instance: 647 * 648 * |[ 649 * g_object_bind_property (action, "active", widget, "sensitive", 0); 650 * ]| 651 * 652 * Will result in the "sensitive" property of the widget #GObject instance to be 653 * updated with the same value of the "active" property of the action #GObject 654 * instance. 655 * 656 * If @flags contains %G_BINDING_BIDIRECTIONAL then the binding will be mutual: 657 * if @target_property on @target changes then the @source_property on @source 658 * will be updated as well. 659 * 660 * The binding will automatically be removed when either the @source or the 661 * @target instances are finalized. To remove the binding without affecting the 662 * @source and the @target you can just call g_object_unref() on the returned 663 * #GBinding instance. 664 * 665 * A #GObject can have multiple bindings. 666 * 667 * Params: 668 * sourceProperty = the property on @source to bind 669 * target = the target #GObject 670 * targetProperty = the property on @target to bind 671 * flags = flags to pass to #GBinding 672 * 673 * Returns: the #GBinding instance representing the 674 * binding between the two #GObject instances. The binding is released 675 * whenever the #GBinding reference count reaches zero. 676 * 677 * Since: 2.26 678 */ 679 public Binding bindProperty(string sourceProperty, ObjectG target, string targetProperty, GBindingFlags flags) 680 { 681 auto p = g_object_bind_property(gObject, Str.toStringz(sourceProperty), (target is null) ? null : target.getObjectGStruct(), Str.toStringz(targetProperty), flags); 682 683 if(p is null) 684 { 685 return null; 686 } 687 688 return ObjectG.getDObject!(Binding)(cast(GBinding*) p); 689 } 690 691 /** 692 * Complete version of g_object_bind_property(). 693 * 694 * Creates a binding between @source_property on @source and @target_property 695 * on @target, allowing you to set the transformation functions to be used by 696 * the binding. 697 * 698 * If @flags contains %G_BINDING_BIDIRECTIONAL then the binding will be mutual: 699 * if @target_property on @target changes then the @source_property on @source 700 * will be updated as well. The @transform_from function is only used in case 701 * of bidirectional bindings, otherwise it will be ignored 702 * 703 * The binding will automatically be removed when either the @source or the 704 * @target instances are finalized. To remove the binding without affecting the 705 * @source and the @target you can just call g_object_unref() on the returned 706 * #GBinding instance. 707 * 708 * A #GObject can have multiple bindings. 709 * 710 * The same @user_data parameter will be used for both @transform_to 711 * and @transform_from transformation functions; the @notify function will 712 * be called once, when the binding is removed. If you need different data 713 * for each transformation function, please use 714 * g_object_bind_property_with_closures() instead. 715 * 716 * Params: 717 * sourceProperty = the property on @source to bind 718 * target = the target #GObject 719 * targetProperty = the property on @target to bind 720 * flags = flags to pass to #GBinding 721 * transformTo = the transformation function 722 * from the @source to the @target, or %NULL to use the default 723 * transformFrom = the transformation function 724 * from the @target to the @source, or %NULL to use the default 725 * userData = custom data to be passed to the transformation functions, 726 * or %NULL 727 * notify = function to be called when disposing the binding, to free the 728 * resources used by the transformation functions 729 * 730 * Returns: the #GBinding instance representing the 731 * binding between the two #GObject instances. The binding is released 732 * whenever the #GBinding reference count reaches zero. 733 * 734 * Since: 2.26 735 */ 736 public Binding bindPropertyFull(string sourceProperty, ObjectG target, string targetProperty, GBindingFlags flags, GBindingTransformFunc transformTo, GBindingTransformFunc transformFrom, void* userData, GDestroyNotify notify) 737 { 738 auto p = g_object_bind_property_full(gObject, Str.toStringz(sourceProperty), (target is null) ? null : target.getObjectGStruct(), Str.toStringz(targetProperty), flags, transformTo, transformFrom, userData, notify); 739 740 if(p is null) 741 { 742 return null; 743 } 744 745 return ObjectG.getDObject!(Binding)(cast(GBinding*) p); 746 } 747 748 /** 749 * Creates a binding between @source_property on @source and @target_property 750 * on @target, allowing you to set the transformation functions to be used by 751 * the binding. 752 * 753 * This function is the language bindings friendly version of 754 * g_object_bind_property_full(), using #GClosures instead of 755 * function pointers. 756 * 757 * Params: 758 * sourceProperty = the property on @source to bind 759 * target = the target #GObject 760 * targetProperty = the property on @target to bind 761 * flags = flags to pass to #GBinding 762 * transformTo = a #GClosure wrapping the transformation function 763 * from the @source to the @target, or %NULL to use the default 764 * transformFrom = a #GClosure wrapping the transformation function 765 * from the @target to the @source, or %NULL to use the default 766 * 767 * Returns: the #GBinding instance representing the 768 * binding between the two #GObject instances. The binding is released 769 * whenever the #GBinding reference count reaches zero. 770 * 771 * Since: 2.26 772 */ 773 public Binding bindPropertyWithClosures(string sourceProperty, ObjectG target, string targetProperty, GBindingFlags flags, Closure transformTo, Closure transformFrom) 774 { 775 auto p = g_object_bind_property_with_closures(gObject, Str.toStringz(sourceProperty), (target is null) ? null : target.getObjectGStruct(), Str.toStringz(targetProperty), flags, (transformTo is null) ? null : transformTo.getClosureStruct(), (transformFrom is null) ? null : transformFrom.getClosureStruct()); 776 777 if(p is null) 778 { 779 return null; 780 } 781 782 return ObjectG.getDObject!(Binding)(cast(GBinding*) p); 783 } 784 785 /** 786 * This is a variant of g_object_get_data() which returns 787 * a 'duplicate' of the value. @dup_func defines the 788 * meaning of 'duplicate' in this context, it could e.g. 789 * take a reference on a ref-counted object. 790 * 791 * If the @key is not set on the object then @dup_func 792 * will be called with a %NULL argument. 793 * 794 * Note that @dup_func is called while user data of @object 795 * is locked. 796 * 797 * This function can be useful to avoid races when multiple 798 * threads are using object data on the same key on the same 799 * object. 800 * 801 * Params: 802 * key = a string, naming the user data pointer 803 * dupFunc = function to dup the value 804 * userData = passed as user_data to @dup_func 805 * 806 * Returns: the result of calling @dup_func on the value 807 * associated with @key on @object, or %NULL if not set. 808 * If @dup_func is %NULL, the value is returned 809 * unmodified. 810 * 811 * Since: 2.34 812 */ 813 public void* dupData(string key, GDuplicateFunc dupFunc, void* userData) 814 { 815 return g_object_dup_data(gObject, Str.toStringz(key), dupFunc, userData); 816 } 817 818 /** 819 * This is a variant of g_object_get_qdata() which returns 820 * a 'duplicate' of the value. @dup_func defines the 821 * meaning of 'duplicate' in this context, it could e.g. 822 * take a reference on a ref-counted object. 823 * 824 * If the @quark is not set on the object then @dup_func 825 * will be called with a %NULL argument. 826 * 827 * Note that @dup_func is called while user data of @object 828 * is locked. 829 * 830 * This function can be useful to avoid races when multiple 831 * threads are using object data on the same key on the same 832 * object. 833 * 834 * Params: 835 * quark = a #GQuark, naming the user data pointer 836 * dupFunc = function to dup the value 837 * userData = passed as user_data to @dup_func 838 * 839 * Returns: the result of calling @dup_func on the value 840 * associated with @quark on @object, or %NULL if not set. 841 * If @dup_func is %NULL, the value is returned 842 * unmodified. 843 * 844 * Since: 2.34 845 */ 846 public void* dupQdata(GQuark quark, GDuplicateFunc dupFunc, void* userData) 847 { 848 return g_object_dup_qdata(gObject, quark, dupFunc, userData); 849 } 850 851 /** 852 * This function is intended for #GObject implementations to re-enforce 853 * a [floating][floating-ref] object reference. Doing this is seldom 854 * required: all #GInitiallyUnowneds are created with a floating reference 855 * which usually just needs to be sunken by calling g_object_ref_sink(). 856 * 857 * Since: 2.10 858 */ 859 public void forceFloating() 860 { 861 g_object_force_floating(gObject); 862 } 863 864 /** 865 * Increases the freeze count on @object. If the freeze count is 866 * non-zero, the emission of "notify" signals on @object is 867 * stopped. The signals are queued until the freeze count is decreased 868 * to zero. Duplicate notifications are squashed so that at most one 869 * #GObject::notify signal is emitted for each property modified while the 870 * object is frozen. 871 * 872 * This is necessary for accessors that modify multiple properties to prevent 873 * premature notification while the object is still being modified. 874 */ 875 public void freezeNotify() 876 { 877 g_object_freeze_notify(gObject); 878 } 879 880 /** 881 * Gets a named field from the objects table of associations (see g_object_set_data()). 882 * 883 * Params: 884 * key = name of the key for that association 885 * 886 * Returns: the data if found, or %NULL if no such data exists. 887 */ 888 public void* getData(string key) 889 { 890 return g_object_get_data(gObject, Str.toStringz(key)); 891 } 892 893 /** 894 * Gets a property of an object. @value must have been initialized to the 895 * expected type of the property (or a type to which the expected type can be 896 * transformed) using g_value_init(). 897 * 898 * In general, a copy is made of the property contents and the caller is 899 * responsible for freeing the memory by calling g_value_unset(). 900 * 901 * Note that g_object_get_property() is really intended for language 902 * bindings, g_object_get() is much more convenient for C programming. 903 * 904 * Params: 905 * propertyName = the name of the property to get 906 * value = return location for the property value 907 */ 908 public void getProperty(string propertyName, Value value) 909 { 910 g_object_get_property(gObject, Str.toStringz(propertyName), (value is null) ? null : value.getValueStruct()); 911 } 912 913 /** 914 * This function gets back user data pointers stored via 915 * g_object_set_qdata(). 916 * 917 * Params: 918 * quark = A #GQuark, naming the user data pointer 919 * 920 * Returns: The user data pointer set, or %NULL 921 */ 922 public void* getQdata(GQuark quark) 923 { 924 return g_object_get_qdata(gObject, quark); 925 } 926 927 /** 928 * Gets properties of an object. 929 * 930 * In general, a copy is made of the property contents and the caller 931 * is responsible for freeing the memory in the appropriate manner for 932 * the type, for instance by calling g_free() or g_object_unref(). 933 * 934 * See g_object_get(). 935 * 936 * Params: 937 * firstPropertyName = name of the first property to get 938 * varArgs = return location for the first property, followed optionally by more 939 * name/return location pairs, followed by %NULL 940 */ 941 public void getValist(string firstPropertyName, void* varArgs) 942 { 943 g_object_get_valist(gObject, Str.toStringz(firstPropertyName), varArgs); 944 } 945 946 /** 947 * Gets @n_properties properties for an @object. 948 * Obtained properties will be set to @values. All properties must be valid. 949 * Warnings will be emitted and undefined behaviour may result if invalid 950 * properties are passed in. 951 * 952 * Params: 953 * names = the names of each property to get 954 * values = the values of each property to get 955 * 956 * Since: 2.54 957 */ 958 public void getv(string[] names, Value[] values) 959 { 960 GValue[] valuesArray = new GValue[values.length]; 961 for ( int i = 0; i < values.length; i++ ) 962 { 963 valuesArray[i] = *(values[i].getValueStruct()); 964 } 965 966 g_object_getv(gObject, cast(uint)values.length, Str.toStringzArray(names), valuesArray.ptr); 967 } 968 969 /** 970 * Checks whether @object has a [floating][floating-ref] reference. 971 * 972 * Returns: %TRUE if @object has a floating reference 973 * 974 * Since: 2.10 975 */ 976 public bool isFloating() 977 { 978 return g_object_is_floating(gObject) != 0; 979 } 980 981 /** 982 * Emits a "notify" signal for the property @property_name on @object. 983 * 984 * When possible, eg. when signaling a property change from within the class 985 * that registered the property, you should use g_object_notify_by_pspec() 986 * instead. 987 * 988 * Note that emission of the notify signal may be blocked with 989 * g_object_freeze_notify(). In this case, the signal emissions are queued 990 * and will be emitted (in reverse order) when g_object_thaw_notify() is 991 * called. 992 * 993 * Params: 994 * propertyName = the name of a property installed on the class of @object. 995 */ 996 public void notify(string propertyName) 997 { 998 g_object_notify(gObject, Str.toStringz(propertyName)); 999 } 1000 1001 /** 1002 * Emits a "notify" signal for the property specified by @pspec on @object. 1003 * 1004 * This function omits the property name lookup, hence it is faster than 1005 * g_object_notify(). 1006 * 1007 * One way to avoid using g_object_notify() from within the 1008 * class that registered the properties, and using g_object_notify_by_pspec() 1009 * instead, is to store the GParamSpec used with 1010 * g_object_class_install_property() inside a static array, e.g.: 1011 * 1012 * |[<!-- language="C" --> 1013 * enum 1014 * { 1015 * PROP_0, 1016 * PROP_FOO, 1017 * PROP_LAST 1018 * }; 1019 * 1020 * static GParamSpec *properties[PROP_LAST]; 1021 * 1022 * static void 1023 * my_object_class_init (MyObjectClass *klass) 1024 * { 1025 * properties[PROP_FOO] = g_param_spec_int ("foo", "Foo", "The foo", 1026 * 0, 100, 1027 * 50, 1028 * G_PARAM_READWRITE); 1029 * g_object_class_install_property (gobject_class, 1030 * PROP_FOO, 1031 * properties[PROP_FOO]); 1032 * } 1033 * ]| 1034 * 1035 * and then notify a change on the "foo" property with: 1036 * 1037 * |[<!-- language="C" --> 1038 * g_object_notify_by_pspec (self, properties[PROP_FOO]); 1039 * ]| 1040 * 1041 * Params: 1042 * pspec = the #GParamSpec of a property installed on the class of @object. 1043 * 1044 * Since: 2.26 1045 */ 1046 public void notifyByPspec(ParamSpec pspec) 1047 { 1048 g_object_notify_by_pspec(gObject, (pspec is null) ? null : pspec.getParamSpecStruct()); 1049 } 1050 1051 /** 1052 * Increases the reference count of @object. 1053 * 1054 * Returns: the same @object 1055 */ 1056 public ObjectG doref() 1057 { 1058 auto p = g_object_ref(gObject); 1059 1060 if(p is null) 1061 { 1062 return null; 1063 } 1064 1065 return ObjectG.getDObject!(ObjectG)(cast(GObject*) p); 1066 } 1067 1068 /** 1069 * Increase the reference count of @object, and possibly remove the 1070 * [floating][floating-ref] reference, if @object has a floating reference. 1071 * 1072 * In other words, if the object is floating, then this call "assumes 1073 * ownership" of the floating reference, converting it to a normal 1074 * reference by clearing the floating flag while leaving the reference 1075 * count unchanged. If the object is not floating, then this call 1076 * adds a new normal reference increasing the reference count by one. 1077 * 1078 * Returns: @object 1079 * 1080 * Since: 2.10 1081 */ 1082 public ObjectG refSink() 1083 { 1084 auto p = g_object_ref_sink(gObject); 1085 1086 if(p is null) 1087 { 1088 return null; 1089 } 1090 1091 return ObjectG.getDObject!(ObjectG)(cast(GObject*) p); 1092 } 1093 1094 /** 1095 * Removes a reference added with g_object_add_toggle_ref(). The 1096 * reference count of the object is decreased by one. 1097 * 1098 * Params: 1099 * notify = a function to call when this reference is the 1100 * last reference to the object, or is no longer 1101 * the last reference. 1102 * data = data to pass to @notify 1103 * 1104 * Since: 2.8 1105 */ 1106 public void removeToggleRef(GToggleNotify notify, void* data) 1107 { 1108 g_object_remove_toggle_ref(gObject, notify, data); 1109 } 1110 1111 /** 1112 * Removes a weak reference from @object that was previously added 1113 * using g_object_add_weak_pointer(). The @weak_pointer_location has 1114 * to match the one used with g_object_add_weak_pointer(). 1115 * 1116 * Params: 1117 * weakPointerLocation = The memory address 1118 * of a pointer. 1119 */ 1120 public void removeWeakPointer(ref void* weakPointerLocation) 1121 { 1122 g_object_remove_weak_pointer(gObject, &weakPointerLocation); 1123 } 1124 1125 /** 1126 * Compares the user data for the key @key on @object with 1127 * @oldval, and if they are the same, replaces @oldval with 1128 * @newval. 1129 * 1130 * This is like a typical atomic compare-and-exchange 1131 * operation, for user data on an object. 1132 * 1133 * If the previous value was replaced then ownership of the 1134 * old value (@oldval) is passed to the caller, including 1135 * the registered destroy notify for it (passed out in @old_destroy). 1136 * Its up to the caller to free this as he wishes, which may 1137 * or may not include using @old_destroy as sometimes replacement 1138 * should not destroy the object in the normal way. 1139 * 1140 * Params: 1141 * key = a string, naming the user data pointer 1142 * oldval = the old value to compare against 1143 * newval = the new value 1144 * destroy = a destroy notify for the new value 1145 * oldDestroy = destroy notify for the existing value 1146 * 1147 * Returns: %TRUE if the existing value for @key was replaced 1148 * by @newval, %FALSE otherwise. 1149 * 1150 * Since: 2.34 1151 */ 1152 public bool replaceData(string key, void* oldval, void* newval, GDestroyNotify destroy, GDestroyNotify* oldDestroy) 1153 { 1154 return g_object_replace_data(gObject, Str.toStringz(key), oldval, newval, destroy, oldDestroy) != 0; 1155 } 1156 1157 /** 1158 * Compares the user data for the key @quark on @object with 1159 * @oldval, and if they are the same, replaces @oldval with 1160 * @newval. 1161 * 1162 * This is like a typical atomic compare-and-exchange 1163 * operation, for user data on an object. 1164 * 1165 * If the previous value was replaced then ownership of the 1166 * old value (@oldval) is passed to the caller, including 1167 * the registered destroy notify for it (passed out in @old_destroy). 1168 * Its up to the caller to free this as he wishes, which may 1169 * or may not include using @old_destroy as sometimes replacement 1170 * should not destroy the object in the normal way. 1171 * 1172 * Params: 1173 * quark = a #GQuark, naming the user data pointer 1174 * oldval = the old value to compare against 1175 * newval = the new value 1176 * destroy = a destroy notify for the new value 1177 * oldDestroy = destroy notify for the existing value 1178 * 1179 * Returns: %TRUE if the existing value for @quark was replaced 1180 * by @newval, %FALSE otherwise. 1181 * 1182 * Since: 2.34 1183 */ 1184 public bool replaceQdata(GQuark quark, void* oldval, void* newval, GDestroyNotify destroy, GDestroyNotify* oldDestroy) 1185 { 1186 return g_object_replace_qdata(gObject, quark, oldval, newval, destroy, oldDestroy) != 0; 1187 } 1188 1189 /** 1190 * Releases all references to other objects. This can be used to break 1191 * reference cycles. 1192 * 1193 * This function should only be called from object system implementations. 1194 */ 1195 public void runDispose() 1196 { 1197 g_object_run_dispose(gObject); 1198 } 1199 1200 /** 1201 * Each object carries around a table of associations from 1202 * strings to pointers. This function lets you set an association. 1203 * 1204 * If the object already had an association with that name, 1205 * the old association will be destroyed. 1206 * 1207 * Params: 1208 * key = name of the key 1209 * data = data to associate with that key 1210 */ 1211 public void setData(string key, void* data) 1212 { 1213 g_object_set_data(gObject, Str.toStringz(key), data); 1214 } 1215 1216 /** 1217 * Like g_object_set_data() except it adds notification 1218 * for when the association is destroyed, either by setting it 1219 * to a different value or when the object is destroyed. 1220 * 1221 * Note that the @destroy callback is not called if @data is %NULL. 1222 * 1223 * Params: 1224 * key = name of the key 1225 * data = data to associate with that key 1226 * destroy = function to call when the association is destroyed 1227 */ 1228 public void setDataFull(string key, void* data, GDestroyNotify destroy) 1229 { 1230 g_object_set_data_full(gObject, Str.toStringz(key), data, destroy); 1231 } 1232 1233 /** 1234 * Sets a property on an object. 1235 * 1236 * Params: 1237 * propertyName = the name of the property to set 1238 * value = the value 1239 */ 1240 public void setProperty(string propertyName, Value value) 1241 { 1242 g_object_set_property(gObject, Str.toStringz(propertyName), (value is null) ? null : value.getValueStruct()); 1243 } 1244 1245 /** 1246 * This sets an opaque, named pointer on an object. 1247 * The name is specified through a #GQuark (retrived e.g. via 1248 * g_quark_from_static_string()), and the pointer 1249 * can be gotten back from the @object with g_object_get_qdata() 1250 * until the @object is finalized. 1251 * Setting a previously set user data pointer, overrides (frees) 1252 * the old pointer set, using #NULL as pointer essentially 1253 * removes the data stored. 1254 * 1255 * Params: 1256 * quark = A #GQuark, naming the user data pointer 1257 * data = An opaque user data pointer 1258 */ 1259 public void setQdata(GQuark quark, void* data) 1260 { 1261 g_object_set_qdata(gObject, quark, data); 1262 } 1263 1264 /** 1265 * This function works like g_object_set_qdata(), but in addition, 1266 * a void (*destroy) (gpointer) function may be specified which is 1267 * called with @data as argument when the @object is finalized, or 1268 * the data is being overwritten by a call to g_object_set_qdata() 1269 * with the same @quark. 1270 * 1271 * Params: 1272 * quark = A #GQuark, naming the user data pointer 1273 * data = An opaque user data pointer 1274 * destroy = Function to invoke with @data as argument, when @data 1275 * needs to be freed 1276 */ 1277 public void setQdataFull(GQuark quark, void* data, GDestroyNotify destroy) 1278 { 1279 g_object_set_qdata_full(gObject, quark, data, destroy); 1280 } 1281 1282 /** 1283 * Sets properties on an object. 1284 * 1285 * Params: 1286 * firstPropertyName = name of the first property to set 1287 * varArgs = value for the first property, followed optionally by more 1288 * name/value pairs, followed by %NULL 1289 */ 1290 public void setValist(string firstPropertyName, void* varArgs) 1291 { 1292 g_object_set_valist(gObject, Str.toStringz(firstPropertyName), varArgs); 1293 } 1294 1295 /** 1296 * Sets @n_properties properties for an @object. 1297 * Properties to be set will be taken from @values. All properties must be 1298 * valid. Warnings will be emitted and undefined behaviour may result if invalid 1299 * properties are passed in. 1300 * 1301 * Params: 1302 * names = the names of each property to be set 1303 * values = the values of each property to be set 1304 * 1305 * Since: 2.54 1306 */ 1307 public void setv(string[] names, Value[] values) 1308 { 1309 GValue[] valuesArray = new GValue[values.length]; 1310 for ( int i = 0; i < values.length; i++ ) 1311 { 1312 valuesArray[i] = *(values[i].getValueStruct()); 1313 } 1314 1315 g_object_setv(gObject, cast(uint)values.length, Str.toStringzArray(names), valuesArray.ptr); 1316 } 1317 1318 /** 1319 * Remove a specified datum from the object's data associations, 1320 * without invoking the association's destroy handler. 1321 * 1322 * Params: 1323 * key = name of the key 1324 * 1325 * Returns: the data if found, or %NULL if no such data exists. 1326 */ 1327 public void* stealData(string key) 1328 { 1329 return g_object_steal_data(gObject, Str.toStringz(key)); 1330 } 1331 1332 /** 1333 * This function gets back user data pointers stored via 1334 * g_object_set_qdata() and removes the @data from object 1335 * without invoking its destroy() function (if any was 1336 * set). 1337 * Usually, calling this function is only required to update 1338 * user data pointers with a destroy notifier, for example: 1339 * |[<!-- language="C" --> 1340 * void 1341 * object_add_to_user_list (GObject *object, 1342 * const gchar *new_string) 1343 * { 1344 * // the quark, naming the object data 1345 * GQuark quark_string_list = g_quark_from_static_string ("my-string-list"); 1346 * // retrive the old string list 1347 * GList *list = g_object_steal_qdata (object, quark_string_list); 1348 * 1349 * // prepend new string 1350 * list = g_list_prepend (list, g_strdup (new_string)); 1351 * // this changed 'list', so we need to set it again 1352 * g_object_set_qdata_full (object, quark_string_list, list, free_string_list); 1353 * } 1354 * static void 1355 * free_string_list (gpointer data) 1356 * { 1357 * GList *node, *list = data; 1358 * 1359 * for (node = list; node; node = node->next) 1360 * g_free (node->data); 1361 * g_list_free (list); 1362 * } 1363 * ]| 1364 * Using g_object_get_qdata() in the above example, instead of 1365 * g_object_steal_qdata() would have left the destroy function set, 1366 * and thus the partial string list would have been freed upon 1367 * g_object_set_qdata_full(). 1368 * 1369 * Params: 1370 * quark = A #GQuark, naming the user data pointer 1371 * 1372 * Returns: The user data pointer set, or %NULL 1373 */ 1374 public void* stealQdata(GQuark quark) 1375 { 1376 return g_object_steal_qdata(gObject, quark); 1377 } 1378 1379 /** 1380 * Reverts the effect of a previous call to 1381 * g_object_freeze_notify(). The freeze count is decreased on @object 1382 * and when it reaches zero, queued "notify" signals are emitted. 1383 * 1384 * Duplicate notifications for each property are squashed so that at most one 1385 * #GObject::notify signal is emitted for each property, in the reverse order 1386 * in which they have been queued. 1387 * 1388 * It is an error to call this function when the freeze count is zero. 1389 */ 1390 public void thawNotify() 1391 { 1392 g_object_thaw_notify(gObject); 1393 } 1394 1395 /** 1396 * Decreases the reference count of @object. When its reference count 1397 * drops to 0, the object is finalized (i.e. its memory is freed). 1398 * 1399 * If the pointer to the #GObject may be reused in future (for example, if it is 1400 * an instance variable of another object), it is recommended to clear the 1401 * pointer to %NULL rather than retain a dangling pointer to a potentially 1402 * invalid #GObject instance. Use g_clear_object() for this. 1403 */ 1404 public void unref() 1405 { 1406 g_object_unref(gObject); 1407 } 1408 1409 /** 1410 * This function essentially limits the life time of the @closure to 1411 * the life time of the object. That is, when the object is finalized, 1412 * the @closure is invalidated by calling g_closure_invalidate() on 1413 * it, in order to prevent invocations of the closure with a finalized 1414 * (nonexisting) object. Also, g_object_ref() and g_object_unref() are 1415 * added as marshal guards to the @closure, to ensure that an extra 1416 * reference count is held on @object during invocation of the 1417 * @closure. Usually, this function will be called on closures that 1418 * use this @object as closure data. 1419 * 1420 * Params: 1421 * closure = GClosure to watch 1422 */ 1423 public void watchClosure(Closure closure) 1424 { 1425 g_object_watch_closure(gObject, (closure is null) ? null : closure.getClosureStruct()); 1426 } 1427 1428 /** 1429 * Adds a weak reference callback to an object. Weak references are 1430 * used for notification when an object is finalized. They are called 1431 * "weak references" because they allow you to safely hold a pointer 1432 * to an object without calling g_object_ref() (g_object_ref() adds a 1433 * strong reference, that is, forces the object to stay alive). 1434 * 1435 * Note that the weak references created by this method are not 1436 * thread-safe: they cannot safely be used in one thread if the 1437 * object's last g_object_unref() might happen in another thread. 1438 * Use #GWeakRef if thread-safety is required. 1439 * 1440 * Params: 1441 * notify = callback to invoke before the object is freed 1442 * data = extra data to pass to notify 1443 */ 1444 public void weakRef(GWeakNotify notify, void* data) 1445 { 1446 g_object_weak_ref(gObject, notify, data); 1447 } 1448 1449 /** 1450 * Removes a weak reference callback to an object. 1451 * 1452 * Params: 1453 * notify = callback to search for 1454 * data = data to search for 1455 */ 1456 public void weakUnref(GWeakNotify notify, void* data) 1457 { 1458 g_object_weak_unref(gObject, notify, data); 1459 } 1460 1461 /** 1462 * Clears a reference to a #GObject. 1463 * 1464 * @object_ptr must not be %NULL. 1465 * 1466 * If the reference is %NULL then this function does nothing. 1467 * Otherwise, the reference count of the object is decreased and the 1468 * pointer is set to %NULL. 1469 * 1470 * A macro is also included that allows this function to be used without 1471 * pointer casts. 1472 * 1473 * Params: 1474 * objectPtr = a pointer to a #GObject reference 1475 * 1476 * Since: 2.28 1477 */ 1478 public static void clearObject(ref ObjectG objectPtr) 1479 { 1480 GObject* outobjectPtr = objectPtr.getObjectGStruct(); 1481 1482 g_clear_object(&outobjectPtr); 1483 1484 objectPtr = ObjectG.getDObject!(ObjectG)(outobjectPtr); 1485 } 1486 }