<?xml version="1.0"?>
<!DOCTYPE refentry PUBLIC '-//OASIS//DTD DocBook XML V4.5//EN'
                      'http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd' [

<!ENTITY % local.common.attrib "xmlns:xi  CDATA  #FIXED 'http://www.w3.org/2003/XInclude'">
<!ENTITY version SYSTEM "version.xml">
]>
<refentry id="gobject-The-Base-Object-Type">
<refmeta>
<refentrytitle role="top_of_page" id="gobject-The-Base-Object-Type.top_of_page">GObject</refentrytitle>
<manvolnum>3</manvolnum>
<refmiscinfo>GOBJECT Library</refmiscinfo>
</refmeta>
<refnamediv>
<refname>GObject</refname>
<refpurpose>The base object type</refpurpose>
</refnamediv>

<refsect1 id="gobject-The-Base-Object-Type.functions" role="functions_proto">
<title role="functions_proto.title">Functions</title>
<informaltable pgwide="1" frame="none">
<tgroup cols="2">
<colspec colname="functions_proto_type" colwidth="150px"/>
<colspec colname="functions_proto_name"/>
<tbody>
<row><entry role="function_type"><link linkend="void"><returnvalue>void</returnvalue></link>
</entry><entry role="function_name"><phrase role="c_punctuation">(</phrase><link linkend="GObjectGetPropertyFunc">*GObjectGetPropertyFunc</link><phrase role="c_punctuation">)</phrase>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="void"><returnvalue>void</returnvalue></link>
</entry><entry role="function_name"><phrase role="c_punctuation">(</phrase><link linkend="GObjectSetPropertyFunc">*GObjectSetPropertyFunc</link><phrase role="c_punctuation">)</phrase>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="void"><returnvalue>void</returnvalue></link>
</entry><entry role="function_name"><phrase role="c_punctuation">(</phrase><link linkend="GObjectFinalizeFunc">*GObjectFinalizeFunc</link><phrase role="c_punctuation">)</phrase>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="define_keyword">#define</entry><entry role="function_name"><link linkend="G-TYPE-IS-OBJECT:CAPS">G_TYPE_IS_OBJECT</link><phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="define_keyword">#define</entry><entry role="function_name"><link linkend="G-OBJECT:CAPS">G_OBJECT</link><phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="define_keyword">#define</entry><entry role="function_name"><link linkend="G-IS-OBJECT:CAPS">G_IS_OBJECT</link><phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="define_keyword">#define</entry><entry role="function_name"><link linkend="G-OBJECT-CLASS:CAPS">G_OBJECT_CLASS</link><phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="define_keyword">#define</entry><entry role="function_name"><link linkend="G-IS-OBJECT-CLASS:CAPS">G_IS_OBJECT_CLASS</link><phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="define_keyword">#define</entry><entry role="function_name"><link linkend="G-OBJECT-GET-CLASS:CAPS">G_OBJECT_GET_CLASS</link><phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="define_keyword">#define</entry><entry role="function_name"><link linkend="G-OBJECT-TYPE:CAPS">G_OBJECT_TYPE</link><phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="define_keyword">#define</entry><entry role="function_name"><link linkend="G-OBJECT-TYPE-NAME:CAPS">G_OBJECT_TYPE_NAME</link><phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="define_keyword">#define</entry><entry role="function_name"><link linkend="G-OBJECT-CLASS-TYPE:CAPS">G_OBJECT_CLASS_TYPE</link><phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="define_keyword">#define</entry><entry role="function_name"><link linkend="G-OBJECT-CLASS-NAME:CAPS">G_OBJECT_CLASS_NAME</link><phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="void"><returnvalue>void</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-object-class-install-property">g_object_class_install_property</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="void"><returnvalue>void</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-object-class-install-properties">g_object_class_install_properties</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="GParamSpec"><returnvalue>GParamSpec</returnvalue></link>&#160;*
</entry><entry role="function_name"><link linkend="g-object-class-find-property">g_object_class_find_property</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="GParamSpec"><returnvalue>GParamSpec</returnvalue></link>&#160;**
</entry><entry role="function_name"><link linkend="g-object-class-list-properties">g_object_class_list_properties</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="void"><returnvalue>void</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-object-class-override-property">g_object_class_override_property</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="void"><returnvalue>void</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-object-interface-install-property">g_object_interface_install_property</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="GParamSpec"><returnvalue>GParamSpec</returnvalue></link>&#160;*
</entry><entry role="function_name"><link linkend="g-object-interface-find-property">g_object_interface_find_property</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="GParamSpec"><returnvalue>GParamSpec</returnvalue></link>&#160;**
</entry><entry role="function_name"><link linkend="g-object-interface-list-properties">g_object_interface_list_properties</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="gpointer"><returnvalue>gpointer</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-object-new">g_object_new</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="GObject"><returnvalue>GObject</returnvalue></link>&#160;*
</entry><entry role="function_name"><link linkend="g-object-new-with-properties">g_object_new_with_properties</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="gpointer"><returnvalue>gpointer</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-object-newv">g_object_newv</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="gpointer"><returnvalue>gpointer</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-object-ref">g_object_ref</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="void"><returnvalue>void</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-object-unref">g_object_unref</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="gpointer"><returnvalue>gpointer</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-object-ref-sink">g_object_ref_sink</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="gboolean"><returnvalue>gboolean</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-set-object">g_set_object</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="void"><returnvalue>void</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-clear-object">g_clear_object</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="gboolean"><returnvalue>gboolean</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-object-is-floating">g_object_is_floating</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="void"><returnvalue>void</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-object-force-floating">g_object_force_floating</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="void"><returnvalue>void</returnvalue></link>
</entry><entry role="function_name"><phrase role="c_punctuation">(</phrase><link linkend="GWeakNotify">*GWeakNotify</link><phrase role="c_punctuation">)</phrase>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="void"><returnvalue>void</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-object-weak-ref">g_object_weak_ref</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="void"><returnvalue>void</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-object-weak-unref">g_object_weak_unref</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="void"><returnvalue>void</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-object-add-weak-pointer">g_object_add_weak_pointer</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="void"><returnvalue>void</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-object-remove-weak-pointer">g_object_remove_weak_pointer</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="gboolean"><returnvalue>gboolean</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-set-weak-pointer">g_set_weak_pointer</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="void"><returnvalue>void</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-clear-weak-pointer">g_clear_weak_pointer</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="void"><returnvalue>void</returnvalue></link>
</entry><entry role="function_name"><phrase role="c_punctuation">(</phrase><link linkend="GToggleNotify">*GToggleNotify</link><phrase role="c_punctuation">)</phrase>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="void"><returnvalue>void</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-object-add-toggle-ref">g_object_add_toggle_ref</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="void"><returnvalue>void</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-object-remove-toggle-ref">g_object_remove_toggle_ref</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="gpointer"><returnvalue>gpointer</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-object-connect">g_object_connect</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="void"><returnvalue>void</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-object-disconnect">g_object_disconnect</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="void"><returnvalue>void</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-object-set">g_object_set</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="void"><returnvalue>void</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-object-setv">g_object_setv</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="void"><returnvalue>void</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-object-get">g_object_get</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="void"><returnvalue>void</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-object-getv">g_object_getv</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="void"><returnvalue>void</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-object-notify">g_object_notify</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="void"><returnvalue>void</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-object-notify-by-pspec">g_object_notify_by_pspec</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="void"><returnvalue>void</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-object-freeze-notify">g_object_freeze_notify</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="void"><returnvalue>void</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-object-thaw-notify">g_object_thaw_notify</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="gpointer"><returnvalue>gpointer</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-object-get-data">g_object_get_data</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="void"><returnvalue>void</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-object-set-data">g_object_set_data</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="void"><returnvalue>void</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-object-set-data-full">g_object_set_data_full</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="gpointer"><returnvalue>gpointer</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-object-steal-data">g_object_steal_data</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="gpointer"><returnvalue>gpointer</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-object-dup-data">g_object_dup_data</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="gboolean"><returnvalue>gboolean</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-object-replace-data">g_object_replace_data</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="gpointer"><returnvalue>gpointer</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-object-get-qdata">g_object_get_qdata</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="void"><returnvalue>void</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-object-set-qdata">g_object_set_qdata</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="void"><returnvalue>void</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-object-set-qdata-full">g_object_set_qdata_full</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="gpointer"><returnvalue>gpointer</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-object-steal-qdata">g_object_steal_qdata</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="gpointer"><returnvalue>gpointer</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-object-dup-qdata">g_object_dup_qdata</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="gboolean"><returnvalue>gboolean</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-object-replace-qdata">g_object_replace_qdata</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="void"><returnvalue>void</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-object-set-property">g_object_set_property</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="void"><returnvalue>void</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-object-get-property">g_object_get_property</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="GObject"><returnvalue>GObject</returnvalue></link>&#160;*
</entry><entry role="function_name"><link linkend="g-object-new-valist">g_object_new_valist</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="void"><returnvalue>void</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-object-set-valist">g_object_set_valist</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="void"><returnvalue>void</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-object-get-valist">g_object_get_valist</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="void"><returnvalue>void</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-object-watch-closure">g_object_watch_closure</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="void"><returnvalue>void</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-object-run-dispose">g_object_run_dispose</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="define_keyword">#define</entry><entry role="function_name"><link linkend="G-OBJECT-WARN-INVALID-PROPERTY-ID:CAPS">G_OBJECT_WARN_INVALID_PROPERTY_ID</link><phrase role="c_punctuation">()</phrase></entry></row>

<row><entry role="function_type"><link linkend="void"><returnvalue>void</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-weak-ref-init">g_weak_ref_init</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="void"><returnvalue>void</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-weak-ref-clear">g_weak_ref_clear</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="gpointer"><returnvalue>gpointer</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-weak-ref-get">g_weak_ref_get</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="void"><returnvalue>void</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-weak-ref-set">g_weak_ref_set</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>

<row><entry role="function_type"><link linkend="void"><returnvalue>void</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-assert-finalize-object">g_assert_finalize_object</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>

</tbody>
</tgroup>
</informaltable>
</refsect1>
<refsect1 id="gobject-The-Base-Object-Type.signals" role="signal_proto">
<title role="signal_proto.title">Signals</title>
<informaltable frame="none">
<tgroup cols="3">
<colspec colname="signal_proto_type" colwidth="150px"/>
<colspec colname="signal_proto_name" colwidth="300px"/>
<colspec colname="signal_proto_flags" colwidth="200px"/>
<tbody>
<row><entry role="signal_type"><link linkend="void"><returnvalue>void</returnvalue></link></entry><entry role="signal_name"><link linkend="GObject-notify">notify</link></entry><entry role="signal_flags"><link linkend="G-SIGNAL-NO-HOOKS:CAPS">No Hooks</link></entry></row>

</tbody>
</tgroup>
</informaltable>
</refsect1>
<anchor id="GObject"/><anchor id="GInitiallyUnowned"/><refsect1 id="gobject-The-Base-Object-Type.other" role="other_proto">
<title role="other_proto.title">Types and Values</title>
<informaltable pgwide="1" frame="none">
<tgroup cols="2">
<colspec colname="other_proto_type" colwidth="150px"/>
<colspec colname="other_proto_name"/>
<tbody>
<row><entry role="datatype_keyword">struct</entry><entry role="function_name"><link linkend="GObject-struct">GObject</link></entry></row>
<row><entry role="datatype_keyword">struct</entry><entry role="function_name"><link linkend="GObjectClass">GObjectClass</link></entry></row>
<row><entry role="datatype_keyword">struct</entry><entry role="function_name"><link linkend="GObjectConstructParam">GObjectConstructParam</link></entry></row>
<row><entry role="datatype_keyword">struct</entry><entry role="function_name"><link linkend="GParameter">GParameter</link></entry></row>
<row><entry role="typedef_keyword">typedef</entry><entry role="function_name"><link linkend="GInitiallyUnowned">GInitiallyUnowned</link></entry></row>
<row><entry role="typedef_keyword">typedef</entry><entry role="function_name"><link linkend="GInitiallyUnownedClass">GInitiallyUnownedClass</link></entry></row>
<row><entry role="define_keyword">#define</entry><entry role="function_name"><link linkend="G-TYPE-INITIALLY-UNOWNED:CAPS">G_TYPE_INITIALLY_UNOWNED</link></entry></row>

<row><entry role="datatype_keyword"></entry><entry role="function_name"><link linkend="GWeakRef">GWeakRef</link></entry></row>

</tbody>
</tgroup>
</informaltable>
</refsect1>
<refsect1 id="gobject-The-Base-Object-Type.object-hierarchy" role="object_hierarchy">
<title role="object_hierarchy.title">Object Hierarchy</title>
<screen>    GObject
    <phrase role="lineart">&#9500;&#9472;&#9472;</phrase> <link linkend="GBinding">GBinding</link>
    <phrase role="lineart">&#9500;&#9472;&#9472;</phrase> GInitiallyUnowned
    <phrase role="lineart">&#9584;&#9472;&#9472;</phrase> <link linkend="GTypeModule">GTypeModule</link>
</screen>
</refsect1>

<refsect1 id="gobject-The-Base-Object-Type.includes"><title>Includes</title><synopsis>#include &lt;glib-object.h&gt;
</synopsis></refsect1>

<refsect1 id="gobject-The-Base-Object-Type.description" role="desc">
<title role="desc.title">Description</title>
<para>GObject is the fundamental type providing the common attributes and
methods for all object types in GTK+, Pango and other libraries
based on GObject.  The GObject class provides methods for object
construction and destruction, property access methods, and signal
support.  Signals are described in detail <link linkend="gobject-Signals">here</link>.</para>
<para>For a tutorial on implementing a new GObject class, see <link linkend="howto-gobject">How to define and
implement a new GObject</link>. For a list of naming conventions for
GObjects and their methods, see the <link linkend="gtype-conventions">GType conventions</link>.
For the high-level concepts behind GObject, read <link linkend="gtype-instantiable-classed">Instantiable classed types:
Objects</link>.</para>
<refsect3 id="floating-ref"><title>Floating references</title><para>**Note**: Floating references are a C convenience API and should not be
used in modern GObject code. Language bindings in particular find the
concept highly problematic, as floating references are not identifiable
through annotations, and neither are deviations from the floating reference
behavior, like types that inherit from <link linkend="GInitiallyUnowned"><type>GInitiallyUnowned</type></link> and still return
a full reference from <link linkend="g-object-new"><function>g_object_new()</function></link>.</para>
<para>GInitiallyUnowned is derived from GObject. The only difference between
the two is that the initial reference of a GInitiallyUnowned is flagged
as a "floating" reference. This means that it is not specifically
claimed to be "owned" by any code portion. The main motivation for
providing floating references is C convenience. In particular, it
allows code to be written as:</para>
<informalexample><programlisting role="example"><![CDATA[
container = create_container ();
container_add_child (container, create_child());
]]></programlisting></informalexample>
<para>
If <link linkend="container-add-child"><function>container_add_child()</function></link> calls <link linkend="g-object-ref-sink"><function>g_object_ref_sink()</function></link> on the passed-in child,
no reference of the newly created child is leaked. Without floating
references, <link linkend="container-add-child"><function>container_add_child()</function></link> can only <link linkend="g-object-ref"><function>g_object_ref()</function></link> the new child,
so to implement this code without reference leaks, it would have to be
written as:</para>
<informalexample><programlisting role="example"><![CDATA[
Child *child;
container = create_container ();
child = create_child ();
container_add_child (container, child);
g_object_unref (child);
]]></programlisting></informalexample>
<para>
The floating reference can be converted into an ordinary reference by
calling <link linkend="g-object-ref-sink"><function>g_object_ref_sink()</function></link>. For already sunken objects (objects that
don't have a floating reference anymore), <link linkend="g-object-ref-sink"><function>g_object_ref_sink()</function></link> is equivalent
to <link linkend="g-object-ref"><function>g_object_ref()</function></link> and returns a new reference.</para>
<para>Since floating references are useful almost exclusively for C convenience,
language bindings that provide automated reference and memory ownership
maintenance (such as smart pointers or garbage collection) should not
expose floating references in their API. The best practice for handling
types that have initially floating references is to immediately sink those
references after <link linkend="g-object-new"><function>g_object_new()</function></link> returns, by checking if the <link linkend="GType"><type>GType</type></link>
inherits from <link linkend="GInitiallyUnowned"><type>GInitiallyUnowned</type></link>. For instance:</para>
<informalexample><programlisting role="example"><![CDATA[
GObject *res = g_object_new_with_properties (gtype,
                                             n_props,
                                             prop_names,
                                             prop_values);

// or: if (g_type_is_a (gtype, G_TYPE_INITIALLY_UNOWNED))
if (G_IS_INITIALLY_UNOWNED (res))
  g_object_ref_sink (res);

return res;
]]></programlisting></informalexample>
<para></para>
<para>Some object implementations may need to save an objects floating state
across certain code portions (an example is <link linkend="GtkMenu"><type>GtkMenu</type></link>), to achieve this,
the following sequence can be used:</para>
<informalexample><programlisting role="example"><![CDATA[
// save floating state
gboolean was_floating = g_object_is_floating (object);
g_object_ref_sink (object);
// protected code portion

...

// restore floating state
if (was_floating)
  g_object_force_floating (object);
else
  g_object_unref (object); // release previously acquired reference
]]></programlisting></informalexample>
<para></para>
</refsect3>

</refsect1>
<refsect1 id="gobject-The-Base-Object-Type.functions_details" role="details">
<title role="details.title">Functions</title>
<refsect2 id="GObjectGetPropertyFunc" role="function">
<title>GObjectGetPropertyFunc&#160;()</title>
<indexterm zone="GObjectGetPropertyFunc"><primary sortas="ObjectGetPropertyFunc">GObjectGetPropertyFunc</primary></indexterm>
<programlisting language="C"><link linkend="void"><returnvalue>void</returnvalue></link>
<phrase role="c_punctuation">(</phrase>*GObjectGetPropertyFunc<phrase role="c_punctuation">)</phrase> (<parameter><link linkend="GObject"><type>GObject</type></link> *object</parameter>,
                           <parameter><link linkend="guint"><type>guint</type></link> property_id</parameter>,
                           <parameter><link linkend="GValue"><type>GValue</type></link> *value</parameter>,
                           <parameter><link linkend="GParamSpec"><type>GParamSpec</type></link> *pspec</parameter>);</programlisting>
<para>The type of the <parameter>get_property</parameter>
 function of <link linkend="GObjectClass"><type>GObjectClass</type></link>.</para>
<refsect3 id="GObjectGetPropertyFunc.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>object</para></entry>
<entry role="parameter_description"><para>a <link linkend="GObject"><type>GObject</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>property_id</para></entry>
<entry role="parameter_description"><para>the numeric id under which the property was registered with
<link linkend="g-object-class-install-property"><function>g_object_class_install_property()</function></link>.</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>value</para></entry>
<entry role="parameter_description"><para>a <link linkend="GValue"><type>GValue</type></link> to return the property value in</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>pspec</para></entry>
<entry role="parameter_description"><para>the <link linkend="GParamSpec"><type>GParamSpec</type></link> describing the property</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3></refsect2>
<refsect2 id="GObjectSetPropertyFunc" role="function">
<title>GObjectSetPropertyFunc&#160;()</title>
<indexterm zone="GObjectSetPropertyFunc"><primary sortas="ObjectSetPropertyFunc">GObjectSetPropertyFunc</primary></indexterm>
<programlisting language="C"><link linkend="void"><returnvalue>void</returnvalue></link>
<phrase role="c_punctuation">(</phrase>*GObjectSetPropertyFunc<phrase role="c_punctuation">)</phrase> (<parameter><link linkend="GObject"><type>GObject</type></link> *object</parameter>,
                           <parameter><link linkend="guint"><type>guint</type></link> property_id</parameter>,
                           <parameter>const <link linkend="GValue"><type>GValue</type></link> *value</parameter>,
                           <parameter><link linkend="GParamSpec"><type>GParamSpec</type></link> *pspec</parameter>);</programlisting>
<para>The type of the <parameter>set_property</parameter>
 function of <link linkend="GObjectClass"><type>GObjectClass</type></link>.</para>
<refsect3 id="GObjectSetPropertyFunc.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>object</para></entry>
<entry role="parameter_description"><para>a <link linkend="GObject"><type>GObject</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>property_id</para></entry>
<entry role="parameter_description"><para>the numeric id under which the property was registered with
<link linkend="g-object-class-install-property"><function>g_object_class_install_property()</function></link>.</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>value</para></entry>
<entry role="parameter_description"><para>the new value for the property</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>pspec</para></entry>
<entry role="parameter_description"><para>the <link linkend="GParamSpec"><type>GParamSpec</type></link> describing the property</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3></refsect2>
<refsect2 id="GObjectFinalizeFunc" role="function">
<title>GObjectFinalizeFunc&#160;()</title>
<indexterm zone="GObjectFinalizeFunc"><primary sortas="ObjectFinalizeFunc">GObjectFinalizeFunc</primary></indexterm>
<programlisting language="C"><link linkend="void"><returnvalue>void</returnvalue></link>
<phrase role="c_punctuation">(</phrase>*GObjectFinalizeFunc<phrase role="c_punctuation">)</phrase> (<parameter><link linkend="GObject"><type>GObject</type></link> *object</parameter>);</programlisting>
<para>The type of the <parameter>finalize</parameter>
 function of <link linkend="GObjectClass"><type>GObjectClass</type></link>.</para>
<refsect3 id="GObjectFinalizeFunc.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>object</para></entry>
<entry role="parameter_description"><para>the <link linkend="GObject"><type>GObject</type></link> being finalized</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3></refsect2>
<refsect2 id="G-TYPE-IS-OBJECT:CAPS" role="macro">
<title>G_TYPE_IS_OBJECT()</title>
<indexterm zone="G-TYPE-IS-OBJECT:CAPS"><primary sortas="TYPE_IS_OBJECT">G_TYPE_IS_OBJECT</primary></indexterm>
<programlisting language="C">#define G_TYPE_IS_OBJECT(type)      (G_TYPE_FUNDAMENTAL (type) == G_TYPE_OBJECT)
</programlisting>
<para>Check if the passed in type id is a <link linkend="G-TYPE-OBJECT:CAPS"><literal>G_TYPE_OBJECT</literal></link> or derived from it.</para>
<refsect3 id="G-TYPE-IS-OBJECT.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>type</para></entry>
<entry role="parameter_description"><para>Type id to check</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="G-TYPE-IS-OBJECT.returns" role="returns">
<title>Returns</title>
<para> <link linkend="FALSE:CAPS"><literal>FALSE</literal></link> or <link linkend="TRUE:CAPS"><literal>TRUE</literal></link>, indicating whether <parameter>type</parameter>
is a <link linkend="G-TYPE-OBJECT:CAPS"><literal>G_TYPE_OBJECT</literal></link>.</para>
</refsect3></refsect2>
<refsect2 id="G-OBJECT:CAPS" role="macro">
<title>G_OBJECT()</title>
<indexterm zone="G-OBJECT:CAPS"><primary sortas="OBJECT">G_OBJECT</primary></indexterm>
<programlisting language="C">#define G_OBJECT(object)            (G_TYPE_CHECK_INSTANCE_CAST ((object), G_TYPE_OBJECT, GObject))
</programlisting>
<para>Casts a <link linkend="GObject"><type>GObject</type></link> or derived pointer into a (GObject*) pointer.
Depending on the current debugging level, this function may invoke
certain runtime checks to identify invalid casts.</para>
<refsect3 id="G-OBJECT.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>object</para></entry>
<entry role="parameter_description"><para>Object which is subject to casting.</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3></refsect2>
<refsect2 id="G-IS-OBJECT:CAPS" role="macro">
<title>G_IS_OBJECT()</title>
<indexterm zone="G-IS-OBJECT:CAPS"><primary sortas="IS_OBJECT">G_IS_OBJECT</primary></indexterm>
<programlisting language="C">#define G_IS_OBJECT(object)         (G_TYPE_CHECK_INSTANCE_FUNDAMENTAL_TYPE ((object), G_TYPE_OBJECT))
</programlisting>
<para>Checks whether a valid <link linkend="GTypeInstance"><type>GTypeInstance</type></link> pointer is of type <link linkend="G-TYPE-OBJECT:CAPS"><literal>G_TYPE_OBJECT</literal></link>.</para>
<refsect3 id="G-IS-OBJECT.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>object</para></entry>
<entry role="parameter_description"><para>Instance to check for being a <link linkend="G-TYPE-OBJECT:CAPS"><literal>G_TYPE_OBJECT</literal></link>.</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3></refsect2>
<refsect2 id="G-OBJECT-CLASS:CAPS" role="macro">
<title>G_OBJECT_CLASS()</title>
<indexterm zone="G-OBJECT-CLASS:CAPS"><primary sortas="OBJECT_CLASS">G_OBJECT_CLASS</primary></indexterm>
<programlisting language="C">#define G_OBJECT_CLASS(class)       (G_TYPE_CHECK_CLASS_CAST ((class), G_TYPE_OBJECT, GObjectClass))
</programlisting>
<para>Casts a derived <link linkend="GObjectClass"><type>GObjectClass</type></link> structure into a <link linkend="GObjectClass"><type>GObjectClass</type></link> structure.</para>
<refsect3 id="G-OBJECT-CLASS.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>class</para></entry>
<entry role="parameter_description"><para>a valid <link linkend="GObjectClass"><type>GObjectClass</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3></refsect2>
<refsect2 id="G-IS-OBJECT-CLASS:CAPS" role="macro">
<title>G_IS_OBJECT_CLASS()</title>
<indexterm zone="G-IS-OBJECT-CLASS:CAPS"><primary sortas="IS_OBJECT_CLASS">G_IS_OBJECT_CLASS</primary></indexterm>
<programlisting language="C">#define G_IS_OBJECT_CLASS(class)    (G_TYPE_CHECK_CLASS_TYPE ((class), G_TYPE_OBJECT))
</programlisting>
<para>Checks whether <parameter>class</parameter>
 "is a" valid <link linkend="GObjectClass"><type>GObjectClass</type></link> structure of type
<link linkend="G-TYPE-OBJECT:CAPS"><literal>G_TYPE_OBJECT</literal></link> or derived.</para>
<refsect3 id="G-IS-OBJECT-CLASS.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>class</para></entry>
<entry role="parameter_description"><para>a <link linkend="GObjectClass"><type>GObjectClass</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3></refsect2>
<refsect2 id="G-OBJECT-GET-CLASS:CAPS" role="macro">
<title>G_OBJECT_GET_CLASS()</title>
<indexterm zone="G-OBJECT-GET-CLASS:CAPS"><primary sortas="OBJECT_GET_CLASS">G_OBJECT_GET_CLASS</primary></indexterm>
<programlisting language="C">#define G_OBJECT_GET_CLASS(object)  (G_TYPE_INSTANCE_GET_CLASS ((object), G_TYPE_OBJECT, GObjectClass))
</programlisting>
<para>Get the class structure associated to a <link linkend="GObject"><type>GObject</type></link> instance.</para>
<refsect3 id="G-OBJECT-GET-CLASS.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>object</para></entry>
<entry role="parameter_description"><para>a <link linkend="GObject"><type>GObject</type></link> instance.</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="G-OBJECT-GET-CLASS.returns" role="returns">
<title>Returns</title>
<para> pointer to object class structure.</para>
</refsect3></refsect2>
<refsect2 id="G-OBJECT-TYPE:CAPS" role="macro">
<title>G_OBJECT_TYPE()</title>
<indexterm zone="G-OBJECT-TYPE:CAPS"><primary sortas="OBJECT_TYPE">G_OBJECT_TYPE</primary></indexterm>
<programlisting language="C">#define G_OBJECT_TYPE(object)       (G_TYPE_FROM_INSTANCE (object))
</programlisting>
<para>Get the type id of an object.</para>
<refsect3 id="G-OBJECT-TYPE.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>object</para></entry>
<entry role="parameter_description"><para>Object to return the type id for.</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="G-OBJECT-TYPE.returns" role="returns">
<title>Returns</title>
<para> Type id of <parameter>object</parameter>
.</para>
</refsect3></refsect2>
<refsect2 id="G-OBJECT-TYPE-NAME:CAPS" role="macro">
<title>G_OBJECT_TYPE_NAME()</title>
<indexterm zone="G-OBJECT-TYPE-NAME:CAPS"><primary sortas="OBJECT_TYPE_NAME">G_OBJECT_TYPE_NAME</primary></indexterm>
<programlisting language="C">#define G_OBJECT_TYPE_NAME(object)  (g_type_name (G_OBJECT_TYPE (object)))
</programlisting>
<para>Get the name of an object's type.</para>
<refsect3 id="G-OBJECT-TYPE-NAME.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>object</para></entry>
<entry role="parameter_description"><para>Object to return the type name for.</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="G-OBJECT-TYPE-NAME.returns" role="returns">
<title>Returns</title>
<para> Type name of <parameter>object</parameter>
. The string is owned by the type system and
should not be freed.</para>
</refsect3></refsect2>
<refsect2 id="G-OBJECT-CLASS-TYPE:CAPS" role="macro">
<title>G_OBJECT_CLASS_TYPE()</title>
<indexterm zone="G-OBJECT-CLASS-TYPE:CAPS"><primary sortas="OBJECT_CLASS_TYPE">G_OBJECT_CLASS_TYPE</primary></indexterm>
<programlisting language="C">#define G_OBJECT_CLASS_TYPE(class)  (G_TYPE_FROM_CLASS (class))
</programlisting>
<para>Get the type id of a class structure.</para>
<refsect3 id="G-OBJECT-CLASS-TYPE.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>class</para></entry>
<entry role="parameter_description"><para>a valid <link linkend="GObjectClass"><type>GObjectClass</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="G-OBJECT-CLASS-TYPE.returns" role="returns">
<title>Returns</title>
<para> Type id of <parameter>class</parameter>
.</para>
</refsect3></refsect2>
<refsect2 id="G-OBJECT-CLASS-NAME:CAPS" role="macro">
<title>G_OBJECT_CLASS_NAME()</title>
<indexterm zone="G-OBJECT-CLASS-NAME:CAPS"><primary sortas="OBJECT_CLASS_NAME">G_OBJECT_CLASS_NAME</primary></indexterm>
<programlisting language="C">#define G_OBJECT_CLASS_NAME(class)  (g_type_name (G_OBJECT_CLASS_TYPE (class)))
</programlisting>
<para>Return the name of a class structure's type.</para>
<refsect3 id="G-OBJECT-CLASS-NAME.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>class</para></entry>
<entry role="parameter_description"><para>a valid <link linkend="GObjectClass"><type>GObjectClass</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="G-OBJECT-CLASS-NAME.returns" role="returns">
<title>Returns</title>
<para> Type name of <parameter>class</parameter>
. The string is owned by the type system and
should not be freed.</para>
</refsect3></refsect2>
<refsect2 id="g-object-class-install-property" role="function">
<title>g_object_class_install_property&#160;()</title>
<indexterm zone="g-object-class-install-property"><primary sortas="object_class_install_property">g_object_class_install_property</primary></indexterm>
<programlisting language="C"><link linkend="void"><returnvalue>void</returnvalue></link>
g_object_class_install_property (<parameter><link linkend="GObjectClass"><type>GObjectClass</type></link> *oclass</parameter>,
                                 <parameter><link linkend="guint"><type>guint</type></link> property_id</parameter>,
                                 <parameter><link linkend="GParamSpec"><type>GParamSpec</type></link> *pspec</parameter>);</programlisting>
<para>Installs a new property.</para>
<para>All properties should be installed during the class initializer.  It
is possible to install properties after that, but doing so is not
recommend, and specifically, is not guaranteed to be thread-safe vs.
use of properties on the same type on other threads.</para>
<para>Note that it is possible to redefine a property in a derived class,
by installing a property with the same name. This can be useful at times,
e.g. to change the range of allowed values or the default value.</para>
<refsect3 id="g-object-class-install-property.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>oclass</para></entry>
<entry role="parameter_description"><para>a <link linkend="GObjectClass"><type>GObjectClass</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>property_id</para></entry>
<entry role="parameter_description"><para>the id for the new property</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>pspec</para></entry>
<entry role="parameter_description"><para>the <link linkend="GParamSpec"><type>GParamSpec</type></link> for the new property</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3></refsect2>
<refsect2 id="g-object-class-install-properties" role="function" condition="since:2.26">
<title>g_object_class_install_properties&#160;()</title>
<indexterm zone="g-object-class-install-properties" role="2.26"><primary sortas="object_class_install_properties">g_object_class_install_properties</primary></indexterm>
<programlisting language="C"><link linkend="void"><returnvalue>void</returnvalue></link>
g_object_class_install_properties (<parameter><link linkend="GObjectClass"><type>GObjectClass</type></link> *oclass</parameter>,
                                   <parameter><link linkend="guint"><type>guint</type></link> n_pspecs</parameter>,
                                   <parameter><link linkend="GParamSpec"><type>GParamSpec</type></link> **pspecs</parameter>);</programlisting>
<para>Installs new properties from an array of <link linkend="GParamSpecs"><type>GParamSpecs</type></link>.</para>
<para>All properties should be installed during the class initializer.  It
is possible to install properties after that, but doing so is not
recommend, and specifically, is not guaranteed to be thread-safe vs.
use of properties on the same type on other threads.</para>
<para>The property id of each property is the index of each <link linkend="GParamSpec"><type>GParamSpec</type></link> in
the <parameter>pspecs</parameter>
 array.</para>
<para>The property id of 0 is treated specially by <link linkend="GObject"><type>GObject</type></link> and it should not
be used to store a <link linkend="GParamSpec"><type>GParamSpec</type></link>.</para>
<para>This function should be used if you plan to use a static array of
<link linkend="GParamSpecs"><type>GParamSpecs</type></link> and <link linkend="g-object-notify-by-pspec"><function>g_object_notify_by_pspec()</function></link>. For instance, this
class initialization:</para>
<informalexample><programlisting role="example"><![CDATA[
enum {
  PROP_0, PROP_FOO, PROP_BAR, N_PROPERTIES
};

static GParamSpec *obj_properties[N_PROPERTIES] = { NULL, };

static void
my_object_class_init (MyObjectClass *klass)
{
  GObjectClass *gobject_class = G_OBJECT_CLASS (klass);

  obj_properties[PROP_FOO] =
    g_param_spec_int ("foo", "Foo", "Foo",
                      -1, G_MAXINT,
                      0,
                      G_PARAM_READWRITE);

  obj_properties[PROP_BAR] =
    g_param_spec_string ("bar", "Bar", "Bar",
                         NULL,
                         G_PARAM_READWRITE);

  gobject_class->set_property = my_object_set_property;
  gobject_class->get_property = my_object_get_property;
  g_object_class_install_properties (gobject_class,
                                     N_PROPERTIES,
                                     obj_properties);
}
]]></programlisting></informalexample>
<para></para>
<para>allows calling <link linkend="g-object-notify-by-pspec"><function>g_object_notify_by_pspec()</function></link> to notify of property changes:</para>
<informalexample><programlisting role="example"><![CDATA[
void
my_object_set_foo (MyObject *self, gint foo)
{
  if (self->foo != foo)
    {
      self->foo = foo;
      g_object_notify_by_pspec (G_OBJECT (self), obj_properties[PROP_FOO]);
    }
 }
]]></programlisting></informalexample>
<para></para>
<refsect3 id="g-object-class-install-properties.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>oclass</para></entry>
<entry role="parameter_description"><para>a <link linkend="GObjectClass"><type>GObjectClass</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>n_pspecs</para></entry>
<entry role="parameter_description"><para>the length of the <link linkend="GParamSpecs"><type>GParamSpecs</type></link> array</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>pspecs</para></entry>
<entry role="parameter_description"><para>the <link linkend="GParamSpecs"><type>GParamSpecs</type></link> array
defining the new properties. </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>array</acronym> length=n_pspecs]</emphasis></entry></row>
</tbody></tgroup></informaltable>
</refsect3><para role="since">Since: <link linkend="api-index-2.26">2.26</link></para></refsect2>
<refsect2 id="g-object-class-find-property" role="function">
<title>g_object_class_find_property&#160;()</title>
<indexterm zone="g-object-class-find-property"><primary sortas="object_class_find_property">g_object_class_find_property</primary></indexterm>
<programlisting language="C"><link linkend="GParamSpec"><returnvalue>GParamSpec</returnvalue></link>&#160;*
g_object_class_find_property (<parameter><link linkend="GObjectClass"><type>GObjectClass</type></link> *oclass</parameter>,
                              <parameter>const <link linkend="gchar"><type>gchar</type></link> *property_name</parameter>);</programlisting>
<para>Looks up the <link linkend="GParamSpec"><type>GParamSpec</type></link> for a property of a class.</para>
<refsect3 id="g-object-class-find-property.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>oclass</para></entry>
<entry role="parameter_description"><para>a <link linkend="GObjectClass"><type>GObjectClass</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>property_name</para></entry>
<entry role="parameter_description"><para>the name of the property to look up</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-object-class-find-property.returns" role="returns">
<title>Returns</title>
<para>the <link linkend="GParamSpec"><type>GParamSpec</type></link> for the property, or
<link linkend="NULL:CAPS"><literal>NULL</literal></link> if the class doesn't have a property of that name. </para>
<para><emphasis role="annotation">[<acronym>transfer none</acronym>]</emphasis></para>
</refsect3></refsect2>
<refsect2 id="g-object-class-list-properties" role="function">
<title>g_object_class_list_properties&#160;()</title>
<indexterm zone="g-object-class-list-properties"><primary sortas="object_class_list_properties">g_object_class_list_properties</primary></indexterm>
<programlisting language="C"><link linkend="GParamSpec"><returnvalue>GParamSpec</returnvalue></link>&#160;**
g_object_class_list_properties (<parameter><link linkend="GObjectClass"><type>GObjectClass</type></link> *oclass</parameter>,
                                <parameter><link linkend="guint"><type>guint</type></link> *n_properties</parameter>);</programlisting>
<para>Get an array of <link linkend="GParamSpec"><type>GParamSpec</type></link>* for all properties of a class.</para>
<refsect3 id="g-object-class-list-properties.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>oclass</para></entry>
<entry role="parameter_description"><para>a <link linkend="GObjectClass"><type>GObjectClass</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>n_properties</para></entry>
<entry role="parameter_description"><para>return location for the length of the returned array. </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>out</acronym>]</emphasis></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-object-class-list-properties.returns" role="returns">
<title>Returns</title>
<para>an array of
<link linkend="GParamSpec"><type>GParamSpec</type></link>* which should be freed after use. </para>
<para><emphasis role="annotation">[<acronym>array</acronym> length=n_properties][<acronym>transfer container</acronym>]</emphasis></para>
</refsect3></refsect2>
<refsect2 id="g-object-class-override-property" role="function" condition="since:2.4">
<title>g_object_class_override_property&#160;()</title>
<indexterm zone="g-object-class-override-property" role="2.4"><primary sortas="object_class_override_property">g_object_class_override_property</primary></indexterm>
<programlisting language="C"><link linkend="void"><returnvalue>void</returnvalue></link>
g_object_class_override_property (<parameter><link linkend="GObjectClass"><type>GObjectClass</type></link> *oclass</parameter>,
                                  <parameter><link linkend="guint"><type>guint</type></link> property_id</parameter>,
                                  <parameter>const <link linkend="gchar"><type>gchar</type></link> *name</parameter>);</programlisting>
<para>Registers <parameter>property_id</parameter>
 as referring to a property with the name
<parameter>name</parameter>
 in a parent class or in an interface implemented by <parameter>oclass</parameter>
.
This allows this class to "override" a property implementation in
a parent class or to provide the implementation of a property from
an interface.</para>
<para>Internally, overriding is implemented by creating a property of type
<link linkend="GParamSpecOverride"><type>GParamSpecOverride</type></link>; generally operations that query the properties of
the object class, such as <link linkend="g-object-class-find-property"><function>g_object_class_find_property()</function></link> or
<link linkend="g-object-class-list-properties"><function>g_object_class_list_properties()</function></link> will return the overridden
property. However, in one case, the <parameter>construct_properties</parameter>
 argument of
the <parameter>constructor</parameter>
 virtual function, the <link linkend="GParamSpecOverride"><type>GParamSpecOverride</type></link> is passed
instead, so that the <parameter>param_id</parameter>
 field of the <link linkend="GParamSpec"><type>GParamSpec</type></link> will be
correct.  For virtually all uses, this makes no difference. If you
need to get the overridden property, you can call
<link linkend="g-param-spec-get-redirect-target"><function>g_param_spec_get_redirect_target()</function></link>.</para>
<refsect3 id="g-object-class-override-property.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>oclass</para></entry>
<entry role="parameter_description"><para>a <link linkend="GObjectClass"><type>GObjectClass</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>property_id</para></entry>
<entry role="parameter_description"><para>the new property ID</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>name</para></entry>
<entry role="parameter_description"><para>the name of a property registered in a parent class or
in an interface of this class.</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><para role="since">Since: <link linkend="api-index-2.4">2.4</link></para></refsect2>
<refsect2 id="g-object-interface-install-property" role="function" condition="since:2.4">
<title>g_object_interface_install_property&#160;()</title>
<indexterm zone="g-object-interface-install-property" role="2.4"><primary sortas="object_interface_install_property">g_object_interface_install_property</primary></indexterm>
<programlisting language="C"><link linkend="void"><returnvalue>void</returnvalue></link>
g_object_interface_install_property (<parameter><link linkend="gpointer"><type>gpointer</type></link> g_iface</parameter>,
                                     <parameter><link linkend="GParamSpec"><type>GParamSpec</type></link> *pspec</parameter>);</programlisting>
<para>Add a property to an interface; this is only useful for interfaces
that are added to GObject-derived types. Adding a property to an
interface forces all objects classes with that interface to have a
compatible property. The compatible property could be a newly
created <link linkend="GParamSpec"><type>GParamSpec</type></link>, but normally
<link linkend="g-object-class-override-property"><function>g_object_class_override_property()</function></link> will be used so that the object
class only needs to provide an implementation and inherits the
property description, default value, bounds, and so forth from the
interface property.</para>
<para>This function is meant to be called from the interface's default
vtable initialization function (the <parameter>class_init</parameter>
 member of
<link linkend="GTypeInfo"><type>GTypeInfo</type></link>.) It must not be called after after <parameter>class_init</parameter>
 has
been called for any object types implementing this interface.</para>
<para>If <parameter>pspec</parameter>
 is a floating reference, it will be consumed.</para>
<refsect3 id="g-object-interface-install-property.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>g_iface</para></entry>
<entry role="parameter_description"><para>any interface vtable for the
interface, or the default
vtable for the interface. </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>type</acronym> GObject.TypeInterface]</emphasis></entry></row>
<row><entry role="parameter_name"><para>pspec</para></entry>
<entry role="parameter_description"><para>the <link linkend="GParamSpec"><type>GParamSpec</type></link> for the new property</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><para role="since">Since: <link linkend="api-index-2.4">2.4</link></para></refsect2>
<refsect2 id="g-object-interface-find-property" role="function" condition="since:2.4">
<title>g_object_interface_find_property&#160;()</title>
<indexterm zone="g-object-interface-find-property" role="2.4"><primary sortas="object_interface_find_property">g_object_interface_find_property</primary></indexterm>
<programlisting language="C"><link linkend="GParamSpec"><returnvalue>GParamSpec</returnvalue></link>&#160;*
g_object_interface_find_property (<parameter><link linkend="gpointer"><type>gpointer</type></link> g_iface</parameter>,
                                  <parameter>const <link linkend="gchar"><type>gchar</type></link> *property_name</parameter>);</programlisting>
<para>Find the <link linkend="GParamSpec"><type>GParamSpec</type></link> with the given name for an
interface. Generally, the interface vtable passed in as <parameter>g_iface</parameter>

will be the default vtable from <link linkend="g-type-default-interface-ref"><function>g_type_default_interface_ref()</function></link>, or,
if you know the interface has already been loaded,
<link linkend="g-type-default-interface-peek"><function>g_type_default_interface_peek()</function></link>.</para>
<refsect3 id="g-object-interface-find-property.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>g_iface</para></entry>
<entry role="parameter_description"><para>any interface vtable for the
interface, or the default vtable for the interface. </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>type</acronym> GObject.TypeInterface]</emphasis></entry></row>
<row><entry role="parameter_name"><para>property_name</para></entry>
<entry role="parameter_description"><para>name of a property to look up.</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-object-interface-find-property.returns" role="returns">
<title>Returns</title>
<para>the <link linkend="GParamSpec"><type>GParamSpec</type></link> for the property of the
interface with the name <parameter>property_name</parameter>
, or <link linkend="NULL:CAPS"><literal>NULL</literal></link> if no
such property exists. </para>
<para><emphasis role="annotation">[<acronym>transfer none</acronym>]</emphasis></para>
</refsect3><para role="since">Since: <link linkend="api-index-2.4">2.4</link></para></refsect2>
<refsect2 id="g-object-interface-list-properties" role="function" condition="since:2.4">
<title>g_object_interface_list_properties&#160;()</title>
<indexterm zone="g-object-interface-list-properties" role="2.4"><primary sortas="object_interface_list_properties">g_object_interface_list_properties</primary></indexterm>
<programlisting language="C"><link linkend="GParamSpec"><returnvalue>GParamSpec</returnvalue></link>&#160;**
g_object_interface_list_properties (<parameter><link linkend="gpointer"><type>gpointer</type></link> g_iface</parameter>,
                                    <parameter><link linkend="guint"><type>guint</type></link> *n_properties_p</parameter>);</programlisting>
<para>Lists the properties of an interface.Generally, the interface
vtable passed in as <parameter>g_iface</parameter>
 will be the default vtable from
<link linkend="g-type-default-interface-ref"><function>g_type_default_interface_ref()</function></link>, or, if you know the interface has
already been loaded, <link linkend="g-type-default-interface-peek"><function>g_type_default_interface_peek()</function></link>.</para>
<refsect3 id="g-object-interface-list-properties.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>g_iface</para></entry>
<entry role="parameter_description"><para>any interface vtable for the
interface, or the default vtable for the interface. </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>type</acronym> GObject.TypeInterface]</emphasis></entry></row>
<row><entry role="parameter_name"><para>n_properties_p</para></entry>
<entry role="parameter_description"><para>location to store number of properties returned. </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>out</acronym>]</emphasis></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-object-interface-list-properties.returns" role="returns">
<title>Returns</title>
<para>a
pointer to an array of pointers to <link linkend="GParamSpec"><type>GParamSpec</type></link>
structures. The paramspecs are owned by GLib, but the
array should be freed with <link linkend="g-free"><function>g_free()</function></link> when you are done with
it. </para>
<para><emphasis role="annotation">[<acronym>array</acronym> length=n_properties_p][<acronym>transfer container</acronym>]</emphasis></para>
</refsect3><para role="since">Since: <link linkend="api-index-2.4">2.4</link></para></refsect2>
<refsect2 id="g-object-new" role="function">
<title>g_object_new&#160;()</title>
<indexterm zone="g-object-new"><primary sortas="object_new">g_object_new</primary></indexterm>
<programlisting language="C"><link linkend="gpointer"><returnvalue>gpointer</returnvalue></link>
g_object_new (<parameter><link linkend="GType"><type>GType</type></link> object_type</parameter>,
              <parameter>const <link linkend="gchar"><type>gchar</type></link> *first_property_name</parameter>,
              <parameter>...</parameter>);</programlisting>
<para>Creates a new instance of a <link linkend="GObject"><type>GObject</type></link> subtype and sets its properties.</para>
<para>Construction parameters (see <link linkend="G-PARAM-CONSTRUCT:CAPS"><type>G_PARAM_CONSTRUCT</type></link>, <link linkend="G-PARAM-CONSTRUCT-ONLY:CAPS"><type>G_PARAM_CONSTRUCT_ONLY</type></link>)
which are not explicitly specified are set to their default values. Any
private data for the object is guaranteed to be initialized with zeros, as
per <link linkend="g-type-create-instance"><function>g_type_create_instance()</function></link>.</para>
<para>Note that in C, small integer types in variable argument lists are promoted
up to <link linkend="gint"><type>gint</type></link> or <link linkend="guint"><type>guint</type></link> as appropriate, and read back accordingly. <link linkend="gint"><type>gint</type></link> is 32
bits on every platform on which GLib is currently supported. This means that
you can use C expressions of type <link linkend="gint"><type>gint</type></link> with <link linkend="g-object-new"><function>g_object_new()</function></link> and properties of
type <link linkend="gint"><type>gint</type></link> or <link linkend="guint"><type>guint</type></link> or smaller. Specifically, you can use integer literals
with these property types.</para>
<para>When using property types of <link linkend="gint64"><type>gint64</type></link> or <link linkend="guint64"><type>guint64</type></link>, you must ensure that the
value that you provide is 64 bit. This means that you should use a cast or
make use of the <link linkend="G-GINT64-CONSTANT:CAPS"><literal>G_GINT64_CONSTANT</literal></link> or <link linkend="G-GUINT64-CONSTANT:CAPS"><literal>G_GUINT64_CONSTANT</literal></link> macros.</para>
<para>Similarly, <link linkend="gfloat"><type>gfloat</type></link> is promoted to <link linkend="gdouble"><type>gdouble</type></link>, so you must ensure that the value
you provide is a <link linkend="gdouble"><type>gdouble</type></link>, even for a property of type <link linkend="gfloat"><type>gfloat</type></link>.</para>

<para><emphasis role="annotation">[<acronym>skip</acronym>]</emphasis></para><refsect3 id="g-object-new.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>object_type</para></entry>
<entry role="parameter_description"><para>the type id of the <link linkend="GObject"><type>GObject</type></link> subtype to instantiate</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>first_property_name</para></entry>
<entry role="parameter_description"><para>the name of the first property</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>...</para></entry>
<entry role="parameter_description"><para>the value of the first property, followed optionally by more
name/value pairs, followed by <link linkend="NULL:CAPS"><literal>NULL</literal></link></para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-object-new.returns" role="returns">
<title>Returns</title>
<para>a new instance of
<parameter>object_type</parameter>
. </para>
<para><emphasis role="annotation">[<acronym>transfer full</acronym>][<acronym>type</acronym> GObject.Object]</emphasis></para>
</refsect3></refsect2>
<refsect2 id="g-object-new-with-properties" role="function" condition="since:2.54">
<title>g_object_new_with_properties&#160;()</title>
<indexterm zone="g-object-new-with-properties" role="2.54"><primary sortas="object_new_with_properties">g_object_new_with_properties</primary></indexterm>
<programlisting language="C"><link linkend="GObject"><returnvalue>GObject</returnvalue></link>&#160;*
g_object_new_with_properties (<parameter><link linkend="GType"><type>GType</type></link> object_type</parameter>,
                              <parameter><link linkend="guint"><type>guint</type></link> n_properties</parameter>,
                              <parameter>const <link linkend="char"><type>char</type></link> *names[]</parameter>,
                              <parameter>const <link linkend="GValue"><type>GValue</type></link> values[]</parameter>);</programlisting>
<para>Creates a new instance of a <link linkend="GObject"><type>GObject</type></link> subtype and sets its properties using
the provided arrays. Both arrays must have exactly <parameter>n_properties</parameter>
 elements,
and the names and values correspond by index.</para>
<para>Construction parameters (see <link linkend="G-PARAM-CONSTRUCT:CAPS"><literal>G_PARAM_CONSTRUCT</literal></link>, <link linkend="G-PARAM-CONSTRUCT-ONLY:CAPS"><literal>G_PARAM_CONSTRUCT_ONLY</literal></link>)
which are not explicitly specified are set to their default values.</para>

<para><emphasis role="annotation">[<acronym>skip</acronym>]</emphasis></para><refsect3 id="g-object-new-with-properties.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>object_type</para></entry>
<entry role="parameter_description"><para>the object type to instantiate</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>n_properties</para></entry>
<entry role="parameter_description"><para>the number of properties</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>names</para></entry>
<entry role="parameter_description"><para>the names of each property to be set. </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>array</acronym> length=n_properties]</emphasis></entry></row>
<row><entry role="parameter_name"><para>values</para></entry>
<entry role="parameter_description"><para>the values of each property to be set. </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>array</acronym> length=n_properties]</emphasis></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-object-new-with-properties.returns" role="returns">
<title>Returns</title>
<para>a new instance of
<parameter>object_type</parameter>
. </para>
<para><emphasis role="annotation">[<acronym>type</acronym> GObject.Object][<acronym>transfer full</acronym>]</emphasis></para>
</refsect3><para role="since">Since: <link linkend="api-index-2.54">2.54</link></para></refsect2>
<refsect2 id="g-object-newv" role="function" condition="deprecated">
<title>g_object_newv&#160;()</title>
<indexterm zone="g-object-newv" role="deprecated"><primary sortas="object_newv">g_object_newv</primary></indexterm>
<programlisting language="C"><link linkend="gpointer"><returnvalue>gpointer</returnvalue></link>
g_object_newv (<parameter><link linkend="GType"><type>GType</type></link> object_type</parameter>,
               <parameter><link linkend="guint"><type>guint</type></link> n_parameters</parameter>,
               <parameter><link linkend="GParameter"><type>GParameter</type></link> *parameters</parameter>);</programlisting>
<warning><para><literal>g_object_newv</literal> has been deprecated since version 2.54 and should not be used in newly-written code.</para> <para>Use <link linkend="g-object-new-with-properties"><function>g_object_new_with_properties()</function></link> instead.
deprecated. See <link linkend="GParameter"><type>GParameter</type></link> for more information.</para>
</warning>
<para>Creates a new instance of a <link linkend="GObject"><type>GObject</type></link> subtype and sets its properties.</para>
<para>Construction parameters (see <link linkend="G-PARAM-CONSTRUCT:CAPS"><type>G_PARAM_CONSTRUCT</type></link>, <link linkend="G-PARAM-CONSTRUCT-ONLY:CAPS"><type>G_PARAM_CONSTRUCT_ONLY</type></link>)
which are not explicitly specified are set to their default values.</para>
<refsect3 id="g-object-newv.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>object_type</para></entry>
<entry role="parameter_description"><para>the type id of the <link linkend="GObject"><type>GObject</type></link> subtype to instantiate</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>n_parameters</para></entry>
<entry role="parameter_description"><para>the length of the <parameter>parameters</parameter>
array</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>parameters</para></entry>
<entry role="parameter_description"><para>an array of <link linkend="GParameter"><type>GParameter</type></link>. </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>array</acronym> length=n_parameters]</emphasis></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-object-newv.returns" role="returns">
<title>Returns</title>
<para>a new instance of
<parameter>object_type</parameter>
. </para>
<para><emphasis role="annotation">[<acronym>type</acronym> GObject.Object][<acronym>transfer full</acronym>]</emphasis></para>
</refsect3></refsect2>
<refsect2 id="g-object-ref" role="function">
<title>g_object_ref&#160;()</title>
<indexterm zone="g-object-ref"><primary sortas="object_ref">g_object_ref</primary></indexterm>
<programlisting language="C"><link linkend="gpointer"><returnvalue>gpointer</returnvalue></link>
g_object_ref (<parameter><link linkend="gpointer"><type>gpointer</type></link> object</parameter>);</programlisting>
<para>Increases the reference count of <parameter>object</parameter>
.</para>
<para>Since GLib 2.56, if <literal>GLIB_VERSION_MAX_ALLOWED</literal> is 2.56 or greater, the type
of <parameter>object</parameter>
 will be propagated to the return type (using the GCC <link linkend="typeof"><function>typeof()</function></link>
extension), so any casting the caller needs to do on the return type must be
explicit.</para>
<refsect3 id="g-object-ref.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>object</para></entry>
<entry role="parameter_description"><para>a <link linkend="GObject"><type>GObject</type></link>. </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>type</acronym> GObject.Object]</emphasis></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-object-ref.returns" role="returns">
<title>Returns</title>
<para>the same <parameter>object</parameter>
. </para>
<para><emphasis role="annotation">[<acronym>type</acronym> GObject.Object][<acronym>transfer none</acronym>]</emphasis></para>
</refsect3></refsect2>
<refsect2 id="g-object-unref" role="function">
<title>g_object_unref&#160;()</title>
<indexterm zone="g-object-unref"><primary sortas="object_unref">g_object_unref</primary></indexterm>
<programlisting language="C"><link linkend="void"><returnvalue>void</returnvalue></link>
g_object_unref (<parameter><link linkend="gpointer"><type>gpointer</type></link> object</parameter>);</programlisting>
<para>Decreases the reference count of <parameter>object</parameter>
. When its reference count
drops to 0, the object is finalized (i.e. its memory is freed).</para>
<para>If the pointer to the <link linkend="GObject"><type>GObject</type></link> may be reused in future (for example, if it is
an instance variable of another object), it is recommended to clear the
pointer to <link linkend="NULL:CAPS"><literal>NULL</literal></link> rather than retain a dangling pointer to a potentially
invalid <link linkend="GObject"><type>GObject</type></link> instance. Use <link linkend="g-clear-object"><function>g_clear_object()</function></link> for this.</para>
<refsect3 id="g-object-unref.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>object</para></entry>
<entry role="parameter_description"><para>a <link linkend="GObject"><type>GObject</type></link>. </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>type</acronym> GObject.Object]</emphasis></entry></row>
</tbody></tgroup></informaltable>
</refsect3></refsect2>
<refsect2 id="g-object-ref-sink" role="function" condition="since:2.10">
<title>g_object_ref_sink&#160;()</title>
<indexterm zone="g-object-ref-sink" role="2.10"><primary sortas="object_ref_sink">g_object_ref_sink</primary></indexterm>
<programlisting language="C"><link linkend="gpointer"><returnvalue>gpointer</returnvalue></link>
g_object_ref_sink (<parameter><link linkend="gpointer"><type>gpointer</type></link> object</parameter>);</programlisting>
<para>Increase the reference count of <parameter>object</parameter>
, and possibly remove the
<link linkend="floating-ref">floating</link> reference, if <parameter>object</parameter>
 has a floating reference.</para>
<para>In other words, if the object is floating, then this call "assumes
ownership" of the floating reference, converting it to a normal
reference by clearing the floating flag while leaving the reference
count unchanged.  If the object is not floating, then this call
adds a new normal reference increasing the reference count by one.</para>
<para>Since GLib 2.56, the type of <parameter>object</parameter>
 will be propagated to the return type
under the same conditions as for <link linkend="g-object-ref"><function>g_object_ref()</function></link>.</para>
<refsect3 id="g-object-ref-sink.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>object</para></entry>
<entry role="parameter_description"><para>a <link linkend="GObject"><type>GObject</type></link>. </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>type</acronym> GObject.Object]</emphasis></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-object-ref-sink.returns" role="returns">
<title>Returns</title>
<para><parameter>object</parameter>
. </para>
<para><emphasis role="annotation">[<acronym>type</acronym> GObject.Object][<acronym>transfer none</acronym>]</emphasis></para>
</refsect3><para role="since">Since: <link linkend="api-index-2.10">2.10</link></para></refsect2>
<refsect2 id="g-set-object" role="function" condition="since:2.44">
<title>g_set_object&#160;()</title>
<indexterm zone="g-set-object" role="2.44"><primary sortas="set_object">g_set_object</primary></indexterm>
<programlisting language="C"><link linkend="gboolean"><returnvalue>gboolean</returnvalue></link>
g_set_object (<parameter><link linkend="GObject"><type>GObject</type></link> **object_ptr</parameter>,
              <parameter><link linkend="GObject"><type>GObject</type></link> *new_object</parameter>);</programlisting>
<para>Updates a <link linkend="GObject"><type>GObject</type></link> pointer to refer to <parameter>new_object</parameter>
. It increments the
reference count of <parameter>new_object</parameter>
 (if non-<link linkend="NULL:CAPS"><literal>NULL</literal></link>), decrements the reference
count of the current value of <parameter>object_ptr</parameter>
 (if non-<link linkend="NULL:CAPS"><literal>NULL</literal></link>), and assigns
<parameter>new_object</parameter>
 to <parameter>object_ptr</parameter>
. The assignment is not atomic.</para>
<para><parameter>object_ptr</parameter>
 must not be <link linkend="NULL:CAPS"><literal>NULL</literal></link>.</para>
<para>A macro is also included that allows this function to be used without
pointer casts. The function itself is static inline, so its address may vary
between compilation units.</para>
<para>One convenient usage of this function is in implementing property setters:</para>
<informalexample><programlisting role="example"><![CDATA[
  void
  foo_set_bar (Foo *foo,
               Bar *new_bar)
  {
    g_return_if_fail (IS_FOO (foo));
    g_return_if_fail (new_bar == NULL || IS_BAR (new_bar));

    if (g_set_object (&foo->bar, new_bar))
      g_object_notify (foo, "bar");
  }
]]></programlisting></informalexample>
<para></para>

<para><emphasis role="annotation">[<acronym>skip</acronym>]</emphasis></para><refsect3 id="g-set-object.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>object_ptr</para></entry>
<entry role="parameter_description"><para>a pointer to a <link linkend="GObject"><type>GObject</type></link> reference</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>new_object</para></entry>
<entry role="parameter_description"><para>a pointer to the new <link linkend="GObject"><type>GObject</type></link> to
assign to it, or <link linkend="NULL:CAPS"><literal>NULL</literal></link> to clear the pointer. </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>nullable</acronym>][<acronym>transfer none</acronym>]</emphasis></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-set-object.returns" role="returns">
<title>Returns</title>
<para> <link linkend="TRUE:CAPS"><literal>TRUE</literal></link> if the value of <parameter>object_ptr</parameter>
changed, <link linkend="FALSE:CAPS"><literal>FALSE</literal></link> otherwise</para>
</refsect3><para role="since">Since: <link linkend="api-index-2.44">2.44</link></para></refsect2>
<refsect2 id="g-clear-object" role="function" condition="since:2.28">
<title>g_clear_object&#160;()</title>
<indexterm zone="g-clear-object" role="2.28"><primary sortas="clear_object">g_clear_object</primary></indexterm>
<programlisting language="C"><link linkend="void"><returnvalue>void</returnvalue></link>
g_clear_object (<parameter><link linkend="GObject"><type>GObject</type></link> **object_ptr</parameter>);</programlisting>
<para>Clears a reference to a <link linkend="GObject"><type>GObject</type></link>.</para>
<para><parameter>object_ptr</parameter>
 must not be <link linkend="NULL:CAPS"><literal>NULL</literal></link>.</para>
<para>If the reference is <link linkend="NULL:CAPS"><literal>NULL</literal></link> then this function does nothing.
Otherwise, the reference count of the object is decreased and the
pointer is set to <link linkend="NULL:CAPS"><literal>NULL</literal></link>.</para>
<para>A macro is also included that allows this function to be used without
pointer casts.</para>

<para><emphasis role="annotation">[<acronym>skip</acronym>]</emphasis></para><refsect3 id="g-clear-object.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>object_ptr</para></entry>
<entry role="parameter_description"><para>a pointer to a <link linkend="GObject"><type>GObject</type></link> reference</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><para role="since">Since: <link linkend="api-index-2.28">2.28</link></para></refsect2>
<refsect2 id="g-object-is-floating" role="function" condition="since:2.10">
<title>g_object_is_floating&#160;()</title>
<indexterm zone="g-object-is-floating" role="2.10"><primary sortas="object_is_floating">g_object_is_floating</primary></indexterm>
<programlisting language="C"><link linkend="gboolean"><returnvalue>gboolean</returnvalue></link>
g_object_is_floating (<parameter><link linkend="gpointer"><type>gpointer</type></link> object</parameter>);</programlisting>
<para>Checks whether <parameter>object</parameter>
 has a <link linkend="floating-ref">floating</link> reference.</para>
<refsect3 id="g-object-is-floating.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>object</para></entry>
<entry role="parameter_description"><para>a <link linkend="GObject"><type>GObject</type></link>. </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>type</acronym> GObject.Object]</emphasis></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-object-is-floating.returns" role="returns">
<title>Returns</title>
<para> <link linkend="TRUE:CAPS"><literal>TRUE</literal></link> if <parameter>object</parameter>
has a floating reference</para>
</refsect3><para role="since">Since: <link linkend="api-index-2.10">2.10</link></para></refsect2>
<refsect2 id="g-object-force-floating" role="function" condition="since:2.10">
<title>g_object_force_floating&#160;()</title>
<indexterm zone="g-object-force-floating" role="2.10"><primary sortas="object_force_floating">g_object_force_floating</primary></indexterm>
<programlisting language="C"><link linkend="void"><returnvalue>void</returnvalue></link>
g_object_force_floating (<parameter><link linkend="GObject"><type>GObject</type></link> *object</parameter>);</programlisting>
<para>This function is intended for <link linkend="GObject"><type>GObject</type></link> implementations to re-enforce
a <link linkend="floating-ref">floating</link> object reference. Doing this is seldom
required: all <link linkend="GInitiallyUnowneds"><type>GInitiallyUnowneds</type></link> are created with a floating reference
which usually just needs to be sunken by calling <link linkend="g-object-ref-sink"><function>g_object_ref_sink()</function></link>.</para>
<refsect3 id="g-object-force-floating.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>object</para></entry>
<entry role="parameter_description"><para>a <link linkend="GObject"><type>GObject</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><para role="since">Since: <link linkend="api-index-2.10">2.10</link></para></refsect2>
<refsect2 id="GWeakNotify" role="function">
<title>GWeakNotify&#160;()</title>
<indexterm zone="GWeakNotify"><primary sortas="WeakNotify">GWeakNotify</primary></indexterm>
<programlisting language="C"><link linkend="void"><returnvalue>void</returnvalue></link>
<phrase role="c_punctuation">(</phrase>*GWeakNotify<phrase role="c_punctuation">)</phrase> (<parameter><link linkend="gpointer"><type>gpointer</type></link> data</parameter>,
                <parameter><link linkend="GObject"><type>GObject</type></link> *where_the_object_was</parameter>);</programlisting>
<para>A <link linkend="GWeakNotify"><type>GWeakNotify</type></link> function can be added to an object as a callback that gets
triggered when the object is finalized. Since the object is already being
finalized when the <link linkend="GWeakNotify"><type>GWeakNotify</type></link> is called, there's not much you could do 
with the object, apart from e.g. using its address as hash-index or the like.</para>
<refsect3 id="GWeakNotify.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>data</para></entry>
<entry role="parameter_description"><para>data that was provided when the weak reference was established</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>where_the_object_was</para></entry>
<entry role="parameter_description"><para>the object being finalized</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3></refsect2>
<refsect2 id="g-object-weak-ref" role="function">
<title>g_object_weak_ref&#160;()</title>
<indexterm zone="g-object-weak-ref"><primary sortas="object_weak_ref">g_object_weak_ref</primary></indexterm>
<programlisting language="C"><link linkend="void"><returnvalue>void</returnvalue></link>
g_object_weak_ref (<parameter><link linkend="GObject"><type>GObject</type></link> *object</parameter>,
                   <parameter><link linkend="GWeakNotify"><type>GWeakNotify</type></link> notify</parameter>,
                   <parameter><link linkend="gpointer"><type>gpointer</type></link> data</parameter>);</programlisting>
<para>Adds a weak reference callback to an object. Weak references are
used for notification when an object is finalized. They are called
"weak references" because they allow you to safely hold a pointer
to an object without calling <link linkend="g-object-ref"><function>g_object_ref()</function></link> (<link linkend="g-object-ref"><function>g_object_ref()</function></link> adds a
strong reference, that is, forces the object to stay alive).</para>
<para>Note that the weak references created by this method are not
thread-safe: they cannot safely be used in one thread if the
object's last <link linkend="g-object-unref"><function>g_object_unref()</function></link> might happen in another thread.
Use <link linkend="GWeakRef"><type>GWeakRef</type></link> if thread-safety is required.</para>

<para><emphasis role="annotation">[<acronym>skip</acronym>]</emphasis></para><refsect3 id="g-object-weak-ref.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>object</para></entry>
<entry role="parameter_description"><para><link linkend="GObject"><type>GObject</type></link> to reference weakly</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>notify</para></entry>
<entry role="parameter_description"><para>callback to invoke before the object is freed</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>data</para></entry>
<entry role="parameter_description"><para>extra data to pass to notify</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3></refsect2>
<refsect2 id="g-object-weak-unref" role="function">
<title>g_object_weak_unref&#160;()</title>
<indexterm zone="g-object-weak-unref"><primary sortas="object_weak_unref">g_object_weak_unref</primary></indexterm>
<programlisting language="C"><link linkend="void"><returnvalue>void</returnvalue></link>
g_object_weak_unref (<parameter><link linkend="GObject"><type>GObject</type></link> *object</parameter>,
                     <parameter><link linkend="GWeakNotify"><type>GWeakNotify</type></link> notify</parameter>,
                     <parameter><link linkend="gpointer"><type>gpointer</type></link> data</parameter>);</programlisting>
<para>Removes a weak reference callback to an object.</para>

<para><emphasis role="annotation">[<acronym>skip</acronym>]</emphasis></para><refsect3 id="g-object-weak-unref.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>object</para></entry>
<entry role="parameter_description"><para><link linkend="GObject"><type>GObject</type></link> to remove a weak reference from</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>notify</para></entry>
<entry role="parameter_description"><para>callback to search for</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>data</para></entry>
<entry role="parameter_description"><para>data to search for</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3></refsect2>
<refsect2 id="g-object-add-weak-pointer" role="function">
<title>g_object_add_weak_pointer&#160;()</title>
<indexterm zone="g-object-add-weak-pointer"><primary sortas="object_add_weak_pointer">g_object_add_weak_pointer</primary></indexterm>
<programlisting language="C"><link linkend="void"><returnvalue>void</returnvalue></link>
g_object_add_weak_pointer (<parameter><link linkend="GObject"><type>GObject</type></link> *object</parameter>,
                           <parameter><link linkend="gpointer"><type>gpointer</type></link> *weak_pointer_location</parameter>);</programlisting>
<para>Adds a weak reference from weak_pointer to <parameter>object</parameter>
 to indicate that
the pointer located at <parameter>weak_pointer_location</parameter>
 is only valid during
the lifetime of <parameter>object</parameter>
. When the <parameter>object</parameter>
 is finalized,
<parameter>weak_pointer</parameter>
 will be set to <link linkend="NULL:CAPS"><literal>NULL</literal></link>.</para>
<para>Note that as with <link linkend="g-object-weak-ref"><function>g_object_weak_ref()</function></link>, the weak references created by
this method are not thread-safe: they cannot safely be used in one
thread if the object's last <link linkend="g-object-unref"><function>g_object_unref()</function></link> might happen in another
thread. Use <link linkend="GWeakRef"><type>GWeakRef</type></link> if thread-safety is required.</para>

<para><emphasis role="annotation">[<acronym>skip</acronym>]</emphasis></para><refsect3 id="g-object-add-weak-pointer.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>object</para></entry>
<entry role="parameter_description"><para>The object that should be weak referenced.</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>weak_pointer_location</para></entry>
<entry role="parameter_description"><para>The memory address
of a pointer. </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>inout</acronym>][<acronym>not optional</acronym>]</emphasis></entry></row>
</tbody></tgroup></informaltable>
</refsect3></refsect2>
<refsect2 id="g-object-remove-weak-pointer" role="function">
<title>g_object_remove_weak_pointer&#160;()</title>
<indexterm zone="g-object-remove-weak-pointer"><primary sortas="object_remove_weak_pointer">g_object_remove_weak_pointer</primary></indexterm>
<programlisting language="C"><link linkend="void"><returnvalue>void</returnvalue></link>
g_object_remove_weak_pointer (<parameter><link linkend="GObject"><type>GObject</type></link> *object</parameter>,
                              <parameter><link linkend="gpointer"><type>gpointer</type></link> *weak_pointer_location</parameter>);</programlisting>
<para>Removes a weak reference from <parameter>object</parameter>
 that was previously added
using <link linkend="g-object-add-weak-pointer"><function>g_object_add_weak_pointer()</function></link>. The <parameter>weak_pointer_location</parameter>
 has
to match the one used with <link linkend="g-object-add-weak-pointer"><function>g_object_add_weak_pointer()</function></link>.</para>

<para><emphasis role="annotation">[<acronym>skip</acronym>]</emphasis></para><refsect3 id="g-object-remove-weak-pointer.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>object</para></entry>
<entry role="parameter_description"><para>The object that is weak referenced.</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>weak_pointer_location</para></entry>
<entry role="parameter_description"><para>The memory address
of a pointer. </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>inout</acronym>][<acronym>not optional</acronym>]</emphasis></entry></row>
</tbody></tgroup></informaltable>
</refsect3></refsect2>
<refsect2 id="g-set-weak-pointer" role="function" condition="since:2.56">
<title>g_set_weak_pointer&#160;()</title>
<indexterm zone="g-set-weak-pointer" role="2.56"><primary sortas="set_weak_pointer">g_set_weak_pointer</primary></indexterm>
<programlisting language="C"><link linkend="gboolean"><returnvalue>gboolean</returnvalue></link>
g_set_weak_pointer (<parameter><link linkend="gpointer"><type>gpointer</type></link> *weak_pointer_location</parameter>,
                    <parameter><link linkend="GObject"><type>GObject</type></link> *new_object</parameter>);</programlisting>
<para>Updates a pointer to weakly refer to <parameter>new_object</parameter>
. It assigns <parameter>new_object</parameter>

to <parameter>weak_pointer_location</parameter>
 and ensures that <parameter>weak_pointer_location</parameter>
 will
automatically be set to <link linkend="NULL:CAPS"><literal>NULL</literal></link> if <parameter>new_object</parameter>
 gets destroyed. The assignment
is not atomic. The weak reference is not thread-safe, see
<link linkend="g-object-add-weak-pointer"><function>g_object_add_weak_pointer()</function></link> for details.</para>
<para><parameter>weak_pointer_location</parameter>
 must not be <link linkend="NULL:CAPS"><literal>NULL</literal></link>.</para>
<para>A macro is also included that allows this function to be used without
pointer casts. The function itself is static inline, so its address may vary
between compilation units.</para>
<para>One convenient usage of this function is in implementing property setters:</para>
<informalexample><programlisting role="example"><![CDATA[
  void
  foo_set_bar (Foo *foo,
               Bar *new_bar)
  {
    g_return_if_fail (IS_FOO (foo));
    g_return_if_fail (new_bar == NULL || IS_BAR (new_bar));

    if (g_set_weak_pointer (&foo->bar, new_bar))
      g_object_notify (foo, "bar");
  }
]]></programlisting></informalexample>
<para></para>

<para><emphasis role="annotation">[<acronym>skip</acronym>]</emphasis></para><refsect3 id="g-set-weak-pointer.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>weak_pointer_location</para></entry>
<entry role="parameter_description"><para>the memory address of a pointer</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>new_object</para></entry>
<entry role="parameter_description"><para>a pointer to the new <link linkend="GObject"><type>GObject</type></link> to
assign to it, or <link linkend="NULL:CAPS"><literal>NULL</literal></link> to clear the pointer. </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>nullable</acronym>][<acronym>transfer none</acronym>]</emphasis></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-set-weak-pointer.returns" role="returns">
<title>Returns</title>
<para> <link linkend="TRUE:CAPS"><literal>TRUE</literal></link> if the value of <parameter>weak_pointer_location</parameter>
changed, <link linkend="FALSE:CAPS"><literal>FALSE</literal></link> otherwise</para>
</refsect3><para role="since">Since: <link linkend="api-index-2.56">2.56</link></para></refsect2>
<refsect2 id="g-clear-weak-pointer" role="function" condition="since:2.56">
<title>g_clear_weak_pointer&#160;()</title>
<indexterm zone="g-clear-weak-pointer" role="2.56"><primary sortas="clear_weak_pointer">g_clear_weak_pointer</primary></indexterm>
<programlisting language="C"><link linkend="void"><returnvalue>void</returnvalue></link>
g_clear_weak_pointer (<parameter><link linkend="gpointer"><type>gpointer</type></link> *weak_pointer_location</parameter>);</programlisting>
<para>Clears a weak reference to a <link linkend="GObject"><type>GObject</type></link>.</para>
<para><parameter>weak_pointer_location</parameter>
 must not be <link linkend="NULL:CAPS"><literal>NULL</literal></link>.</para>
<para>If the weak reference is <link linkend="NULL:CAPS"><literal>NULL</literal></link> then this function does nothing.
Otherwise, the weak reference to the object is removed for that location
and the pointer is set to <link linkend="NULL:CAPS"><literal>NULL</literal></link>.</para>
<para>A macro is also included that allows this function to be used without
pointer casts. The function itself is static inline, so its address may vary
between compilation units.</para>

<para><emphasis role="annotation">[<acronym>skip</acronym>]</emphasis></para><refsect3 id="g-clear-weak-pointer.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>weak_pointer_location</para></entry>
<entry role="parameter_description"><para>The memory address of a pointer</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><para role="since">Since: <link linkend="api-index-2.56">2.56</link></para></refsect2>
<refsect2 id="GToggleNotify" role="function">
<title>GToggleNotify&#160;()</title>
<indexterm zone="GToggleNotify"><primary sortas="ToggleNotify">GToggleNotify</primary></indexterm>
<programlisting language="C"><link linkend="void"><returnvalue>void</returnvalue></link>
<phrase role="c_punctuation">(</phrase>*GToggleNotify<phrase role="c_punctuation">)</phrase> (<parameter><link linkend="gpointer"><type>gpointer</type></link> data</parameter>,
                  <parameter><link linkend="GObject"><type>GObject</type></link> *object</parameter>,
                  <parameter><link linkend="gboolean"><type>gboolean</type></link> is_last_ref</parameter>);</programlisting>
<para>A callback function used for notification when the state
of a toggle reference changes. See <link linkend="g-object-add-toggle-ref"><function>g_object_add_toggle_ref()</function></link>.</para>
<refsect3 id="GToggleNotify.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>data</para></entry>
<entry role="parameter_description"><para>Callback data passed to <link linkend="g-object-add-toggle-ref"><function>g_object_add_toggle_ref()</function></link></para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>object</para></entry>
<entry role="parameter_description"><para>The object on which <link linkend="g-object-add-toggle-ref"><function>g_object_add_toggle_ref()</function></link> was called.</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>is_last_ref</para></entry>
<entry role="parameter_description"><para><link linkend="TRUE:CAPS"><literal>TRUE</literal></link> if the toggle reference is now the
last reference to the object. <link linkend="FALSE:CAPS"><literal>FALSE</literal></link> if the toggle
reference was the last reference and there are now other
references.</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3></refsect2>
<refsect2 id="g-object-add-toggle-ref" role="function" condition="since:2.8">
<title>g_object_add_toggle_ref&#160;()</title>
<indexterm zone="g-object-add-toggle-ref" role="2.8"><primary sortas="object_add_toggle_ref">g_object_add_toggle_ref</primary></indexterm>
<programlisting language="C"><link linkend="void"><returnvalue>void</returnvalue></link>
g_object_add_toggle_ref (<parameter><link linkend="GObject"><type>GObject</type></link> *object</parameter>,
                         <parameter><link linkend="GToggleNotify"><type>GToggleNotify</type></link> notify</parameter>,
                         <parameter><link linkend="gpointer"><type>gpointer</type></link> data</parameter>);</programlisting>
<para>Increases the reference count of the object by one and sets a
callback to be called when all other references to the object are
dropped, or when this is already the last reference to the object
and another reference is established.</para>
<para>This functionality is intended for binding <parameter>object</parameter>
 to a proxy
object managed by another memory manager. This is done with two
paired references: the strong reference added by
<link linkend="g-object-add-toggle-ref"><function>g_object_add_toggle_ref()</function></link> and a reverse reference to the proxy
object which is either a strong reference or weak reference.</para>
<para>The setup is that when there are no other references to <parameter>object</parameter>
,
only a weak reference is held in the reverse direction from <parameter>object</parameter>

to the proxy object, but when there are other references held to
<parameter>object</parameter>
, a strong reference is held. The <parameter>notify</parameter>
 callback is called
when the reference from <parameter>object</parameter>
 to the proxy object should be
"toggled" from strong to weak (<parameter>is_last_ref</parameter>
 true) or weak to strong
(<parameter>is_last_ref</parameter>
 false).</para>
<para>Since a (normal) reference must be held to the object before
calling <link linkend="g-object-add-toggle-ref"><function>g_object_add_toggle_ref()</function></link>, the initial state of the reverse
link is always strong.</para>
<para>Multiple toggle references may be added to the same gobject,
however if there are multiple toggle references to an object, none
of them will ever be notified until all but one are removed.  For
this reason, you should only ever use a toggle reference if there
is important state in the proxy object.</para>

<para><emphasis role="annotation">[<acronym>skip</acronym>]</emphasis></para><refsect3 id="g-object-add-toggle-ref.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>object</para></entry>
<entry role="parameter_description"><para>a <link linkend="GObject"><type>GObject</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>notify</para></entry>
<entry role="parameter_description"><para>a function to call when this reference is the
last reference to the object, or is no longer
the last reference.</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>data</para></entry>
<entry role="parameter_description"><para>data to pass to <parameter>notify</parameter>
</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><para role="since">Since: <link linkend="api-index-2.8">2.8</link></para></refsect2>
<refsect2 id="g-object-remove-toggle-ref" role="function" condition="since:2.8">
<title>g_object_remove_toggle_ref&#160;()</title>
<indexterm zone="g-object-remove-toggle-ref" role="2.8"><primary sortas="object_remove_toggle_ref">g_object_remove_toggle_ref</primary></indexterm>
<programlisting language="C"><link linkend="void"><returnvalue>void</returnvalue></link>
g_object_remove_toggle_ref (<parameter><link linkend="GObject"><type>GObject</type></link> *object</parameter>,
                            <parameter><link linkend="GToggleNotify"><type>GToggleNotify</type></link> notify</parameter>,
                            <parameter><link linkend="gpointer"><type>gpointer</type></link> data</parameter>);</programlisting>
<para>Removes a reference added with <link linkend="g-object-add-toggle-ref"><function>g_object_add_toggle_ref()</function></link>. The
reference count of the object is decreased by one.</para>

<para><emphasis role="annotation">[<acronym>skip</acronym>]</emphasis></para><refsect3 id="g-object-remove-toggle-ref.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>object</para></entry>
<entry role="parameter_description"><para>a <link linkend="GObject"><type>GObject</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>notify</para></entry>
<entry role="parameter_description"><para>a function to call when this reference is the
last reference to the object, or is no longer
the last reference.</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>data</para></entry>
<entry role="parameter_description"><para>data to pass to <parameter>notify</parameter>
</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><para role="since">Since: <link linkend="api-index-2.8">2.8</link></para></refsect2>
<refsect2 id="g-object-connect" role="function">
<title>g_object_connect&#160;()</title>
<indexterm zone="g-object-connect"><primary sortas="object_connect">g_object_connect</primary></indexterm>
<programlisting language="C"><link linkend="gpointer"><returnvalue>gpointer</returnvalue></link>
g_object_connect (<parameter><link linkend="gpointer"><type>gpointer</type></link> object</parameter>,
                  <parameter>const <link linkend="gchar"><type>gchar</type></link> *signal_spec</parameter>,
                  <parameter>...</parameter>);</programlisting>
<para>A convenience function to connect multiple signals at once.</para>
<para>The signal specs expected by this function have the form
"modifier::signal_name", where modifier can be one of the following:</para>
<itemizedlist>
<listitem><para>signal: equivalent to g_signal_connect_data (..., NULL, 0)</para></listitem>
<listitem><para>object-signal, object_signal: equivalent to g_signal_connect_object (..., 0)</para></listitem>
<listitem><para>swapped-signal, swapped_signal: equivalent to g_signal_connect_data (..., NULL, G_CONNECT_SWAPPED)</para></listitem>
<listitem><para>swapped_object_signal, swapped-object-signal: equivalent to g_signal_connect_object (..., G_CONNECT_SWAPPED)</para></listitem>
<listitem><para>signal_after, signal-after: equivalent to g_signal_connect_data (..., NULL, G_CONNECT_AFTER)</para></listitem>
<listitem><para>object_signal_after, object-signal-after: equivalent to g_signal_connect_object (..., G_CONNECT_AFTER)</para></listitem>
<listitem><para>swapped_signal_after, swapped-signal-after: equivalent to g_signal_connect_data (..., NULL, G_CONNECT_SWAPPED | G_CONNECT_AFTER)</para></listitem>
<listitem>
<para>swapped_object_signal_after, swapped-object-signal-after: equivalent to g_signal_connect_object (..., G_CONNECT_SWAPPED | G_CONNECT_AFTER)</para>
</listitem>
</itemizedlist>
<informalexample><programlisting role="example"><![CDATA[
  menu->toplevel = g_object_connect (g_object_new (GTK_TYPE_WINDOW,
						   "type", GTK_WINDOW_POPUP,
						   "child", menu,
						   NULL),
				     "signal::event", gtk_menu_window_event, menu,
				     "signal::size_request", gtk_menu_window_size_request, menu,
				     "signal::destroy", gtk_widget_destroyed, &menu->toplevel,
				     NULL);
]]></programlisting></informalexample>
<para></para>

<para><emphasis role="annotation">[<acronym>skip</acronym>]</emphasis></para><refsect3 id="g-object-connect.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>object</para></entry>
<entry role="parameter_description"><para>a <link linkend="GObject"><type>GObject</type></link>. </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>type</acronym> GObject.Object]</emphasis></entry></row>
<row><entry role="parameter_name"><para>signal_spec</para></entry>
<entry role="parameter_description"><para>the spec for the first signal</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>...</para></entry>
<entry role="parameter_description"><para><link linkend="GCallback"><type>GCallback</type></link> for the first signal, followed by data for the
first signal, followed optionally by more signal
spec/callback/data triples, followed by <link linkend="NULL:CAPS"><literal>NULL</literal></link></para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-object-connect.returns" role="returns">
<title>Returns</title>
<para><parameter>object</parameter>
. </para>
<para><emphasis role="annotation">[<acronym>transfer none</acronym>][<acronym>type</acronym> GObject.Object]</emphasis></para>
</refsect3></refsect2>
<refsect2 id="g-object-disconnect" role="function">
<title>g_object_disconnect&#160;()</title>
<indexterm zone="g-object-disconnect"><primary sortas="object_disconnect">g_object_disconnect</primary></indexterm>
<programlisting language="C"><link linkend="void"><returnvalue>void</returnvalue></link>
g_object_disconnect (<parameter><link linkend="gpointer"><type>gpointer</type></link> object</parameter>,
                     <parameter>const <link linkend="gchar"><type>gchar</type></link> *signal_spec</parameter>,
                     <parameter>...</parameter>);</programlisting>
<para>A convenience function to disconnect multiple signals at once.</para>
<para>The signal specs expected by this function have the form
"any_signal", which means to disconnect any signal with matching
callback and data, or "any_signal::signal_name", which only
disconnects the signal named "signal_name".</para>

<para><emphasis role="annotation">[<acronym>skip</acronym>]</emphasis></para><refsect3 id="g-object-disconnect.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>object</para></entry>
<entry role="parameter_description"><para>a <link linkend="GObject"><type>GObject</type></link>. </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>type</acronym> GObject.Object]</emphasis></entry></row>
<row><entry role="parameter_name"><para>signal_spec</para></entry>
<entry role="parameter_description"><para>the spec for the first signal</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>...</para></entry>
<entry role="parameter_description"><para><link linkend="GCallback"><type>GCallback</type></link> for the first signal, followed by data for the first signal,
followed optionally by more signal spec/callback/data triples,
followed by <link linkend="NULL:CAPS"><literal>NULL</literal></link></para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3></refsect2>
<refsect2 id="g-object-set" role="function">
<title>g_object_set&#160;()</title>
<indexterm zone="g-object-set"><primary sortas="object_set">g_object_set</primary></indexterm>
<programlisting language="C"><link linkend="void"><returnvalue>void</returnvalue></link>
g_object_set (<parameter><link linkend="gpointer"><type>gpointer</type></link> object</parameter>,
              <parameter>const <link linkend="gchar"><type>gchar</type></link> *first_property_name</parameter>,
              <parameter>...</parameter>);</programlisting>
<para>Sets properties on an object.</para>
<para>The same caveats about passing integer literals as varargs apply as with
<link linkend="g-object-new"><function>g_object_new()</function></link>. In particular, any integer literals set as the values for
properties of type <link linkend="gint64"><type>gint64</type></link> or <link linkend="guint64"><type>guint64</type></link> must be 64 bits wide, using the
<link linkend="G-GINT64-CONSTANT:CAPS"><literal>G_GINT64_CONSTANT</literal></link> or <link linkend="G-GUINT64-CONSTANT:CAPS"><literal>G_GUINT64_CONSTANT</literal></link> macros.</para>
<para>Note that the "notify" signals are queued and only emitted (in
reverse order) after all properties have been set. See
<link linkend="g-object-freeze-notify"><function>g_object_freeze_notify()</function></link>.</para>

<para><emphasis role="annotation">[<acronym>skip</acronym>]</emphasis></para><refsect3 id="g-object-set.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>object</para></entry>
<entry role="parameter_description"><para>a <link linkend="GObject"><type>GObject</type></link>. </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>type</acronym> GObject.Object]</emphasis></entry></row>
<row><entry role="parameter_name"><para>first_property_name</para></entry>
<entry role="parameter_description"><para>name of the first property to set</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>...</para></entry>
<entry role="parameter_description"><para>value for the first property, followed optionally by more
name/value pairs, followed by <link linkend="NULL:CAPS"><literal>NULL</literal></link></para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3></refsect2>
<refsect2 id="g-object-setv" role="function" condition="since:2.54">
<title>g_object_setv&#160;()</title>
<indexterm zone="g-object-setv" role="2.54"><primary sortas="object_setv">g_object_setv</primary></indexterm>
<programlisting language="C"><link linkend="void"><returnvalue>void</returnvalue></link>
g_object_setv (<parameter><link linkend="GObject"><type>GObject</type></link> *object</parameter>,
               <parameter><link linkend="guint"><type>guint</type></link> n_properties</parameter>,
               <parameter>const <link linkend="gchar"><type>gchar</type></link> *names[]</parameter>,
               <parameter>const <link linkend="GValue"><type>GValue</type></link> values[]</parameter>);</programlisting>
<para>Sets <parameter>n_properties</parameter>
 properties for an <parameter>object</parameter>
.
Properties to be set will be taken from <parameter>values</parameter>
. All properties must be
valid. Warnings will be emitted and undefined behaviour may result if invalid
properties are passed in.</para>

<para><emphasis role="annotation">[<acronym>skip</acronym>]</emphasis></para><refsect3 id="g-object-setv.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>object</para></entry>
<entry role="parameter_description"><para>a <link linkend="GObject"><type>GObject</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>n_properties</para></entry>
<entry role="parameter_description"><para>the number of properties</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>names</para></entry>
<entry role="parameter_description"><para>the names of each property to be set. </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>array</acronym> length=n_properties]</emphasis></entry></row>
<row><entry role="parameter_name"><para>values</para></entry>
<entry role="parameter_description"><para>the values of each property to be set. </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>array</acronym> length=n_properties]</emphasis></entry></row>
</tbody></tgroup></informaltable>
</refsect3><para role="since">Since: <link linkend="api-index-2.54">2.54</link></para></refsect2>
<refsect2 id="g-object-get" role="function">
<title>g_object_get&#160;()</title>
<indexterm zone="g-object-get"><primary sortas="object_get">g_object_get</primary></indexterm>
<programlisting language="C"><link linkend="void"><returnvalue>void</returnvalue></link>
g_object_get (<parameter><link linkend="gpointer"><type>gpointer</type></link> object</parameter>,
              <parameter>const <link linkend="gchar"><type>gchar</type></link> *first_property_name</parameter>,
              <parameter>...</parameter>);</programlisting>
<para>Gets properties of an object.</para>
<para>In general, a copy is made of the property contents and the caller
is responsible for freeing the memory in the appropriate manner for
the type, for instance by calling <link linkend="g-free"><function>g_free()</function></link> or <link linkend="g-object-unref"><function>g_object_unref()</function></link>.</para>
<para>Here is an example of using <link linkend="g-object-get"><function>g_object_get()</function></link> to get the contents
of three properties: an integer, a string and an object:</para>
<informalexample><programlisting role="example"><![CDATA[
 gint intval;
 guint64 uint64val;
 gchar *strval;
 GObject *objval;

 g_object_get (my_object,
               "int-property", &intval,
               "uint64-property", &uint64val,
               "str-property", &strval,
               "obj-property", &objval,
               NULL);

 // Do something with intval, uint64val, strval, objval

 g_free (strval);
 g_object_unref (objval);
]]></programlisting></informalexample>
<para></para>

<para><emphasis role="annotation">[<acronym>skip</acronym>]</emphasis></para><refsect3 id="g-object-get.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>object</para></entry>
<entry role="parameter_description"><para>a <link linkend="GObject"><type>GObject</type></link>. </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>type</acronym> GObject.Object]</emphasis></entry></row>
<row><entry role="parameter_name"><para>first_property_name</para></entry>
<entry role="parameter_description"><para>name of the first property to get</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>...</para></entry>
<entry role="parameter_description"><para>return location for the first property, followed optionally by more
name/return location pairs, followed by <link linkend="NULL:CAPS"><literal>NULL</literal></link></para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3></refsect2>
<refsect2 id="g-object-getv" role="function" condition="since:2.54">
<title>g_object_getv&#160;()</title>
<indexterm zone="g-object-getv" role="2.54"><primary sortas="object_getv">g_object_getv</primary></indexterm>
<programlisting language="C"><link linkend="void"><returnvalue>void</returnvalue></link>
g_object_getv (<parameter><link linkend="GObject"><type>GObject</type></link> *object</parameter>,
               <parameter><link linkend="guint"><type>guint</type></link> n_properties</parameter>,
               <parameter>const <link linkend="gchar"><type>gchar</type></link> *names[]</parameter>,
               <parameter><link linkend="GValue"><type>GValue</type></link> values[]</parameter>);</programlisting>
<para>Gets <parameter>n_properties</parameter>
 properties for an <parameter>object</parameter>
.
Obtained properties will be set to <parameter>values</parameter>
. All properties must be valid.
Warnings will be emitted and undefined behaviour may result if invalid
properties are passed in.</para>
<refsect3 id="g-object-getv.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>object</para></entry>
<entry role="parameter_description"><para>a <link linkend="GObject"><type>GObject</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>n_properties</para></entry>
<entry role="parameter_description"><para>the number of properties</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>names</para></entry>
<entry role="parameter_description"><para>the names of each property to get. </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>array</acronym> length=n_properties]</emphasis></entry></row>
<row><entry role="parameter_name"><para>values</para></entry>
<entry role="parameter_description"><para>the values of each property to get. </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>array</acronym> length=n_properties]</emphasis></entry></row>
</tbody></tgroup></informaltable>
</refsect3><para role="since">Since: <link linkend="api-index-2.54">2.54</link></para></refsect2>
<refsect2 id="g-object-notify" role="function">
<title>g_object_notify&#160;()</title>
<indexterm zone="g-object-notify"><primary sortas="object_notify">g_object_notify</primary></indexterm>
<programlisting language="C"><link linkend="void"><returnvalue>void</returnvalue></link>
g_object_notify (<parameter><link linkend="GObject"><type>GObject</type></link> *object</parameter>,
                 <parameter>const <link linkend="gchar"><type>gchar</type></link> *property_name</parameter>);</programlisting>
<para>Emits a "notify" signal for the property <parameter>property_name</parameter>
 on <parameter>object</parameter>
.</para>
<para>When possible, eg. when signaling a property change from within the class
that registered the property, you should use <link linkend="g-object-notify-by-pspec"><function>g_object_notify_by_pspec()</function></link>
instead.</para>
<para>Note that emission of the notify signal may be blocked with
<link linkend="g-object-freeze-notify"><function>g_object_freeze_notify()</function></link>. In this case, the signal emissions are queued
and will be emitted (in reverse order) when <link linkend="g-object-thaw-notify"><function>g_object_thaw_notify()</function></link> is
called.</para>
<refsect3 id="g-object-notify.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>object</para></entry>
<entry role="parameter_description"><para>a <link linkend="GObject"><type>GObject</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>property_name</para></entry>
<entry role="parameter_description"><para>the name of a property installed on the class of <parameter>object</parameter>
.</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3></refsect2>
<refsect2 id="g-object-notify-by-pspec" role="function" condition="since:2.26">
<title>g_object_notify_by_pspec&#160;()</title>
<indexterm zone="g-object-notify-by-pspec" role="2.26"><primary sortas="object_notify_by_pspec">g_object_notify_by_pspec</primary></indexterm>
<programlisting language="C"><link linkend="void"><returnvalue>void</returnvalue></link>
g_object_notify_by_pspec (<parameter><link linkend="GObject"><type>GObject</type></link> *object</parameter>,
                          <parameter><link linkend="GParamSpec"><type>GParamSpec</type></link> *pspec</parameter>);</programlisting>
<para>Emits a "notify" signal for the property specified by <parameter>pspec</parameter>
 on <parameter>object</parameter>
.</para>
<para>This function omits the property name lookup, hence it is faster than
<link linkend="g-object-notify"><function>g_object_notify()</function></link>.</para>
<para>One way to avoid using <link linkend="g-object-notify"><function>g_object_notify()</function></link> from within the
class that registered the properties, and using <link linkend="g-object-notify-by-pspec"><function>g_object_notify_by_pspec()</function></link>
instead, is to store the GParamSpec used with
<link linkend="g-object-class-install-property"><function>g_object_class_install_property()</function></link> inside a static array, e.g.:</para>
<informalexample><programlisting role="example"><![CDATA[
  enum
  {
    PROP_0,
    PROP_FOO,
    PROP_LAST
  };

  static GParamSpec *properties[PROP_LAST];

  static void
  my_object_class_init (MyObjectClass *klass)
  {
    properties[PROP_FOO] = g_param_spec_int ("foo", "Foo", "The foo",
                                             0, 100,
                                             50,
                                             G_PARAM_READWRITE);
    g_object_class_install_property (gobject_class,
                                     PROP_FOO,
                                     properties[PROP_FOO]);
  }
]]></programlisting></informalexample>
<para></para>
<para>and then notify a change on the "foo" property with:</para>
<informalexample><programlisting role="example"><![CDATA[
  g_object_notify_by_pspec (self, properties[PROP_FOO]);
]]></programlisting></informalexample>
<para></para>
<refsect3 id="g-object-notify-by-pspec.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>object</para></entry>
<entry role="parameter_description"><para>a <link linkend="GObject"><type>GObject</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>pspec</para></entry>
<entry role="parameter_description"><para>the <link linkend="GParamSpec"><type>GParamSpec</type></link> of a property installed on the class of <parameter>object</parameter>
.</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><para role="since">Since: <link linkend="api-index-2.26">2.26</link></para></refsect2>
<refsect2 id="g-object-freeze-notify" role="function">
<title>g_object_freeze_notify&#160;()</title>
<indexterm zone="g-object-freeze-notify"><primary sortas="object_freeze_notify">g_object_freeze_notify</primary></indexterm>
<programlisting language="C"><link linkend="void"><returnvalue>void</returnvalue></link>
g_object_freeze_notify (<parameter><link linkend="GObject"><type>GObject</type></link> *object</parameter>);</programlisting>
<para>Increases the freeze count on <parameter>object</parameter>
. If the freeze count is
non-zero, the emission of "notify" signals on <parameter>object</parameter>
 is
stopped. The signals are queued until the freeze count is decreased
to zero. Duplicate notifications are squashed so that at most one
<link linkend="GObject-notify"><type>“notify”</type></link> signal is emitted for each property modified while the
object is frozen.</para>
<para>This is necessary for accessors that modify multiple properties to prevent
premature notification while the object is still being modified.</para>
<refsect3 id="g-object-freeze-notify.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>object</para></entry>
<entry role="parameter_description"><para>a <link linkend="GObject"><type>GObject</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3></refsect2>
<refsect2 id="g-object-thaw-notify" role="function">
<title>g_object_thaw_notify&#160;()</title>
<indexterm zone="g-object-thaw-notify"><primary sortas="object_thaw_notify">g_object_thaw_notify</primary></indexterm>
<programlisting language="C"><link linkend="void"><returnvalue>void</returnvalue></link>
g_object_thaw_notify (<parameter><link linkend="GObject"><type>GObject</type></link> *object</parameter>);</programlisting>
<para>Reverts the effect of a previous call to
<link linkend="g-object-freeze-notify"><function>g_object_freeze_notify()</function></link>. The freeze count is decreased on <parameter>object</parameter>

and when it reaches zero, queued "notify" signals are emitted.</para>
<para>Duplicate notifications for each property are squashed so that at most one
<link linkend="GObject-notify"><type>“notify”</type></link> signal is emitted for each property, in the reverse order
in which they have been queued.</para>
<para>It is an error to call this function when the freeze count is zero.</para>
<refsect3 id="g-object-thaw-notify.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>object</para></entry>
<entry role="parameter_description"><para>a <link linkend="GObject"><type>GObject</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3></refsect2>
<refsect2 id="g-object-get-data" role="function">
<title>g_object_get_data&#160;()</title>
<indexterm zone="g-object-get-data"><primary sortas="object_get_data">g_object_get_data</primary></indexterm>
<programlisting language="C"><link linkend="gpointer"><returnvalue>gpointer</returnvalue></link>
g_object_get_data (<parameter><link linkend="GObject"><type>GObject</type></link> *object</parameter>,
                   <parameter>const <link linkend="gchar"><type>gchar</type></link> *key</parameter>);</programlisting>
<para>Gets a named field from the objects table of associations (see <link linkend="g-object-set-data"><function>g_object_set_data()</function></link>).</para>
<refsect3 id="g-object-get-data.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>object</para></entry>
<entry role="parameter_description"><para><link linkend="GObject"><type>GObject</type></link> containing the associations</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>key</para></entry>
<entry role="parameter_description"><para>name of the key for that association</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-object-get-data.returns" role="returns">
<title>Returns</title>
<para>the data if found,
or <link linkend="NULL:CAPS"><literal>NULL</literal></link> if no such data exists. </para>
<para><emphasis role="annotation">[<acronym>transfer none</acronym>][<acronym>nullable</acronym>]</emphasis></para>
</refsect3></refsect2>
<refsect2 id="g-object-set-data" role="function">
<title>g_object_set_data&#160;()</title>
<indexterm zone="g-object-set-data"><primary sortas="object_set_data">g_object_set_data</primary></indexterm>
<programlisting language="C"><link linkend="void"><returnvalue>void</returnvalue></link>
g_object_set_data (<parameter><link linkend="GObject"><type>GObject</type></link> *object</parameter>,
                   <parameter>const <link linkend="gchar"><type>gchar</type></link> *key</parameter>,
                   <parameter><link linkend="gpointer"><type>gpointer</type></link> data</parameter>);</programlisting>
<para>Each object carries around a table of associations from
strings to pointers.  This function lets you set an association.</para>
<para>If the object already had an association with that name,
the old association will be destroyed.</para>
<para>Internally, the <parameter>key</parameter>
 is converted to a <link linkend="GQuark"><type>GQuark</type></link> using <link linkend="g-quark-from-string"><function>g_quark_from_string()</function></link>.
This means a copy of <parameter>key</parameter>
 is kept permanently (even after <parameter>object</parameter>
 has been
finalized) — so it is recommended to only use a small, bounded set of values
for <parameter>key</parameter>
 in your program, to avoid the <link linkend="GQuark"><type>GQuark</type></link> storage growing unbounded.</para>
<refsect3 id="g-object-set-data.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>object</para></entry>
<entry role="parameter_description"><para><link linkend="GObject"><type>GObject</type></link> containing the associations.</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>key</para></entry>
<entry role="parameter_description"><para>name of the key</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>data</para></entry>
<entry role="parameter_description"><para>data to associate with that key. </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>nullable</acronym>]</emphasis></entry></row>
</tbody></tgroup></informaltable>
</refsect3></refsect2>
<refsect2 id="g-object-set-data-full" role="function">
<title>g_object_set_data_full&#160;()</title>
<indexterm zone="g-object-set-data-full"><primary sortas="object_set_data_full">g_object_set_data_full</primary></indexterm>
<programlisting language="C"><link linkend="void"><returnvalue>void</returnvalue></link>
g_object_set_data_full (<parameter><link linkend="GObject"><type>GObject</type></link> *object</parameter>,
                        <parameter>const <link linkend="gchar"><type>gchar</type></link> *key</parameter>,
                        <parameter><link linkend="gpointer"><type>gpointer</type></link> data</parameter>,
                        <parameter><link linkend="GDestroyNotify"><type>GDestroyNotify</type></link> destroy</parameter>);</programlisting>
<para>Like <link linkend="g-object-set-data"><function>g_object_set_data()</function></link> except it adds notification
for when the association is destroyed, either by setting it
to a different value or when the object is destroyed.</para>
<para>Note that the <parameter>destroy</parameter>
 callback is not called if <parameter>data</parameter>
 is <link linkend="NULL:CAPS"><literal>NULL</literal></link>.</para>

<para><emphasis role="annotation">[<acronym>skip</acronym>]</emphasis></para><refsect3 id="g-object-set-data-full.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>object</para></entry>
<entry role="parameter_description"><para><link linkend="GObject"><type>GObject</type></link> containing the associations</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>key</para></entry>
<entry role="parameter_description"><para>name of the key</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>data</para></entry>
<entry role="parameter_description"><para>data to associate with that key. </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>nullable</acronym>]</emphasis></entry></row>
<row><entry role="parameter_name"><para>destroy</para></entry>
<entry role="parameter_description"><para>function to call when the association is destroyed. </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>nullable</acronym>]</emphasis></entry></row>
</tbody></tgroup></informaltable>
</refsect3></refsect2>
<refsect2 id="g-object-steal-data" role="function">
<title>g_object_steal_data&#160;()</title>
<indexterm zone="g-object-steal-data"><primary sortas="object_steal_data">g_object_steal_data</primary></indexterm>
<programlisting language="C"><link linkend="gpointer"><returnvalue>gpointer</returnvalue></link>
g_object_steal_data (<parameter><link linkend="GObject"><type>GObject</type></link> *object</parameter>,
                     <parameter>const <link linkend="gchar"><type>gchar</type></link> *key</parameter>);</programlisting>
<para>Remove a specified datum from the object's data associations,
without invoking the association's destroy handler.</para>
<refsect3 id="g-object-steal-data.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>object</para></entry>
<entry role="parameter_description"><para><link linkend="GObject"><type>GObject</type></link> containing the associations</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>key</para></entry>
<entry role="parameter_description"><para>name of the key</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-object-steal-data.returns" role="returns">
<title>Returns</title>
<para>the data if found, or <link linkend="NULL:CAPS"><literal>NULL</literal></link>
if no such data exists. </para>
<para><emphasis role="annotation">[<acronym>transfer full</acronym>][<acronym>nullable</acronym>]</emphasis></para>
</refsect3></refsect2>
<refsect2 id="g-object-dup-data" role="function" condition="since:2.34">
<title>g_object_dup_data&#160;()</title>
<indexterm zone="g-object-dup-data" role="2.34"><primary sortas="object_dup_data">g_object_dup_data</primary></indexterm>
<programlisting language="C"><link linkend="gpointer"><returnvalue>gpointer</returnvalue></link>
g_object_dup_data (<parameter><link linkend="GObject"><type>GObject</type></link> *object</parameter>,
                   <parameter>const <link linkend="gchar"><type>gchar</type></link> *key</parameter>,
                   <parameter><link linkend="GDuplicateFunc"><type>GDuplicateFunc</type></link> dup_func</parameter>,
                   <parameter><link linkend="gpointer"><type>gpointer</type></link> user_data</parameter>);</programlisting>
<para>This is a variant of <link linkend="g-object-get-data"><function>g_object_get_data()</function></link> which returns
a 'duplicate' of the value. <parameter>dup_func</parameter>
 defines the
meaning of 'duplicate' in this context, it could e.g.
take a reference on a ref-counted object.</para>
<para>If the <parameter>key</parameter>
 is not set on the object then <parameter>dup_func</parameter>

will be called with a <link linkend="NULL:CAPS"><literal>NULL</literal></link> argument.</para>
<para>Note that <parameter>dup_func</parameter>
 is called while user data of <parameter>object</parameter>

is locked.</para>
<para>This function can be useful to avoid races when multiple
threads are using object data on the same key on the same
object.</para>

<para><emphasis role="annotation">[<acronym>skip</acronym>]</emphasis></para><refsect3 id="g-object-dup-data.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>object</para></entry>
<entry role="parameter_description"><para>the <link linkend="GObject"><type>GObject</type></link> to store user data on</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>key</para></entry>
<entry role="parameter_description"><para>a string, naming the user data pointer</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>dup_func</para></entry>
<entry role="parameter_description"><para>function to dup the value. </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>nullable</acronym>]</emphasis></entry></row>
<row><entry role="parameter_name"><para>user_data</para></entry>
<entry role="parameter_description"><para>passed as user_data to <parameter>dup_func</parameter>
. </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>nullable</acronym>]</emphasis></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-object-dup-data.returns" role="returns">
<title>Returns</title>
<para> the result of calling <parameter>dup_func</parameter>
on the value
associated with <parameter>key</parameter>
on <parameter>object</parameter>
, or <link linkend="NULL:CAPS"><literal>NULL</literal></link> if not set.
If <parameter>dup_func</parameter>
is <link linkend="NULL:CAPS"><literal>NULL</literal></link>, the value is returned
unmodified.</para>
</refsect3><para role="since">Since: <link linkend="api-index-2.34">2.34</link></para></refsect2>
<refsect2 id="g-object-replace-data" role="function" condition="since:2.34">
<title>g_object_replace_data&#160;()</title>
<indexterm zone="g-object-replace-data" role="2.34"><primary sortas="object_replace_data">g_object_replace_data</primary></indexterm>
<programlisting language="C"><link linkend="gboolean"><returnvalue>gboolean</returnvalue></link>
g_object_replace_data (<parameter><link linkend="GObject"><type>GObject</type></link> *object</parameter>,
                       <parameter>const <link linkend="gchar"><type>gchar</type></link> *key</parameter>,
                       <parameter><link linkend="gpointer"><type>gpointer</type></link> oldval</parameter>,
                       <parameter><link linkend="gpointer"><type>gpointer</type></link> newval</parameter>,
                       <parameter><link linkend="GDestroyNotify"><type>GDestroyNotify</type></link> destroy</parameter>,
                       <parameter><link linkend="GDestroyNotify"><type>GDestroyNotify</type></link> *old_destroy</parameter>);</programlisting>
<para>Compares the user data for the key <parameter>key</parameter>
 on <parameter>object</parameter>
 with
<parameter>oldval</parameter>
, and if they are the same, replaces <parameter>oldval</parameter>
 with
<parameter>newval</parameter>
.</para>
<para>This is like a typical atomic compare-and-exchange
operation, for user data on an object.</para>
<para>If the previous value was replaced then ownership of the
old value (<parameter>oldval</parameter>
) is passed to the caller, including
the registered destroy notify for it (passed out in <parameter>old_destroy</parameter>
).
It’s up to the caller to free this as needed, which may
or may not include using <parameter>old_destroy</parameter>
 as sometimes replacement
should not destroy the object in the normal way.</para>
<para>See <link linkend="g-object-set-data"><function>g_object_set_data()</function></link> for guidance on using a small, bounded set of values
for <parameter>key</parameter>
.</para>

<para><emphasis role="annotation">[<acronym>skip</acronym>]</emphasis></para><refsect3 id="g-object-replace-data.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>object</para></entry>
<entry role="parameter_description"><para>the <link linkend="GObject"><type>GObject</type></link> to store user data on</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>key</para></entry>
<entry role="parameter_description"><para>a string, naming the user data pointer</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>oldval</para></entry>
<entry role="parameter_description"><para>the old value to compare against. </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>nullable</acronym>]</emphasis></entry></row>
<row><entry role="parameter_name"><para>newval</para></entry>
<entry role="parameter_description"><para>the new value. </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>nullable</acronym>]</emphasis></entry></row>
<row><entry role="parameter_name"><para>destroy</para></entry>
<entry role="parameter_description"><para>a destroy notify for the new value. </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>nullable</acronym>]</emphasis></entry></row>
<row><entry role="parameter_name"><para>old_destroy</para></entry>
<entry role="parameter_description"><para>destroy notify for the existing value. </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>out</acronym>][<acronym>optional</acronym>]</emphasis></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-object-replace-data.returns" role="returns">
<title>Returns</title>
<para> <link linkend="TRUE:CAPS"><literal>TRUE</literal></link> if the existing value for <parameter>key</parameter>
was replaced
by <parameter>newval</parameter>
, <link linkend="FALSE:CAPS"><literal>FALSE</literal></link> otherwise.</para>
</refsect3><para role="since">Since: <link linkend="api-index-2.34">2.34</link></para></refsect2>
<refsect2 id="g-object-get-qdata" role="function">
<title>g_object_get_qdata&#160;()</title>
<indexterm zone="g-object-get-qdata"><primary sortas="object_get_qdata">g_object_get_qdata</primary></indexterm>
<programlisting language="C"><link linkend="gpointer"><returnvalue>gpointer</returnvalue></link>
g_object_get_qdata (<parameter><link linkend="GObject"><type>GObject</type></link> *object</parameter>,
                    <parameter><link linkend="GQuark"><type>GQuark</type></link> quark</parameter>);</programlisting>
<para>This function gets back user data pointers stored via
<link linkend="g-object-set-qdata"><function>g_object_set_qdata()</function></link>.</para>
<refsect3 id="g-object-get-qdata.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>object</para></entry>
<entry role="parameter_description"><para>The GObject to get a stored user data pointer from</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>quark</para></entry>
<entry role="parameter_description"><para>A <link linkend="GQuark"><type>GQuark</type></link>, naming the user data pointer</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-object-get-qdata.returns" role="returns">
<title>Returns</title>
<para>The user data pointer set, or <link linkend="NULL:CAPS"><literal>NULL</literal></link>. </para>
<para><emphasis role="annotation">[<acronym>transfer none</acronym>][<acronym>nullable</acronym>]</emphasis></para>
</refsect3></refsect2>
<refsect2 id="g-object-set-qdata" role="function">
<title>g_object_set_qdata&#160;()</title>
<indexterm zone="g-object-set-qdata"><primary sortas="object_set_qdata">g_object_set_qdata</primary></indexterm>
<programlisting language="C"><link linkend="void"><returnvalue>void</returnvalue></link>
g_object_set_qdata (<parameter><link linkend="GObject"><type>GObject</type></link> *object</parameter>,
                    <parameter><link linkend="GQuark"><type>GQuark</type></link> quark</parameter>,
                    <parameter><link linkend="gpointer"><type>gpointer</type></link> data</parameter>);</programlisting>
<para>This sets an opaque, named pointer on an object.
The name is specified through a <link linkend="GQuark"><type>GQuark</type></link> (retrieved e.g. via
<link linkend="g-quark-from-static-string"><function>g_quark_from_static_string()</function></link>), and the pointer
can be gotten back from the <parameter>object</parameter>
 with <link linkend="g-object-get-qdata"><function>g_object_get_qdata()</function></link>
until the <parameter>object</parameter>
 is finalized.
Setting a previously set user data pointer, overrides (frees)
the old pointer set, using <link linkend="NULL:CAPS"><type>NULL</type></link> as pointer essentially
removes the data stored.</para>

<para><emphasis role="annotation">[<acronym>skip</acronym>]</emphasis></para><refsect3 id="g-object-set-qdata.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>object</para></entry>
<entry role="parameter_description"><para>The GObject to set store a user data pointer</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>quark</para></entry>
<entry role="parameter_description"><para>A <link linkend="GQuark"><type>GQuark</type></link>, naming the user data pointer</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>data</para></entry>
<entry role="parameter_description"><para>An opaque user data pointer. </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>nullable</acronym>]</emphasis></entry></row>
</tbody></tgroup></informaltable>
</refsect3></refsect2>
<refsect2 id="g-object-set-qdata-full" role="function">
<title>g_object_set_qdata_full&#160;()</title>
<indexterm zone="g-object-set-qdata-full"><primary sortas="object_set_qdata_full">g_object_set_qdata_full</primary></indexterm>
<programlisting language="C"><link linkend="void"><returnvalue>void</returnvalue></link>
g_object_set_qdata_full (<parameter><link linkend="GObject"><type>GObject</type></link> *object</parameter>,
                         <parameter><link linkend="GQuark"><type>GQuark</type></link> quark</parameter>,
                         <parameter><link linkend="gpointer"><type>gpointer</type></link> data</parameter>,
                         <parameter><link linkend="GDestroyNotify"><type>GDestroyNotify</type></link> destroy</parameter>);</programlisting>
<para>This function works like <link linkend="g-object-set-qdata"><function>g_object_set_qdata()</function></link>, but in addition,
a void (*destroy) (gpointer) function may be specified which is
called with <parameter>data</parameter>
 as argument when the <parameter>object</parameter>
 is finalized, or
the data is being overwritten by a call to <link linkend="g-object-set-qdata"><function>g_object_set_qdata()</function></link>
with the same <parameter>quark</parameter>
.</para>

<para><emphasis role="annotation">[<acronym>skip</acronym>]</emphasis></para><refsect3 id="g-object-set-qdata-full.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>object</para></entry>
<entry role="parameter_description"><para>The GObject to set store a user data pointer</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>quark</para></entry>
<entry role="parameter_description"><para>A <link linkend="GQuark"><type>GQuark</type></link>, naming the user data pointer</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>data</para></entry>
<entry role="parameter_description"><para>An opaque user data pointer. </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>nullable</acronym>]</emphasis></entry></row>
<row><entry role="parameter_name"><para>destroy</para></entry>
<entry role="parameter_description"><para>Function to invoke with <parameter>data</parameter>
as argument, when <parameter>data</parameter>
needs to be freed. </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>nullable</acronym>]</emphasis></entry></row>
</tbody></tgroup></informaltable>
</refsect3></refsect2>
<refsect2 id="g-object-steal-qdata" role="function">
<title>g_object_steal_qdata&#160;()</title>
<indexterm zone="g-object-steal-qdata"><primary sortas="object_steal_qdata">g_object_steal_qdata</primary></indexterm>
<programlisting language="C"><link linkend="gpointer"><returnvalue>gpointer</returnvalue></link>
g_object_steal_qdata (<parameter><link linkend="GObject"><type>GObject</type></link> *object</parameter>,
                      <parameter><link linkend="GQuark"><type>GQuark</type></link> quark</parameter>);</programlisting>
<para>This function gets back user data pointers stored via
<link linkend="g-object-set-qdata"><function>g_object_set_qdata()</function></link> and removes the <parameter>data</parameter>
 from object
without invoking its <link linkend="destroy"><function>destroy()</function></link> function (if any was
set).
Usually, calling this function is only required to update
user data pointers with a destroy notifier, for example:</para>
<informalexample><programlisting role="example"><![CDATA[
void
object_add_to_user_list (GObject     *object,
                         const gchar *new_string)
{
  // the quark, naming the object data
  GQuark quark_string_list = g_quark_from_static_string ("my-string-list");
  // retrieve the old string list
  GList *list = g_object_steal_qdata (object, quark_string_list);

  // prepend new string
  list = g_list_prepend (list, g_strdup (new_string));
  // this changed 'list', so we need to set it again
  g_object_set_qdata_full (object, quark_string_list, list, free_string_list);
}
static void
free_string_list (gpointer data)
{
  GList *node, *list = data;

  for (node = list; node; node = node->next)
    g_free (node->data);
  g_list_free (list);
}
]]></programlisting></informalexample>
<para>
Using <link linkend="g-object-get-qdata"><function>g_object_get_qdata()</function></link> in the above example, instead of
<link linkend="g-object-steal-qdata"><function>g_object_steal_qdata()</function></link> would have left the destroy function set,
and thus the partial string list would have been freed upon
<link linkend="g-object-set-qdata-full"><function>g_object_set_qdata_full()</function></link>.</para>
<refsect3 id="g-object-steal-qdata.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>object</para></entry>
<entry role="parameter_description"><para>The GObject to get a stored user data pointer from</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>quark</para></entry>
<entry role="parameter_description"><para>A <link linkend="GQuark"><type>GQuark</type></link>, naming the user data pointer</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-object-steal-qdata.returns" role="returns">
<title>Returns</title>
<para>The user data pointer set, or <link linkend="NULL:CAPS"><literal>NULL</literal></link>. </para>
<para><emphasis role="annotation">[<acronym>transfer full</acronym>][<acronym>nullable</acronym>]</emphasis></para>
</refsect3></refsect2>
<refsect2 id="g-object-dup-qdata" role="function" condition="since:2.34">
<title>g_object_dup_qdata&#160;()</title>
<indexterm zone="g-object-dup-qdata" role="2.34"><primary sortas="object_dup_qdata">g_object_dup_qdata</primary></indexterm>
<programlisting language="C"><link linkend="gpointer"><returnvalue>gpointer</returnvalue></link>
g_object_dup_qdata (<parameter><link linkend="GObject"><type>GObject</type></link> *object</parameter>,
                    <parameter><link linkend="GQuark"><type>GQuark</type></link> quark</parameter>,
                    <parameter><link linkend="GDuplicateFunc"><type>GDuplicateFunc</type></link> dup_func</parameter>,
                    <parameter><link linkend="gpointer"><type>gpointer</type></link> user_data</parameter>);</programlisting>
<para>This is a variant of <link linkend="g-object-get-qdata"><function>g_object_get_qdata()</function></link> which returns
a 'duplicate' of the value. <parameter>dup_func</parameter>
 defines the
meaning of 'duplicate' in this context, it could e.g.
take a reference on a ref-counted object.</para>
<para>If the <parameter>quark</parameter>
 is not set on the object then <parameter>dup_func</parameter>

will be called with a <link linkend="NULL:CAPS"><literal>NULL</literal></link> argument.</para>
<para>Note that <parameter>dup_func</parameter>
 is called while user data of <parameter>object</parameter>

is locked.</para>
<para>This function can be useful to avoid races when multiple
threads are using object data on the same key on the same
object.</para>

<para><emphasis role="annotation">[<acronym>skip</acronym>]</emphasis></para><refsect3 id="g-object-dup-qdata.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>object</para></entry>
<entry role="parameter_description"><para>the <link linkend="GObject"><type>GObject</type></link> to store user data on</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>quark</para></entry>
<entry role="parameter_description"><para>a <link linkend="GQuark"><type>GQuark</type></link>, naming the user data pointer</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>dup_func</para></entry>
<entry role="parameter_description"><para>function to dup the value. </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>nullable</acronym>]</emphasis></entry></row>
<row><entry role="parameter_name"><para>user_data</para></entry>
<entry role="parameter_description"><para>passed as user_data to <parameter>dup_func</parameter>
. </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>nullable</acronym>]</emphasis></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-object-dup-qdata.returns" role="returns">
<title>Returns</title>
<para> the result of calling <parameter>dup_func</parameter>
on the value
associated with <parameter>quark</parameter>
on <parameter>object</parameter>
, or <link linkend="NULL:CAPS"><literal>NULL</literal></link> if not set.
If <parameter>dup_func</parameter>
is <link linkend="NULL:CAPS"><literal>NULL</literal></link>, the value is returned
unmodified.</para>
</refsect3><para role="since">Since: <link linkend="api-index-2.34">2.34</link></para></refsect2>
<refsect2 id="g-object-replace-qdata" role="function" condition="since:2.34">
<title>g_object_replace_qdata&#160;()</title>
<indexterm zone="g-object-replace-qdata" role="2.34"><primary sortas="object_replace_qdata">g_object_replace_qdata</primary></indexterm>
<programlisting language="C"><link linkend="gboolean"><returnvalue>gboolean</returnvalue></link>
g_object_replace_qdata (<parameter><link linkend="GObject"><type>GObject</type></link> *object</parameter>,
                        <parameter><link linkend="GQuark"><type>GQuark</type></link> quark</parameter>,
                        <parameter><link linkend="gpointer"><type>gpointer</type></link> oldval</parameter>,
                        <parameter><link linkend="gpointer"><type>gpointer</type></link> newval</parameter>,
                        <parameter><link linkend="GDestroyNotify"><type>GDestroyNotify</type></link> destroy</parameter>,
                        <parameter><link linkend="GDestroyNotify"><type>GDestroyNotify</type></link> *old_destroy</parameter>);</programlisting>
<para>Compares the user data for the key <parameter>quark</parameter>
 on <parameter>object</parameter>
 with
<parameter>oldval</parameter>
, and if they are the same, replaces <parameter>oldval</parameter>
 with
<parameter>newval</parameter>
.</para>
<para>This is like a typical atomic compare-and-exchange
operation, for user data on an object.</para>
<para>If the previous value was replaced then ownership of the
old value (<parameter>oldval</parameter>
) is passed to the caller, including
the registered destroy notify for it (passed out in <parameter>old_destroy</parameter>
).
It’s up to the caller to free this as needed, which may
or may not include using <parameter>old_destroy</parameter>
 as sometimes replacement
should not destroy the object in the normal way.</para>

<para><emphasis role="annotation">[<acronym>skip</acronym>]</emphasis></para><refsect3 id="g-object-replace-qdata.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>object</para></entry>
<entry role="parameter_description"><para>the <link linkend="GObject"><type>GObject</type></link> to store user data on</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>quark</para></entry>
<entry role="parameter_description"><para>a <link linkend="GQuark"><type>GQuark</type></link>, naming the user data pointer</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>oldval</para></entry>
<entry role="parameter_description"><para>the old value to compare against. </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>nullable</acronym>]</emphasis></entry></row>
<row><entry role="parameter_name"><para>newval</para></entry>
<entry role="parameter_description"><para>the new value. </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>nullable</acronym>]</emphasis></entry></row>
<row><entry role="parameter_name"><para>destroy</para></entry>
<entry role="parameter_description"><para>a destroy notify for the new value. </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>nullable</acronym>]</emphasis></entry></row>
<row><entry role="parameter_name"><para>old_destroy</para></entry>
<entry role="parameter_description"><para>destroy notify for the existing value. </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>out</acronym>][<acronym>optional</acronym>]</emphasis></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-object-replace-qdata.returns" role="returns">
<title>Returns</title>
<para> <link linkend="TRUE:CAPS"><literal>TRUE</literal></link> if the existing value for <parameter>quark</parameter>
was replaced
by <parameter>newval</parameter>
, <link linkend="FALSE:CAPS"><literal>FALSE</literal></link> otherwise.</para>
</refsect3><para role="since">Since: <link linkend="api-index-2.34">2.34</link></para></refsect2>
<refsect2 id="g-object-set-property" role="function">
<title>g_object_set_property&#160;()</title>
<indexterm zone="g-object-set-property"><primary sortas="object_set_property">g_object_set_property</primary></indexterm>
<programlisting language="C"><link linkend="void"><returnvalue>void</returnvalue></link>
g_object_set_property (<parameter><link linkend="GObject"><type>GObject</type></link> *object</parameter>,
                       <parameter>const <link linkend="gchar"><type>gchar</type></link> *property_name</parameter>,
                       <parameter>const <link linkend="GValue"><type>GValue</type></link> *value</parameter>);</programlisting>
<para>Sets a property on an object.</para>
<refsect3 id="g-object-set-property.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>object</para></entry>
<entry role="parameter_description"><para>a <link linkend="GObject"><type>GObject</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>property_name</para></entry>
<entry role="parameter_description"><para>the name of the property to set</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>value</para></entry>
<entry role="parameter_description"><para>the value</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3></refsect2>
<refsect2 id="g-object-get-property" role="function">
<title>g_object_get_property&#160;()</title>
<indexterm zone="g-object-get-property"><primary sortas="object_get_property">g_object_get_property</primary></indexterm>
<programlisting language="C"><link linkend="void"><returnvalue>void</returnvalue></link>
g_object_get_property (<parameter><link linkend="GObject"><type>GObject</type></link> *object</parameter>,
                       <parameter>const <link linkend="gchar"><type>gchar</type></link> *property_name</parameter>,
                       <parameter><link linkend="GValue"><type>GValue</type></link> *value</parameter>);</programlisting>
<para>Gets a property of an object.</para>
<para>The <parameter>value</parameter>
 can be:</para>
<itemizedlist>
<listitem><para>an empty <link linkend="GValue"><type>GValue</type></link> initialized by <link linkend="G-VALUE-INIT:CAPS"><literal>G_VALUE_INIT</literal></link>, which will be
automatically initialized with the expected type of the property
(since GLib 2.60)</para></listitem>
<listitem><para>a <link linkend="GValue"><type>GValue</type></link> initialized with the expected type of the property</para></listitem>
<listitem>
<para>a <link linkend="GValue"><type>GValue</type></link> initialized with a type to which the expected type
of the property can be transformed</para>
</listitem>
</itemizedlist>
<para>In general, a copy is made of the property contents and the caller is
responsible for freeing the memory by calling <link linkend="g-value-unset"><function>g_value_unset()</function></link>.</para>
<para>Note that <link linkend="g-object-get-property"><function>g_object_get_property()</function></link> is really intended for language
bindings, <link linkend="g-object-get"><function>g_object_get()</function></link> is much more convenient for C programming.</para>
<refsect3 id="g-object-get-property.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>object</para></entry>
<entry role="parameter_description"><para>a <link linkend="GObject"><type>GObject</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>property_name</para></entry>
<entry role="parameter_description"><para>the name of the property to get</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>value</para></entry>
<entry role="parameter_description"><para>return location for the property value</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3></refsect2>
<refsect2 id="g-object-new-valist" role="function">
<title>g_object_new_valist&#160;()</title>
<indexterm zone="g-object-new-valist"><primary sortas="object_new_valist">g_object_new_valist</primary></indexterm>
<programlisting language="C"><link linkend="GObject"><returnvalue>GObject</returnvalue></link>&#160;*
g_object_new_valist (<parameter><link linkend="GType"><type>GType</type></link> object_type</parameter>,
                     <parameter>const <link linkend="gchar"><type>gchar</type></link> *first_property_name</parameter>,
                     <parameter><link linkend="va-list"><type>va_list</type></link> var_args</parameter>);</programlisting>
<para>Creates a new instance of a <link linkend="GObject"><type>GObject</type></link> subtype and sets its properties.</para>
<para>Construction parameters (see <link linkend="G-PARAM-CONSTRUCT:CAPS"><type>G_PARAM_CONSTRUCT</type></link>, <link linkend="G-PARAM-CONSTRUCT-ONLY:CAPS"><type>G_PARAM_CONSTRUCT_ONLY</type></link>)
which are not explicitly specified are set to their default values.</para>

<para><emphasis role="annotation">[<acronym>skip</acronym>]</emphasis></para><refsect3 id="g-object-new-valist.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>object_type</para></entry>
<entry role="parameter_description"><para>the type id of the <link linkend="GObject"><type>GObject</type></link> subtype to instantiate</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>first_property_name</para></entry>
<entry role="parameter_description"><para>the name of the first property</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>var_args</para></entry>
<entry role="parameter_description"><para>the value of the first property, followed optionally by more
name/value pairs, followed by <link linkend="NULL:CAPS"><literal>NULL</literal></link></para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-object-new-valist.returns" role="returns">
<title>Returns</title>
<para> a new instance of <parameter>object_type</parameter>
</para>
</refsect3></refsect2>
<refsect2 id="g-object-set-valist" role="function">
<title>g_object_set_valist&#160;()</title>
<indexterm zone="g-object-set-valist"><primary sortas="object_set_valist">g_object_set_valist</primary></indexterm>
<programlisting language="C"><link linkend="void"><returnvalue>void</returnvalue></link>
g_object_set_valist (<parameter><link linkend="GObject"><type>GObject</type></link> *object</parameter>,
                     <parameter>const <link linkend="gchar"><type>gchar</type></link> *first_property_name</parameter>,
                     <parameter><link linkend="va-list"><type>va_list</type></link> var_args</parameter>);</programlisting>
<para>Sets properties on an object.</para>

<para><emphasis role="annotation">[<acronym>skip</acronym>]</emphasis></para><refsect3 id="g-object-set-valist.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>object</para></entry>
<entry role="parameter_description"><para>a <link linkend="GObject"><type>GObject</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>first_property_name</para></entry>
<entry role="parameter_description"><para>name of the first property to set</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>var_args</para></entry>
<entry role="parameter_description"><para>value for the first property, followed optionally by more
name/value pairs, followed by <link linkend="NULL:CAPS"><literal>NULL</literal></link></para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3></refsect2>
<refsect2 id="g-object-get-valist" role="function">
<title>g_object_get_valist&#160;()</title>
<indexterm zone="g-object-get-valist"><primary sortas="object_get_valist">g_object_get_valist</primary></indexterm>
<programlisting language="C"><link linkend="void"><returnvalue>void</returnvalue></link>
g_object_get_valist (<parameter><link linkend="GObject"><type>GObject</type></link> *object</parameter>,
                     <parameter>const <link linkend="gchar"><type>gchar</type></link> *first_property_name</parameter>,
                     <parameter><link linkend="va-list"><type>va_list</type></link> var_args</parameter>);</programlisting>
<para>Gets properties of an object.</para>
<para>In general, a copy is made of the property contents and the caller
is responsible for freeing the memory in the appropriate manner for
the type, for instance by calling <link linkend="g-free"><function>g_free()</function></link> or <link linkend="g-object-unref"><function>g_object_unref()</function></link>.</para>
<para>See <link linkend="g-object-get"><function>g_object_get()</function></link>.</para>

<para><emphasis role="annotation">[<acronym>skip</acronym>]</emphasis></para><refsect3 id="g-object-get-valist.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>object</para></entry>
<entry role="parameter_description"><para>a <link linkend="GObject"><type>GObject</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>first_property_name</para></entry>
<entry role="parameter_description"><para>name of the first property to get</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>var_args</para></entry>
<entry role="parameter_description"><para>return location for the first property, followed optionally by more
name/return location pairs, followed by <link linkend="NULL:CAPS"><literal>NULL</literal></link></para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3></refsect2>
<refsect2 id="g-object-watch-closure" role="function">
<title>g_object_watch_closure&#160;()</title>
<indexterm zone="g-object-watch-closure"><primary sortas="object_watch_closure">g_object_watch_closure</primary></indexterm>
<programlisting language="C"><link linkend="void"><returnvalue>void</returnvalue></link>
g_object_watch_closure (<parameter><link linkend="GObject"><type>GObject</type></link> *object</parameter>,
                        <parameter><link linkend="GClosure"><type>GClosure</type></link> *closure</parameter>);</programlisting>
<para>This function essentially limits the life time of the <parameter>closure</parameter>
 to
the life time of the object. That is, when the object is finalized,
the <parameter>closure</parameter>
 is invalidated by calling <link linkend="g-closure-invalidate"><function>g_closure_invalidate()</function></link> on
it, in order to prevent invocations of the closure with a finalized
(nonexisting) object. Also, <link linkend="g-object-ref"><function>g_object_ref()</function></link> and <link linkend="g-object-unref"><function>g_object_unref()</function></link> are
added as marshal guards to the <parameter>closure</parameter>
, to ensure that an extra
reference count is held on <parameter>object</parameter>
 during invocation of the
<parameter>closure</parameter>
.  Usually, this function will be called on closures that
use this <parameter>object</parameter>
 as closure data.</para>
<refsect3 id="g-object-watch-closure.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>object</para></entry>
<entry role="parameter_description"><para><link linkend="GObject"><type>GObject</type></link> restricting lifetime of <parameter>closure</parameter>
</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>closure</para></entry>
<entry role="parameter_description"><para><link linkend="GClosure"><type>GClosure</type></link> to watch</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3></refsect2>
<refsect2 id="g-object-run-dispose" role="function">
<title>g_object_run_dispose&#160;()</title>
<indexterm zone="g-object-run-dispose"><primary sortas="object_run_dispose">g_object_run_dispose</primary></indexterm>
<programlisting language="C"><link linkend="void"><returnvalue>void</returnvalue></link>
g_object_run_dispose (<parameter><link linkend="GObject"><type>GObject</type></link> *object</parameter>);</programlisting>
<para>Releases all references to other objects. This can be used to break
reference cycles.</para>
<para>This function should only be called from object system implementations.</para>
<refsect3 id="g-object-run-dispose.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>object</para></entry>
<entry role="parameter_description"><para>a <link linkend="GObject"><type>GObject</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3></refsect2>
<refsect2 id="G-OBJECT-WARN-INVALID-PROPERTY-ID:CAPS" role="macro">
<title>G_OBJECT_WARN_INVALID_PROPERTY_ID()</title>
<indexterm zone="G-OBJECT-WARN-INVALID-PROPERTY-ID:CAPS"><primary sortas="OBJECT_WARN_INVALID_PROPERTY_ID">G_OBJECT_WARN_INVALID_PROPERTY_ID</primary></indexterm>
<programlisting language="C">#define             G_OBJECT_WARN_INVALID_PROPERTY_ID(object, property_id, pspec)</programlisting>
<para>This macro should be used to emit a standard warning about unexpected 
properties in <link linkend="set-property"><function>set_property()</function></link> and <link linkend="get-property"><function>get_property()</function></link> implementations.</para>
<refsect3 id="G-OBJECT-WARN-INVALID-PROPERTY-ID.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>object</para></entry>
<entry role="parameter_description"><para>the <link linkend="GObject"><type>GObject</type></link> on which <link linkend="set-property"><function>set_property()</function></link> or <link linkend="get-property"><function>get_property()</function></link> was called</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>property_id</para></entry>
<entry role="parameter_description"><para>the numeric id of the property</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>pspec</para></entry>
<entry role="parameter_description"><para>the <link linkend="GParamSpec"><type>GParamSpec</type></link> of the property</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3></refsect2>
<refsect2 id="g-weak-ref-init" role="function" condition="since:2.32">
<title>g_weak_ref_init&#160;()</title>
<indexterm zone="g-weak-ref-init" role="2.32"><primary sortas="weak_ref_init">g_weak_ref_init</primary></indexterm>
<programlisting language="C"><link linkend="void"><returnvalue>void</returnvalue></link>
g_weak_ref_init (<parameter><link linkend="GWeakRef"><type>GWeakRef</type></link> *weak_ref</parameter>,
                 <parameter><link linkend="gpointer"><type>gpointer</type></link> object</parameter>);</programlisting>
<para>Initialise a non-statically-allocated <link linkend="GWeakRef"><type>GWeakRef</type></link>.</para>
<para>This function also calls <link linkend="g-weak-ref-set"><function>g_weak_ref_set()</function></link> with <parameter>object</parameter>
 on the
freshly-initialised weak reference.</para>
<para>This function should always be matched with a call to
<link linkend="g-weak-ref-clear"><function>g_weak_ref_clear()</function></link>.  It is not necessary to use this function for a
<link linkend="GWeakRef"><type>GWeakRef</type></link> in static storage because it will already be
properly initialised.  Just use <link linkend="g-weak-ref-set"><function>g_weak_ref_set()</function></link> directly.</para>

<para><emphasis role="annotation">[<acronym>skip</acronym>]</emphasis></para><refsect3 id="g-weak-ref-init.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>weak_ref</para></entry>
<entry role="parameter_description"><para>uninitialized or empty location for a weak
reference. </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>inout</acronym>]</emphasis></entry></row>
<row><entry role="parameter_name"><para>object</para></entry>
<entry role="parameter_description"><para>a <link linkend="GObject"><type>GObject</type></link> or <link linkend="NULL:CAPS"><literal>NULL</literal></link>. </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>type</acronym> GObject.Object][<acronym>nullable</acronym>]</emphasis></entry></row>
</tbody></tgroup></informaltable>
</refsect3><para role="since">Since: <link linkend="api-index-2.32">2.32</link></para></refsect2>
<refsect2 id="g-weak-ref-clear" role="function" condition="since:2.32">
<title>g_weak_ref_clear&#160;()</title>
<indexterm zone="g-weak-ref-clear" role="2.32"><primary sortas="weak_ref_clear">g_weak_ref_clear</primary></indexterm>
<programlisting language="C"><link linkend="void"><returnvalue>void</returnvalue></link>
g_weak_ref_clear (<parameter><link linkend="GWeakRef"><type>GWeakRef</type></link> *weak_ref</parameter>);</programlisting>
<para>Frees resources associated with a non-statically-allocated <link linkend="GWeakRef"><type>GWeakRef</type></link>.
After this call, the <link linkend="GWeakRef"><type>GWeakRef</type></link> is left in an undefined state.</para>
<para>You should only call this on a <link linkend="GWeakRef"><type>GWeakRef</type></link> that previously had
<link linkend="g-weak-ref-init"><function>g_weak_ref_init()</function></link> called on it.</para>

<para><emphasis role="annotation">[<acronym>skip</acronym>]</emphasis></para><refsect3 id="g-weak-ref-clear.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>weak_ref</para></entry>
<entry role="parameter_description"><para>location of a weak reference, which
may be empty. </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>inout</acronym>]</emphasis></entry></row>
</tbody></tgroup></informaltable>
</refsect3><para role="since">Since: <link linkend="api-index-2.32">2.32</link></para></refsect2>
<refsect2 id="g-weak-ref-get" role="function" condition="since:2.32">
<title>g_weak_ref_get&#160;()</title>
<indexterm zone="g-weak-ref-get" role="2.32"><primary sortas="weak_ref_get">g_weak_ref_get</primary></indexterm>
<programlisting language="C"><link linkend="gpointer"><returnvalue>gpointer</returnvalue></link>
g_weak_ref_get (<parameter><link linkend="GWeakRef"><type>GWeakRef</type></link> *weak_ref</parameter>);</programlisting>
<para>If <parameter>weak_ref</parameter>
 is not empty, atomically acquire a strong
reference to the object it points to, and return that reference.</para>
<para>This function is needed because of the potential race between taking
the pointer value and <link linkend="g-object-ref"><function>g_object_ref()</function></link> on it, if the object was losing
its last reference at the same time in a different thread.</para>
<para>The caller should release the resulting reference in the usual way,
by using <link linkend="g-object-unref"><function>g_object_unref()</function></link>.</para>

<para><emphasis role="annotation">[<acronym>skip</acronym>]</emphasis></para><refsect3 id="g-weak-ref-get.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>weak_ref</para></entry>
<entry role="parameter_description"><para>location of a weak reference to a <link linkend="GObject"><type>GObject</type></link>. </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>inout</acronym>]</emphasis></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-weak-ref-get.returns" role="returns">
<title>Returns</title>
<para>the object pointed to
by <parameter>weak_ref</parameter>
, or <link linkend="NULL:CAPS"><literal>NULL</literal></link> if it was empty. </para>
<para><emphasis role="annotation">[<acronym>transfer full</acronym>][<acronym>type</acronym> GObject.Object]</emphasis></para>
</refsect3><para role="since">Since: <link linkend="api-index-2.32">2.32</link></para></refsect2>
<refsect2 id="g-weak-ref-set" role="function" condition="since:2.32">
<title>g_weak_ref_set&#160;()</title>
<indexterm zone="g-weak-ref-set" role="2.32"><primary sortas="weak_ref_set">g_weak_ref_set</primary></indexterm>
<programlisting language="C"><link linkend="void"><returnvalue>void</returnvalue></link>
g_weak_ref_set (<parameter><link linkend="GWeakRef"><type>GWeakRef</type></link> *weak_ref</parameter>,
                <parameter><link linkend="gpointer"><type>gpointer</type></link> object</parameter>);</programlisting>
<para>Change the object to which <parameter>weak_ref</parameter>
 points, or set it to
<link linkend="NULL:CAPS"><literal>NULL</literal></link>.</para>
<para>You must own a strong reference on <parameter>object</parameter>
 while calling this
function.</para>

<para><emphasis role="annotation">[<acronym>skip</acronym>]</emphasis></para><refsect3 id="g-weak-ref-set.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>weak_ref</para></entry>
<entry role="parameter_description"><para>location for a weak reference</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>object</para></entry>
<entry role="parameter_description"><para>a <link linkend="GObject"><type>GObject</type></link> or <link linkend="NULL:CAPS"><literal>NULL</literal></link>. </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>type</acronym> GObject.Object][<acronym>nullable</acronym>]</emphasis></entry></row>
</tbody></tgroup></informaltable>
</refsect3><para role="since">Since: <link linkend="api-index-2.32">2.32</link></para></refsect2>
<refsect2 id="g-assert-finalize-object" role="function" condition="since:2.62">
<title>g_assert_finalize_object&#160;()</title>
<indexterm zone="g-assert-finalize-object" role="2.62"><primary sortas="assert_finalize_object">g_assert_finalize_object</primary></indexterm>
<programlisting language="C"><link linkend="void"><returnvalue>void</returnvalue></link>
g_assert_finalize_object (<parameter><link linkend="GObject"><type>GObject</type></link> *object</parameter>);</programlisting>
<para>Assert that <parameter>object</parameter>
 is non-<link linkend="NULL:CAPS"><literal>NULL</literal></link>, then release one reference to it with
<link linkend="g-object-unref"><function>g_object_unref()</function></link> and assert that it has been finalized (i.e. that there
are no more references).</para>
<para>If assertions are disabled via <literal>G_DISABLE_ASSERT</literal>,
this macro just calls <link linkend="g-object-unref"><function>g_object_unref()</function></link> without any further checks.</para>
<para>This macro should only be used in regression tests.</para>

<para><emphasis role="annotation">[<acronym>skip</acronym>]</emphasis></para><refsect3 id="g-assert-finalize-object.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>object</para></entry>
<entry role="parameter_description"><para>an object. </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>transfer full</acronym>][<acronym>type</acronym> GObject.Object]</emphasis></entry></row>
</tbody></tgroup></informaltable>
</refsect3><para role="since">Since: <link linkend="api-index-2.62">2.62</link></para></refsect2>

</refsect1>
<refsect1 id="gobject-The-Base-Object-Type.other_details" role="details">
<title role="details.title">Types and Values</title>
<refsect2 id="GObject-struct" role="struct">
<title>struct GObject</title>
<indexterm zone="GObject-struct"><primary sortas="Object">GObject</primary></indexterm>
<programlisting language="C">struct GObject;</programlisting>
<para>All the fields in the GObject structure are private

to the <link linkend="GObject"><type>GObject</type></link> implementation and should never be accessed directly.</para>
</refsect2>
<refsect2 id="GObjectClass" role="struct">
<title>struct GObjectClass</title>
<indexterm zone="GObjectClass"><primary sortas="ObjectClass">GObjectClass</primary></indexterm>
<programlisting language="C">struct GObjectClass {
  GTypeClass   g_type_class;

  /* seldom overridden */
  GObject*   (*constructor)     (GType                  type,
                                 guint                  n_construct_properties,
                                 GObjectConstructParam *construct_properties);
  /* overridable methods */
  void       (*set_property)		(GObject        *object,
                                         guint           property_id,
                                         const GValue   *value,
                                         GParamSpec     *pspec);
  void       (*get_property)		(GObject        *object,
                                         guint           property_id,
                                         GValue         *value,
                                         GParamSpec     *pspec);
  void       (*dispose)			(GObject        *object);
  void       (*finalize)		(GObject        *object);
  /* seldom overridden */
  void       (*dispatch_properties_changed) (GObject      *object,
					     guint	   n_pspecs,
					     GParamSpec  **pspecs);
  /* signals */
  void	     (*notify)			(GObject&#160;*object,
					 GParamSpec&#160;*pspec);

  /* called when done constructing */
  void	     (*constructed)		(GObject&#160;*object);
};
</programlisting>
<para>The class structure for the GObject type.</para>
<informalexample><programlisting role="example"><![CDATA[
// Example of implementing a singleton using a constructor.
static MySingleton *the_singleton = NULL;

static GObject*
my_singleton_constructor (GType                  type,
                          guint                  n_construct_params,
                          GObjectConstructParam *construct_params)
{
  GObject *object;

  if (!the_singleton)
    {
      object = G_OBJECT_CLASS (parent_class)->constructor (type,
                                                           n_construct_params,
                                                           construct_params);
      the_singleton = MY_SINGLETON (object);
    }
  else
    object = g_object_ref (G_OBJECT (the_singleton));

  return object;
}
]]></programlisting></informalexample>
<para></para>
<refsect3 id="GObjectClass.members" role="struct_members">
<title>Members</title>
<informaltable role="struct_members_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="struct_members_name" colwidth="300px"/>
<colspec colname="struct_members_description"/>
<colspec colname="struct_members_annotations" colwidth="200px"/>
<tbody>
<row role="member"><entry role="struct_member_name"><para><link linkend="GTypeClass"><type>GTypeClass</type></link>&#160;<structfield id="GObjectClass.g-type-class">g_type_class</structfield>;</para></entry>
<entry role="struct_member_description"><para>the parent class</para></entry>
<entry role="struct_member_annotations"></entry>
</row>
<row role="member"><entry role="struct_member_name"><para><structfield id="GObjectClass.constructor">constructor</structfield>&#160;()</para></entry>
<entry role="struct_member_description"><para>the <parameter>constructor</parameter>
function is called by <link linkend="g-object-new"><function>g_object_new()</function></link> to
complete the object initialization after all the construction properties are
set. The first thing a <parameter>constructor</parameter>
implementation must do is chain up to the
<parameter>constructor</parameter>
of the parent class. Overriding <parameter>constructor</parameter>
should be rarely
needed, e.g. to handle construct properties, or to implement singletons.</para></entry>
<entry role="struct_member_annotations"></entry>
</row>
<row role="member"><entry role="struct_member_name"><para><structfield id="GObjectClass.set-property">set_property</structfield>&#160;()</para></entry>
<entry role="struct_member_description"><para>the generic setter for all properties of this type. Should be
overridden for every type with properties. If implementations of
<parameter>set_property</parameter>
don't emit property change notification explicitly, this will
be done implicitly by the type system. However, if the notify signal is
emitted explicitly, the type system will not emit it a second time.</para></entry>
<entry role="struct_member_annotations"></entry>
</row>
<row role="member"><entry role="struct_member_name"><para><structfield id="GObjectClass.get-property">get_property</structfield>&#160;()</para></entry>
<entry role="struct_member_description"><para>the generic getter for all properties of this type. Should be
overridden for every type with properties.</para></entry>
<entry role="struct_member_annotations"></entry>
</row>
<row role="member"><entry role="struct_member_name"><para><structfield id="GObjectClass.dispose">dispose</structfield>&#160;()</para></entry>
<entry role="struct_member_description"><para>the <parameter>dispose</parameter>
function is supposed to drop all references to other
objects, but keep the instance otherwise intact, so that client method
invocations still work. It may be run multiple times (due to reference
loops). Before returning, <parameter>dispose</parameter>
should chain up to the <parameter>dispose</parameter>
method
of the parent class.</para></entry>
<entry role="struct_member_annotations"></entry>
</row>
<row role="member"><entry role="struct_member_name"><para><structfield id="GObjectClass.finalize">finalize</structfield>&#160;()</para></entry>
<entry role="struct_member_description"><para>instance finalization function, should finish the finalization of
the instance begun in <parameter>dispose</parameter>
and chain up to the <parameter>finalize</parameter>
method of the
parent class.</para></entry>
<entry role="struct_member_annotations"></entry>
</row>
<row role="member"><entry role="struct_member_name"><para><structfield id="GObjectClass.dispatch-properties-changed">dispatch_properties_changed</structfield>&#160;()</para></entry>
<entry role="struct_member_description"><para>emits property change notification for a bunch
of properties. Overriding <parameter>dispatch_properties_changed</parameter>
should be rarely
needed.</para></entry>
<entry role="struct_member_annotations"></entry>
</row>
<row role="member"><entry role="struct_member_name"><para><structfield id="GObjectClass.notify">notify</structfield>&#160;()</para></entry>
<entry role="struct_member_description"><para>the class closure for the notify signal</para></entry>
<entry role="struct_member_annotations"></entry>
</row>
<row role="member"><entry role="struct_member_name"><para><structfield id="GObjectClass.constructed">constructed</structfield>&#160;()</para></entry>
<entry role="struct_member_description"><para>the <parameter>constructed</parameter>
function is called by <link linkend="g-object-new"><function>g_object_new()</function></link> as the
final step of the object creation process.  At the point of the call, all
construction properties have been set on the object.  The purpose of this
call is to allow for object initialisation steps that can only be performed
after construction properties have been set.  <parameter>constructed</parameter>
implementors
should chain up to the <parameter>constructed</parameter>
call of their parent class to allow it
to complete its initialisation.</para></entry>
<entry role="struct_member_annotations"></entry>
</row>
</tbody></tgroup></informaltable>
</refsect3>
</refsect2>
<refsect2 id="GObjectConstructParam" role="struct">
<title>struct GObjectConstructParam</title>
<indexterm zone="GObjectConstructParam"><primary sortas="ObjectConstructParam">GObjectConstructParam</primary></indexterm>
<programlisting language="C">struct GObjectConstructParam {
  GParamSpec *pspec;
  GValue     *value;
};
</programlisting>
<para>The GObjectConstructParam struct is an auxiliary

structure used to hand <link linkend="GParamSpec"><type>GParamSpec</type></link>/<link linkend="GValue"><type>GValue</type></link> pairs to the <parameter>constructor</parameter>
 of
a <link linkend="GObjectClass"><type>GObjectClass</type></link>.</para>
<refsect3 id="GObjectConstructParam.members" role="struct_members">
<title>Members</title>
<informaltable role="struct_members_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="struct_members_name" colwidth="300px"/>
<colspec colname="struct_members_description"/>
<colspec colname="struct_members_annotations" colwidth="200px"/>
<tbody>
<row role="member"><entry role="struct_member_name"><para><link linkend="GParamSpec"><type>GParamSpec</type></link>&#160;*<structfield id="GObjectConstructParam.pspec">pspec</structfield>;</para></entry>
<entry role="struct_member_description"><para>the <link linkend="GParamSpec"><type>GParamSpec</type></link> of the construct parameter</para></entry>
<entry role="struct_member_annotations"></entry>
</row>
<row role="member"><entry role="struct_member_name"><para><link linkend="GValue"><type>GValue</type></link>&#160;*<structfield id="GObjectConstructParam.value">value</structfield>;</para></entry>
<entry role="struct_member_description"><para>the value to set the parameter to</para></entry>
<entry role="struct_member_annotations"></entry>
</row>
</tbody></tgroup></informaltable>
</refsect3>
</refsect2>
<refsect2 id="GParameter" role="struct" condition="deprecated:2.54: This type is not introspectable.">
<title>struct GParameter</title>
<indexterm zone="GParameter" role="deprecated"><primary sortas="Parameter">GParameter</primary></indexterm>
<programlisting language="C">struct GParameter {
  const gchar *name;
  GValue       value;
};
</programlisting>
<warning><para><literal>GParameter</literal> has been deprecated since version 2.54 and should not be used in newly-written code.</para> <para>This type is not introspectable.</para>
</warning>
<para>The GParameter struct is an auxiliary structure used
to hand parameter name/value pairs to <link linkend="g-object-newv"><function>g_object_newv()</function></link>.</para>
<refsect3 id="GParameter.members" role="struct_members">
<title>Members</title>
<informaltable role="struct_members_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="struct_members_name" colwidth="300px"/>
<colspec colname="struct_members_description"/>
<colspec colname="struct_members_annotations" colwidth="200px"/>
<tbody>
<row role="member"><entry role="struct_member_name"><para>const&#160;<link linkend="gchar"><type>gchar</type></link>&#160;*<structfield id="GParameter.name">name</structfield>;</para></entry>
<entry role="struct_member_description"><para>the parameter name</para></entry>
<entry role="struct_member_annotations"></entry>
</row>
<row role="member"><entry role="struct_member_name"><para><link linkend="GValue"><type>GValue</type></link>&#160;<structfield id="GParameter.value">value</structfield>;</para></entry>
<entry role="struct_member_description"><para>the parameter value</para></entry>
<entry role="struct_member_annotations"></entry>
</row>
</tbody></tgroup></informaltable>
</refsect3>
</refsect2>
<refsect2 id="GInitiallyUnowned" role="typedef">
<title>GInitiallyUnowned</title>
<indexterm zone="GInitiallyUnowned"><primary sortas="InitiallyUnowned">GInitiallyUnowned</primary></indexterm>
<programlisting language="C">typedef struct _GObject                  GInitiallyUnowned;
</programlisting>
<para>All the fields in the GInitiallyUnowned structure

are private to the <link linkend="GInitiallyUnowned"><type>GInitiallyUnowned</type></link> implementation and should never be

accessed directly.</para>
</refsect2>
<refsect2 id="GInitiallyUnownedClass" role="typedef">
<title>GInitiallyUnownedClass</title>
<indexterm zone="GInitiallyUnownedClass"><primary sortas="InitiallyUnownedClass">GInitiallyUnownedClass</primary></indexterm>
<programlisting language="C">typedef struct _GObjectClass             GInitiallyUnownedClass;
</programlisting>
<para>The class structure for the GInitiallyUnowned type.</para>
</refsect2>
<refsect2 id="G-TYPE-INITIALLY-UNOWNED:CAPS" role="macro">
<title>G_TYPE_INITIALLY_UNOWNED</title>
<indexterm zone="G-TYPE-INITIALLY-UNOWNED:CAPS"><primary sortas="TYPE_INITIALLY_UNOWNED">G_TYPE_INITIALLY_UNOWNED</primary></indexterm>
<programlisting language="C">#define G_TYPE_INITIALLY_UNOWNED	      (g_initially_unowned_get_type())
</programlisting>
<para>The type for <link linkend="GInitiallyUnowned"><type>GInitiallyUnowned</type></link>.</para>
</refsect2>
<refsect2 id="GWeakRef" role="struct">
<title>GWeakRef</title>
<indexterm zone="GWeakRef"><primary sortas="WeakRef">GWeakRef</primary></indexterm>
<programlisting language="C">typedef struct {
} GWeakRef;
</programlisting>
<para>A structure containing a weak reference to a <link linkend="GObject"><type>GObject</type></link>.  It can either
be empty (i.e. point to <link linkend="NULL:CAPS"><literal>NULL</literal></link>), or point to an object for as long as
at least one "strong" reference to that object exists. Before the
object's <link linkend="GObjectClass.dispose"><type>GObjectClass.dispose</type></link> method is called, every <link linkend="GWeakRef"><type>GWeakRef</type></link>
associated with becomes empty (i.e. points to <link linkend="NULL:CAPS"><literal>NULL</literal></link>).</para>
<para>Like <link linkend="GValue"><type>GValue</type></link>, <link linkend="GWeakRef"><type>GWeakRef</type></link> can be statically allocated, stack- or
heap-allocated, or embedded in larger structures.</para>
<para>Unlike <link linkend="g-object-weak-ref"><function>g_object_weak_ref()</function></link> and <link linkend="g-object-add-weak-pointer"><function>g_object_add_weak_pointer()</function></link>, this weak
reference is thread-safe: converting a weak pointer to a reference is
atomic with respect to invalidation of weak pointers to destroyed
objects.</para>
<para>If the object's <link linkend="GObjectClass.dispose"><type>GObjectClass.dispose</type></link> method results in additional
references to the object being held, any <link linkend="GWeakRefs"><type>GWeakRefs</type></link> taken
before it was disposed will continue to point to <link linkend="NULL:CAPS"><literal>NULL</literal></link>.  If
<link linkend="GWeakRefs"><type>GWeakRefs</type></link> are taken after the object is disposed and
re-referenced, they will continue to point to it until its refcount
goes back to zero, at which point they too will be invalidated.</para>
</refsect2>

</refsect1>
<refsect1 id="gobject-The-Base-Object-Type.signal-details" role="signals">
<title role="signals.title">Signal Details</title>
<refsect2 id="GObject-notify" role="signal"><title>The <literal>“notify”</literal> signal</title>
<indexterm zone="GObject-notify"><primary sortas="Object::notify">GObject::notify</primary></indexterm>
<programlisting language="C"><link linkend="void"><returnvalue>void</returnvalue></link>
user_function (<link linkend="GObject"><type>GObject</type></link>    *gobject,
               <link linkend="GParamSpec"><type>GParamSpec</type></link> *pspec,
               <link linkend="gpointer"><type>gpointer</type></link>    user_data)</programlisting>
<para>The notify signal is emitted on an object when one of its properties has
its value set through <link linkend="g-object-set-property"><function>g_object_set_property()</function></link>, <link linkend="g-object-set"><function>g_object_set()</function></link>, et al.</para>
<para>Note that getting this signal doesn’t itself guarantee that the value of
the property has actually changed. When it is emitted is determined by the
derived GObject class. If the implementor did not create the property with
<link linkend="G-PARAM-EXPLICIT-NOTIFY:CAPS"><literal>G_PARAM_EXPLICIT_NOTIFY</literal></link>, then any call to <link linkend="g-object-set-property"><function>g_object_set_property()</function></link> results
in ::notify being emitted, even if the new value is the same as the old.
If they did pass <link linkend="G-PARAM-EXPLICIT-NOTIFY:CAPS"><literal>G_PARAM_EXPLICIT_NOTIFY</literal></link>, then this signal is emitted only
when they explicitly call <link linkend="g-object-notify"><function>g_object_notify()</function></link> or <link linkend="g-object-notify-by-pspec"><function>g_object_notify_by_pspec()</function></link>,
and common practice is to do that only when the value has actually changed.</para>
<para>This signal is typically used to obtain change notification for a
single property, by specifying the property name as a detail in the
<link linkend="g-signal-connect"><function>g_signal_connect()</function></link> call, like this:</para>
<informalexample><programlisting role="example"><![CDATA[
g_signal_connect (text_view->buffer, "notify::paste-target-list",
                  G_CALLBACK (gtk_text_view_target_list_notify),
                  text_view)
]]></programlisting></informalexample>
<para>
It is important to note that you must use
<link linkend="canonical-parameter-names">canonical parameter names</link> as
detail strings for the notify signal.</para>
<refsect3 id="GObject-notify.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>gobject</para></entry>
<entry role="parameter_description"><para>the object which received the signal.</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>pspec</para></entry>
<entry role="parameter_description"><para>the <link linkend="GParamSpec"><type>GParamSpec</type></link> of the property which changed.</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><simpara>user_data</simpara></entry>
<entry role="parameter_description"><simpara>user data set when the signal handler was connected.</simpara></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><para>Flags: <link linkend="G-SIGNAL-NO-HOOKS:CAPS">No Hooks</link></para>
</refsect2>
</refsect1>
<refsect1 id="gobject-The-Base-Object-Type.see-also">
<title>See Also</title>
<para><link linkend="GParamSpecObject"><type>GParamSpecObject</type></link>, <link linkend="g-param-spec-object"><function>g_param_spec_object()</function></link></para>

</refsect1>

</refentry>
