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