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