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