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