| <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> |
| <html> |
| <head> |
| <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> |
| <title>GObject: GObject Reference Manual</title> |
| <meta name="generator" content="DocBook XSL Stylesheets V1.79.1"> |
| <link rel="home" href="index.html" title="GObject Reference Manual"> |
| <link rel="up" href="rn01.html" title="API Reference"> |
| <link rel="prev" href="GTypeModule.html" title="GTypeModule"> |
| <link rel="next" href="gobject-Enumeration-and-Flag-Types.html" title="Enumeration and Flag Types"> |
| <meta name="generator" content="GTK-Doc V1.25.1 (XML mode)"> |
| <link rel="stylesheet" href="style.css" type="text/css"> |
| </head> |
| <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"> |
| <table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="5"><tr valign="middle"> |
| <td width="100%" align="left" class="shortcuts"> |
| <a href="#" class="shortcut">Top</a><span id="nav_description"> <span class="dim">|</span> |
| <a href="#gobject-The-Base-Object-Type.description" class="shortcut">Description</a></span><span id="nav_hierarchy"> <span class="dim">|</span> |
| <a href="#gobject-The-Base-Object-Type.object-hierarchy" class="shortcut">Object Hierarchy</a></span><span id="nav_signals"> <span class="dim">|</span> |
| <a href="#gobject-The-Base-Object-Type.signals" class="shortcut">Signals</a></span> |
| </td> |
| <td><a accesskey="h" href="index.html"><img src="home.png" width="16" height="16" border="0" alt="Home"></a></td> |
| <td><a accesskey="u" href="rn01.html"><img src="up.png" width="16" height="16" border="0" alt="Up"></a></td> |
| <td><a accesskey="p" href="GTypeModule.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td> |
| <td><a accesskey="n" href="gobject-Enumeration-and-Flag-Types.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td> |
| </tr></table> |
| <div class="refentry"> |
| <a name="gobject-The-Base-Object-Type"></a><div class="titlepage"></div> |
| <div class="refnamediv"><table width="100%"><tr> |
| <td valign="top"> |
| <h2><span class="refentrytitle"><a name="gobject-The-Base-Object-Type.top_of_page"></a>GObject</span></h2> |
| <p>GObject — The base object type</p> |
| </td> |
| <td class="gallery_image" valign="top" align="right"></td> |
| </tr></table></div> |
| <div class="refsect1"> |
| <a name="gobject-The-Base-Object-Type.functions"></a><h2>Functions</h2> |
| <div class="informaltable"><table class="informaltable" width="100%" border="0"> |
| <colgroup> |
| <col width="150px" class="functions_return"> |
| <col class="functions_name"> |
| </colgroup> |
| <tbody> |
| <tr> |
| <td class="function_type"> |
| <span class="returnvalue">void</span> |
| </td> |
| <td class="function_name"> |
| <span class="c_punctuation">(</span><a class="link" href="gobject-The-Base-Object-Type.html#GObjectGetPropertyFunc" title="GObjectGetPropertyFunc ()">*GObjectGetPropertyFunc</a><span class="c_punctuation">)</span> <span class="c_punctuation">()</span> |
| </td> |
| </tr> |
| <tr> |
| <td class="function_type"> |
| <span class="returnvalue">void</span> |
| </td> |
| <td class="function_name"> |
| <span class="c_punctuation">(</span><a class="link" href="gobject-The-Base-Object-Type.html#GObjectSetPropertyFunc" title="GObjectSetPropertyFunc ()">*GObjectSetPropertyFunc</a><span class="c_punctuation">)</span> <span class="c_punctuation">()</span> |
| </td> |
| </tr> |
| <tr> |
| <td class="function_type"> |
| <span class="returnvalue">void</span> |
| </td> |
| <td class="function_name"> |
| <span class="c_punctuation">(</span><a class="link" href="gobject-The-Base-Object-Type.html#GObjectFinalizeFunc" title="GObjectFinalizeFunc ()">*GObjectFinalizeFunc</a><span class="c_punctuation">)</span> <span class="c_punctuation">()</span> |
| </td> |
| </tr> |
| <tr> |
| <td class="define_keyword">#define</td> |
| <td class="function_name"> |
| <a class="link" href="gobject-The-Base-Object-Type.html#G-TYPE-IS-OBJECT:CAPS" title="G_TYPE_IS_OBJECT()">G_TYPE_IS_OBJECT</a><span class="c_punctuation">()</span> |
| </td> |
| </tr> |
| <tr> |
| <td class="define_keyword">#define</td> |
| <td class="function_name"> |
| <a class="link" href="gobject-The-Base-Object-Type.html#G-OBJECT:CAPS" title="G_OBJECT()">G_OBJECT</a><span class="c_punctuation">()</span> |
| </td> |
| </tr> |
| <tr> |
| <td class="define_keyword">#define</td> |
| <td class="function_name"> |
| <a class="link" href="gobject-The-Base-Object-Type.html#G-IS-OBJECT:CAPS" title="G_IS_OBJECT()">G_IS_OBJECT</a><span class="c_punctuation">()</span> |
| </td> |
| </tr> |
| <tr> |
| <td class="define_keyword">#define</td> |
| <td class="function_name"> |
| <a class="link" href="gobject-The-Base-Object-Type.html#G-OBJECT-CLASS:CAPS" title="G_OBJECT_CLASS()">G_OBJECT_CLASS</a><span class="c_punctuation">()</span> |
| </td> |
| </tr> |
| <tr> |
| <td class="define_keyword">#define</td> |
| <td class="function_name"> |
| <a class="link" href="gobject-The-Base-Object-Type.html#G-IS-OBJECT-CLASS:CAPS" title="G_IS_OBJECT_CLASS()">G_IS_OBJECT_CLASS</a><span class="c_punctuation">()</span> |
| </td> |
| </tr> |
| <tr> |
| <td class="define_keyword">#define</td> |
| <td class="function_name"> |
| <a class="link" href="gobject-The-Base-Object-Type.html#G-OBJECT-GET-CLASS:CAPS" title="G_OBJECT_GET_CLASS()">G_OBJECT_GET_CLASS</a><span class="c_punctuation">()</span> |
| </td> |
| </tr> |
| <tr> |
| <td class="define_keyword">#define</td> |
| <td class="function_name"> |
| <a class="link" href="gobject-The-Base-Object-Type.html#G-OBJECT-TYPE:CAPS" title="G_OBJECT_TYPE()">G_OBJECT_TYPE</a><span class="c_punctuation">()</span> |
| </td> |
| </tr> |
| <tr> |
| <td class="define_keyword">#define</td> |
| <td class="function_name"> |
| <a class="link" href="gobject-The-Base-Object-Type.html#G-OBJECT-TYPE-NAME:CAPS" title="G_OBJECT_TYPE_NAME()">G_OBJECT_TYPE_NAME</a><span class="c_punctuation">()</span> |
| </td> |
| </tr> |
| <tr> |
| <td class="define_keyword">#define</td> |
| <td class="function_name"> |
| <a class="link" href="gobject-The-Base-Object-Type.html#G-OBJECT-CLASS-TYPE:CAPS" title="G_OBJECT_CLASS_TYPE()">G_OBJECT_CLASS_TYPE</a><span class="c_punctuation">()</span> |
| </td> |
| </tr> |
| <tr> |
| <td class="define_keyword">#define</td> |
| <td class="function_name"> |
| <a class="link" href="gobject-The-Base-Object-Type.html#G-OBJECT-CLASS-NAME:CAPS" title="G_OBJECT_CLASS_NAME()">G_OBJECT_CLASS_NAME</a><span class="c_punctuation">()</span> |
| </td> |
| </tr> |
| <tr> |
| <td class="function_type"> |
| <span class="returnvalue">void</span> |
| </td> |
| <td class="function_name"> |
| <a class="link" href="gobject-The-Base-Object-Type.html#g-object-class-install-property" title="g_object_class_install_property ()">g_object_class_install_property</a> <span class="c_punctuation">()</span> |
| </td> |
| </tr> |
| <tr> |
| <td class="function_type"> |
| <span class="returnvalue">void</span> |
| </td> |
| <td class="function_name"> |
| <a class="link" href="gobject-The-Base-Object-Type.html#g-object-class-install-properties" title="g_object_class_install_properties ()">g_object_class_install_properties</a> <span class="c_punctuation">()</span> |
| </td> |
| </tr> |
| <tr> |
| <td class="function_type"> |
| <a class="link" href="gobject-GParamSpec.html#GParamSpec" title="struct GParamSpec"><span class="returnvalue">GParamSpec</span></a> * |
| </td> |
| <td class="function_name"> |
| <a class="link" href="gobject-The-Base-Object-Type.html#g-object-class-find-property" title="g_object_class_find_property ()">g_object_class_find_property</a> <span class="c_punctuation">()</span> |
| </td> |
| </tr> |
| <tr> |
| <td class="function_type"> |
| <a class="link" href="gobject-GParamSpec.html#GParamSpec" title="struct GParamSpec"><span class="returnvalue">GParamSpec</span></a> ** |
| </td> |
| <td class="function_name"> |
| <a class="link" href="gobject-The-Base-Object-Type.html#g-object-class-list-properties" title="g_object_class_list_properties ()">g_object_class_list_properties</a> <span class="c_punctuation">()</span> |
| </td> |
| </tr> |
| <tr> |
| <td class="function_type"> |
| <span class="returnvalue">void</span> |
| </td> |
| <td class="function_name"> |
| <a class="link" href="gobject-The-Base-Object-Type.html#g-object-class-override-property" title="g_object_class_override_property ()">g_object_class_override_property</a> <span class="c_punctuation">()</span> |
| </td> |
| </tr> |
| <tr> |
| <td class="function_type"> |
| <span class="returnvalue">void</span> |
| </td> |
| <td class="function_name"> |
| <a class="link" href="gobject-The-Base-Object-Type.html#g-object-interface-install-property" title="g_object_interface_install_property ()">g_object_interface_install_property</a> <span class="c_punctuation">()</span> |
| </td> |
| </tr> |
| <tr> |
| <td class="function_type"> |
| <a class="link" href="gobject-GParamSpec.html#GParamSpec" title="struct GParamSpec"><span class="returnvalue">GParamSpec</span></a> * |
| </td> |
| <td class="function_name"> |
| <a class="link" href="gobject-The-Base-Object-Type.html#g-object-interface-find-property" title="g_object_interface_find_property ()">g_object_interface_find_property</a> <span class="c_punctuation">()</span> |
| </td> |
| </tr> |
| <tr> |
| <td class="function_type"> |
| <a class="link" href="gobject-GParamSpec.html#GParamSpec" title="struct GParamSpec"><span class="returnvalue">GParamSpec</span></a> ** |
| </td> |
| <td class="function_name"> |
| <a class="link" href="gobject-The-Base-Object-Type.html#g-object-interface-list-properties" title="g_object_interface_list_properties ()">g_object_interface_list_properties</a> <span class="c_punctuation">()</span> |
| </td> |
| </tr> |
| <tr> |
| <td class="function_type"> |
| <a href="../glib-Basic-Types.html#gpointer"><span class="returnvalue">gpointer</span></a> |
| </td> |
| <td class="function_name"> |
| <a class="link" href="gobject-The-Base-Object-Type.html#g-object-new" title="g_object_new ()">g_object_new</a> <span class="c_punctuation">()</span> |
| </td> |
| </tr> |
| <tr> |
| <td class="function_type"> |
| <a href="../glib-Basic-Types.html#gpointer"><span class="returnvalue">gpointer</span></a> |
| </td> |
| <td class="function_name"> |
| <a class="link" href="gobject-The-Base-Object-Type.html#g-object-newv" title="g_object_newv ()">g_object_newv</a> <span class="c_punctuation">()</span> |
| </td> |
| </tr> |
| <tr> |
| <td class="function_type"> |
| <a href="../glib-Basic-Types.html#gpointer"><span class="returnvalue">gpointer</span></a> |
| </td> |
| <td class="function_name"> |
| <a class="link" href="gobject-The-Base-Object-Type.html#g-object-ref" title="g_object_ref ()">g_object_ref</a> <span class="c_punctuation">()</span> |
| </td> |
| </tr> |
| <tr> |
| <td class="function_type"> |
| <span class="returnvalue">void</span> |
| </td> |
| <td class="function_name"> |
| <a class="link" href="gobject-The-Base-Object-Type.html#g-object-unref" title="g_object_unref ()">g_object_unref</a> <span class="c_punctuation">()</span> |
| </td> |
| </tr> |
| <tr> |
| <td class="function_type"> |
| <a href="../glib-Basic-Types.html#gpointer"><span class="returnvalue">gpointer</span></a> |
| </td> |
| <td class="function_name"> |
| <a class="link" href="gobject-The-Base-Object-Type.html#g-object-ref-sink" title="g_object_ref_sink ()">g_object_ref_sink</a> <span class="c_punctuation">()</span> |
| </td> |
| </tr> |
| <tr> |
| <td class="define_keyword">#define</td> |
| <td class="function_name"> |
| <a class="link" href="gobject-The-Base-Object-Type.html#g-set-object" title="g_set_object()">g_set_object</a><span class="c_punctuation">()</span> |
| </td> |
| </tr> |
| <tr> |
| <td class="function_type"> |
| <span class="returnvalue">void</span> |
| </td> |
| <td class="function_name"> |
| <a class="link" href="gobject-The-Base-Object-Type.html#g-clear-object" title="g_clear_object ()">g_clear_object</a> <span class="c_punctuation">()</span> |
| </td> |
| </tr> |
| <tr> |
| <td class="function_type"> |
| <a href="../glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a> |
| </td> |
| <td class="function_name"> |
| <a class="link" href="gobject-The-Base-Object-Type.html#g-object-is-floating" title="g_object_is_floating ()">g_object_is_floating</a> <span class="c_punctuation">()</span> |
| </td> |
| </tr> |
| <tr> |
| <td class="function_type"> |
| <span class="returnvalue">void</span> |
| </td> |
| <td class="function_name"> |
| <a class="link" href="gobject-The-Base-Object-Type.html#g-object-force-floating" title="g_object_force_floating ()">g_object_force_floating</a> <span class="c_punctuation">()</span> |
| </td> |
| </tr> |
| <tr> |
| <td class="function_type"> |
| <span class="returnvalue">void</span> |
| </td> |
| <td class="function_name"> |
| <span class="c_punctuation">(</span><a class="link" href="gobject-The-Base-Object-Type.html#GWeakNotify" title="GWeakNotify ()">*GWeakNotify</a><span class="c_punctuation">)</span> <span class="c_punctuation">()</span> |
| </td> |
| </tr> |
| <tr> |
| <td class="function_type"> |
| <span class="returnvalue">void</span> |
| </td> |
| <td class="function_name"> |
| <a class="link" href="gobject-The-Base-Object-Type.html#g-object-weak-ref" title="g_object_weak_ref ()">g_object_weak_ref</a> <span class="c_punctuation">()</span> |
| </td> |
| </tr> |
| <tr> |
| <td class="function_type"> |
| <span class="returnvalue">void</span> |
| </td> |
| <td class="function_name"> |
| <a class="link" href="gobject-The-Base-Object-Type.html#g-object-weak-unref" title="g_object_weak_unref ()">g_object_weak_unref</a> <span class="c_punctuation">()</span> |
| </td> |
| </tr> |
| <tr> |
| <td class="function_type"> |
| <span class="returnvalue">void</span> |
| </td> |
| <td class="function_name"> |
| <a class="link" href="gobject-The-Base-Object-Type.html#g-object-add-weak-pointer" title="g_object_add_weak_pointer ()">g_object_add_weak_pointer</a> <span class="c_punctuation">()</span> |
| </td> |
| </tr> |
| <tr> |
| <td class="function_type"> |
| <span class="returnvalue">void</span> |
| </td> |
| <td class="function_name"> |
| <a class="link" href="gobject-The-Base-Object-Type.html#g-object-remove-weak-pointer" title="g_object_remove_weak_pointer ()">g_object_remove_weak_pointer</a> <span class="c_punctuation">()</span> |
| </td> |
| </tr> |
| <tr> |
| <td class="function_type"> |
| <span class="returnvalue">void</span> |
| </td> |
| <td class="function_name"> |
| <span class="c_punctuation">(</span><a class="link" href="gobject-The-Base-Object-Type.html#GToggleNotify" title="GToggleNotify ()">*GToggleNotify</a><span class="c_punctuation">)</span> <span class="c_punctuation">()</span> |
| </td> |
| </tr> |
| <tr> |
| <td class="function_type"> |
| <span class="returnvalue">void</span> |
| </td> |
| <td class="function_name"> |
| <a class="link" href="gobject-The-Base-Object-Type.html#g-object-add-toggle-ref" title="g_object_add_toggle_ref ()">g_object_add_toggle_ref</a> <span class="c_punctuation">()</span> |
| </td> |
| </tr> |
| <tr> |
| <td class="function_type"> |
| <span class="returnvalue">void</span> |
| </td> |
| <td class="function_name"> |
| <a class="link" href="gobject-The-Base-Object-Type.html#g-object-remove-toggle-ref" title="g_object_remove_toggle_ref ()">g_object_remove_toggle_ref</a> <span class="c_punctuation">()</span> |
| </td> |
| </tr> |
| <tr> |
| <td class="function_type"> |
| <a href="../glib-Basic-Types.html#gpointer"><span class="returnvalue">gpointer</span></a> |
| </td> |
| <td class="function_name"> |
| <a class="link" href="gobject-The-Base-Object-Type.html#g-object-connect" title="g_object_connect ()">g_object_connect</a> <span class="c_punctuation">()</span> |
| </td> |
| </tr> |
| <tr> |
| <td class="function_type"> |
| <span class="returnvalue">void</span> |
| </td> |
| <td class="function_name"> |
| <a class="link" href="gobject-The-Base-Object-Type.html#g-object-disconnect" title="g_object_disconnect ()">g_object_disconnect</a> <span class="c_punctuation">()</span> |
| </td> |
| </tr> |
| <tr> |
| <td class="function_type"> |
| <span class="returnvalue">void</span> |
| </td> |
| <td class="function_name"> |
| <a class="link" href="gobject-The-Base-Object-Type.html#g-object-set" title="g_object_set ()">g_object_set</a> <span class="c_punctuation">()</span> |
| </td> |
| </tr> |
| <tr> |
| <td class="function_type"> |
| <span class="returnvalue">void</span> |
| </td> |
| <td class="function_name"> |
| <a class="link" href="gobject-The-Base-Object-Type.html#g-object-get" title="g_object_get ()">g_object_get</a> <span class="c_punctuation">()</span> |
| </td> |
| </tr> |
| <tr> |
| <td class="function_type"> |
| <span class="returnvalue">void</span> |
| </td> |
| <td class="function_name"> |
| <a class="link" href="gobject-The-Base-Object-Type.html#g-object-notify" title="g_object_notify ()">g_object_notify</a> <span class="c_punctuation">()</span> |
| </td> |
| </tr> |
| <tr> |
| <td class="function_type"> |
| <span class="returnvalue">void</span> |
| </td> |
| <td class="function_name"> |
| <a class="link" href="gobject-The-Base-Object-Type.html#g-object-notify-by-pspec" title="g_object_notify_by_pspec ()">g_object_notify_by_pspec</a> <span class="c_punctuation">()</span> |
| </td> |
| </tr> |
| <tr> |
| <td class="function_type"> |
| <span class="returnvalue">void</span> |
| </td> |
| <td class="function_name"> |
| <a class="link" href="gobject-The-Base-Object-Type.html#g-object-freeze-notify" title="g_object_freeze_notify ()">g_object_freeze_notify</a> <span class="c_punctuation">()</span> |
| </td> |
| </tr> |
| <tr> |
| <td class="function_type"> |
| <span class="returnvalue">void</span> |
| </td> |
| <td class="function_name"> |
| <a class="link" href="gobject-The-Base-Object-Type.html#g-object-thaw-notify" title="g_object_thaw_notify ()">g_object_thaw_notify</a> <span class="c_punctuation">()</span> |
| </td> |
| </tr> |
| <tr> |
| <td class="function_type"> |
| <a href="../glib-Basic-Types.html#gpointer"><span class="returnvalue">gpointer</span></a> |
| </td> |
| <td class="function_name"> |
| <a class="link" href="gobject-The-Base-Object-Type.html#g-object-get-data" title="g_object_get_data ()">g_object_get_data</a> <span class="c_punctuation">()</span> |
| </td> |
| </tr> |
| <tr> |
| <td class="function_type"> |
| <span class="returnvalue">void</span> |
| </td> |
| <td class="function_name"> |
| <a class="link" href="gobject-The-Base-Object-Type.html#g-object-set-data" title="g_object_set_data ()">g_object_set_data</a> <span class="c_punctuation">()</span> |
| </td> |
| </tr> |
| <tr> |
| <td class="function_type"> |
| <span class="returnvalue">void</span> |
| </td> |
| <td class="function_name"> |
| <a class="link" href="gobject-The-Base-Object-Type.html#g-object-set-data-full" title="g_object_set_data_full ()">g_object_set_data_full</a> <span class="c_punctuation">()</span> |
| </td> |
| </tr> |
| <tr> |
| <td class="function_type"> |
| <a href="../glib-Basic-Types.html#gpointer"><span class="returnvalue">gpointer</span></a> |
| </td> |
| <td class="function_name"> |
| <a class="link" href="gobject-The-Base-Object-Type.html#g-object-steal-data" title="g_object_steal_data ()">g_object_steal_data</a> <span class="c_punctuation">()</span> |
| </td> |
| </tr> |
| <tr> |
| <td class="function_type"> |
| <a href="../glib-Basic-Types.html#gpointer"><span class="returnvalue">gpointer</span></a> |
| </td> |
| <td class="function_name"> |
| <a class="link" href="gobject-The-Base-Object-Type.html#g-object-dup-data" title="g_object_dup_data ()">g_object_dup_data</a> <span class="c_punctuation">()</span> |
| </td> |
| </tr> |
| <tr> |
| <td class="function_type"> |
| <a href="../glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a> |
| </td> |
| <td class="function_name"> |
| <a class="link" href="gobject-The-Base-Object-Type.html#g-object-replace-data" title="g_object_replace_data ()">g_object_replace_data</a> <span class="c_punctuation">()</span> |
| </td> |
| </tr> |
| <tr> |
| <td class="function_type"> |
| <a href="../glib-Basic-Types.html#gpointer"><span class="returnvalue">gpointer</span></a> |
| </td> |
| <td class="function_name"> |
| <a class="link" href="gobject-The-Base-Object-Type.html#g-object-get-qdata" title="g_object_get_qdata ()">g_object_get_qdata</a> <span class="c_punctuation">()</span> |
| </td> |
| </tr> |
| <tr> |
| <td class="function_type"> |
| <span class="returnvalue">void</span> |
| </td> |
| <td class="function_name"> |
| <a class="link" href="gobject-The-Base-Object-Type.html#g-object-set-qdata" title="g_object_set_qdata ()">g_object_set_qdata</a> <span class="c_punctuation">()</span> |
| </td> |
| </tr> |
| <tr> |
| <td class="function_type"> |
| <span class="returnvalue">void</span> |
| </td> |
| <td class="function_name"> |
| <a class="link" href="gobject-The-Base-Object-Type.html#g-object-set-qdata-full" title="g_object_set_qdata_full ()">g_object_set_qdata_full</a> <span class="c_punctuation">()</span> |
| </td> |
| </tr> |
| <tr> |
| <td class="function_type"> |
| <a href="../glib-Basic-Types.html#gpointer"><span class="returnvalue">gpointer</span></a> |
| </td> |
| <td class="function_name"> |
| <a class="link" href="gobject-The-Base-Object-Type.html#g-object-steal-qdata" title="g_object_steal_qdata ()">g_object_steal_qdata</a> <span class="c_punctuation">()</span> |
| </td> |
| </tr> |
| <tr> |
| <td class="function_type"> |
| <a href="../glib-Basic-Types.html#gpointer"><span class="returnvalue">gpointer</span></a> |
| </td> |
| <td class="function_name"> |
| <a class="link" href="gobject-The-Base-Object-Type.html#g-object-dup-qdata" title="g_object_dup_qdata ()">g_object_dup_qdata</a> <span class="c_punctuation">()</span> |
| </td> |
| </tr> |
| <tr> |
| <td class="function_type"> |
| <a href="../glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a> |
| </td> |
| <td class="function_name"> |
| <a class="link" href="gobject-The-Base-Object-Type.html#g-object-replace-qdata" title="g_object_replace_qdata ()">g_object_replace_qdata</a> <span class="c_punctuation">()</span> |
| </td> |
| </tr> |
| <tr> |
| <td class="function_type"> |
| <span class="returnvalue">void</span> |
| </td> |
| <td class="function_name"> |
| <a class="link" href="gobject-The-Base-Object-Type.html#g-object-set-property" title="g_object_set_property ()">g_object_set_property</a> <span class="c_punctuation">()</span> |
| </td> |
| </tr> |
| <tr> |
| <td class="function_type"> |
| <span class="returnvalue">void</span> |
| </td> |
| <td class="function_name"> |
| <a class="link" href="gobject-The-Base-Object-Type.html#g-object-get-property" title="g_object_get_property ()">g_object_get_property</a> <span class="c_punctuation">()</span> |
| </td> |
| </tr> |
| <tr> |
| <td class="function_type"> |
| <a class="link" href="gobject-The-Base-Object-Type.html#GObject"><span class="returnvalue">GObject</span></a> * |
| </td> |
| <td class="function_name"> |
| <a class="link" href="gobject-The-Base-Object-Type.html#g-object-new-valist" title="g_object_new_valist ()">g_object_new_valist</a> <span class="c_punctuation">()</span> |
| </td> |
| </tr> |
| <tr> |
| <td class="function_type"> |
| <span class="returnvalue">void</span> |
| </td> |
| <td class="function_name"> |
| <a class="link" href="gobject-The-Base-Object-Type.html#g-object-set-valist" title="g_object_set_valist ()">g_object_set_valist</a> <span class="c_punctuation">()</span> |
| </td> |
| </tr> |
| <tr> |
| <td class="function_type"> |
| <span class="returnvalue">void</span> |
| </td> |
| <td class="function_name"> |
| <a class="link" href="gobject-The-Base-Object-Type.html#g-object-get-valist" title="g_object_get_valist ()">g_object_get_valist</a> <span class="c_punctuation">()</span> |
| </td> |
| </tr> |
| <tr> |
| <td class="function_type"> |
| <span class="returnvalue">void</span> |
| </td> |
| <td class="function_name"> |
| <a class="link" href="gobject-The-Base-Object-Type.html#g-object-watch-closure" title="g_object_watch_closure ()">g_object_watch_closure</a> <span class="c_punctuation">()</span> |
| </td> |
| </tr> |
| <tr> |
| <td class="function_type"> |
| <span class="returnvalue">void</span> |
| </td> |
| <td class="function_name"> |
| <a class="link" href="gobject-The-Base-Object-Type.html#g-object-run-dispose" title="g_object_run_dispose ()">g_object_run_dispose</a> <span class="c_punctuation">()</span> |
| </td> |
| </tr> |
| <tr> |
| <td class="define_keyword">#define</td> |
| <td class="function_name"> |
| <a class="link" href="gobject-The-Base-Object-Type.html#G-OBJECT-WARN-INVALID-PROPERTY-ID:CAPS" title="G_OBJECT_WARN_INVALID_PROPERTY_ID()">G_OBJECT_WARN_INVALID_PROPERTY_ID</a><span class="c_punctuation">()</span> |
| </td> |
| </tr> |
| <tr> |
| <td class="function_type"> |
| <span class="returnvalue">void</span> |
| </td> |
| <td class="function_name"> |
| <a class="link" href="gobject-The-Base-Object-Type.html#g-weak-ref-init" title="g_weak_ref_init ()">g_weak_ref_init</a> <span class="c_punctuation">()</span> |
| </td> |
| </tr> |
| <tr> |
| <td class="function_type"> |
| <span class="returnvalue">void</span> |
| </td> |
| <td class="function_name"> |
| <a class="link" href="gobject-The-Base-Object-Type.html#g-weak-ref-clear" title="g_weak_ref_clear ()">g_weak_ref_clear</a> <span class="c_punctuation">()</span> |
| </td> |
| </tr> |
| <tr> |
| <td class="function_type"> |
| <a href="../glib-Basic-Types.html#gpointer"><span class="returnvalue">gpointer</span></a> |
| </td> |
| <td class="function_name"> |
| <a class="link" href="gobject-The-Base-Object-Type.html#g-weak-ref-get" title="g_weak_ref_get ()">g_weak_ref_get</a> <span class="c_punctuation">()</span> |
| </td> |
| </tr> |
| <tr> |
| <td class="function_type"> |
| <span class="returnvalue">void</span> |
| </td> |
| <td class="function_name"> |
| <a class="link" href="gobject-The-Base-Object-Type.html#g-weak-ref-set" title="g_weak_ref_set ()">g_weak_ref_set</a> <span class="c_punctuation">()</span> |
| </td> |
| </tr> |
| </tbody> |
| </table></div> |
| </div> |
| <div class="refsect1"> |
| <a name="gobject-The-Base-Object-Type.signals"></a><h2>Signals</h2> |
| <div class="informaltable"><table class="informaltable" border="0"> |
| <colgroup> |
| <col width="150px" class="signals_return"> |
| <col width="300px" class="signals_name"> |
| <col width="200px" class="signals_flags"> |
| </colgroup> |
| <tbody><tr> |
| <td class="signal_type"><span class="returnvalue">void</span></td> |
| <td class="signal_name"><a class="link" href="gobject-The-Base-Object-Type.html#GObject-notify" title="The “notify” signal">notify</a></td> |
| <td class="signal_flags"><a class="link" href="gobject-Signals.html#G-SIGNAL-NO-HOOKS:CAPS">No Hooks</a></td> |
| </tr></tbody> |
| </table></div> |
| </div> |
| <a name="GObject"></a><div class="refsect1"> |
| <a name="gobject-The-Base-Object-Type.other"></a><h2>Types and Values</h2> |
| <div class="informaltable"><table class="informaltable" width="100%" border="0"> |
| <colgroup> |
| <col width="150px" class="name"> |
| <col class="description"> |
| </colgroup> |
| <tbody> |
| <tr> |
| <td class="datatype_keyword">struct</td> |
| <td class="function_name"><a class="link" href="gobject-The-Base-Object-Type.html#GObject-struct" title="struct GObject">GObject</a></td> |
| </tr> |
| <tr> |
| <td class="datatype_keyword">struct</td> |
| <td class="function_name"><a class="link" href="gobject-The-Base-Object-Type.html#GObjectClass" title="struct GObjectClass">GObjectClass</a></td> |
| </tr> |
| <tr> |
| <td class="datatype_keyword">struct</td> |
| <td class="function_name"><a class="link" href="gobject-The-Base-Object-Type.html#GObjectConstructParam" title="struct GObjectConstructParam">GObjectConstructParam</a></td> |
| </tr> |
| <tr> |
| <td class="datatype_keyword">struct</td> |
| <td class="function_name"><a class="link" href="gobject-The-Base-Object-Type.html#GParameter" title="struct GParameter">GParameter</a></td> |
| </tr> |
| <tr> |
| <td class="typedef_keyword">typedef</td> |
| <td class="function_name"><a class="link" href="gobject-The-Base-Object-Type.html#GInitiallyUnowned" title="GInitiallyUnowned">GInitiallyUnowned</a></td> |
| </tr> |
| <tr> |
| <td class="typedef_keyword">typedef</td> |
| <td class="function_name"><a class="link" href="gobject-The-Base-Object-Type.html#GInitiallyUnownedClass" title="GInitiallyUnownedClass">GInitiallyUnownedClass</a></td> |
| </tr> |
| <tr> |
| <td class="define_keyword">#define</td> |
| <td class="function_name"><a class="link" href="gobject-The-Base-Object-Type.html#G-TYPE-INITIALLY-UNOWNED:CAPS" title="G_TYPE_INITIALLY_UNOWNED">G_TYPE_INITIALLY_UNOWNED</a></td> |
| </tr> |
| <tr> |
| <td class="datatype_keyword"> </td> |
| <td class="function_name"><a class="link" href="gobject-The-Base-Object-Type.html#GWeakRef" title="GWeakRef">GWeakRef</a></td> |
| </tr> |
| </tbody> |
| </table></div> |
| </div> |
| <div class="refsect1"> |
| <a name="gobject-The-Base-Object-Type.object-hierarchy"></a><h2>Object Hierarchy</h2> |
| <pre class="screen"> GObject |
| <span class="lineart">├──</span> <a class="link" href="GBinding.html" title="GBinding">GBinding</a> |
| <span class="lineart">╰──</span> <a class="link" href="GTypeModule.html" title="GTypeModule">GTypeModule</a> |
| </pre> |
| </div> |
| <div class="refsect1"> |
| <a name="gobject-The-Base-Object-Type.includes"></a><h2>Includes</h2> |
| <pre class="synopsis">#include <glib-object.h> |
| </pre> |
| </div> |
| <div class="refsect1"> |
| <a name="gobject-The-Base-Object-Type.description"></a><h2>Description</h2> |
| <p>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 <a class="link" href="gobject-Signals.html" title="Signals">here</a>.</p> |
| <p>For a tutorial on implementing a new GObject class, see <a class="link" href="howto-gobject.html" title="How to define and implement a new GObject">How to define and |
| implement a new GObject</a>. For a list of naming conventions for |
| GObjects and their methods, see the <a class="link" href="gtype-conventions.html" title="Conventions">GType conventions</a>. |
| For the high-level concepts behind GObject, read <a class="link" href="gtype-instantiable-classed.html" title="Instantiable classed types: objects">Instantiable classed types: |
| Objects</a>.</p> |
| <div class="refsect3"> |
| <a name="floating-ref"></a><h4>Floating references</h4> |
| <p>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:</p> |
| <div class="informalexample"> |
| <table class="listing_frame" border="0" cellpadding="0" cellspacing="0"> |
| <tbody> |
| <tr> |
| <td class="listing_lines" align="right"><pre>1 |
| 2</pre></td> |
| <td class="listing_code"><pre class="programlisting"><span class="normal">container </span><span class="symbol">=</span><span class="normal"> </span><span class="function">create_container</span><span class="normal"> </span><span class="symbol">();</span> |
| <span class="function">container_add_child</span><span class="normal"> </span><span class="symbol">(</span><span class="normal">container</span><span class="symbol">,</span><span class="normal"> </span><span class="function">create_child</span><span class="symbol">());</span></pre></td> |
| </tr> |
| </tbody> |
| </table> |
| </div> |
| |
| <p> |
| If <code class="function">container_add_child()</code> calls <a class="link" href="gobject-The-Base-Object-Type.html#g-object-ref-sink" title="g_object_ref_sink ()"><code class="function">g_object_ref_sink()</code></a> on the passed-in child, |
| no reference of the newly created child is leaked. Without floating |
| references, <code class="function">container_add_child()</code> can only <a class="link" href="gobject-The-Base-Object-Type.html#g-object-ref" title="g_object_ref ()"><code class="function">g_object_ref()</code></a> the new child, |
| so to implement this code without reference leaks, it would have to be |
| written as:</p> |
| <div class="informalexample"> |
| <table class="listing_frame" border="0" cellpadding="0" cellspacing="0"> |
| <tbody> |
| <tr> |
| <td class="listing_lines" align="right"><pre>1 |
| 2 |
| 3 |
| 4 |
| 5</pre></td> |
| <td class="listing_code"><pre class="programlisting"><span class="usertype">Child</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">child</span><span class="symbol">;</span> |
| <span class="normal">container </span><span class="symbol">=</span><span class="normal"> </span><span class="function">create_container</span><span class="normal"> </span><span class="symbol">();</span> |
| <span class="normal">child </span><span class="symbol">=</span><span class="normal"> </span><span class="function">create_child</span><span class="normal"> </span><span class="symbol">();</span> |
| <span class="function">container_add_child</span><span class="normal"> </span><span class="symbol">(</span><span class="normal">container</span><span class="symbol">,</span><span class="normal"> child</span><span class="symbol">);</span> |
| <span class="function"><a href="gobject-The-Base-Object-Type.html#g-object-unref">g_object_unref</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">child</span><span class="symbol">);</span></pre></td> |
| </tr> |
| </tbody> |
| </table> |
| </div> |
| |
| <p> |
| The floating reference can be converted into an ordinary reference by |
| calling <a class="link" href="gobject-The-Base-Object-Type.html#g-object-ref-sink" title="g_object_ref_sink ()"><code class="function">g_object_ref_sink()</code></a>. For already sunken objects (objects that |
| don't have a floating reference anymore), <a class="link" href="gobject-The-Base-Object-Type.html#g-object-ref-sink" title="g_object_ref_sink ()"><code class="function">g_object_ref_sink()</code></a> is equivalent |
| to <a class="link" href="gobject-The-Base-Object-Type.html#g-object-ref" title="g_object_ref ()"><code class="function">g_object_ref()</code></a> and returns a new reference.</p> |
| <p>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.</p> |
| <p>Some object implementations may need to save an objects floating state |
| across certain code portions (an example is <a href="http://developer.gnome.org/gtk3/GtkMenu.html#GtkMenu-struct"><span class="type">GtkMenu</span></a>), to achieve this, |
| the following sequence can be used:</p> |
| <div class="informalexample"> |
| <table class="listing_frame" border="0" cellpadding="0" cellspacing="0"> |
| <tbody> |
| <tr> |
| <td class="listing_lines" align="right"><pre>1 |
| 2 |
| 3 |
| 4 |
| 5 |
| 6 |
| 7 |
| 8 |
| 9 |
| 10 |
| 11 |
| 12</pre></td> |
| <td class="listing_code"><pre class="programlisting"><span class="comment">// save floating state</span> |
| <span class="usertype">gboolean</span><span class="normal"> was_floating </span><span class="symbol">=</span><span class="normal"> </span><span class="function"><a href="gobject-The-Base-Object-Type.html#g-object-is-floating">g_object_is_floating</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">object</span><span class="symbol">);</span> |
| <span class="function"><a href="gobject-The-Base-Object-Type.html#g-object-ref-sink">g_object_ref_sink</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">object</span><span class="symbol">);</span> |
| <span class="comment">// protected code portion</span> |
| |
| <span class="symbol">...</span> |
| |
| <span class="comment">// restore floating state</span> |
| <span class="keyword">if</span><span class="normal"> </span><span class="symbol">(</span><span class="normal">was_floating</span><span class="symbol">)</span> |
| <span class="normal"> </span><span class="function"><a href="gobject-The-Base-Object-Type.html#g-object-force-floating">g_object_force_floating</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">object</span><span class="symbol">);</span> |
| <span class="keyword">else</span> |
| <span class="normal"> </span><span class="function"><a href="gobject-The-Base-Object-Type.html#g-object-unref">g_object_unref</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">object</span><span class="symbol">);</span><span class="normal"> </span><span class="comment">// release previously acquired reference</span></pre></td> |
| </tr> |
| </tbody> |
| </table> |
| </div> |
| |
| <p></p> |
| </div> |
| </div> |
| <div class="refsect1"> |
| <a name="gobject-The-Base-Object-Type.functions_details"></a><h2>Functions</h2> |
| <div class="refsect2"> |
| <a name="GObjectGetPropertyFunc"></a><h3>GObjectGetPropertyFunc ()</h3> |
| <pre class="programlisting"><span class="returnvalue">void</span> |
| <span class="c_punctuation">(</span>*GObjectGetPropertyFunc<span class="c_punctuation">)</span> (<em class="parameter"><code><a class="link" href="gobject-The-Base-Object-Type.html#GObject"><span class="type">GObject</span></a> *object</code></em>, |
| <em class="parameter"><code><a href="../glib-Basic-Types.html#guint"><span class="type">guint</span></a> property_id</code></em>, |
| <em class="parameter"><code><a class="link" href="gobject-Generic-values.html#GValue" title="GValue"><span class="type">GValue</span></a> *value</code></em>, |
| <em class="parameter"><code><a class="link" href="gobject-GParamSpec.html#GParamSpec" title="struct GParamSpec"><span class="type">GParamSpec</span></a> *pspec</code></em>);</pre> |
| <p>The type of the <em class="parameter"><code>get_property</code></em> |
| function of <a class="link" href="gobject-The-Base-Object-Type.html#GObjectClass" title="struct GObjectClass"><span class="type">GObjectClass</span></a>.</p> |
| <div class="refsect3"> |
| <a name="GObjectGetPropertyFunc.parameters"></a><h4>Parameters</h4> |
| <div class="informaltable"><table class="informaltable" width="100%" border="0"> |
| <colgroup> |
| <col width="150px" class="parameters_name"> |
| <col class="parameters_description"> |
| <col width="200px" class="parameters_annotations"> |
| </colgroup> |
| <tbody> |
| <tr> |
| <td class="parameter_name"><p>object</p></td> |
| <td class="parameter_description"><p>a <a class="link" href="gobject-The-Base-Object-Type.html#GObject"><span class="type">GObject</span></a></p></td> |
| <td class="parameter_annotations"> </td> |
| </tr> |
| <tr> |
| <td class="parameter_name"><p>property_id</p></td> |
| <td class="parameter_description"><p>the numeric id under which the property was registered with |
| <a class="link" href="gobject-The-Base-Object-Type.html#g-object-class-install-property" title="g_object_class_install_property ()"><code class="function">g_object_class_install_property()</code></a>.</p></td> |
| <td class="parameter_annotations"> </td> |
| </tr> |
| <tr> |
| <td class="parameter_name"><p>value</p></td> |
| <td class="parameter_description"><p>a <a class="link" href="gobject-Generic-values.html#GValue" title="GValue"><span class="type">GValue</span></a> to return the property value in</p></td> |
| <td class="parameter_annotations"> </td> |
| </tr> |
| <tr> |
| <td class="parameter_name"><p>pspec</p></td> |
| <td class="parameter_description"><p>the <a class="link" href="gobject-GParamSpec.html#GParamSpec" title="struct GParamSpec"><span class="type">GParamSpec</span></a> describing the property</p></td> |
| <td class="parameter_annotations"> </td> |
| </tr> |
| </tbody> |
| </table></div> |
| </div> |
| </div> |
| <hr> |
| <div class="refsect2"> |
| <a name="GObjectSetPropertyFunc"></a><h3>GObjectSetPropertyFunc ()</h3> |
| <pre class="programlisting"><span class="returnvalue">void</span> |
| <span class="c_punctuation">(</span>*GObjectSetPropertyFunc<span class="c_punctuation">)</span> (<em class="parameter"><code><a class="link" href="gobject-The-Base-Object-Type.html#GObject"><span class="type">GObject</span></a> *object</code></em>, |
| <em class="parameter"><code><a href="../glib-Basic-Types.html#guint"><span class="type">guint</span></a> property_id</code></em>, |
| <em class="parameter"><code>const <a class="link" href="gobject-Generic-values.html#GValue" title="GValue"><span class="type">GValue</span></a> *value</code></em>, |
| <em class="parameter"><code><a class="link" href="gobject-GParamSpec.html#GParamSpec" title="struct GParamSpec"><span class="type">GParamSpec</span></a> *pspec</code></em>);</pre> |
| <p>The type of the <em class="parameter"><code>set_property</code></em> |
| function of <a class="link" href="gobject-The-Base-Object-Type.html#GObjectClass" title="struct GObjectClass"><span class="type">GObjectClass</span></a>.</p> |
| <div class="refsect3"> |
| <a name="GObjectSetPropertyFunc.parameters"></a><h4>Parameters</h4> |
| <div class="informaltable"><table class="informaltable" width="100%" border="0"> |
| <colgroup> |
| <col width="150px" class="parameters_name"> |
| <col class="parameters_description"> |
| <col width="200px" class="parameters_annotations"> |
| </colgroup> |
| <tbody> |
| <tr> |
| <td class="parameter_name"><p>object</p></td> |
| <td class="parameter_description"><p>a <a class="link" href="gobject-The-Base-Object-Type.html#GObject"><span class="type">GObject</span></a></p></td> |
| <td class="parameter_annotations"> </td> |
| </tr> |
| <tr> |
| <td class="parameter_name"><p>property_id</p></td> |
| <td class="parameter_description"><p>the numeric id under which the property was registered with |
| <a class="link" href="gobject-The-Base-Object-Type.html#g-object-class-install-property" title="g_object_class_install_property ()"><code class="function">g_object_class_install_property()</code></a>.</p></td> |
| <td class="parameter_annotations"> </td> |
| </tr> |
| <tr> |
| <td class="parameter_name"><p>value</p></td> |
| <td class="parameter_description"><p>the new value for the property</p></td> |
| <td class="parameter_annotations"> </td> |
| </tr> |
| <tr> |
| <td class="parameter_name"><p>pspec</p></td> |
| <td class="parameter_description"><p>the <a class="link" href="gobject-GParamSpec.html#GParamSpec" title="struct GParamSpec"><span class="type">GParamSpec</span></a> describing the property</p></td> |
| <td class="parameter_annotations"> </td> |
| </tr> |
| </tbody> |
| </table></div> |
| </div> |
| </div> |
| <hr> |
| <div class="refsect2"> |
| <a name="GObjectFinalizeFunc"></a><h3>GObjectFinalizeFunc ()</h3> |
| <pre class="programlisting"><span class="returnvalue">void</span> |
| <span class="c_punctuation">(</span>*GObjectFinalizeFunc<span class="c_punctuation">)</span> (<em class="parameter"><code><a class="link" href="gobject-The-Base-Object-Type.html#GObject"><span class="type">GObject</span></a> *object</code></em>);</pre> |
| <p>The type of the <em class="parameter"><code>finalize</code></em> |
| function of <a class="link" href="gobject-The-Base-Object-Type.html#GObjectClass" title="struct GObjectClass"><span class="type">GObjectClass</span></a>.</p> |
| <div class="refsect3"> |
| <a name="GObjectFinalizeFunc.parameters"></a><h4>Parameters</h4> |
| <div class="informaltable"><table class="informaltable" width="100%" border="0"> |
| <colgroup> |
| <col width="150px" class="parameters_name"> |
| <col class="parameters_description"> |
| <col width="200px" class="parameters_annotations"> |
| </colgroup> |
| <tbody><tr> |
| <td class="parameter_name"><p>object</p></td> |
| <td class="parameter_description"><p>the <a class="link" href="gobject-The-Base-Object-Type.html#GObject"><span class="type">GObject</span></a> being finalized</p></td> |
| <td class="parameter_annotations"> </td> |
| </tr></tbody> |
| </table></div> |
| </div> |
| </div> |
| <hr> |
| <div class="refsect2"> |
| <a name="G-TYPE-IS-OBJECT:CAPS"></a><h3>G_TYPE_IS_OBJECT()</h3> |
| <pre class="programlisting">#define G_TYPE_IS_OBJECT(type) (G_TYPE_FUNDAMENTAL (type) == G_TYPE_OBJECT) |
| </pre> |
| <p>Check if the passed in type id is a <a class="link" href="gobject-Type-Information.html#G-TYPE-OBJECT:CAPS" title="G_TYPE_OBJECT"><code class="literal">G_TYPE_OBJECT</code></a> or derived from it.</p> |
| <div class="refsect3"> |
| <a name="G-TYPE-IS-OBJECT.parameters"></a><h4>Parameters</h4> |
| <div class="informaltable"><table class="informaltable" width="100%" border="0"> |
| <colgroup> |
| <col width="150px" class="parameters_name"> |
| <col class="parameters_description"> |
| <col width="200px" class="parameters_annotations"> |
| </colgroup> |
| <tbody><tr> |
| <td class="parameter_name"><p>type</p></td> |
| <td class="parameter_description"><p>Type id to check</p></td> |
| <td class="parameter_annotations"> </td> |
| </tr></tbody> |
| </table></div> |
| </div> |
| <div class="refsect3"> |
| <a name="G-TYPE-IS-OBJECT.returns"></a><h4>Returns</h4> |
| <p> <a href="../glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> or <a href="../glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a>, indicating whether <em class="parameter"><code>type</code></em> |
| is a <a class="link" href="gobject-Type-Information.html#G-TYPE-OBJECT:CAPS" title="G_TYPE_OBJECT"><code class="literal">G_TYPE_OBJECT</code></a>.</p> |
| </div> |
| </div> |
| <hr> |
| <div class="refsect2"> |
| <a name="G-OBJECT:CAPS"></a><h3>G_OBJECT()</h3> |
| <pre class="programlisting">#define G_OBJECT(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), G_TYPE_OBJECT, GObject)) |
| </pre> |
| <p>Casts a <a class="link" href="gobject-The-Base-Object-Type.html#GObject"><span class="type">GObject</span></a> or derived pointer into a (GObject*) pointer. |
| Depending on the current debugging level, this function may invoke |
| certain runtime checks to identify invalid casts.</p> |
| <div class="refsect3"> |
| <a name="G-OBJECT.parameters"></a><h4>Parameters</h4> |
| <div class="informaltable"><table class="informaltable" width="100%" border="0"> |
| <colgroup> |
| <col width="150px" class="parameters_name"> |
| <col class="parameters_description"> |
| <col width="200px" class="parameters_annotations"> |
| </colgroup> |
| <tbody><tr> |
| <td class="parameter_name"><p>object</p></td> |
| <td class="parameter_description"><p>Object which is subject to casting.</p></td> |
| <td class="parameter_annotations"> </td> |
| </tr></tbody> |
| </table></div> |
| </div> |
| </div> |
| <hr> |
| <div class="refsect2"> |
| <a name="G-IS-OBJECT:CAPS"></a><h3>G_IS_OBJECT()</h3> |
| <pre class="programlisting">#define G_IS_OBJECT(object) (G_TYPE_CHECK_INSTANCE_FUNDAMENTAL_TYPE ((object), G_TYPE_OBJECT)) |
| </pre> |
| <p>Checks whether a valid <a class="link" href="gobject-Type-Information.html#GTypeInstance" title="struct GTypeInstance"><span class="type">GTypeInstance</span></a> pointer is of type <a class="link" href="gobject-Type-Information.html#G-TYPE-OBJECT:CAPS" title="G_TYPE_OBJECT"><code class="literal">G_TYPE_OBJECT</code></a>.</p> |
| <div class="refsect3"> |
| <a name="G-IS-OBJECT.parameters"></a><h4>Parameters</h4> |
| <div class="informaltable"><table class="informaltable" width="100%" border="0"> |
| <colgroup> |
| <col width="150px" class="parameters_name"> |
| <col class="parameters_description"> |
| <col width="200px" class="parameters_annotations"> |
| </colgroup> |
| <tbody><tr> |
| <td class="parameter_name"><p>object</p></td> |
| <td class="parameter_description"><p>Instance to check for being a <a class="link" href="gobject-Type-Information.html#G-TYPE-OBJECT:CAPS" title="G_TYPE_OBJECT"><code class="literal">G_TYPE_OBJECT</code></a>.</p></td> |
| <td class="parameter_annotations"> </td> |
| </tr></tbody> |
| </table></div> |
| </div> |
| </div> |
| <hr> |
| <div class="refsect2"> |
| <a name="G-OBJECT-CLASS:CAPS"></a><h3>G_OBJECT_CLASS()</h3> |
| <pre class="programlisting">#define G_OBJECT_CLASS(class) (G_TYPE_CHECK_CLASS_CAST ((class), G_TYPE_OBJECT, GObjectClass)) |
| </pre> |
| <p>Casts a derived <a class="link" href="gobject-The-Base-Object-Type.html#GObjectClass" title="struct GObjectClass"><span class="type">GObjectClass</span></a> structure into a <a class="link" href="gobject-The-Base-Object-Type.html#GObjectClass" title="struct GObjectClass"><span class="type">GObjectClass</span></a> structure.</p> |
| <div class="refsect3"> |
| <a name="G-OBJECT-CLASS.parameters"></a><h4>Parameters</h4> |
| <div class="informaltable"><table class="informaltable" width="100%" border="0"> |
| <colgroup> |
| <col width="150px" class="parameters_name"> |
| <col class="parameters_description"> |
| <col width="200px" class="parameters_annotations"> |
| </colgroup> |
| <tbody><tr> |
| <td class="parameter_name"><p>class</p></td> |
| <td class="parameter_description"><p>a valid <a class="link" href="gobject-The-Base-Object-Type.html#GObjectClass" title="struct GObjectClass"><span class="type">GObjectClass</span></a></p></td> |
| <td class="parameter_annotations"> </td> |
| </tr></tbody> |
| </table></div> |
| </div> |
| </div> |
| <hr> |
| <div class="refsect2"> |
| <a name="G-IS-OBJECT-CLASS:CAPS"></a><h3>G_IS_OBJECT_CLASS()</h3> |
| <pre class="programlisting">#define G_IS_OBJECT_CLASS(class) (G_TYPE_CHECK_CLASS_TYPE ((class), G_TYPE_OBJECT)) |
| </pre> |
| <p>Checks whether <em class="parameter"><code>class</code></em> |
| "is a" valid <a class="link" href="gobject-The-Base-Object-Type.html#GObjectClass" title="struct GObjectClass"><span class="type">GObjectClass</span></a> structure of type |
| <a class="link" href="gobject-Type-Information.html#G-TYPE-OBJECT:CAPS" title="G_TYPE_OBJECT"><code class="literal">G_TYPE_OBJECT</code></a> or derived.</p> |
| <div class="refsect3"> |
| <a name="G-IS-OBJECT-CLASS.parameters"></a><h4>Parameters</h4> |
| <div class="informaltable"><table class="informaltable" width="100%" border="0"> |
| <colgroup> |
| <col width="150px" class="parameters_name"> |
| <col class="parameters_description"> |
| <col width="200px" class="parameters_annotations"> |
| </colgroup> |
| <tbody><tr> |
| <td class="parameter_name"><p>class</p></td> |
| <td class="parameter_description"><p>a <a class="link" href="gobject-The-Base-Object-Type.html#GObjectClass" title="struct GObjectClass"><span class="type">GObjectClass</span></a></p></td> |
| <td class="parameter_annotations"> </td> |
| </tr></tbody> |
| </table></div> |
| </div> |
| </div> |
| <hr> |
| <div class="refsect2"> |
| <a name="G-OBJECT-GET-CLASS:CAPS"></a><h3>G_OBJECT_GET_CLASS()</h3> |
| <pre class="programlisting">#define G_OBJECT_GET_CLASS(object) (G_TYPE_INSTANCE_GET_CLASS ((object), G_TYPE_OBJECT, GObjectClass)) |
| </pre> |
| <p>Get the class structure associated to a <a class="link" href="gobject-The-Base-Object-Type.html#GObject"><span class="type">GObject</span></a> instance.</p> |
| <div class="refsect3"> |
| <a name="G-OBJECT-GET-CLASS.parameters"></a><h4>Parameters</h4> |
| <div class="informaltable"><table class="informaltable" width="100%" border="0"> |
| <colgroup> |
| <col width="150px" class="parameters_name"> |
| <col class="parameters_description"> |
| <col width="200px" class="parameters_annotations"> |
| </colgroup> |
| <tbody><tr> |
| <td class="parameter_name"><p>object</p></td> |
| <td class="parameter_description"><p>a <a class="link" href="gobject-The-Base-Object-Type.html#GObject"><span class="type">GObject</span></a> instance.</p></td> |
| <td class="parameter_annotations"> </td> |
| </tr></tbody> |
| </table></div> |
| </div> |
| <div class="refsect3"> |
| <a name="G-OBJECT-GET-CLASS.returns"></a><h4>Returns</h4> |
| <p> pointer to object class structure.</p> |
| </div> |
| </div> |
| <hr> |
| <div class="refsect2"> |
| <a name="G-OBJECT-TYPE:CAPS"></a><h3>G_OBJECT_TYPE()</h3> |
| <pre class="programlisting">#define G_OBJECT_TYPE(object) (G_TYPE_FROM_INSTANCE (object)) |
| </pre> |
| <p>Get the type id of an object.</p> |
| <div class="refsect3"> |
| <a name="G-OBJECT-TYPE.parameters"></a><h4>Parameters</h4> |
| <div class="informaltable"><table class="informaltable" width="100%" border="0"> |
| <colgroup> |
| <col width="150px" class="parameters_name"> |
| <col class="parameters_description"> |
| <col width="200px" class="parameters_annotations"> |
| </colgroup> |
| <tbody><tr> |
| <td class="parameter_name"><p>object</p></td> |
| <td class="parameter_description"><p>Object to return the type id for.</p></td> |
| <td class="parameter_annotations"> </td> |
| </tr></tbody> |
| </table></div> |
| </div> |
| <div class="refsect3"> |
| <a name="G-OBJECT-TYPE.returns"></a><h4>Returns</h4> |
| <p> Type id of <em class="parameter"><code>object</code></em> |
| .</p> |
| </div> |
| </div> |
| <hr> |
| <div class="refsect2"> |
| <a name="G-OBJECT-TYPE-NAME:CAPS"></a><h3>G_OBJECT_TYPE_NAME()</h3> |
| <pre class="programlisting">#define G_OBJECT_TYPE_NAME(object) (g_type_name (G_OBJECT_TYPE (object))) |
| </pre> |
| <p>Get the name of an object's type.</p> |
| <div class="refsect3"> |
| <a name="G-OBJECT-TYPE-NAME.parameters"></a><h4>Parameters</h4> |
| <div class="informaltable"><table class="informaltable" width="100%" border="0"> |
| <colgroup> |
| <col width="150px" class="parameters_name"> |
| <col class="parameters_description"> |
| <col width="200px" class="parameters_annotations"> |
| </colgroup> |
| <tbody><tr> |
| <td class="parameter_name"><p>object</p></td> |
| <td class="parameter_description"><p>Object to return the type name for.</p></td> |
| <td class="parameter_annotations"> </td> |
| </tr></tbody> |
| </table></div> |
| </div> |
| <div class="refsect3"> |
| <a name="G-OBJECT-TYPE-NAME.returns"></a><h4>Returns</h4> |
| <p> Type name of <em class="parameter"><code>object</code></em> |
| . The string is owned by the type system and |
| should not be freed.</p> |
| </div> |
| </div> |
| <hr> |
| <div class="refsect2"> |
| <a name="G-OBJECT-CLASS-TYPE:CAPS"></a><h3>G_OBJECT_CLASS_TYPE()</h3> |
| <pre class="programlisting">#define G_OBJECT_CLASS_TYPE(class) (G_TYPE_FROM_CLASS (class)) |
| </pre> |
| <p>Get the type id of a class structure.</p> |
| <div class="refsect3"> |
| <a name="G-OBJECT-CLASS-TYPE.parameters"></a><h4>Parameters</h4> |
| <div class="informaltable"><table class="informaltable" width="100%" border="0"> |
| <colgroup> |
| <col width="150px" class="parameters_name"> |
| <col class="parameters_description"> |
| <col width="200px" class="parameters_annotations"> |
| </colgroup> |
| <tbody><tr> |
| <td class="parameter_name"><p>class</p></td> |
| <td class="parameter_description"><p>a valid <a class="link" href="gobject-The-Base-Object-Type.html#GObjectClass" title="struct GObjectClass"><span class="type">GObjectClass</span></a></p></td> |
| <td class="parameter_annotations"> </td> |
| </tr></tbody> |
| </table></div> |
| </div> |
| <div class="refsect3"> |
| <a name="G-OBJECT-CLASS-TYPE.returns"></a><h4>Returns</h4> |
| <p> Type id of <em class="parameter"><code>class</code></em> |
| .</p> |
| </div> |
| </div> |
| <hr> |
| <div class="refsect2"> |
| <a name="G-OBJECT-CLASS-NAME:CAPS"></a><h3>G_OBJECT_CLASS_NAME()</h3> |
| <pre class="programlisting">#define G_OBJECT_CLASS_NAME(class) (g_type_name (G_OBJECT_CLASS_TYPE (class))) |
| </pre> |
| <p>Return the name of a class structure's type.</p> |
| <div class="refsect3"> |
| <a name="G-OBJECT-CLASS-NAME.parameters"></a><h4>Parameters</h4> |
| <div class="informaltable"><table class="informaltable" width="100%" border="0"> |
| <colgroup> |
| <col width="150px" class="parameters_name"> |
| <col class="parameters_description"> |
| <col width="200px" class="parameters_annotations"> |
| </colgroup> |
| <tbody><tr> |
| <td class="parameter_name"><p>class</p></td> |
| <td class="parameter_description"><p>a valid <a class="link" href="gobject-The-Base-Object-Type.html#GObjectClass" title="struct GObjectClass"><span class="type">GObjectClass</span></a></p></td> |
| <td class="parameter_annotations"> </td> |
| </tr></tbody> |
| </table></div> |
| </div> |
| <div class="refsect3"> |
| <a name="G-OBJECT-CLASS-NAME.returns"></a><h4>Returns</h4> |
| <p> Type name of <em class="parameter"><code>class</code></em> |
| . The string is owned by the type system and |
| should not be freed.</p> |
| </div> |
| </div> |
| <hr> |
| <div class="refsect2"> |
| <a name="g-object-class-install-property"></a><h3>g_object_class_install_property ()</h3> |
| <pre class="programlisting"><span class="returnvalue">void</span> |
| g_object_class_install_property (<em class="parameter"><code><a class="link" href="gobject-The-Base-Object-Type.html#GObjectClass" title="struct GObjectClass"><span class="type">GObjectClass</span></a> *oclass</code></em>, |
| <em class="parameter"><code><a href="../glib-Basic-Types.html#guint"><span class="type">guint</span></a> property_id</code></em>, |
| <em class="parameter"><code><a class="link" href="gobject-GParamSpec.html#GParamSpec" title="struct GParamSpec"><span class="type">GParamSpec</span></a> *pspec</code></em>);</pre> |
| <p>Installs a new property.</p> |
| <p>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.</p> |
| <p>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.</p> |
| <div class="refsect3"> |
| <a name="g-object-class-install-property.parameters"></a><h4>Parameters</h4> |
| <div class="informaltable"><table class="informaltable" width="100%" border="0"> |
| <colgroup> |
| <col width="150px" class="parameters_name"> |
| <col class="parameters_description"> |
| <col width="200px" class="parameters_annotations"> |
| </colgroup> |
| <tbody> |
| <tr> |
| <td class="parameter_name"><p>oclass</p></td> |
| <td class="parameter_description"><p>a <a class="link" href="gobject-The-Base-Object-Type.html#GObjectClass" title="struct GObjectClass"><span class="type">GObjectClass</span></a></p></td> |
| <td class="parameter_annotations"> </td> |
| </tr> |
| <tr> |
| <td class="parameter_name"><p>property_id</p></td> |
| <td class="parameter_description"><p>the id for the new property</p></td> |
| <td class="parameter_annotations"> </td> |
| </tr> |
| <tr> |
| <td class="parameter_name"><p>pspec</p></td> |
| <td class="parameter_description"><p>the <a class="link" href="gobject-GParamSpec.html#GParamSpec" title="struct GParamSpec"><span class="type">GParamSpec</span></a> for the new property</p></td> |
| <td class="parameter_annotations"> </td> |
| </tr> |
| </tbody> |
| </table></div> |
| </div> |
| </div> |
| <hr> |
| <div class="refsect2"> |
| <a name="g-object-class-install-properties"></a><h3>g_object_class_install_properties ()</h3> |
| <pre class="programlisting"><span class="returnvalue">void</span> |
| g_object_class_install_properties (<em class="parameter"><code><a class="link" href="gobject-The-Base-Object-Type.html#GObjectClass" title="struct GObjectClass"><span class="type">GObjectClass</span></a> *oclass</code></em>, |
| <em class="parameter"><code><a href="../glib-Basic-Types.html#guint"><span class="type">guint</span></a> n_pspecs</code></em>, |
| <em class="parameter"><code><a class="link" href="gobject-GParamSpec.html#GParamSpec" title="struct GParamSpec"><span class="type">GParamSpec</span></a> **pspecs</code></em>);</pre> |
| <p>Installs new properties from an array of <a href="gobject-GParamSpec.html#GParamSpec"><span class="type">GParamSpecs</span></a>.</p> |
| <p>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.</p> |
| <p>The property id of each property is the index of each <a class="link" href="gobject-GParamSpec.html#GParamSpec" title="struct GParamSpec"><span class="type">GParamSpec</span></a> in |
| the <em class="parameter"><code>pspecs</code></em> |
| array.</p> |
| <p>The property id of 0 is treated specially by <a class="link" href="gobject-The-Base-Object-Type.html#GObject"><span class="type">GObject</span></a> and it should not |
| be used to store a <a class="link" href="gobject-GParamSpec.html#GParamSpec" title="struct GParamSpec"><span class="type">GParamSpec</span></a>.</p> |
| <p>This function should be used if you plan to use a static array of |
| <a href="gobject-GParamSpec.html#GParamSpec"><span class="type">GParamSpecs</span></a> and <a class="link" href="gobject-The-Base-Object-Type.html#g-object-notify-by-pspec" title="g_object_notify_by_pspec ()"><code class="function">g_object_notify_by_pspec()</code></a>. For instance, this |
| class initialization:</p> |
| <div class="informalexample"> |
| <table class="listing_frame" border="0" cellpadding="0" cellspacing="0"> |
| <tbody> |
| <tr> |
| <td class="listing_lines" align="right"><pre>1 |
| 2 |
| 3 |
| 4 |
| 5 |
| 6 |
| 7 |
| 8 |
| 9 |
| 10 |
| 11 |
| 12 |
| 13 |
| 14 |
| 15 |
| 16 |
| 17 |
| 18 |
| 19 |
| 20 |
| 21 |
| 22 |
| 23 |
| 24 |
| 25 |
| 26 |
| 27 |
| 28</pre></td> |
| <td class="listing_code"><pre class="programlisting"><span class="keyword">enum</span><span class="normal"> </span><span class="cbracket">{</span> |
| <span class="normal"> PROP_0</span><span class="symbol">,</span><span class="normal"> PROP_FOO</span><span class="symbol">,</span><span class="normal"> PROP_BAR</span><span class="symbol">,</span><span class="normal"> N_PROPERTIES</span> |
| <span class="cbracket">}</span><span class="symbol">;</span> |
| |
| <span class="keyword">static</span><span class="normal"> </span><span class="usertype">GParamSpec</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">obj_properties</span><span class="symbol">[</span><span class="normal">N_PROPERTIES</span><span class="symbol">]</span><span class="normal"> </span><span class="symbol">=</span><span class="normal"> </span><span class="cbracket">{</span><span class="normal"> <a href="../glib-Standard-Macros.html#NULL:CAPS">NULL</a></span><span class="symbol">,</span><span class="normal"> </span><span class="cbracket">}</span><span class="symbol">;</span> |
| |
| <span class="keyword">static</span><span class="normal"> </span><span class="type">void</span> |
| <span class="function">my_object_class_init</span><span class="normal"> </span><span class="symbol">(</span><span class="usertype">MyObjectClass</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">klass</span><span class="symbol">)</span> |
| <span class="cbracket">{</span> |
| <span class="normal"> </span><span class="usertype">GObjectClass</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">gobject_class </span><span class="symbol">=</span><span class="normal"> </span><span class="function"><a href="gobject-The-Base-Object-Type.html#G-OBJECT-CLASS:CAPS">G_OBJECT_CLASS</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">klass</span><span class="symbol">);</span> |
| |
| <span class="normal"> obj_properties</span><span class="symbol">[</span><span class="normal">PROP_FOO</span><span class="symbol">]</span><span class="normal"> </span><span class="symbol">=</span> |
| <span class="normal"> </span><span class="function"><a href="gobject-Standard-Parameter-and-Value-Types.html#g-param-spec-int">g_param_spec_int</a></span><span class="normal"> </span><span class="symbol">(</span><span class="string">"foo"</span><span class="symbol">,</span><span class="normal"> </span><span class="string">"Foo"</span><span class="symbol">,</span><span class="normal"> </span><span class="string">"Foo"</span><span class="symbol">,</span> |
| <span class="normal"> </span><span class="symbol">-</span><span class="number">1</span><span class="symbol">,</span><span class="normal"> <a href="../glib-Basic-Types.html#G-MAXINT:CAPS">G_MAXINT</a></span><span class="symbol">,</span> |
| <span class="normal"> </span><span class="number">0</span><span class="symbol">,</span> |
| <span class="normal"> <a href="gobject-GParamSpec.html#G-PARAM-READWRITE:CAPS">G_PARAM_READWRITE</a></span><span class="symbol">);</span> |
| |
| <span class="normal"> obj_properties</span><span class="symbol">[</span><span class="normal">PROP_BAR</span><span class="symbol">]</span><span class="normal"> </span><span class="symbol">=</span> |
| <span class="normal"> </span><span class="function"><a href="gobject-Standard-Parameter-and-Value-Types.html#g-param-spec-string">g_param_spec_string</a></span><span class="normal"> </span><span class="symbol">(</span><span class="string">"bar"</span><span class="symbol">,</span><span class="normal"> </span><span class="string">"Bar"</span><span class="symbol">,</span><span class="normal"> </span><span class="string">"Bar"</span><span class="symbol">,</span> |
| <span class="normal"> <a href="../glib-Standard-Macros.html#NULL:CAPS">NULL</a></span><span class="symbol">,</span> |
| <span class="normal"> <a href="gobject-GParamSpec.html#G-PARAM-READWRITE:CAPS">G_PARAM_READWRITE</a></span><span class="symbol">);</span> |
| |
| <span class="normal"> gobject_class</span><span class="symbol">-></span><span class="normal">set_property </span><span class="symbol">=</span><span class="normal"> my_object_set_property</span><span class="symbol">;</span> |
| <span class="normal"> gobject_class</span><span class="symbol">-></span><span class="normal">get_property </span><span class="symbol">=</span><span class="normal"> my_object_get_property</span><span class="symbol">;</span> |
| <span class="normal"> </span><span class="function"><a href="gobject-The-Base-Object-Type.html#g-object-class-install-properties">g_object_class_install_properties</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">gobject_class</span><span class="symbol">,</span> |
| <span class="normal"> N_PROPERTIES</span><span class="symbol">,</span> |
| <span class="normal"> obj_properties</span><span class="symbol">);</span> |
| <span class="cbracket">}</span></pre></td> |
| </tr> |
| </tbody> |
| </table> |
| </div> |
| |
| <p></p> |
| <p>allows calling <a class="link" href="gobject-The-Base-Object-Type.html#g-object-notify-by-pspec" title="g_object_notify_by_pspec ()"><code class="function">g_object_notify_by_pspec()</code></a> to notify of property changes:</p> |
| <div class="informalexample"> |
| <table class="listing_frame" border="0" cellpadding="0" cellspacing="0"> |
| <tbody> |
| <tr> |
| <td class="listing_lines" align="right"><pre>1 |
| 2 |
| 3 |
| 4 |
| 5 |
| 6 |
| 7 |
| 8 |
| 9</pre></td> |
| <td class="listing_code"><pre class="programlisting"><span class="type">void</span> |
| <span class="function">my_object_set_foo</span><span class="normal"> </span><span class="symbol">(</span><span class="usertype">MyObject</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">self</span><span class="symbol">,</span><span class="normal"> </span><span class="usertype">gint</span><span class="normal"> foo</span><span class="symbol">)</span> |
| <span class="cbracket">{</span> |
| <span class="normal"> </span><span class="keyword">if</span><span class="normal"> </span><span class="symbol">(</span><span class="normal">self</span><span class="symbol">-></span><span class="normal">foo </span><span class="symbol">!=</span><span class="normal"> foo</span><span class="symbol">)</span> |
| <span class="normal"> </span><span class="cbracket">{</span> |
| <span class="normal"> self</span><span class="symbol">-></span><span class="normal">foo </span><span class="symbol">=</span><span class="normal"> foo</span><span class="symbol">;</span> |
| <span class="normal"> </span><span class="function"><a href="gobject-The-Base-Object-Type.html#g-object-notify-by-pspec">g_object_notify_by_pspec</a></span><span class="normal"> </span><span class="symbol">(</span><span class="function"><a href="gobject-The-Base-Object-Type.html#G-OBJECT:CAPS">G_OBJECT</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">self</span><span class="symbol">),</span><span class="normal"> obj_properties</span><span class="symbol">[</span><span class="normal">PROP_FOO</span><span class="symbol">]);</span> |
| <span class="normal"> </span><span class="cbracket">}</span> |
| <span class="normal"> </span><span class="cbracket">}</span></pre></td> |
| </tr> |
| </tbody> |
| </table> |
| </div> |
| |
| <p></p> |
| <div class="refsect3"> |
| <a name="g-object-class-install-properties.parameters"></a><h4>Parameters</h4> |
| <div class="informaltable"><table class="informaltable" width="100%" border="0"> |
| <colgroup> |
| <col width="150px" class="parameters_name"> |
| <col class="parameters_description"> |
| <col width="200px" class="parameters_annotations"> |
| </colgroup> |
| <tbody> |
| <tr> |
| <td class="parameter_name"><p>oclass</p></td> |
| <td class="parameter_description"><p>a <a class="link" href="gobject-The-Base-Object-Type.html#GObjectClass" title="struct GObjectClass"><span class="type">GObjectClass</span></a></p></td> |
| <td class="parameter_annotations"> </td> |
| </tr> |
| <tr> |
| <td class="parameter_name"><p>n_pspecs</p></td> |
| <td class="parameter_description"><p>the length of the <a href="gobject-GParamSpec.html#GParamSpec"><span class="type">GParamSpecs</span></a> array</p></td> |
| <td class="parameter_annotations"> </td> |
| </tr> |
| <tr> |
| <td class="parameter_name"><p>pspecs</p></td> |
| <td class="parameter_description"><p> the <a href="gobject-GParamSpec.html#GParamSpec"><span class="type">GParamSpecs</span></a> array |
| defining the new properties. </p></td> |
| <td class="parameter_annotations"><span class="annotation">[<acronym title="Parameter points to an array of items."><span class="acronym">array</span></acronym> length=n_pspecs]</span></td> |
| </tr> |
| </tbody> |
| </table></div> |
| </div> |
| <p class="since">Since: <a class="link" href="api-index-2-26.html#api-index-2.26">2.26</a></p> |
| </div> |
| <hr> |
| <div class="refsect2"> |
| <a name="g-object-class-find-property"></a><h3>g_object_class_find_property ()</h3> |
| <pre class="programlisting"><a class="link" href="gobject-GParamSpec.html#GParamSpec" title="struct GParamSpec"><span class="returnvalue">GParamSpec</span></a> * |
| g_object_class_find_property (<em class="parameter"><code><a class="link" href="gobject-The-Base-Object-Type.html#GObjectClass" title="struct GObjectClass"><span class="type">GObjectClass</span></a> *oclass</code></em>, |
| <em class="parameter"><code>const <a href="../glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *property_name</code></em>);</pre> |
| <p>Looks up the <a class="link" href="gobject-GParamSpec.html#GParamSpec" title="struct GParamSpec"><span class="type">GParamSpec</span></a> for a property of a class.</p> |
| <div class="refsect3"> |
| <a name="g-object-class-find-property.parameters"></a><h4>Parameters</h4> |
| <div class="informaltable"><table class="informaltable" width="100%" border="0"> |
| <colgroup> |
| <col width="150px" class="parameters_name"> |
| <col class="parameters_description"> |
| <col width="200px" class="parameters_annotations"> |
| </colgroup> |
| <tbody> |
| <tr> |
| <td class="parameter_name"><p>oclass</p></td> |
| <td class="parameter_description"><p>a <a class="link" href="gobject-The-Base-Object-Type.html#GObjectClass" title="struct GObjectClass"><span class="type">GObjectClass</span></a></p></td> |
| <td class="parameter_annotations"> </td> |
| </tr> |
| <tr> |
| <td class="parameter_name"><p>property_name</p></td> |
| <td class="parameter_description"><p>the name of the property to look up</p></td> |
| <td class="parameter_annotations"> </td> |
| </tr> |
| </tbody> |
| </table></div> |
| </div> |
| <div class="refsect3"> |
| <a name="g-object-class-find-property.returns"></a><h4>Returns</h4> |
| <p> the <a class="link" href="gobject-GParamSpec.html#GParamSpec" title="struct GParamSpec"><span class="type">GParamSpec</span></a> for the property, or |
| <a href="../glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> if the class doesn't have a property of that name. </p> |
| <p><span class="annotation">[<acronym title="Don't free data after the code is done."><span class="acronym">transfer none</span></acronym>]</span></p> |
| </div> |
| </div> |
| <hr> |
| <div class="refsect2"> |
| <a name="g-object-class-list-properties"></a><h3>g_object_class_list_properties ()</h3> |
| <pre class="programlisting"><a class="link" href="gobject-GParamSpec.html#GParamSpec" title="struct GParamSpec"><span class="returnvalue">GParamSpec</span></a> ** |
| g_object_class_list_properties (<em class="parameter"><code><a class="link" href="gobject-The-Base-Object-Type.html#GObjectClass" title="struct GObjectClass"><span class="type">GObjectClass</span></a> *oclass</code></em>, |
| <em class="parameter"><code><a href="../glib-Basic-Types.html#guint"><span class="type">guint</span></a> *n_properties</code></em>);</pre> |
| <p>Get an array of <a class="link" href="gobject-GParamSpec.html#GParamSpec" title="struct GParamSpec"><span class="type">GParamSpec</span></a>* for all properties of a class.</p> |
| <div class="refsect3"> |
| <a name="g-object-class-list-properties.parameters"></a><h4>Parameters</h4> |
| <div class="informaltable"><table class="informaltable" width="100%" border="0"> |
| <colgroup> |
| <col width="150px" class="parameters_name"> |
| <col class="parameters_description"> |
| <col width="200px" class="parameters_annotations"> |
| </colgroup> |
| <tbody> |
| <tr> |
| <td class="parameter_name"><p>oclass</p></td> |
| <td class="parameter_description"><p>a <a class="link" href="gobject-The-Base-Object-Type.html#GObjectClass" title="struct GObjectClass"><span class="type">GObjectClass</span></a></p></td> |
| <td class="parameter_annotations"> </td> |
| </tr> |
| <tr> |
| <td class="parameter_name"><p>n_properties</p></td> |
| <td class="parameter_description"><p> return location for the length of the returned array. </p></td> |
| <td class="parameter_annotations"><span class="annotation">[<acronym title="Parameter for returning results. Default is transfer full."><span class="acronym">out</span></acronym>]</span></td> |
| </tr> |
| </tbody> |
| </table></div> |
| </div> |
| <div class="refsect3"> |
| <a name="g-object-class-list-properties.returns"></a><h4>Returns</h4> |
| <p> an array of |
| <a class="link" href="gobject-GParamSpec.html#GParamSpec" title="struct GParamSpec"><span class="type">GParamSpec</span></a>* which should be freed after use. </p> |
| <p><span class="annotation">[<acronym title="Parameter points to an array of items."><span class="acronym">array</span></acronym> length=n_properties][<acronym title="Free data container after the code is done."><span class="acronym">transfer container</span></acronym>]</span></p> |
| </div> |
| </div> |
| <hr> |
| <div class="refsect2"> |
| <a name="g-object-class-override-property"></a><h3>g_object_class_override_property ()</h3> |
| <pre class="programlisting"><span class="returnvalue">void</span> |
| g_object_class_override_property (<em class="parameter"><code><a class="link" href="gobject-The-Base-Object-Type.html#GObjectClass" title="struct GObjectClass"><span class="type">GObjectClass</span></a> *oclass</code></em>, |
| <em class="parameter"><code><a href="../glib-Basic-Types.html#guint"><span class="type">guint</span></a> property_id</code></em>, |
| <em class="parameter"><code>const <a href="../glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *name</code></em>);</pre> |
| <p>Registers <em class="parameter"><code>property_id</code></em> |
| as referring to a property with the name |
| <em class="parameter"><code>name</code></em> |
| in a parent class or in an interface implemented by <em class="parameter"><code>oclass</code></em> |
| . |
| This allows this class to "override" a property implementation in |
| a parent class or to provide the implementation of a property from |
| an interface.</p> |
| <p>Internally, overriding is implemented by creating a property of type |
| <a class="link" href="gobject-Standard-Parameter-and-Value-Types.html#GParamSpecOverride" title="struct GParamSpecOverride"><span class="type">GParamSpecOverride</span></a>; generally operations that query the properties of |
| the object class, such as <a class="link" href="gobject-The-Base-Object-Type.html#g-object-class-find-property" title="g_object_class_find_property ()"><code class="function">g_object_class_find_property()</code></a> or |
| <a class="link" href="gobject-The-Base-Object-Type.html#g-object-class-list-properties" title="g_object_class_list_properties ()"><code class="function">g_object_class_list_properties()</code></a> will return the overridden |
| property. However, in one case, the <em class="parameter"><code>construct_properties</code></em> |
| argument of |
| the <em class="parameter"><code>constructor</code></em> |
| virtual function, the <a class="link" href="gobject-Standard-Parameter-and-Value-Types.html#GParamSpecOverride" title="struct GParamSpecOverride"><span class="type">GParamSpecOverride</span></a> is passed |
| instead, so that the <em class="parameter"><code>param_id</code></em> |
| field of the <a class="link" href="gobject-GParamSpec.html#GParamSpec" title="struct GParamSpec"><span class="type">GParamSpec</span></a> will be |
| correct. For virtually all uses, this makes no difference. If you |
| need to get the overridden property, you can call |
| <a class="link" href="gobject-GParamSpec.html#g-param-spec-get-redirect-target" title="g_param_spec_get_redirect_target ()"><code class="function">g_param_spec_get_redirect_target()</code></a>.</p> |
| <div class="refsect3"> |
| <a name="g-object-class-override-property.parameters"></a><h4>Parameters</h4> |
| <div class="informaltable"><table class="informaltable" width="100%" border="0"> |
| <colgroup> |
| <col width="150px" class="parameters_name"> |
| <col class="parameters_description"> |
| <col width="200px" class="parameters_annotations"> |
| </colgroup> |
| <tbody> |
| <tr> |
| <td class="parameter_name"><p>oclass</p></td> |
| <td class="parameter_description"><p>a <a class="link" href="gobject-The-Base-Object-Type.html#GObjectClass" title="struct GObjectClass"><span class="type">GObjectClass</span></a></p></td> |
| <td class="parameter_annotations"> </td> |
| </tr> |
| <tr> |
| <td class="parameter_name"><p>property_id</p></td> |
| <td class="parameter_description"><p>the new property ID</p></td> |
| <td class="parameter_annotations"> </td> |
| </tr> |
| <tr> |
| <td class="parameter_name"><p>name</p></td> |
| <td class="parameter_description"><p>the name of a property registered in a parent class or |
| in an interface of this class.</p></td> |
| <td class="parameter_annotations"> </td> |
| </tr> |
| </tbody> |
| </table></div> |
| </div> |
| <p class="since">Since: <a class="link" href="api-index-2-4.html#api-index-2.4">2.4</a></p> |
| </div> |
| <hr> |
| <div class="refsect2"> |
| <a name="g-object-interface-install-property"></a><h3>g_object_interface_install_property ()</h3> |
| <pre class="programlisting"><span class="returnvalue">void</span> |
| g_object_interface_install_property (<em class="parameter"><code><a href="../glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> g_iface</code></em>, |
| <em class="parameter"><code><a class="link" href="gobject-GParamSpec.html#GParamSpec" title="struct GParamSpec"><span class="type">GParamSpec</span></a> *pspec</code></em>);</pre> |
| <p>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 <a class="link" href="gobject-GParamSpec.html#GParamSpec" title="struct GParamSpec"><span class="type">GParamSpec</span></a>, but normally |
| <a class="link" href="gobject-The-Base-Object-Type.html#g-object-class-override-property" title="g_object_class_override_property ()"><code class="function">g_object_class_override_property()</code></a> 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.</p> |
| <p>This function is meant to be called from the interface's default |
| vtable initialization function (the <em class="parameter"><code>class_init</code></em> |
| member of |
| <a class="link" href="gobject-Type-Information.html#GTypeInfo" title="struct GTypeInfo"><span class="type">GTypeInfo</span></a>.) It must not be called after after <em class="parameter"><code>class_init</code></em> |
| has |
| been called for any object types implementing this interface.</p> |
| <div class="refsect3"> |
| <a name="g-object-interface-install-property.parameters"></a><h4>Parameters</h4> |
| <div class="informaltable"><table class="informaltable" width="100%" border="0"> |
| <colgroup> |
| <col width="150px" class="parameters_name"> |
| <col class="parameters_description"> |
| <col width="200px" class="parameters_annotations"> |
| </colgroup> |
| <tbody> |
| <tr> |
| <td class="parameter_name"><p>g_iface</p></td> |
| <td class="parameter_description"><p> any interface vtable for the |
| interface, or the default |
| vtable for the interface. </p></td> |
| <td class="parameter_annotations"><span class="annotation">[<acronym title="Override the parsed C type with given type."><span class="acronym">type</span></acronym> GObject.TypeInterface]</span></td> |
| </tr> |
| <tr> |
| <td class="parameter_name"><p>pspec</p></td> |
| <td class="parameter_description"><p>the <a class="link" href="gobject-GParamSpec.html#GParamSpec" title="struct GParamSpec"><span class="type">GParamSpec</span></a> for the new property</p></td> |
| <td class="parameter_annotations"> </td> |
| </tr> |
| </tbody> |
| </table></div> |
| </div> |
| <p class="since">Since: <a class="link" href="api-index-2-4.html#api-index-2.4">2.4</a></p> |
| </div> |
| <hr> |
| <div class="refsect2"> |
| <a name="g-object-interface-find-property"></a><h3>g_object_interface_find_property ()</h3> |
| <pre class="programlisting"><a class="link" href="gobject-GParamSpec.html#GParamSpec" title="struct GParamSpec"><span class="returnvalue">GParamSpec</span></a> * |
| g_object_interface_find_property (<em class="parameter"><code><a href="../glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> g_iface</code></em>, |
| <em class="parameter"><code>const <a href="../glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *property_name</code></em>);</pre> |
| <p>Find the <a class="link" href="gobject-GParamSpec.html#GParamSpec" title="struct GParamSpec"><span class="type">GParamSpec</span></a> with the given name for an |
| interface. Generally, the interface vtable passed in as <em class="parameter"><code>g_iface</code></em> |
| |
| will be the default vtable from <a class="link" href="gobject-Type-Information.html#g-type-default-interface-ref" title="g_type_default_interface_ref ()"><code class="function">g_type_default_interface_ref()</code></a>, or, |
| if you know the interface has already been loaded, |
| <a class="link" href="gobject-Type-Information.html#g-type-default-interface-peek" title="g_type_default_interface_peek ()"><code class="function">g_type_default_interface_peek()</code></a>.</p> |
| <div class="refsect3"> |
| <a name="g-object-interface-find-property.parameters"></a><h4>Parameters</h4> |
| <div class="informaltable"><table class="informaltable" width="100%" border="0"> |
| <colgroup> |
| <col width="150px" class="parameters_name"> |
| <col class="parameters_description"> |
| <col width="200px" class="parameters_annotations"> |
| </colgroup> |
| <tbody> |
| <tr> |
| <td class="parameter_name"><p>g_iface</p></td> |
| <td class="parameter_description"><p> any interface vtable for the |
| interface, or the default vtable for the interface. </p></td> |
| <td class="parameter_annotations"><span class="annotation">[<acronym title="Override the parsed C type with given type."><span class="acronym">type</span></acronym> GObject.TypeInterface]</span></td> |
| </tr> |
| <tr> |
| <td class="parameter_name"><p>property_name</p></td> |
| <td class="parameter_description"><p>name of a property to lookup.</p></td> |
| <td class="parameter_annotations"> </td> |
| </tr> |
| </tbody> |
| </table></div> |
| </div> |
| <div class="refsect3"> |
| <a name="g-object-interface-find-property.returns"></a><h4>Returns</h4> |
| <p> the <a class="link" href="gobject-GParamSpec.html#GParamSpec" title="struct GParamSpec"><span class="type">GParamSpec</span></a> for the property of the |
| interface with the name <em class="parameter"><code>property_name</code></em> |
| , or <a href="../glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> if no |
| such property exists. </p> |
| <p><span class="annotation">[<acronym title="Don't free data after the code is done."><span class="acronym">transfer none</span></acronym>]</span></p> |
| </div> |
| <p class="since">Since: <a class="link" href="api-index-2-4.html#api-index-2.4">2.4</a></p> |
| </div> |
| <hr> |
| <div class="refsect2"> |
| <a name="g-object-interface-list-properties"></a><h3>g_object_interface_list_properties ()</h3> |
| <pre class="programlisting"><a class="link" href="gobject-GParamSpec.html#GParamSpec" title="struct GParamSpec"><span class="returnvalue">GParamSpec</span></a> ** |
| g_object_interface_list_properties (<em class="parameter"><code><a href="../glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> g_iface</code></em>, |
| <em class="parameter"><code><a href="../glib-Basic-Types.html#guint"><span class="type">guint</span></a> *n_properties_p</code></em>);</pre> |
| <p>Lists the properties of an interface.Generally, the interface |
| vtable passed in as <em class="parameter"><code>g_iface</code></em> |
| will be the default vtable from |
| <a class="link" href="gobject-Type-Information.html#g-type-default-interface-ref" title="g_type_default_interface_ref ()"><code class="function">g_type_default_interface_ref()</code></a>, or, if you know the interface has |
| already been loaded, <a class="link" href="gobject-Type-Information.html#g-type-default-interface-peek" title="g_type_default_interface_peek ()"><code class="function">g_type_default_interface_peek()</code></a>.</p> |
| <div class="refsect3"> |
| <a name="g-object-interface-list-properties.parameters"></a><h4>Parameters</h4> |
| <div class="informaltable"><table class="informaltable" width="100%" border="0"> |
| <colgroup> |
| <col width="150px" class="parameters_name"> |
| <col class="parameters_description"> |
| <col width="200px" class="parameters_annotations"> |
| </colgroup> |
| <tbody> |
| <tr> |
| <td class="parameter_name"><p>g_iface</p></td> |
| <td class="parameter_description"><p> any interface vtable for the |
| interface, or the default vtable for the interface. </p></td> |
| <td class="parameter_annotations"><span class="annotation">[<acronym title="Override the parsed C type with given type."><span class="acronym">type</span></acronym> GObject.TypeInterface]</span></td> |
| </tr> |
| <tr> |
| <td class="parameter_name"><p>n_properties_p</p></td> |
| <td class="parameter_description"><p> location to store number of properties returned. </p></td> |
| <td class="parameter_annotations"><span class="annotation">[<acronym title="Parameter for returning results. Default is transfer full."><span class="acronym">out</span></acronym>]</span></td> |
| </tr> |
| </tbody> |
| </table></div> |
| </div> |
| <div class="refsect3"> |
| <a name="g-object-interface-list-properties.returns"></a><h4>Returns</h4> |
| <p> a |
| pointer to an array of pointers to <a class="link" href="gobject-GParamSpec.html#GParamSpec" title="struct GParamSpec"><span class="type">GParamSpec</span></a> |
| structures. The paramspecs are owned by GLib, but the |
| array should be freed with <a href="../glib-Memory-Allocation.html#g-free"><code class="function">g_free()</code></a> when you are done with |
| it. </p> |
| <p><span class="annotation">[<acronym title="Parameter points to an array of items."><span class="acronym">array</span></acronym> length=n_properties_p][<acronym title="Free data container after the code is done."><span class="acronym">transfer container</span></acronym>]</span></p> |
| </div> |
| <p class="since">Since: <a class="link" href="api-index-2-4.html#api-index-2.4">2.4</a></p> |
| </div> |
| <hr> |
| <div class="refsect2"> |
| <a name="g-object-new"></a><h3>g_object_new ()</h3> |
| <pre class="programlisting"><a href="../glib-Basic-Types.html#gpointer"><span class="returnvalue">gpointer</span></a> |
| g_object_new (<em class="parameter"><code><a class="link" href="gobject-Type-Information.html#GType" title="GType"><span class="type">GType</span></a> object_type</code></em>, |
| <em class="parameter"><code>const <a href="../glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *first_property_name</code></em>, |
| <em class="parameter"><code>...</code></em>);</pre> |
| <p>Creates a new instance of a <a class="link" href="gobject-The-Base-Object-Type.html#GObject"><span class="type">GObject</span></a> subtype and sets its properties.</p> |
| <p>Construction parameters (see <a class="link" href="gobject-GParamSpec.html#G-PARAM-CONSTRUCT:CAPS"><span class="type">G_PARAM_CONSTRUCT</span></a>, <a class="link" href="gobject-GParamSpec.html#G-PARAM-CONSTRUCT-ONLY:CAPS"><span class="type">G_PARAM_CONSTRUCT_ONLY</span></a>) |
| which are not explicitly specified are set to their default values.</p> |
| <p><span class="annotation">[<acronym title="Exposed in C code, not necessarily available in other languages."><span class="acronym">skip</span></acronym>]</span></p> |
| <div class="refsect3"> |
| <a name="g-object-new.parameters"></a><h4>Parameters</h4> |
| <div class="informaltable"><table class="informaltable" width="100%" border="0"> |
| <colgroup> |
| <col width="150px" class="parameters_name"> |
| <col class="parameters_description"> |
| <col width="200px" class="parameters_annotations"> |
| </colgroup> |
| <tbody> |
| <tr> |
| <td class="parameter_name"><p>object_type</p></td> |
| <td class="parameter_description"><p>the type id of the <a class="link" href="gobject-The-Base-Object-Type.html#GObject"><span class="type">GObject</span></a> subtype to instantiate</p></td> |
| <td class="parameter_annotations"> </td> |
| </tr> |
| <tr> |
| <td class="parameter_name"><p>first_property_name</p></td> |
| <td class="parameter_description"><p>the name of the first property</p></td> |
| <td class="parameter_annotations"> </td> |
| </tr> |
| <tr> |
| <td class="parameter_name"><p>...</p></td> |
| <td class="parameter_description"><p>the value of the first property, followed optionally by more |
| name/value pairs, followed by <a href="../glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a></p></td> |
| <td class="parameter_annotations"> </td> |
| </tr> |
| </tbody> |
| </table></div> |
| </div> |
| <div class="refsect3"> |
| <a name="g-object-new.returns"></a><h4>Returns</h4> |
| <p> (transfer full) (type GObject.Object) : a new instance of |
| <em class="parameter"><code>object_type</code></em> |
| </p> |
| </div> |
| </div> |
| <hr> |
| <div class="refsect2"> |
| <a name="g-object-newv"></a><h3>g_object_newv ()</h3> |
| <pre class="programlisting"><a href="../glib-Basic-Types.html#gpointer"><span class="returnvalue">gpointer</span></a> |
| g_object_newv (<em class="parameter"><code><a class="link" href="gobject-Type-Information.html#GType" title="GType"><span class="type">GType</span></a> object_type</code></em>, |
| <em class="parameter"><code><a href="../glib-Basic-Types.html#guint"><span class="type">guint</span></a> n_parameters</code></em>, |
| <em class="parameter"><code><a class="link" href="gobject-The-Base-Object-Type.html#GParameter" title="struct GParameter"><span class="type">GParameter</span></a> *parameters</code></em>);</pre> |
| <p>Creates a new instance of a <a class="link" href="gobject-The-Base-Object-Type.html#GObject"><span class="type">GObject</span></a> subtype and sets its properties.</p> |
| <p>Construction parameters (see <a class="link" href="gobject-GParamSpec.html#G-PARAM-CONSTRUCT:CAPS"><span class="type">G_PARAM_CONSTRUCT</span></a>, <a class="link" href="gobject-GParamSpec.html#G-PARAM-CONSTRUCT-ONLY:CAPS"><span class="type">G_PARAM_CONSTRUCT_ONLY</span></a>) |
| which are not explicitly specified are set to their default values.</p> |
| <p><span class="annotation">[<acronym title="Rename the original symbol's name to SYMBOL."><span class="acronym">rename-to</span></acronym> g_object_new]</span></p> |
| <div class="refsect3"> |
| <a name="g-object-newv.parameters"></a><h4>Parameters</h4> |
| <div class="informaltable"><table class="informaltable" width="100%" border="0"> |
| <colgroup> |
| <col width="150px" class="parameters_name"> |
| <col class="parameters_description"> |
| <col width="200px" class="parameters_annotations"> |
| </colgroup> |
| <tbody> |
| <tr> |
| <td class="parameter_name"><p>object_type</p></td> |
| <td class="parameter_description"><p>the type id of the <a class="link" href="gobject-The-Base-Object-Type.html#GObject"><span class="type">GObject</span></a> subtype to instantiate</p></td> |
| <td class="parameter_annotations"> </td> |
| </tr> |
| <tr> |
| <td class="parameter_name"><p>n_parameters</p></td> |
| <td class="parameter_description"><p>the length of the <em class="parameter"><code>parameters</code></em> |
| array</p></td> |
| <td class="parameter_annotations"> </td> |
| </tr> |
| <tr> |
| <td class="parameter_name"><p>parameters</p></td> |
| <td class="parameter_description"><p> an array of <a class="link" href="gobject-The-Base-Object-Type.html#GParameter" title="struct GParameter"><span class="type">GParameter</span></a>. </p></td> |
| <td class="parameter_annotations"><span class="annotation">[<acronym title="Parameter points to an array of items."><span class="acronym">array</span></acronym> length=n_parameters]</span></td> |
| </tr> |
| </tbody> |
| </table></div> |
| </div> |
| <div class="refsect3"> |
| <a name="g-object-newv.returns"></a><h4>Returns</h4> |
| <p> a new instance of |
| <em class="parameter"><code>object_type</code></em> |
| . </p> |
| <p><span class="annotation">[<acronym title="Override the parsed C type with given type."><span class="acronym">type</span></acronym> GObject.Object][<acronym title="Free data after the code is done."><span class="acronym">transfer full</span></acronym>]</span></p> |
| </div> |
| </div> |
| <hr> |
| <div class="refsect2"> |
| <a name="g-object-ref"></a><h3>g_object_ref ()</h3> |
| <pre class="programlisting"><a href="../glib-Basic-Types.html#gpointer"><span class="returnvalue">gpointer</span></a> |
| g_object_ref (<em class="parameter"><code><a href="../glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> object</code></em>);</pre> |
| <p>Increases the reference count of <em class="parameter"><code>object</code></em> |
| .</p> |
| <div class="refsect3"> |
| <a name="g-object-ref.parameters"></a><h4>Parameters</h4> |
| <div class="informaltable"><table class="informaltable" width="100%" border="0"> |
| <colgroup> |
| <col width="150px" class="parameters_name"> |
| <col class="parameters_description"> |
| <col width="200px" class="parameters_annotations"> |
| </colgroup> |
| <tbody><tr> |
| <td class="parameter_name"><p>object</p></td> |
| <td class="parameter_description"><p> a <a class="link" href="gobject-The-Base-Object-Type.html#GObject"><span class="type">GObject</span></a>. </p></td> |
| <td class="parameter_annotations"><span class="annotation">[<acronym title="Override the parsed C type with given type."><span class="acronym">type</span></acronym> GObject.Object]</span></td> |
| </tr></tbody> |
| </table></div> |
| </div> |
| <div class="refsect3"> |
| <a name="g-object-ref.returns"></a><h4>Returns</h4> |
| <p> the same <em class="parameter"><code>object</code></em> |
| . </p> |
| <p><span class="annotation">[<acronym title="Override the parsed C type with given type."><span class="acronym">type</span></acronym> GObject.Object][<acronym title="Don't free data after the code is done."><span class="acronym">transfer none</span></acronym>]</span></p> |
| </div> |
| </div> |
| <hr> |
| <div class="refsect2"> |
| <a name="g-object-unref"></a><h3>g_object_unref ()</h3> |
| <pre class="programlisting"><span class="returnvalue">void</span> |
| g_object_unref (<em class="parameter"><code><a href="../glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> object</code></em>);</pre> |
| <p>Decreases the reference count of <em class="parameter"><code>object</code></em> |
| . When its reference count |
| drops to 0, the object is finalized (i.e. its memory is freed).</p> |
| <p>If the pointer to the <a class="link" href="gobject-The-Base-Object-Type.html#GObject"><span class="type">GObject</span></a> may be reused in future (for example, if it is |
| an instance variable of another object), it is recommended to clear the |
| pointer to <a href="../glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> rather than retain a dangling pointer to a potentially |
| invalid <a class="link" href="gobject-The-Base-Object-Type.html#GObject"><span class="type">GObject</span></a> instance. Use <a class="link" href="gobject-The-Base-Object-Type.html#g-clear-object" title="g_clear_object ()"><code class="function">g_clear_object()</code></a> for this.</p> |
| <div class="refsect3"> |
| <a name="g-object-unref.parameters"></a><h4>Parameters</h4> |
| <div class="informaltable"><table class="informaltable" width="100%" border="0"> |
| <colgroup> |
| <col width="150px" class="parameters_name"> |
| <col class="parameters_description"> |
| <col width="200px" class="parameters_annotations"> |
| </colgroup> |
| <tbody><tr> |
| <td class="parameter_name"><p>object</p></td> |
| <td class="parameter_description"><p> a <a class="link" href="gobject-The-Base-Object-Type.html#GObject"><span class="type">GObject</span></a>. </p></td> |
| <td class="parameter_annotations"><span class="annotation">[<acronym title="Override the parsed C type with given type."><span class="acronym">type</span></acronym> GObject.Object]</span></td> |
| </tr></tbody> |
| </table></div> |
| </div> |
| </div> |
| <hr> |
| <div class="refsect2"> |
| <a name="g-object-ref-sink"></a><h3>g_object_ref_sink ()</h3> |
| <pre class="programlisting"><a href="../glib-Basic-Types.html#gpointer"><span class="returnvalue">gpointer</span></a> |
| g_object_ref_sink (<em class="parameter"><code><a href="../glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> object</code></em>);</pre> |
| <p>Increase the reference count of <em class="parameter"><code>object</code></em> |
| , and possibly remove the |
| <a class="link" href="gobject-The-Base-Object-Type.html#floating-ref" title="Floating references">floating</a> reference, if <em class="parameter"><code>object</code></em> |
| has a floating reference.</p> |
| <p>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.</p> |
| <div class="refsect3"> |
| <a name="g-object-ref-sink.parameters"></a><h4>Parameters</h4> |
| <div class="informaltable"><table class="informaltable" width="100%" border="0"> |
| <colgroup> |
| <col width="150px" class="parameters_name"> |
| <col class="parameters_description"> |
| <col width="200px" class="parameters_annotations"> |
| </colgroup> |
| <tbody><tr> |
| <td class="parameter_name"><p>object</p></td> |
| <td class="parameter_description"><p> a <a class="link" href="gobject-The-Base-Object-Type.html#GObject"><span class="type">GObject</span></a>. </p></td> |
| <td class="parameter_annotations"><span class="annotation">[<acronym title="Override the parsed C type with given type."><span class="acronym">type</span></acronym> GObject.Object]</span></td> |
| </tr></tbody> |
| </table></div> |
| </div> |
| <div class="refsect3"> |
| <a name="g-object-ref-sink.returns"></a><h4>Returns</h4> |
| <p> <em class="parameter"><code>object</code></em> |
| . </p> |
| <p><span class="annotation">[<acronym title="Override the parsed C type with given type."><span class="acronym">type</span></acronym> GObject.Object][<acronym title="Don't free data after the code is done."><span class="acronym">transfer none</span></acronym>]</span></p> |
| </div> |
| <p class="since">Since: <a class="link" href="api-index-2-10.html#api-index-2.10">2.10</a></p> |
| </div> |
| <hr> |
| <div class="refsect2"> |
| <a name="g-set-object"></a><h3>g_set_object()</h3> |
| <pre class="programlisting">#define g_set_object(object_ptr, new_object)</pre> |
| <p>Updates a <a class="link" href="gobject-The-Base-Object-Type.html#GObject"><span class="type">GObject</span></a> pointer to refer to <em class="parameter"><code>new_object</code></em> |
| . It increments the |
| reference count of <em class="parameter"><code>new_object</code></em> |
| (if non-<a href="../glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>), decrements the reference |
| count of the current value of <em class="parameter"><code>object_ptr</code></em> |
| (if non-<a href="../glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>), and assigns |
| <em class="parameter"><code>new_object</code></em> |
| to <em class="parameter"><code>object_ptr</code></em> |
| . The assignment is not atomic.</p> |
| <p><em class="parameter"><code>object_ptr</code></em> |
| must not be <a href="../glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>.</p> |
| <p>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.</p> |
| <p>One convenient usage of this function is in implementing property setters:</p> |
| <div class="informalexample"> |
| <table class="listing_frame" border="0" cellpadding="0" cellspacing="0"> |
| <tbody> |
| <tr> |
| <td class="listing_lines" align="right"><pre>1 |
| 2 |
| 3 |
| 4 |
| 5 |
| 6 |
| 7 |
| 8 |
| 9 |
| 10</pre></td> |
| <td class="listing_code"><pre class="programlisting"><span class="type">void</span> |
| <span class="function">foo_set_bar</span><span class="normal"> </span><span class="symbol">(</span><span class="usertype">Foo</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">foo</span><span class="symbol">,</span> |
| <span class="normal"> </span><span class="usertype">Bar</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">new_bar</span><span class="symbol">)</span> |
| <span class="cbracket">{</span> |
| <span class="normal"> </span><span class="function"><a href="../glib-Warnings-and-Assertions.html#g-return-if-fail">g_return_if_fail</a></span><span class="normal"> </span><span class="symbol">(</span><span class="function">IS_FOO</span><span class="normal"> </span><span class="symbol">(</span><span class="normal">foo</span><span class="symbol">));</span> |
| <span class="normal"> </span><span class="function"><a href="../glib-Warnings-and-Assertions.html#g-return-if-fail">g_return_if_fail</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">new_bar </span><span class="symbol">==</span><span class="normal"> <a href="../glib-Standard-Macros.html#NULL:CAPS">NULL</a> </span><span class="symbol">||</span><span class="normal"> </span><span class="function">IS_BAR</span><span class="normal"> </span><span class="symbol">(</span><span class="normal">new_bar</span><span class="symbol">));</span> |
| |
| <span class="normal"> </span><span class="keyword">if</span><span class="normal"> </span><span class="symbol">(</span><span class="function"><a href="gobject-The-Base-Object-Type.html#g-set-object">g_set_object</a></span><span class="normal"> </span><span class="symbol">(&</span><span class="normal">foo</span><span class="symbol">-></span><span class="normal">bar</span><span class="symbol">,</span><span class="normal"> new_bar</span><span class="symbol">))</span> |
| <span class="normal"> </span><span class="function"><a href="gobject-The-Base-Object-Type.html#g-object-notify">g_object_notify</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">foo</span><span class="symbol">,</span><span class="normal"> </span><span class="string">"bar"</span><span class="symbol">);</span> |
| <span class="cbracket">}</span></pre></td> |
| </tr> |
| </tbody> |
| </table> |
| </div> |
| |
| <p></p> |
| <div class="refsect3"> |
| <a name="g-set-object.parameters"></a><h4>Parameters</h4> |
| <div class="informaltable"><table class="informaltable" width="100%" border="0"> |
| <colgroup> |
| <col width="150px" class="parameters_name"> |
| <col class="parameters_description"> |
| <col width="200px" class="parameters_annotations"> |
| </colgroup> |
| <tbody> |
| <tr> |
| <td class="parameter_name"><p>object_ptr</p></td> |
| <td class="parameter_description"><p>a pointer to a <a class="link" href="gobject-The-Base-Object-Type.html#GObject"><span class="type">GObject</span></a> reference</p></td> |
| <td class="parameter_annotations"> </td> |
| </tr> |
| <tr> |
| <td class="parameter_name"><p>new_object</p></td> |
| <td class="parameter_description"><p> a pointer to the new <a class="link" href="gobject-The-Base-Object-Type.html#GObject"><span class="type">GObject</span></a> to |
| assign to it, or <a href="../glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> to clear the pointer. </p></td> |
| <td class="parameter_annotations"><span class="annotation">[<acronym title="NULL may be passed as the value in, out, in-out; or as a return value."><span class="acronym">nullable</span></acronym>][<acronym title="Don't free data after the code is done."><span class="acronym">transfer none</span></acronym>]</span></td> |
| </tr> |
| </tbody> |
| </table></div> |
| </div> |
| <div class="refsect3"> |
| <a name="g-set-object.returns"></a><h4>Returns</h4> |
| <p> <a href="../glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if the value of <em class="parameter"><code>object_ptr</code></em> |
| changed, <a href="../glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> otherwise</p> |
| </div> |
| <p class="since">Since: <a class="link" href="api-index-2-44.html#api-index-2.44">2.44</a></p> |
| </div> |
| <hr> |
| <div class="refsect2"> |
| <a name="g-clear-object"></a><h3>g_clear_object ()</h3> |
| <pre class="programlisting"><span class="returnvalue">void</span> |
| g_clear_object (<em class="parameter"><code>volatile <a class="link" href="gobject-The-Base-Object-Type.html#GObject"><span class="type">GObject</span></a> **object_ptr</code></em>);</pre> |
| <p>Clears a reference to a <a class="link" href="gobject-The-Base-Object-Type.html#GObject"><span class="type">GObject</span></a>.</p> |
| <p><em class="parameter"><code>object_ptr</code></em> |
| must not be <a href="../glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>.</p> |
| <p>If the reference is <a href="../glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> then this function does nothing. |
| Otherwise, the reference count of the object is decreased and the |
| pointer is set to <a href="../glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>.</p> |
| <p>A macro is also included that allows this function to be used without |
| pointer casts.</p> |
| <p><span class="annotation">[<acronym title="Exposed in C code, not necessarily available in other languages."><span class="acronym">skip</span></acronym>]</span></p> |
| <div class="refsect3"> |
| <a name="g-clear-object.parameters"></a><h4>Parameters</h4> |
| <div class="informaltable"><table class="informaltable" width="100%" border="0"> |
| <colgroup> |
| <col width="150px" class="parameters_name"> |
| <col class="parameters_description"> |
| <col width="200px" class="parameters_annotations"> |
| </colgroup> |
| <tbody><tr> |
| <td class="parameter_name"><p>object_ptr</p></td> |
| <td class="parameter_description"><p>a pointer to a <a class="link" href="gobject-The-Base-Object-Type.html#GObject"><span class="type">GObject</span></a> reference</p></td> |
| <td class="parameter_annotations"> </td> |
| </tr></tbody> |
| </table></div> |
| </div> |
| <p class="since">Since: <a class="link" href="api-index-2-28.html#api-index-2.28">2.28</a></p> |
| </div> |
| <hr> |
| <div class="refsect2"> |
| <a name="g-object-is-floating"></a><h3>g_object_is_floating ()</h3> |
| <pre class="programlisting"><a href="../glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a> |
| g_object_is_floating (<em class="parameter"><code><a href="../glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> object</code></em>);</pre> |
| <p>Checks whether <em class="parameter"><code>object</code></em> |
| has a <a class="link" href="gobject-The-Base-Object-Type.html#floating-ref" title="Floating references">floating</a> reference.</p> |
| <div class="refsect3"> |
| <a name="g-object-is-floating.parameters"></a><h4>Parameters</h4> |
| <div class="informaltable"><table class="informaltable" width="100%" border="0"> |
| <colgroup> |
| <col width="150px" class="parameters_name"> |
| <col class="parameters_description"> |
| <col width="200px" class="parameters_annotations"> |
| </colgroup> |
| <tbody><tr> |
| <td class="parameter_name"><p>object</p></td> |
| <td class="parameter_description"><p> a <a class="link" href="gobject-The-Base-Object-Type.html#GObject"><span class="type">GObject</span></a>. </p></td> |
| <td class="parameter_annotations"><span class="annotation">[<acronym title="Override the parsed C type with given type."><span class="acronym">type</span></acronym> GObject.Object]</span></td> |
| </tr></tbody> |
| </table></div> |
| </div> |
| <div class="refsect3"> |
| <a name="g-object-is-floating.returns"></a><h4>Returns</h4> |
| <p> <a href="../glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if <em class="parameter"><code>object</code></em> |
| has a floating reference</p> |
| </div> |
| <p class="since">Since: <a class="link" href="api-index-2-10.html#api-index-2.10">2.10</a></p> |
| </div> |
| <hr> |
| <div class="refsect2"> |
| <a name="g-object-force-floating"></a><h3>g_object_force_floating ()</h3> |
| <pre class="programlisting"><span class="returnvalue">void</span> |
| g_object_force_floating (<em class="parameter"><code><a class="link" href="gobject-The-Base-Object-Type.html#GObject"><span class="type">GObject</span></a> *object</code></em>);</pre> |
| <p>This function is intended for <a class="link" href="gobject-The-Base-Object-Type.html#GObject"><span class="type">GObject</span></a> implementations to re-enforce |
| a <a class="link" href="gobject-The-Base-Object-Type.html#floating-ref" title="Floating references">floating</a> object reference. Doing this is seldom |
| required: all <a href="gobject-The-Base-Object-Type.html#GInitiallyUnowned"><span class="type">GInitiallyUnowneds</span></a> are created with a floating reference |
| which usually just needs to be sunken by calling <a class="link" href="gobject-The-Base-Object-Type.html#g-object-ref-sink" title="g_object_ref_sink ()"><code class="function">g_object_ref_sink()</code></a>.</p> |
| <div class="refsect3"> |
| <a name="g-object-force-floating.parameters"></a><h4>Parameters</h4> |
| <div class="informaltable"><table class="informaltable" width="100%" border="0"> |
| <colgroup> |
| <col width="150px" class="parameters_name"> |
| <col class="parameters_description"> |
| <col width="200px" class="parameters_annotations"> |
| </colgroup> |
| <tbody><tr> |
| <td class="parameter_name"><p>object</p></td> |
| <td class="parameter_description"><p>a <a class="link" href="gobject-The-Base-Object-Type.html#GObject"><span class="type">GObject</span></a></p></td> |
| <td class="parameter_annotations"> </td> |
| </tr></tbody> |
| </table></div> |
| </div> |
| <p class="since">Since: <a class="link" href="api-index-2-10.html#api-index-2.10">2.10</a></p> |
| </div> |
| <hr> |
| <div class="refsect2"> |
| <a name="GWeakNotify"></a><h3>GWeakNotify ()</h3> |
| <pre class="programlisting"><span class="returnvalue">void</span> |
| <span class="c_punctuation">(</span>*GWeakNotify<span class="c_punctuation">)</span> (<em class="parameter"><code><a href="../glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> data</code></em>, |
| <em class="parameter"><code><a class="link" href="gobject-The-Base-Object-Type.html#GObject"><span class="type">GObject</span></a> *where_the_object_was</code></em>);</pre> |
| <p>A <a class="link" href="gobject-The-Base-Object-Type.html#GWeakNotify" title="GWeakNotify ()"><span class="type">GWeakNotify</span></a> 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 <a class="link" href="gobject-The-Base-Object-Type.html#GWeakNotify" title="GWeakNotify ()"><span class="type">GWeakNotify</span></a> 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.</p> |
| <div class="refsect3"> |
| <a name="GWeakNotify.parameters"></a><h4>Parameters</h4> |
| <div class="informaltable"><table class="informaltable" width="100%" border="0"> |
| <colgroup> |
| <col width="150px" class="parameters_name"> |
| <col class="parameters_description"> |
| <col width="200px" class="parameters_annotations"> |
| </colgroup> |
| <tbody> |
| <tr> |
| <td class="parameter_name"><p>data</p></td> |
| <td class="parameter_description"><p>data that was provided when the weak reference was established</p></td> |
| <td class="parameter_annotations"> </td> |
| </tr> |
| <tr> |
| <td class="parameter_name"><p>where_the_object_was</p></td> |
| <td class="parameter_description"><p>the object being finalized</p></td> |
| <td class="parameter_annotations"> </td> |
| </tr> |
| </tbody> |
| </table></div> |
| </div> |
| </div> |
| <hr> |
| <div class="refsect2"> |
| <a name="g-object-weak-ref"></a><h3>g_object_weak_ref ()</h3> |
| <pre class="programlisting"><span class="returnvalue">void</span> |
| g_object_weak_ref (<em class="parameter"><code><a class="link" href="gobject-The-Base-Object-Type.html#GObject"><span class="type">GObject</span></a> *object</code></em>, |
| <em class="parameter"><code><a class="link" href="gobject-The-Base-Object-Type.html#GWeakNotify" title="GWeakNotify ()"><span class="type">GWeakNotify</span></a> notify</code></em>, |
| <em class="parameter"><code><a href="../glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> data</code></em>);</pre> |
| <p>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 <a class="link" href="gobject-The-Base-Object-Type.html#g-object-ref" title="g_object_ref ()"><code class="function">g_object_ref()</code></a> (<a class="link" href="gobject-The-Base-Object-Type.html#g-object-ref" title="g_object_ref ()"><code class="function">g_object_ref()</code></a> adds a |
| strong reference, that is, forces the object to stay alive).</p> |
| <p>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 <a class="link" href="gobject-The-Base-Object-Type.html#g-object-unref" title="g_object_unref ()"><code class="function">g_object_unref()</code></a> might happen in another thread. |
| Use <a class="link" href="gobject-The-Base-Object-Type.html#GWeakRef" title="GWeakRef"><span class="type">GWeakRef</span></a> if thread-safety is required.</p> |
| <p><span class="annotation">[<acronym title="Exposed in C code, not necessarily available in other languages."><span class="acronym">skip</span></acronym>]</span></p> |
| <div class="refsect3"> |
| <a name="g-object-weak-ref.parameters"></a><h4>Parameters</h4> |
| <div class="informaltable"><table class="informaltable" width="100%" border="0"> |
| <colgroup> |
| <col width="150px" class="parameters_name"> |
| <col class="parameters_description"> |
| <col width="200px" class="parameters_annotations"> |
| </colgroup> |
| <tbody> |
| <tr> |
| <td class="parameter_name"><p>object</p></td> |
| <td class="parameter_description"><p><a class="link" href="gobject-The-Base-Object-Type.html#GObject"><span class="type">GObject</span></a> to reference weakly</p></td> |
| <td class="parameter_annotations"> </td> |
| </tr> |
| <tr> |
| <td class="parameter_name"><p>notify</p></td> |
| <td class="parameter_description"><p>callback to invoke before the object is freed</p></td> |
| <td class="parameter_annotations"> </td> |
| </tr> |
| <tr> |
| <td class="parameter_name"><p>data</p></td> |
| <td class="parameter_description"><p>extra data to pass to notify</p></td> |
| <td class="parameter_annotations"> </td> |
| </tr> |
| </tbody> |
| </table></div> |
| </div> |
| </div> |
| <hr> |
| <div class="refsect2"> |
| <a name="g-object-weak-unref"></a><h3>g_object_weak_unref ()</h3> |
| <pre class="programlisting"><span class="returnvalue">void</span> |
| g_object_weak_unref (<em class="parameter"><code><a class="link" href="gobject-The-Base-Object-Type.html#GObject"><span class="type">GObject</span></a> *object</code></em>, |
| <em class="parameter"><code><a class="link" href="gobject-The-Base-Object-Type.html#GWeakNotify" title="GWeakNotify ()"><span class="type">GWeakNotify</span></a> notify</code></em>, |
| <em class="parameter"><code><a href="../glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> data</code></em>);</pre> |
| <p>Removes a weak reference callback to an object.</p> |
| <p><span class="annotation">[<acronym title="Exposed in C code, not necessarily available in other languages."><span class="acronym">skip</span></acronym>]</span></p> |
| <div class="refsect3"> |
| <a name="g-object-weak-unref.parameters"></a><h4>Parameters</h4> |
| <div class="informaltable"><table class="informaltable" width="100%" border="0"> |
| <colgroup> |
| <col width="150px" class="parameters_name"> |
| <col class="parameters_description"> |
| <col width="200px" class="parameters_annotations"> |
| </colgroup> |
| <tbody> |
| <tr> |
| <td class="parameter_name"><p>object</p></td> |
| <td class="parameter_description"><p><a class="link" href="gobject-The-Base-Object-Type.html#GObject"><span class="type">GObject</span></a> to remove a weak reference from</p></td> |
| <td class="parameter_annotations"> </td> |
| </tr> |
| <tr> |
| <td class="parameter_name"><p>notify</p></td> |
| <td class="parameter_description"><p>callback to search for</p></td> |
| <td class="parameter_annotations"> </td> |
| </tr> |
| <tr> |
| <td class="parameter_name"><p>data</p></td> |
| <td class="parameter_description"><p>data to search for</p></td> |
| <td class="parameter_annotations"> </td> |
| </tr> |
| </tbody> |
| </table></div> |
| </div> |
| </div> |
| <hr> |
| <div class="refsect2"> |
| <a name="g-object-add-weak-pointer"></a><h3>g_object_add_weak_pointer ()</h3> |
| <pre class="programlisting"><span class="returnvalue">void</span> |
| g_object_add_weak_pointer (<em class="parameter"><code><a class="link" href="gobject-The-Base-Object-Type.html#GObject"><span class="type">GObject</span></a> *object</code></em>, |
| <em class="parameter"><code><a href="../glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> *weak_pointer_location</code></em>);</pre> |
| <p>Adds a weak reference from weak_pointer to <em class="parameter"><code>object</code></em> |
| to indicate that |
| the pointer located at <em class="parameter"><code>weak_pointer_location</code></em> |
| is only valid during |
| the lifetime of <em class="parameter"><code>object</code></em> |
| . When the <em class="parameter"><code>object</code></em> |
| is finalized, |
| <em class="parameter"><code>weak_pointer</code></em> |
| will be set to <a href="../glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>.</p> |
| <p>Note that as with <a class="link" href="gobject-The-Base-Object-Type.html#g-object-weak-ref" title="g_object_weak_ref ()"><code class="function">g_object_weak_ref()</code></a>, the weak references created by |
| this method are not thread-safe: they cannot safely be used in one |
| thread if the object's last <a class="link" href="gobject-The-Base-Object-Type.html#g-object-unref" title="g_object_unref ()"><code class="function">g_object_unref()</code></a> might happen in another |
| thread. Use <a class="link" href="gobject-The-Base-Object-Type.html#GWeakRef" title="GWeakRef"><span class="type">GWeakRef</span></a> if thread-safety is required.</p> |
| <p><span class="annotation">[<acronym title="Exposed in C code, not necessarily available in other languages."><span class="acronym">skip</span></acronym>]</span></p> |
| <div class="refsect3"> |
| <a name="g-object-add-weak-pointer.parameters"></a><h4>Parameters</h4> |
| <div class="informaltable"><table class="informaltable" width="100%" border="0"> |
| <colgroup> |
| <col width="150px" class="parameters_name"> |
| <col class="parameters_description"> |
| <col width="200px" class="parameters_annotations"> |
| </colgroup> |
| <tbody> |
| <tr> |
| <td class="parameter_name"><p>object</p></td> |
| <td class="parameter_description"><p>The object that should be weak referenced.</p></td> |
| <td class="parameter_annotations"> </td> |
| </tr> |
| <tr> |
| <td class="parameter_name"><p>weak_pointer_location</p></td> |
| <td class="parameter_description"><p> The memory address |
| of a pointer. </p></td> |
| <td class="parameter_annotations"><span class="annotation">[<acronym title="Parameter for input and for returning results. Default is transfer full."><span class="acronym">inout</span></acronym>][not optional][<acronym title="NULL may be passed as the value in, out, in-out; or as a return value."><span class="acronym">nullable</span></acronym>]</span></td> |
| </tr> |
| </tbody> |
| </table></div> |
| </div> |
| </div> |
| <hr> |
| <div class="refsect2"> |
| <a name="g-object-remove-weak-pointer"></a><h3>g_object_remove_weak_pointer ()</h3> |
| <pre class="programlisting"><span class="returnvalue">void</span> |
| g_object_remove_weak_pointer (<em class="parameter"><code><a class="link" href="gobject-The-Base-Object-Type.html#GObject"><span class="type">GObject</span></a> *object</code></em>, |
| <em class="parameter"><code><a href="../glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> *weak_pointer_location</code></em>);</pre> |
| <p>Removes a weak reference from <em class="parameter"><code>object</code></em> |
| that was previously added |
| using <a class="link" href="gobject-The-Base-Object-Type.html#g-object-add-weak-pointer" title="g_object_add_weak_pointer ()"><code class="function">g_object_add_weak_pointer()</code></a>. The <em class="parameter"><code>weak_pointer_location</code></em> |
| has |
| to match the one used with <a class="link" href="gobject-The-Base-Object-Type.html#g-object-add-weak-pointer" title="g_object_add_weak_pointer ()"><code class="function">g_object_add_weak_pointer()</code></a>.</p> |
| <p><span class="annotation">[<acronym title="Exposed in C code, not necessarily available in other languages."><span class="acronym">skip</span></acronym>]</span></p> |
| <div class="refsect3"> |
| <a name="g-object-remove-weak-pointer.parameters"></a><h4>Parameters</h4> |
| <div class="informaltable"><table class="informaltable" width="100%" border="0"> |
| <colgroup> |
| <col width="150px" class="parameters_name"> |
| <col class="parameters_description"> |
| <col width="200px" class="parameters_annotations"> |
| </colgroup> |
| <tbody> |
| <tr> |
| <td class="parameter_name"><p>object</p></td> |
| <td class="parameter_description"><p>The object that is weak referenced.</p></td> |
| <td class="parameter_annotations"> </td> |
| </tr> |
| <tr> |
| <td class="parameter_name"><p>weak_pointer_location</p></td> |
| <td class="parameter_description"><p> The memory address |
| of a pointer. </p></td> |
| <td class="parameter_annotations"><span class="annotation">[<acronym title="Parameter for input and for returning results. Default is transfer full."><span class="acronym">inout</span></acronym>][not optional][<acronym title="NULL may be passed as the value in, out, in-out; or as a return value."><span class="acronym">nullable</span></acronym>]</span></td> |
| </tr> |
| </tbody> |
| </table></div> |
| </div> |
| </div> |
| <hr> |
| <div class="refsect2"> |
| <a name="GToggleNotify"></a><h3>GToggleNotify ()</h3> |
| <pre class="programlisting"><span class="returnvalue">void</span> |
| <span class="c_punctuation">(</span>*GToggleNotify<span class="c_punctuation">)</span> (<em class="parameter"><code><a href="../glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> data</code></em>, |
| <em class="parameter"><code><a class="link" href="gobject-The-Base-Object-Type.html#GObject"><span class="type">GObject</span></a> *object</code></em>, |
| <em class="parameter"><code><a href="../glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a> is_last_ref</code></em>);</pre> |
| <p>A callback function used for notification when the state |
| of a toggle reference changes. See <a class="link" href="gobject-The-Base-Object-Type.html#g-object-add-toggle-ref" title="g_object_add_toggle_ref ()"><code class="function">g_object_add_toggle_ref()</code></a>.</p> |
| <div class="refsect3"> |
| <a name="GToggleNotify.parameters"></a><h4>Parameters</h4> |
| <div class="informaltable"><table class="informaltable" width="100%" border="0"> |
| <colgroup> |
| <col width="150px" class="parameters_name"> |
| <col class="parameters_description"> |
| <col width="200px" class="parameters_annotations"> |
| </colgroup> |
| <tbody> |
| <tr> |
| <td class="parameter_name"><p>data</p></td> |
| <td class="parameter_description"><p>Callback data passed to <a class="link" href="gobject-The-Base-Object-Type.html#g-object-add-toggle-ref" title="g_object_add_toggle_ref ()"><code class="function">g_object_add_toggle_ref()</code></a></p></td> |
| <td class="parameter_annotations"> </td> |
| </tr> |
| <tr> |
| <td class="parameter_name"><p>object</p></td> |
| <td class="parameter_description"><p>The object on which <a class="link" href="gobject-The-Base-Object-Type.html#g-object-add-toggle-ref" title="g_object_add_toggle_ref ()"><code class="function">g_object_add_toggle_ref()</code></a> was called.</p></td> |
| <td class="parameter_annotations"> </td> |
| </tr> |
| <tr> |
| <td class="parameter_name"><p>is_last_ref</p></td> |
| <td class="parameter_description"><p><a href="../glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if the toggle reference is now the |
| last reference to the object. <a href="../glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> if the toggle |
| reference was the last reference and there are now other |
| references.</p></td> |
| <td class="parameter_annotations"> </td> |
| </tr> |
| </tbody> |
| </table></div> |
| </div> |
| </div> |
| <hr> |
| <div class="refsect2"> |
| <a name="g-object-add-toggle-ref"></a><h3>g_object_add_toggle_ref ()</h3> |
| <pre class="programlisting"><span class="returnvalue">void</span> |
| g_object_add_toggle_ref (<em class="parameter"><code><a class="link" href="gobject-The-Base-Object-Type.html#GObject"><span class="type">GObject</span></a> *object</code></em>, |
| <em class="parameter"><code><a class="link" href="gobject-The-Base-Object-Type.html#GToggleNotify" title="GToggleNotify ()"><span class="type">GToggleNotify</span></a> notify</code></em>, |
| <em class="parameter"><code><a href="../glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> data</code></em>);</pre> |
| <p>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.</p> |
| <p>This functionality is intended for binding <em class="parameter"><code>object</code></em> |
| to a proxy |
| object managed by another memory manager. This is done with two |
| paired references: the strong reference added by |
| <a class="link" href="gobject-The-Base-Object-Type.html#g-object-add-toggle-ref" title="g_object_add_toggle_ref ()"><code class="function">g_object_add_toggle_ref()</code></a> and a reverse reference to the proxy |
| object which is either a strong reference or weak reference.</p> |
| <p>The setup is that when there are no other references to <em class="parameter"><code>object</code></em> |
| , |
| only a weak reference is held in the reverse direction from <em class="parameter"><code>object</code></em> |
| |
| to the proxy object, but when there are other references held to |
| <em class="parameter"><code>object</code></em> |
| , a strong reference is held. The <em class="parameter"><code>notify</code></em> |
| callback is called |
| when the reference from <em class="parameter"><code>object</code></em> |
| to the proxy object should be |
| "toggled" from strong to weak (<em class="parameter"><code>is_last_ref</code></em> |
| true) or weak to strong |
| (<em class="parameter"><code>is_last_ref</code></em> |
| false).</p> |
| <p>Since a (normal) reference must be held to the object before |
| calling <a class="link" href="gobject-The-Base-Object-Type.html#g-object-add-toggle-ref" title="g_object_add_toggle_ref ()"><code class="function">g_object_add_toggle_ref()</code></a>, the initial state of the reverse |
| link is always strong.</p> |
| <p>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.</p> |
| <p><span class="annotation">[<acronym title="Exposed in C code, not necessarily available in other languages."><span class="acronym">skip</span></acronym>]</span></p> |
| <div class="refsect3"> |
| <a name="g-object-add-toggle-ref.parameters"></a><h4>Parameters</h4> |
| <div class="informaltable"><table class="informaltable" width="100%" border="0"> |
| <colgroup> |
| <col width="150px" class="parameters_name"> |
| <col class="parameters_description"> |
| <col width="200px" class="parameters_annotations"> |
| </colgroup> |
| <tbody> |
| <tr> |
| <td class="parameter_name"><p>object</p></td> |
| <td class="parameter_description"><p>a <a class="link" href="gobject-The-Base-Object-Type.html#GObject"><span class="type">GObject</span></a></p></td> |
| <td class="parameter_annotations"> </td> |
| </tr> |
| <tr> |
| <td class="parameter_name"><p>notify</p></td> |
| <td class="parameter_description"><p>a function to call when this reference is the |
| last reference to the object, or is no longer |
| the last reference.</p></td> |
| <td class="parameter_annotations"> </td> |
| </tr> |
| <tr> |
| <td class="parameter_name"><p>data</p></td> |
| <td class="parameter_description"><p>data to pass to <em class="parameter"><code>notify</code></em> |
| </p></td> |
| <td class="parameter_annotations"> </td> |
| </tr> |
| </tbody> |
| </table></div> |
| </div> |
| <p class="since">Since: <a class="link" href="api-index-2-8.html#api-index-2.8">2.8</a></p> |
| </div> |
| <hr> |
| <div class="refsect2"> |
| <a name="g-object-remove-toggle-ref"></a><h3>g_object_remove_toggle_ref ()</h3> |
| <pre class="programlisting"><span class="returnvalue">void</span> |
| g_object_remove_toggle_ref (<em class="parameter"><code><a class="link" href="gobject-The-Base-Object-Type.html#GObject"><span class="type">GObject</span></a> *object</code></em>, |
| <em class="parameter"><code><a class="link" href="gobject-The-Base-Object-Type.html#GToggleNotify" title="GToggleNotify ()"><span class="type">GToggleNotify</span></a> notify</code></em>, |
| <em class="parameter"><code><a href="../glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> data</code></em>);</pre> |
| <p>Removes a reference added with <a class="link" href="gobject-The-Base-Object-Type.html#g-object-add-toggle-ref" title="g_object_add_toggle_ref ()"><code class="function">g_object_add_toggle_ref()</code></a>. The |
| reference count of the object is decreased by one.</p> |
| <p><span class="annotation">[<acronym title="Exposed in C code, not necessarily available in other languages."><span class="acronym">skip</span></acronym>]</span></p> |
| <div class="refsect3"> |
| <a name="g-object-remove-toggle-ref.parameters"></a><h4>Parameters</h4> |
| <div class="informaltable"><table class="informaltable" width="100%" border="0"> |
| <colgroup> |
| <col width="150px" class="parameters_name"> |
| <col class="parameters_description"> |
| <col width="200px" class="parameters_annotations"> |
| </colgroup> |
| <tbody> |
| <tr> |
| <td class="parameter_name"><p>object</p></td> |
| <td class="parameter_description"><p>a <a class="link" href="gobject-The-Base-Object-Type.html#GObject"><span class="type">GObject</span></a></p></td> |
| <td class="parameter_annotations"> </td> |
| </tr> |
| <tr> |
| <td class="parameter_name"><p>notify</p></td> |
| <td class="parameter_description"><p>a function to call when this reference is the |
| last reference to the object, or is no longer |
| the last reference.</p></td> |
| <td class="parameter_annotations"> </td> |
| </tr> |
| <tr> |
| <td class="parameter_name"><p>data</p></td> |
| <td class="parameter_description"><p>data to pass to <em class="parameter"><code>notify</code></em> |
| </p></td> |
| <td class="parameter_annotations"> </td> |
| </tr> |
| </tbody> |
| </table></div> |
| </div> |
| <p class="since">Since: <a class="link" href="api-index-2-8.html#api-index-2.8">2.8</a></p> |
| </div> |
| <hr> |
| <div class="refsect2"> |
| <a name="g-object-connect"></a><h3>g_object_connect ()</h3> |
| <pre class="programlisting"><a href="../glib-Basic-Types.html#gpointer"><span class="returnvalue">gpointer</span></a> |
| g_object_connect (<em class="parameter"><code><a href="../glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> object</code></em>, |
| <em class="parameter"><code>const <a href="../glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *signal_spec</code></em>, |
| <em class="parameter"><code>...</code></em>);</pre> |
| <p>A convenience function to connect multiple signals at once.</p> |
| <p>The signal specs expected by this function have the form |
| "modifier::signal_name", where modifier can be one of the following:</p> |
| <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "> |
| <li class="listitem"><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: circle; "><li class="listitem"><p>signal: equivalent to g_signal_connect_data (..., NULL, 0)</p></li></ul></div></li> |
| <li class="listitem"><p>object-signal, object_signal: equivalent to g_signal_connect_object (..., 0)</p></li> |
| <li class="listitem"><p>swapped-signal, swapped_signal: equivalent to g_signal_connect_data (..., NULL, G_CONNECT_SWAPPED)</p></li> |
| <li class="listitem"><p>swapped_object_signal, swapped-object-signal: equivalent to g_signal_connect_object (..., G_CONNECT_SWAPPED)</p></li> |
| <li class="listitem"><p>signal_after, signal-after: equivalent to g_signal_connect_data (..., NULL, G_CONNECT_AFTER)</p></li> |
| <li class="listitem"><p>object_signal_after, object-signal-after: equivalent to g_signal_connect_object (..., G_CONNECT_AFTER)</p></li> |
| <li class="listitem"><p>swapped_signal_after, swapped-signal-after: equivalent to g_signal_connect_data (..., NULL, G_CONNECT_SWAPPED | G_CONNECT_AFTER)</p></li> |
| <li class="listitem"><p>swapped_object_signal_after, swapped-object-signal-after: equivalent to g_signal_connect_object (..., G_CONNECT_SWAPPED | G_CONNECT_AFTER)</p></li> |
| </ul></div> |
| <div class="informalexample"> |
| <table class="listing_frame" border="0" cellpadding="0" cellspacing="0"> |
| <tbody> |
| <tr> |
| <td class="listing_lines" align="right"><pre>1 |
| 2 |
| 3 |
| 4 |
| 5 |
| 6 |
| 7 |
| 8</pre></td> |
| <td class="listing_code"><pre class="programlisting"><span class="normal">menu</span><span class="symbol">-></span><span class="normal">toplevel </span><span class="symbol">=</span><span class="normal"> </span><span class="function"><a href="gobject-The-Base-Object-Type.html#g-object-connect">g_object_connect</a></span><span class="normal"> </span><span class="symbol">(</span><span class="function"><a href="gobject-The-Base-Object-Type.html#g-object-new">g_object_new</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">GTK_TYPE_WINDOW</span><span class="symbol">,</span> |
| <span class="normal"> </span><span class="string">"type"</span><span class="symbol">,</span><span class="normal"> <a href="http://developer.gnome.org/gtk3/GtkWindow.html#GTK-WINDOW-POPUP:CAPS">GTK_WINDOW_POPUP</a></span><span class="symbol">,</span> |
| <span class="normal"> </span><span class="string">"child"</span><span class="symbol">,</span><span class="normal"> menu</span><span class="symbol">,</span> |
| <span class="normal"> <a href="../glib-Standard-Macros.html#NULL:CAPS">NULL</a></span><span class="symbol">),</span> |
| <span class="normal"> </span><span class="string">"signal::event"</span><span class="symbol">,</span><span class="normal"> gtk_menu_window_event</span><span class="symbol">,</span><span class="normal"> menu</span><span class="symbol">,</span> |
| <span class="normal"> </span><span class="string">"signal::size_request"</span><span class="symbol">,</span><span class="normal"> gtk_menu_window_size_request</span><span class="symbol">,</span><span class="normal"> menu</span><span class="symbol">,</span> |
| <span class="normal"> </span><span class="string">"signal::destroy"</span><span class="symbol">,</span><span class="normal"> <a href="http://developer.gnome.org/gtk3/GtkWidget.html#gtk-widget-destroyed">gtk_widget_destroyed</a></span><span class="symbol">,</span><span class="normal"> </span><span class="symbol">&</span><span class="normal">menu</span><span class="symbol">-></span><span class="normal">toplevel</span><span class="symbol">,</span> |
| <span class="normal"> <a href="../glib-Standard-Macros.html#NULL:CAPS">NULL</a></span><span class="symbol">);</span></pre></td> |
| </tr> |
| </tbody> |
| </table> |
| </div> |
| |
| <p></p> |
| <p><span class="annotation">[<acronym title="Exposed in C code, not necessarily available in other languages."><span class="acronym">skip</span></acronym>]</span></p> |
| <div class="refsect3"> |
| <a name="g-object-connect.parameters"></a><h4>Parameters</h4> |
| <div class="informaltable"><table class="informaltable" width="100%" border="0"> |
| <colgroup> |
| <col width="150px" class="parameters_name"> |
| <col class="parameters_description"> |
| <col width="200px" class="parameters_annotations"> |
| </colgroup> |
| <tbody> |
| <tr> |
| <td class="parameter_name"><p>object</p></td> |
| <td class="parameter_description"><p> a <a class="link" href="gobject-The-Base-Object-Type.html#GObject"><span class="type">GObject</span></a>. </p></td> |
| <td class="parameter_annotations"><span class="annotation">[<acronym title="Override the parsed C type with given type."><span class="acronym">type</span></acronym> GObject.Object]</span></td> |
| </tr> |
| <tr> |
| <td class="parameter_name"><p>signal_spec</p></td> |
| <td class="parameter_description"><p>the spec for the first signal</p></td> |
| <td class="parameter_annotations"> </td> |
| </tr> |
| <tr> |
| <td class="parameter_name"><p>...</p></td> |
| <td class="parameter_description"><p><a class="link" href="gobject-Closures.html#GCallback" title="GCallback ()"><span class="type">GCallback</span></a> for the first signal, followed by data for the |
| first signal, followed optionally by more signal |
| spec/callback/data triples, followed by <a href="../glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a></p></td> |
| <td class="parameter_annotations"> </td> |
| </tr> |
| </tbody> |
| </table></div> |
| </div> |
| <div class="refsect3"> |
| <a name="g-object-connect.returns"></a><h4>Returns</h4> |
| <p> <em class="parameter"><code>object</code></em> |
| . </p> |
| <p><span class="annotation">[<acronym title="Don't free data after the code is done."><span class="acronym">transfer none</span></acronym>][<acronym title="Override the parsed C type with given type."><span class="acronym">type</span></acronym> GObject.Object]</span></p> |
| </div> |
| </div> |
| <hr> |
| <div class="refsect2"> |
| <a name="g-object-disconnect"></a><h3>g_object_disconnect ()</h3> |
| <pre class="programlisting"><span class="returnvalue">void</span> |
| g_object_disconnect (<em class="parameter"><code><a href="../glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> object</code></em>, |
| <em class="parameter"><code>const <a href="../glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *signal_spec</code></em>, |
| <em class="parameter"><code>...</code></em>);</pre> |
| <p>A convenience function to disconnect multiple signals at once.</p> |
| <p>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".</p> |
| <p><span class="annotation">[<acronym title="Exposed in C code, not necessarily available in other languages."><span class="acronym">skip</span></acronym>]</span></p> |
| <div class="refsect3"> |
| <a name="g-object-disconnect.parameters"></a><h4>Parameters</h4> |
| <div class="informaltable"><table class="informaltable" width="100%" border="0"> |
| <colgroup> |
| <col width="150px" class="parameters_name"> |
| <col class="parameters_description"> |
| <col width="200px" class="parameters_annotations"> |
| </colgroup> |
| <tbody> |
| <tr> |
| <td class="parameter_name"><p>object</p></td> |
| <td class="parameter_description"><p> a <a class="link" href="gobject-The-Base-Object-Type.html#GObject"><span class="type">GObject</span></a>. </p></td> |
| <td class="parameter_annotations"><span class="annotation">[<acronym title="Override the parsed C type with given type."><span class="acronym">type</span></acronym> GObject.Object]</span></td> |
| </tr> |
| <tr> |
| <td class="parameter_name"><p>signal_spec</p></td> |
| <td class="parameter_description"><p>the spec for the first signal</p></td> |
| <td class="parameter_annotations"> </td> |
| </tr> |
| <tr> |
| <td class="parameter_name"><p>...</p></td> |
| <td class="parameter_description"><p><a class="link" href="gobject-Closures.html#GCallback" title="GCallback ()"><span class="type">GCallback</span></a> for the first signal, followed by data for the first signal, |
| followed optionally by more signal spec/callback/data triples, |
| followed by <a href="../glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a></p></td> |
| <td class="parameter_annotations"> </td> |
| </tr> |
| </tbody> |
| </table></div> |
| </div> |
| </div> |
| <hr> |
| <div class="refsect2"> |
| <a name="g-object-set"></a><h3>g_object_set ()</h3> |
| <pre class="programlisting"><span class="returnvalue">void</span> |
| g_object_set (<em class="parameter"><code><a href="../glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> object</code></em>, |
| <em class="parameter"><code>const <a href="../glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *first_property_name</code></em>, |
| <em class="parameter"><code>...</code></em>);</pre> |
| <p>Sets properties on an object.</p> |
| <p>Note that the "notify" signals are queued and only emitted (in |
| reverse order) after all properties have been set. See |
| <a class="link" href="gobject-The-Base-Object-Type.html#g-object-freeze-notify" title="g_object_freeze_notify ()"><code class="function">g_object_freeze_notify()</code></a>.</p> |
| <p><span class="annotation">[<acronym title="Exposed in C code, not necessarily available in other languages."><span class="acronym">skip</span></acronym>]</span></p> |
| <div class="refsect3"> |
| <a name="g-object-set.parameters"></a><h4>Parameters</h4> |
| <div class="informaltable"><table class="informaltable" width="100%" border="0"> |
| <colgroup> |
| <col width="150px" class="parameters_name"> |
| <col class="parameters_description"> |
| <col width="200px" class="parameters_annotations"> |
| </colgroup> |
| <tbody> |
| <tr> |
| <td class="parameter_name"><p>object</p></td> |
| <td class="parameter_description"><p> a <a class="link" href="gobject-The-Base-Object-Type.html#GObject"><span class="type">GObject</span></a>. </p></td> |
| <td class="parameter_annotations"><span class="annotation">[<acronym title="Override the parsed C type with given type."><span class="acronym">type</span></acronym> GObject.Object]</span></td> |
| </tr> |
| <tr> |
| <td class="parameter_name"><p>first_property_name</p></td> |
| <td class="parameter_description"><p>name of the first property to set</p></td> |
| <td class="parameter_annotations"> </td> |
| </tr> |
| <tr> |
| <td class="parameter_name"><p>...</p></td> |
| <td class="parameter_description"><p>value for the first property, followed optionally by more |
| name/value pairs, followed by <a href="../glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a></p></td> |
| <td class="parameter_annotations"> </td> |
| </tr> |
| </tbody> |
| </table></div> |
| </div> |
| </div> |
| <hr> |
| <div class="refsect2"> |
| <a name="g-object-get"></a><h3>g_object_get ()</h3> |
| <pre class="programlisting"><span class="returnvalue">void</span> |
| g_object_get (<em class="parameter"><code><a href="../glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> object</code></em>, |
| <em class="parameter"><code>const <a href="../glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *first_property_name</code></em>, |
| <em class="parameter"><code>...</code></em>);</pre> |
| <p>Gets properties of an object.</p> |
| <p>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 <a href="../glib-Memory-Allocation.html#g-free"><code class="function">g_free()</code></a> or <a class="link" href="gobject-The-Base-Object-Type.html#g-object-unref" title="g_object_unref ()"><code class="function">g_object_unref()</code></a>.</p> |
| <p>Here is an example of using <a class="link" href="gobject-The-Base-Object-Type.html#g-object-get" title="g_object_get ()"><code class="function">g_object_get()</code></a> to get the contents |
| of three properties: an integer, a string and an object:</p> |
| <div class="informalexample"> |
| <table class="listing_frame" border="0" cellpadding="0" cellspacing="0"> |
| <tbody> |
| <tr> |
| <td class="listing_lines" align="right"><pre>1 |
| 2 |
| 3 |
| 4 |
| 5 |
| 6 |
| 7 |
| 8 |
| 9 |
| 10 |
| 11 |
| 12 |
| 13 |
| 14</pre></td> |
| <td class="listing_code"><pre class="programlisting"><span class="usertype">gint</span><span class="normal"> intval</span><span class="symbol">;</span> |
| <span class="usertype">gchar</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">strval</span><span class="symbol">;</span> |
| <span class="usertype">GObject</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">objval</span><span class="symbol">;</span> |
| |
| <span class="function"><a href="gobject-The-Base-Object-Type.html#g-object-get">g_object_get</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">my_object</span><span class="symbol">,</span> |
| <span class="normal"> </span><span class="string">"int-property"</span><span class="symbol">,</span><span class="normal"> </span><span class="symbol">&</span><span class="normal">intval</span><span class="symbol">,</span> |
| <span class="normal"> </span><span class="string">"str-property"</span><span class="symbol">,</span><span class="normal"> </span><span class="symbol">&</span><span class="normal">strval</span><span class="symbol">,</span> |
| <span class="normal"> </span><span class="string">"obj-property"</span><span class="symbol">,</span><span class="normal"> </span><span class="symbol">&</span><span class="normal">objval</span><span class="symbol">,</span> |
| <span class="normal"> <a href="../glib-Standard-Macros.html#NULL:CAPS">NULL</a></span><span class="symbol">);</span> |
| |
| <span class="comment">// Do something with intval, strval, objval</span> |
| |
| <span class="function"><a href="../glib-Memory-Allocation.html#g-free">g_free</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">strval</span><span class="symbol">);</span> |
| <span class="function"><a href="gobject-The-Base-Object-Type.html#g-object-unref">g_object_unref</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">objval</span><span class="symbol">);</span></pre></td> |
| </tr> |
| </tbody> |
| </table> |
| </div> |
| |
| <p></p> |
| <p><span class="annotation">[<acronym title="Exposed in C code, not necessarily available in other languages."><span class="acronym">skip</span></acronym>]</span></p> |
| <div class="refsect3"> |
| <a name="g-object-get.parameters"></a><h4>Parameters</h4> |
| <div class="informaltable"><table class="informaltable" width="100%" border="0"> |
| <colgroup> |
| <col width="150px" class="parameters_name"> |
| <col class="parameters_description"> |
| <col width="200px" class="parameters_annotations"> |
| </colgroup> |
| <tbody> |
| <tr> |
| <td class="parameter_name"><p>object</p></td> |
| <td class="parameter_description"><p> a <a class="link" href="gobject-The-Base-Object-Type.html#GObject"><span class="type">GObject</span></a>. </p></td> |
| <td class="parameter_annotations"><span class="annotation">[<acronym title="Override the parsed C type with given type."><span class="acronym">type</span></acronym> GObject.Object]</span></td> |
| </tr> |
| <tr> |
| <td class="parameter_name"><p>first_property_name</p></td> |
| <td class="parameter_description"><p>name of the first property to get</p></td> |
| <td class="parameter_annotations"> </td> |
| </tr> |
| <tr> |
| <td class="parameter_name"><p>...</p></td> |
| <td class="parameter_description"><p>return location for the first property, followed optionally by more |
| name/return location pairs, followed by <a href="../glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a></p></td> |
| <td class="parameter_annotations"> </td> |
| </tr> |
| </tbody> |
| </table></div> |
| </div> |
| </div> |
| <hr> |
| <div class="refsect2"> |
| <a name="g-object-notify"></a><h3>g_object_notify ()</h3> |
| <pre class="programlisting"><span class="returnvalue">void</span> |
| g_object_notify (<em class="parameter"><code><a class="link" href="gobject-The-Base-Object-Type.html#GObject"><span class="type">GObject</span></a> *object</code></em>, |
| <em class="parameter"><code>const <a href="../glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *property_name</code></em>);</pre> |
| <p>Emits a "notify" signal for the property <em class="parameter"><code>property_name</code></em> |
| on <em class="parameter"><code>object</code></em> |
| .</p> |
| <p>When possible, eg. when signaling a property change from within the class |
| that registered the property, you should use <a class="link" href="gobject-The-Base-Object-Type.html#g-object-notify-by-pspec" title="g_object_notify_by_pspec ()"><code class="function">g_object_notify_by_pspec()</code></a> |
| instead.</p> |
| <p>Note that emission of the notify signal may be blocked with |
| <a class="link" href="gobject-The-Base-Object-Type.html#g-object-freeze-notify" title="g_object_freeze_notify ()"><code class="function">g_object_freeze_notify()</code></a>. In this case, the signal emissions are queued |
| and will be emitted (in reverse order) when <a class="link" href="gobject-The-Base-Object-Type.html#g-object-thaw-notify" title="g_object_thaw_notify ()"><code class="function">g_object_thaw_notify()</code></a> is |
| called.</p> |
| <div class="refsect3"> |
| <a name="g-object-notify.parameters"></a><h4>Parameters</h4> |
| <div class="informaltable"><table class="informaltable" width="100%" border="0"> |
| <colgroup> |
| <col width="150px" class="parameters_name"> |
| <col class="parameters_description"> |
| <col width="200px" class="parameters_annotations"> |
| </colgroup> |
| <tbody> |
| <tr> |
| <td class="parameter_name"><p>object</p></td> |
| <td class="parameter_description"><p>a <a class="link" href="gobject-The-Base-Object-Type.html#GObject"><span class="type">GObject</span></a></p></td> |
| <td class="parameter_annotations"> </td> |
| </tr> |
| <tr> |
| <td class="parameter_name"><p>property_name</p></td> |
| <td class="parameter_description"><p>the name of a property installed on the class of <em class="parameter"><code>object</code></em> |
| .</p></td> |
| <td class="parameter_annotations"> </td> |
| </tr> |
| </tbody> |
| </table></div> |
| </div> |
| </div> |
| <hr> |
| <div class="refsect2"> |
| <a name="g-object-notify-by-pspec"></a><h3>g_object_notify_by_pspec ()</h3> |
| <pre class="programlisting"><span class="returnvalue">void</span> |
| g_object_notify_by_pspec (<em class="parameter"><code><a class="link" href="gobject-The-Base-Object-Type.html#GObject"><span class="type">GObject</span></a> *object</code></em>, |
| <em class="parameter"><code><a class="link" href="gobject-GParamSpec.html#GParamSpec" title="struct GParamSpec"><span class="type">GParamSpec</span></a> *pspec</code></em>);</pre> |
| <p>Emits a "notify" signal for the property specified by <em class="parameter"><code>pspec</code></em> |
| on <em class="parameter"><code>object</code></em> |
| .</p> |
| <p>This function omits the property name lookup, hence it is faster than |
| <a class="link" href="gobject-The-Base-Object-Type.html#g-object-notify" title="g_object_notify ()"><code class="function">g_object_notify()</code></a>.</p> |
| <p>One way to avoid using <a class="link" href="gobject-The-Base-Object-Type.html#g-object-notify" title="g_object_notify ()"><code class="function">g_object_notify()</code></a> from within the |
| class that registered the properties, and using <a class="link" href="gobject-The-Base-Object-Type.html#g-object-notify-by-pspec" title="g_object_notify_by_pspec ()"><code class="function">g_object_notify_by_pspec()</code></a> |
| instead, is to store the GParamSpec used with |
| <a class="link" href="gobject-The-Base-Object-Type.html#g-object-class-install-property" title="g_object_class_install_property ()"><code class="function">g_object_class_install_property()</code></a> inside a static array, e.g.:</p> |
| <div class="informalexample"> |
| <table class="listing_frame" border="0" cellpadding="0" cellspacing="0"> |
| <tbody> |
| <tr> |
| <td class="listing_lines" align="right"><pre>1 |
| 2 |
| 3 |
| 4 |
| 5 |
| 6 |
| 7 |
| 8 |
| 9 |
| 10 |
| 11 |
| 12 |
| 13 |
| 14 |
| 15 |
| 16 |
| 17 |
| 18 |
| 19 |
| 20</pre></td> |
| <td class="listing_code"><pre class="programlisting"><span class="keyword">enum</span> |
| <span class="cbracket">{</span> |
| <span class="normal"> PROP_0</span><span class="symbol">,</span> |
| <span class="normal"> PROP_FOO</span><span class="symbol">,</span> |
| <span class="normal"> PROP_LAST</span> |
| <span class="cbracket">}</span><span class="symbol">;</span> |
| |
| <span class="keyword">static</span><span class="normal"> </span><span class="usertype">GParamSpec</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">properties</span><span class="symbol">[</span><span class="normal">PROP_LAST</span><span class="symbol">];</span> |
| |
| <span class="keyword">static</span><span class="normal"> </span><span class="type">void</span> |
| <span class="function">my_object_class_init</span><span class="normal"> </span><span class="symbol">(</span><span class="usertype">MyObjectClass</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">klass</span><span class="symbol">)</span> |
| <span class="cbracket">{</span> |
| <span class="normal"> properties</span><span class="symbol">[</span><span class="normal">PROP_FOO</span><span class="symbol">]</span><span class="normal"> </span><span class="symbol">=</span><span class="normal"> </span><span class="function"><a href="gobject-Standard-Parameter-and-Value-Types.html#g-param-spec-int">g_param_spec_int</a></span><span class="normal"> </span><span class="symbol">(</span><span class="string">"foo"</span><span class="symbol">,</span><span class="normal"> </span><span class="string">"Foo"</span><span class="symbol">,</span><span class="normal"> </span><span class="string">"The foo"</span><span class="symbol">,</span> |
| <span class="normal"> </span><span class="number">0</span><span class="symbol">,</span><span class="normal"> </span><span class="number">100</span><span class="symbol">,</span> |
| <span class="normal"> </span><span class="number">50</span><span class="symbol">,</span> |
| <span class="normal"> <a href="gobject-GParamSpec.html#G-PARAM-READWRITE:CAPS">G_PARAM_READWRITE</a></span><span class="symbol">);</span> |
| <span class="normal"> </span><span class="function"><a href="gobject-The-Base-Object-Type.html#g-object-class-install-property">g_object_class_install_property</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">gobject_class</span><span class="symbol">,</span> |
| <span class="normal"> PROP_FOO</span><span class="symbol">,</span> |
| <span class="normal"> properties</span><span class="symbol">[</span><span class="normal">PROP_FOO</span><span class="symbol">]);</span> |
| <span class="cbracket">}</span></pre></td> |
| </tr> |
| </tbody> |
| </table> |
| </div> |
| |
| <p></p> |
| <p>and then notify a change on the "foo" property with:</p> |
| <div class="informalexample"> |
| <table class="listing_frame" border="0" cellpadding="0" cellspacing="0"> |
| <tbody> |
| <tr> |
| <td class="listing_lines" align="right"><pre>1</pre></td> |
| <td class="listing_code"><pre class="programlisting"><span class="function"><a href="gobject-The-Base-Object-Type.html#g-object-notify-by-pspec">g_object_notify_by_pspec</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">self</span><span class="symbol">,</span><span class="normal"> properties</span><span class="symbol">[</span><span class="normal">PROP_FOO</span><span class="symbol">]);</span></pre></td> |
| </tr> |
| </tbody> |
| </table> |
| </div> |
| |
| <p></p> |
| <div class="refsect3"> |
| <a name="g-object-notify-by-pspec.parameters"></a><h4>Parameters</h4> |
| <div class="informaltable"><table class="informaltable" width="100%" border="0"> |
| <colgroup> |
| <col width="150px" class="parameters_name"> |
| <col class="parameters_description"> |
| <col width="200px" class="parameters_annotations"> |
| </colgroup> |
| <tbody> |
| <tr> |
| <td class="parameter_name"><p>object</p></td> |
| <td class="parameter_description"><p>a <a class="link" href="gobject-The-Base-Object-Type.html#GObject"><span class="type">GObject</span></a></p></td> |
| <td class="parameter_annotations"> </td> |
| </tr> |
| <tr> |
| <td class="parameter_name"><p>pspec</p></td> |
| <td class="parameter_description"><p>the <a class="link" href="gobject-GParamSpec.html#GParamSpec" title="struct GParamSpec"><span class="type">GParamSpec</span></a> of a property installed on the class of <em class="parameter"><code>object</code></em> |
| .</p></td> |
| <td class="parameter_annotations"> </td> |
| </tr> |
| </tbody> |
| </table></div> |
| </div> |
| <p class="since">Since: <a class="link" href="api-index-2-26.html#api-index-2.26">2.26</a></p> |
| </div> |
| <hr> |
| <div class="refsect2"> |
| <a name="g-object-freeze-notify"></a><h3>g_object_freeze_notify ()</h3> |
| <pre class="programlisting"><span class="returnvalue">void</span> |
| g_object_freeze_notify (<em class="parameter"><code><a class="link" href="gobject-The-Base-Object-Type.html#GObject"><span class="type">GObject</span></a> *object</code></em>);</pre> |
| <p>Increases the freeze count on <em class="parameter"><code>object</code></em> |
| . If the freeze count is |
| non-zero, the emission of "notify" signals on <em class="parameter"><code>object</code></em> |
| is |
| stopped. The signals are queued until the freeze count is decreased |
| to zero. Duplicate notifications are squashed so that at most one |
| <a class="link" href="gobject-The-Base-Object-Type.html#GObject-notify" title="The “notify” signal"><span class="type">“notify”</span></a> signal is emitted for each property modified while the |
| object is frozen.</p> |
| <p>This is necessary for accessors that modify multiple properties to prevent |
| premature notification while the object is still being modified.</p> |
| <div class="refsect3"> |
| <a name="g-object-freeze-notify.parameters"></a><h4>Parameters</h4> |
| <div class="informaltable"><table class="informaltable" width="100%" border="0"> |
| <colgroup> |
| <col width="150px" class="parameters_name"> |
| <col class="parameters_description"> |
| <col width="200px" class="parameters_annotations"> |
| </colgroup> |
| <tbody><tr> |
| <td class="parameter_name"><p>object</p></td> |
| <td class="parameter_description"><p>a <a class="link" href="gobject-The-Base-Object-Type.html#GObject"><span class="type">GObject</span></a></p></td> |
| <td class="parameter_annotations"> </td> |
| </tr></tbody> |
| </table></div> |
| </div> |
| </div> |
| <hr> |
| <div class="refsect2"> |
| <a name="g-object-thaw-notify"></a><h3>g_object_thaw_notify ()</h3> |
| <pre class="programlisting"><span class="returnvalue">void</span> |
| g_object_thaw_notify (<em class="parameter"><code><a class="link" href="gobject-The-Base-Object-Type.html#GObject"><span class="type">GObject</span></a> *object</code></em>);</pre> |
| <p>Reverts the effect of a previous call to |
| <a class="link" href="gobject-The-Base-Object-Type.html#g-object-freeze-notify" title="g_object_freeze_notify ()"><code class="function">g_object_freeze_notify()</code></a>. The freeze count is decreased on <em class="parameter"><code>object</code></em> |
| |
| and when it reaches zero, queued "notify" signals are emitted.</p> |
| <p>Duplicate notifications for each property are squashed so that at most one |
| <a class="link" href="gobject-The-Base-Object-Type.html#GObject-notify" title="The “notify” signal"><span class="type">“notify”</span></a> signal is emitted for each property, in the reverse order |
| in which they have been queued.</p> |
| <p>It is an error to call this function when the freeze count is zero.</p> |
| <div class="refsect3"> |
| <a name="g-object-thaw-notify.parameters"></a><h4>Parameters</h4> |
| <div class="informaltable"><table class="informaltable" width="100%" border="0"> |
| <colgroup> |
| <col width="150px" class="parameters_name"> |
| <col class="parameters_description"> |
| <col width="200px" class="parameters_annotations"> |
| </colgroup> |
| <tbody><tr> |
| <td class="parameter_name"><p>object</p></td> |
| <td class="parameter_description"><p>a <a class="link" href="gobject-The-Base-Object-Type.html#GObject"><span class="type">GObject</span></a></p></td> |
| <td class="parameter_annotations"> </td> |
| </tr></tbody> |
| </table></div> |
| </div> |
| </div> |
| <hr> |
| <div class="refsect2"> |
| <a name="g-object-get-data"></a><h3>g_object_get_data ()</h3> |
| <pre class="programlisting"><a href="../glib-Basic-Types.html#gpointer"><span class="returnvalue">gpointer</span></a> |
| g_object_get_data (<em class="parameter"><code><a class="link" href="gobject-The-Base-Object-Type.html#GObject"><span class="type">GObject</span></a> *object</code></em>, |
| <em class="parameter"><code>const <a href="../glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *key</code></em>);</pre> |
| <p>Gets a named field from the objects table of associations (see <a class="link" href="gobject-The-Base-Object-Type.html#g-object-set-data" title="g_object_set_data ()"><code class="function">g_object_set_data()</code></a>).</p> |
| <div class="refsect3"> |
| <a name="g-object-get-data.parameters"></a><h4>Parameters</h4> |
| <div class="informaltable"><table class="informaltable" width="100%" border="0"> |
| <colgroup> |
| <col width="150px" class="parameters_name"> |
| <col class="parameters_description"> |
| <col width="200px" class="parameters_annotations"> |
| </colgroup> |
| <tbody> |
| <tr> |
| <td class="parameter_name"><p>object</p></td> |
| <td class="parameter_description"><p><a class="link" href="gobject-The-Base-Object-Type.html#GObject"><span class="type">GObject</span></a> containing the associations</p></td> |
| <td class="parameter_annotations"> </td> |
| </tr> |
| <tr> |
| <td class="parameter_name"><p>key</p></td> |
| <td class="parameter_description"><p>name of the key for that association</p></td> |
| <td class="parameter_annotations"> </td> |
| </tr> |
| </tbody> |
| </table></div> |
| </div> |
| <div class="refsect3"> |
| <a name="g-object-get-data.returns"></a><h4>Returns</h4> |
| <p> the data if found, or <a href="../glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> if no such data exists. </p> |
| <p><span class="annotation">[<acronym title="Don't free data after the code is done."><span class="acronym">transfer none</span></acronym>]</span></p> |
| </div> |
| </div> |
| <hr> |
| <div class="refsect2"> |
| <a name="g-object-set-data"></a><h3>g_object_set_data ()</h3> |
| <pre class="programlisting"><span class="returnvalue">void</span> |
| g_object_set_data (<em class="parameter"><code><a class="link" href="gobject-The-Base-Object-Type.html#GObject"><span class="type">GObject</span></a> *object</code></em>, |
| <em class="parameter"><code>const <a href="../glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *key</code></em>, |
| <em class="parameter"><code><a href="../glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> data</code></em>);</pre> |
| <p>Each object carries around a table of associations from |
| strings to pointers. This function lets you set an association.</p> |
| <p>If the object already had an association with that name, |
| the old association will be destroyed.</p> |
| <div class="refsect3"> |
| <a name="g-object-set-data.parameters"></a><h4>Parameters</h4> |
| <div class="informaltable"><table class="informaltable" width="100%" border="0"> |
| <colgroup> |
| <col width="150px" class="parameters_name"> |
| <col class="parameters_description"> |
| <col width="200px" class="parameters_annotations"> |
| </colgroup> |
| <tbody> |
| <tr> |
| <td class="parameter_name"><p>object</p></td> |
| <td class="parameter_description"><p><a class="link" href="gobject-The-Base-Object-Type.html#GObject"><span class="type">GObject</span></a> containing the associations.</p></td> |
| <td class="parameter_annotations"> </td> |
| </tr> |
| <tr> |
| <td class="parameter_name"><p>key</p></td> |
| <td class="parameter_description"><p>name of the key</p></td> |
| <td class="parameter_annotations"> </td> |
| </tr> |
| <tr> |
| <td class="parameter_name"><p>data</p></td> |
| <td class="parameter_description"><p>data to associate with that key</p></td> |
| <td class="parameter_annotations"> </td> |
| </tr> |
| </tbody> |
| </table></div> |
| </div> |
| </div> |
| <hr> |
| <div class="refsect2"> |
| <a name="g-object-set-data-full"></a><h3>g_object_set_data_full ()</h3> |
| <pre class="programlisting"><span class="returnvalue">void</span> |
| g_object_set_data_full (<em class="parameter"><code><a class="link" href="gobject-The-Base-Object-Type.html#GObject"><span class="type">GObject</span></a> *object</code></em>, |
| <em class="parameter"><code>const <a href="../glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *key</code></em>, |
| <em class="parameter"><code><a href="../glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> data</code></em>, |
| <em class="parameter"><code><a href="../glib-Datasets.html#GDestroyNotify"><span class="type">GDestroyNotify</span></a> destroy</code></em>);</pre> |
| <p>Like <a class="link" href="gobject-The-Base-Object-Type.html#g-object-set-data" title="g_object_set_data ()"><code class="function">g_object_set_data()</code></a> except it adds notification |
| for when the association is destroyed, either by setting it |
| to a different value or when the object is destroyed.</p> |
| <p>Note that the <em class="parameter"><code>destroy</code></em> |
| callback is not called if <em class="parameter"><code>data</code></em> |
| is <a href="../glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>.</p> |
| <p><span class="annotation">[<acronym title="Exposed in C code, not necessarily available in other languages."><span class="acronym">skip</span></acronym>]</span></p> |
| <div class="refsect3"> |
| <a name="g-object-set-data-full.parameters"></a><h4>Parameters</h4> |
| <div class="informaltable"><table class="informaltable" width="100%" border="0"> |
| <colgroup> |
| <col width="150px" class="parameters_name"> |
| <col class="parameters_description"> |
| <col width="200px" class="parameters_annotations"> |
| </colgroup> |
| <tbody> |
| <tr> |
| <td class="parameter_name"><p>object</p></td> |
| <td class="parameter_description"><p><a class="link" href="gobject-The-Base-Object-Type.html#GObject"><span class="type">GObject</span></a> containing the associations</p></td> |
| <td class="parameter_annotations"> </td> |
| </tr> |
| <tr> |
| <td class="parameter_name"><p>key</p></td> |
| <td class="parameter_description"><p>name of the key</p></td> |
| <td class="parameter_annotations"> </td> |
| </tr> |
| <tr> |
| <td class="parameter_name"><p>data</p></td> |
| <td class="parameter_description"><p>data to associate with that key</p></td> |
| <td class="parameter_annotations"> </td> |
| </tr> |
| <tr> |
| <td class="parameter_name"><p>destroy</p></td> |
| <td class="parameter_description"><p>function to call when the association is destroyed</p></td> |
| <td class="parameter_annotations"> </td> |
| </tr> |
| </tbody> |
| </table></div> |
| </div> |
| </div> |
| <hr> |
| <div class="refsect2"> |
| <a name="g-object-steal-data"></a><h3>g_object_steal_data ()</h3> |
| <pre class="programlisting"><a href="../glib-Basic-Types.html#gpointer"><span class="returnvalue">gpointer</span></a> |
| g_object_steal_data (<em class="parameter"><code><a class="link" href="gobject-The-Base-Object-Type.html#GObject"><span class="type">GObject</span></a> *object</code></em>, |
| <em class="parameter"><code>const <a href="../glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *key</code></em>);</pre> |
| <p>Remove a specified datum from the object's data associations, |
| without invoking the association's destroy handler.</p> |
| <div class="refsect3"> |
| <a name="g-object-steal-data.parameters"></a><h4>Parameters</h4> |
| <div class="informaltable"><table class="informaltable" width="100%" border="0"> |
| <colgroup> |
| <col width="150px" class="parameters_name"> |
| <col class="parameters_description"> |
| <col width="200px" class="parameters_annotations"> |
| </colgroup> |
| <tbody> |
| <tr> |
| <td class="parameter_name"><p>object</p></td> |
| <td class="parameter_description"><p><a class="link" href="gobject-The-Base-Object-Type.html#GObject"><span class="type">GObject</span></a> containing the associations</p></td> |
| <td class="parameter_annotations"> </td> |
| </tr> |
| <tr> |
| <td class="parameter_name"><p>key</p></td> |
| <td class="parameter_description"><p>name of the key</p></td> |
| <td class="parameter_annotations"> </td> |
| </tr> |
| </tbody> |
| </table></div> |
| </div> |
| <div class="refsect3"> |
| <a name="g-object-steal-data.returns"></a><h4>Returns</h4> |
| <p> the data if found, or <a href="../glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> if no such data exists. </p> |
| <p><span class="annotation">[<acronym title="Free data after the code is done."><span class="acronym">transfer full</span></acronym>]</span></p> |
| </div> |
| </div> |
| <hr> |
| <div class="refsect2"> |
| <a name="g-object-dup-data"></a><h3>g_object_dup_data ()</h3> |
| <pre class="programlisting"><a href="../glib-Basic-Types.html#gpointer"><span class="returnvalue">gpointer</span></a> |
| g_object_dup_data (<em class="parameter"><code><a class="link" href="gobject-The-Base-Object-Type.html#GObject"><span class="type">GObject</span></a> *object</code></em>, |
| <em class="parameter"><code>const <a href="../glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *key</code></em>, |
| <em class="parameter"><code><a href="../glib-Keyed-Data-Lists.html#GDuplicateFunc"><span class="type">GDuplicateFunc</span></a> dup_func</code></em>, |
| <em class="parameter"><code><a href="../glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> user_data</code></em>);</pre> |
| <p>This is a variant of <a class="link" href="gobject-The-Base-Object-Type.html#g-object-get-data" title="g_object_get_data ()"><code class="function">g_object_get_data()</code></a> which returns |
| a 'duplicate' of the value. <em class="parameter"><code>dup_func</code></em> |
| defines the |
| meaning of 'duplicate' in this context, it could e.g. |
| take a reference on a ref-counted object.</p> |
| <p>If the <em class="parameter"><code>key</code></em> |
| is not set on the object then <em class="parameter"><code>dup_func</code></em> |
| |
| will be called with a <a href="../glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> argument.</p> |
| <p>Note that <em class="parameter"><code>dup_func</code></em> |
| is called while user data of <em class="parameter"><code>object</code></em> |
| |
| is locked.</p> |
| <p>This function can be useful to avoid races when multiple |
| threads are using object data on the same key on the same |
| object.</p> |
| <div class="refsect3"> |
| <a name="g-object-dup-data.parameters"></a><h4>Parameters</h4> |
| <div class="informaltable"><table class="informaltable" width="100%" border="0"> |
| <colgroup> |
| <col width="150px" class="parameters_name"> |
| <col class="parameters_description"> |
| <col width="200px" class="parameters_annotations"> |
| </colgroup> |
| <tbody> |
| <tr> |
| <td class="parameter_name"><p>object</p></td> |
| <td class="parameter_description"><p>the <a class="link" href="gobject-The-Base-Object-Type.html#GObject"><span class="type">GObject</span></a> to store user data on</p></td> |
| <td class="parameter_annotations"> </td> |
| </tr> |
| <tr> |
| <td class="parameter_name"><p>key</p></td> |
| <td class="parameter_description"><p>a string, naming the user data pointer</p></td> |
| <td class="parameter_annotations"> </td> |
| </tr> |
| <tr> |
| <td class="parameter_name"><p>dup_func</p></td> |
| <td class="parameter_description"><p> function to dup the value. </p></td> |
| <td class="parameter_annotations"><span class="annotation">[<acronym title="NULL is OK, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span></td> |
| </tr> |
| <tr> |
| <td class="parameter_name"><p>user_data</p></td> |
| <td class="parameter_description"><p> passed as user_data to <em class="parameter"><code>dup_func</code></em> |
| . </p></td> |
| <td class="parameter_annotations"><span class="annotation">[<acronym title="NULL is OK, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span></td> |
| </tr> |
| </tbody> |
| </table></div> |
| </div> |
| <div class="refsect3"> |
| <a name="g-object-dup-data.returns"></a><h4>Returns</h4> |
| <p> the result of calling <em class="parameter"><code>dup_func</code></em> |
| on the value |
| associated with <em class="parameter"><code>key</code></em> |
| on <em class="parameter"><code>object</code></em> |
| , or <a href="../glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> if not set. |
| If <em class="parameter"><code>dup_func</code></em> |
| is <a href="../glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>, the value is returned |
| unmodified.</p> |
| </div> |
| <p class="since">Since: <a class="link" href="api-index-2-34.html#api-index-2.34">2.34</a></p> |
| </div> |
| <hr> |
| <div class="refsect2"> |
| <a name="g-object-replace-data"></a><h3>g_object_replace_data ()</h3> |
| <pre class="programlisting"><a href="../glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a> |
| g_object_replace_data (<em class="parameter"><code><a class="link" href="gobject-The-Base-Object-Type.html#GObject"><span class="type">GObject</span></a> *object</code></em>, |
| <em class="parameter"><code>const <a href="../glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *key</code></em>, |
| <em class="parameter"><code><a href="../glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> oldval</code></em>, |
| <em class="parameter"><code><a href="../glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> newval</code></em>, |
| <em class="parameter"><code><a href="../glib-Datasets.html#GDestroyNotify"><span class="type">GDestroyNotify</span></a> destroy</code></em>, |
| <em class="parameter"><code><a href="../glib-Datasets.html#GDestroyNotify"><span class="type">GDestroyNotify</span></a> *old_destroy</code></em>);</pre> |
| <p>Compares the user data for the key <em class="parameter"><code>key</code></em> |
| on <em class="parameter"><code>object</code></em> |
| with |
| <em class="parameter"><code>oldval</code></em> |
| , and if they are the same, replaces <em class="parameter"><code>oldval</code></em> |
| with |
| <em class="parameter"><code>newval</code></em> |
| .</p> |
| <p>This is like a typical atomic compare-and-exchange |
| operation, for user data on an object.</p> |
| <p>If the previous value was replaced then ownership of the |
| old value (<em class="parameter"><code>oldval</code></em> |
| ) is passed to the caller, including |
| the registered destroy notify for it (passed out in <em class="parameter"><code>old_destroy</code></em> |
| ). |
| Its up to the caller to free this as he wishes, which may |
| or may not include using <em class="parameter"><code>old_destroy</code></em> |
| as sometimes replacement |
| should not destroy the object in the normal way.</p> |
| <div class="refsect3"> |
| <a name="g-object-replace-data.parameters"></a><h4>Parameters</h4> |
| <div class="informaltable"><table class="informaltable" width="100%" border="0"> |
| <colgroup> |
| <col width="150px" class="parameters_name"> |
| <col class="parameters_description"> |
| <col width="200px" class="parameters_annotations"> |
| </colgroup> |
| <tbody> |
| <tr> |
| <td class="parameter_name"><p>object</p></td> |
| <td class="parameter_description"><p>the <a class="link" href="gobject-The-Base-Object-Type.html#GObject"><span class="type">GObject</span></a> to store user data on</p></td> |
| <td class="parameter_annotations"> </td> |
| </tr> |
| <tr> |
| <td class="parameter_name"><p>key</p></td> |
| <td class="parameter_description"><p>a string, naming the user data pointer</p></td> |
| <td class="parameter_annotations"> </td> |
| </tr> |
| <tr> |
| <td class="parameter_name"><p>oldval</p></td> |
| <td class="parameter_description"><p> the old value to compare against. </p></td> |
| <td class="parameter_annotations"><span class="annotation">[<acronym title="NULL is OK, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span></td> |
| </tr> |
| <tr> |
| <td class="parameter_name"><p>newval</p></td> |
| <td class="parameter_description"><p> the new value. </p></td> |
| <td class="parameter_annotations"><span class="annotation">[<acronym title="NULL is OK, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span></td> |
| </tr> |
| <tr> |
| <td class="parameter_name"><p>destroy</p></td> |
| <td class="parameter_description"><p> a destroy notify for the new value. </p></td> |
| <td class="parameter_annotations"><span class="annotation">[<acronym title="NULL is OK, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span></td> |
| </tr> |
| <tr> |
| <td class="parameter_name"><p>old_destroy</p></td> |
| <td class="parameter_description"><p> destroy notify for the existing value. </p></td> |
| <td class="parameter_annotations"><span class="annotation">[<acronym title="NULL is OK, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span></td> |
| </tr> |
| </tbody> |
| </table></div> |
| </div> |
| <div class="refsect3"> |
| <a name="g-object-replace-data.returns"></a><h4>Returns</h4> |
| <p> <a href="../glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if the existing value for <em class="parameter"><code>key</code></em> |
| was replaced |
| by <em class="parameter"><code>newval</code></em> |
| , <a href="../glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> otherwise.</p> |
| </div> |
| <p class="since">Since: <a class="link" href="api-index-2-34.html#api-index-2.34">2.34</a></p> |
| </div> |
| <hr> |
| <div class="refsect2"> |
| <a name="g-object-get-qdata"></a><h3>g_object_get_qdata ()</h3> |
| <pre class="programlisting"><a href="../glib-Basic-Types.html#gpointer"><span class="returnvalue">gpointer</span></a> |
| g_object_get_qdata (<em class="parameter"><code><a class="link" href="gobject-The-Base-Object-Type.html#GObject"><span class="type">GObject</span></a> *object</code></em>, |
| <em class="parameter"><code><a href="../glib-Quarks.html#GQuark"><span class="type">GQuark</span></a> quark</code></em>);</pre> |
| <p>This function gets back user data pointers stored via |
| <a class="link" href="gobject-The-Base-Object-Type.html#g-object-set-qdata" title="g_object_set_qdata ()"><code class="function">g_object_set_qdata()</code></a>.</p> |
| <div class="refsect3"> |
| <a name="g-object-get-qdata.parameters"></a><h4>Parameters</h4> |
| <div class="informaltable"><table class="informaltable" width="100%" border="0"> |
| <colgroup> |
| <col width="150px" class="parameters_name"> |
| <col class="parameters_description"> |
| <col width="200px" class="parameters_annotations"> |
| </colgroup> |
| <tbody> |
| <tr> |
| <td class="parameter_name"><p>object</p></td> |
| <td class="parameter_description"><p>The GObject to get a stored user data pointer from</p></td> |
| <td class="parameter_annotations"> </td> |
| </tr> |
| <tr> |
| <td class="parameter_name"><p>quark</p></td> |
| <td class="parameter_description"><p>A <a href="../glib-Quarks.html#GQuark"><span class="type">GQuark</span></a>, naming the user data pointer</p></td> |
| <td class="parameter_annotations"> </td> |
| </tr> |
| </tbody> |
| </table></div> |
| </div> |
| <div class="refsect3"> |
| <a name="g-object-get-qdata.returns"></a><h4>Returns</h4> |
| <p> The user data pointer set, or <a href="../glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>. </p> |
| <p><span class="annotation">[<acronym title="Don't free data after the code is done."><span class="acronym">transfer none</span></acronym>]</span></p> |
| </div> |
| </div> |
| <hr> |
| <div class="refsect2"> |
| <a name="g-object-set-qdata"></a><h3>g_object_set_qdata ()</h3> |
| <pre class="programlisting"><span class="returnvalue">void</span> |
| g_object_set_qdata (<em class="parameter"><code><a class="link" href="gobject-The-Base-Object-Type.html#GObject"><span class="type">GObject</span></a> *object</code></em>, |
| <em class="parameter"><code><a href="../glib-Quarks.html#GQuark"><span class="type">GQuark</span></a> quark</code></em>, |
| <em class="parameter"><code><a href="../glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> data</code></em>);</pre> |
| <p>This sets an opaque, named pointer on an object. |
| The name is specified through a <a href="../glib-Quarks.html#GQuark"><span class="type">GQuark</span></a> (retrived e.g. via |
| <a href="../glib-Quarks.html#g-quark-from-static-string"><code class="function">g_quark_from_static_string()</code></a>), and the pointer |
| can be gotten back from the <em class="parameter"><code>object</code></em> |
| with <a class="link" href="gobject-The-Base-Object-Type.html#g-object-get-qdata" title="g_object_get_qdata ()"><code class="function">g_object_get_qdata()</code></a> |
| until the <em class="parameter"><code>object</code></em> |
| is finalized. |
| Setting a previously set user data pointer, overrides (frees) |
| the old pointer set, using <a href="../glib-Standard-Macros.html#NULL:CAPS"><span class="type">NULL</span></a> as pointer essentially |
| removes the data stored.</p> |
| <p><span class="annotation">[<acronym title="Exposed in C code, not necessarily available in other languages."><span class="acronym">skip</span></acronym>]</span></p> |
| <div class="refsect3"> |
| <a name="g-object-set-qdata.parameters"></a><h4>Parameters</h4> |
| <div class="informaltable"><table class="informaltable" width="100%" border="0"> |
| <colgroup> |
| <col width="150px" class="parameters_name"> |
| <col class="parameters_description"> |
| <col width="200px" class="parameters_annotations"> |
| </colgroup> |
| <tbody> |
| <tr> |
| <td class="parameter_name"><p>object</p></td> |
| <td class="parameter_description"><p>The GObject to set store a user data pointer</p></td> |
| <td class="parameter_annotations"> </td> |
| </tr> |
| <tr> |
| <td class="parameter_name"><p>quark</p></td> |
| <td class="parameter_description"><p>A <a href="../glib-Quarks.html#GQuark"><span class="type">GQuark</span></a>, naming the user data pointer</p></td> |
| <td class="parameter_annotations"> </td> |
| </tr> |
| <tr> |
| <td class="parameter_name"><p>data</p></td> |
| <td class="parameter_description"><p>An opaque user data pointer</p></td> |
| <td class="parameter_annotations"> </td> |
| </tr> |
| </tbody> |
| </table></div> |
| </div> |
| </div> |
| <hr> |
| <div class="refsect2"> |
| <a name="g-object-set-qdata-full"></a><h3>g_object_set_qdata_full ()</h3> |
| <pre class="programlisting"><span class="returnvalue">void</span> |
| g_object_set_qdata_full (<em class="parameter"><code><a class="link" href="gobject-The-Base-Object-Type.html#GObject"><span class="type">GObject</span></a> *object</code></em>, |
| <em class="parameter"><code><a href="../glib-Quarks.html#GQuark"><span class="type">GQuark</span></a> quark</code></em>, |
| <em class="parameter"><code><a href="../glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> data</code></em>, |
| <em class="parameter"><code><a href="../glib-Datasets.html#GDestroyNotify"><span class="type">GDestroyNotify</span></a> destroy</code></em>);</pre> |
| <p>This function works like <a class="link" href="gobject-The-Base-Object-Type.html#g-object-set-qdata" title="g_object_set_qdata ()"><code class="function">g_object_set_qdata()</code></a>, but in addition, |
| a void (*destroy) (gpointer) function may be specified which is |
| called with <em class="parameter"><code>data</code></em> |
| as argument when the <em class="parameter"><code>object</code></em> |
| is finalized, or |
| the data is being overwritten by a call to <a class="link" href="gobject-The-Base-Object-Type.html#g-object-set-qdata" title="g_object_set_qdata ()"><code class="function">g_object_set_qdata()</code></a> |
| with the same <em class="parameter"><code>quark</code></em> |
| .</p> |
| <p><span class="annotation">[<acronym title="Exposed in C code, not necessarily available in other languages."><span class="acronym">skip</span></acronym>]</span></p> |
| <div class="refsect3"> |
| <a name="g-object-set-qdata-full.parameters"></a><h4>Parameters</h4> |
| <div class="informaltable"><table class="informaltable" width="100%" border="0"> |
| <colgroup> |
| <col width="150px" class="parameters_name"> |
| <col class="parameters_description"> |
| <col width="200px" class="parameters_annotations"> |
| </colgroup> |
| <tbody> |
| <tr> |
| <td class="parameter_name"><p>object</p></td> |
| <td class="parameter_description"><p>The GObject to set store a user data pointer</p></td> |
| <td class="parameter_annotations"> </td> |
| </tr> |
| <tr> |
| <td class="parameter_name"><p>quark</p></td> |
| <td class="parameter_description"><p>A <a href="../glib-Quarks.html#GQuark"><span class="type">GQuark</span></a>, naming the user data pointer</p></td> |
| <td class="parameter_annotations"> </td> |
| </tr> |
| <tr> |
| <td class="parameter_name"><p>data</p></td> |
| <td class="parameter_description"><p>An opaque user data pointer</p></td> |
| <td class="parameter_annotations"> </td> |
| </tr> |
| <tr> |
| <td class="parameter_name"><p>destroy</p></td> |
| <td class="parameter_description"><p>Function to invoke with <em class="parameter"><code>data</code></em> |
| as argument, when <em class="parameter"><code>data</code></em> |
| needs to be freed</p></td> |
| <td class="parameter_annotations"> </td> |
| </tr> |
| </tbody> |
| </table></div> |
| </div> |
| </div> |
| <hr> |
| <div class="refsect2"> |
| <a name="g-object-steal-qdata"></a><h3>g_object_steal_qdata ()</h3> |
| <pre class="programlisting"><a href="../glib-Basic-Types.html#gpointer"><span class="returnvalue">gpointer</span></a> |
| g_object_steal_qdata (<em class="parameter"><code><a class="link" href="gobject-The-Base-Object-Type.html#GObject"><span class="type">GObject</span></a> *object</code></em>, |
| <em class="parameter"><code><a href="../glib-Quarks.html#GQuark"><span class="type">GQuark</span></a> quark</code></em>);</pre> |
| <p>This function gets back user data pointers stored via |
| <a class="link" href="gobject-The-Base-Object-Type.html#g-object-set-qdata" title="g_object_set_qdata ()"><code class="function">g_object_set_qdata()</code></a> and removes the <em class="parameter"><code>data</code></em> |
| from object |
| without invoking its <code class="function">destroy()</code> function (if any was |
| set). |
| Usually, calling this function is only required to update |
| user data pointers with a destroy notifier, for example:</p> |
| <div class="informalexample"> |
| <table class="listing_frame" border="0" cellpadding="0" cellspacing="0"> |
| <tbody> |
| <tr> |
| <td class="listing_lines" align="right"><pre>1 |
| 2 |
| 3 |
| 4 |
| 5 |
| 6 |
| 7 |
| 8 |
| 9 |
| 10 |
| 11 |
| 12 |
| 13 |
| 14 |
| 15 |
| 16 |
| 17 |
| 18 |
| 19 |
| 20 |
| 21 |
| 22 |
| 23</pre></td> |
| <td class="listing_code"><pre class="programlisting"><span class="type">void</span> |
| <span class="function">object_add_to_user_list</span><span class="normal"> </span><span class="symbol">(</span><span class="usertype">GObject</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">object</span><span class="symbol">,</span> |
| <span class="normal"> </span><span class="keyword">const</span><span class="normal"> </span><span class="usertype">gchar</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">new_string</span><span class="symbol">)</span> |
| <span class="cbracket">{</span> |
| <span class="normal"> </span><span class="comment">// the quark, naming the object data</span> |
| <span class="normal"> </span><span class="usertype">GQuark</span><span class="normal"> quark_string_list </span><span class="symbol">=</span><span class="normal"> </span><span class="function"><a href="../glib-Quarks.html#g-quark-from-static-string">g_quark_from_static_string</a></span><span class="normal"> </span><span class="symbol">(</span><span class="string">"my-string-list"</span><span class="symbol">);</span> |
| <span class="normal"> </span><span class="comment">// retrive the old string list</span> |
| <span class="normal"> </span><span class="usertype">GList</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">list </span><span class="symbol">=</span><span class="normal"> </span><span class="function"><a href="gobject-The-Base-Object-Type.html#g-object-steal-qdata">g_object_steal_qdata</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">object</span><span class="symbol">,</span><span class="normal"> quark_string_list</span><span class="symbol">);</span> |
| |
| <span class="normal"> </span><span class="comment">// prepend new string</span> |
| <span class="normal"> list </span><span class="symbol">=</span><span class="normal"> </span><span class="function"><a href="../glib-Doubly-Linked-Lists.html#g-list-prepend">g_list_prepend</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">list</span><span class="symbol">,</span><span class="normal"> </span><span class="function"><a href="../glib-String-Utility-Functions.html#g-strdup">g_strdup</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">new_string</span><span class="symbol">));</span> |
| <span class="normal"> </span><span class="comment">// this changed 'list', so we need to set it again</span> |
| <span class="normal"> </span><span class="function"><a href="gobject-The-Base-Object-Type.html#g-object-set-qdata-full">g_object_set_qdata_full</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">object</span><span class="symbol">,</span><span class="normal"> quark_string_list</span><span class="symbol">,</span><span class="normal"> list</span><span class="symbol">,</span><span class="normal"> free_string_list</span><span class="symbol">);</span> |
| <span class="cbracket">}</span> |
| <span class="keyword">static</span><span class="normal"> </span><span class="type">void</span> |
| <span class="function">free_string_list</span><span class="normal"> </span><span class="symbol">(</span><span class="usertype">gpointer</span><span class="normal"> data</span><span class="symbol">)</span> |
| <span class="cbracket">{</span> |
| <span class="normal"> </span><span class="usertype">GList</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">node</span><span class="symbol">,</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">list </span><span class="symbol">=</span><span class="normal"> data</span><span class="symbol">;</span> |
| |
| <span class="normal"> </span><span class="keyword">for</span><span class="normal"> </span><span class="symbol">(</span><span class="normal">node </span><span class="symbol">=</span><span class="normal"> list</span><span class="symbol">;</span><span class="normal"> node</span><span class="symbol">;</span><span class="normal"> node </span><span class="symbol">=</span><span class="normal"> node</span><span class="symbol">-></span><span class="normal">next</span><span class="symbol">)</span> |
| <span class="normal"> </span><span class="function"><a href="../glib-Memory-Allocation.html#g-free">g_free</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">node</span><span class="symbol">-></span><span class="normal">data</span><span class="symbol">);</span> |
| <span class="normal"> </span><span class="function"><a href="../glib-Doubly-Linked-Lists.html#g-list-free">g_list_free</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">list</span><span class="symbol">);</span> |
| <span class="cbracket">}</span></pre></td> |
| </tr> |
| </tbody> |
| </table> |
| </div> |
| |
| <p> |
| Using <a class="link" href="gobject-The-Base-Object-Type.html#g-object-get-qdata" title="g_object_get_qdata ()"><code class="function">g_object_get_qdata()</code></a> in the above example, instead of |
| <a class="link" href="gobject-The-Base-Object-Type.html#g-object-steal-qdata" title="g_object_steal_qdata ()"><code class="function">g_object_steal_qdata()</code></a> would have left the destroy function set, |
| and thus the partial string list would have been freed upon |
| <a class="link" href="gobject-The-Base-Object-Type.html#g-object-set-qdata-full" title="g_object_set_qdata_full ()"><code class="function">g_object_set_qdata_full()</code></a>.</p> |
| <div class="refsect3"> |
| <a name="g-object-steal-qdata.parameters"></a><h4>Parameters</h4> |
| <div class="informaltable"><table class="informaltable" width="100%" border="0"> |
| <colgroup> |
| <col width="150px" class="parameters_name"> |
| <col class="parameters_description"> |
| <col width="200px" class="parameters_annotations"> |
| </colgroup> |
| <tbody> |
| <tr> |
| <td class="parameter_name"><p>object</p></td> |
| <td class="parameter_description"><p>The GObject to get a stored user data pointer from</p></td> |
| <td class="parameter_annotations"> </td> |
| </tr> |
| <tr> |
| <td class="parameter_name"><p>quark</p></td> |
| <td class="parameter_description"><p>A <a href="../glib-Quarks.html#GQuark"><span class="type">GQuark</span></a>, naming the user data pointer</p></td> |
| <td class="parameter_annotations"> </td> |
| </tr> |
| </tbody> |
| </table></div> |
| </div> |
| <div class="refsect3"> |
| <a name="g-object-steal-qdata.returns"></a><h4>Returns</h4> |
| <p> The user data pointer set, or <a href="../glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>. </p> |
| <p><span class="annotation">[<acronym title="Free data after the code is done."><span class="acronym">transfer full</span></acronym>]</span></p> |
| </div> |
| </div> |
| <hr> |
| <div class="refsect2"> |
| <a name="g-object-dup-qdata"></a><h3>g_object_dup_qdata ()</h3> |
| <pre class="programlisting"><a href="../glib-Basic-Types.html#gpointer"><span class="returnvalue">gpointer</span></a> |
| g_object_dup_qdata (<em class="parameter"><code><a class="link" href="gobject-The-Base-Object-Type.html#GObject"><span class="type">GObject</span></a> *object</code></em>, |
| <em class="parameter"><code><a href="../glib-Quarks.html#GQuark"><span class="type">GQuark</span></a> quark</code></em>, |
| <em class="parameter"><code><a href="../glib-Keyed-Data-Lists.html#GDuplicateFunc"><span class="type">GDuplicateFunc</span></a> dup_func</code></em>, |
| <em class="parameter"><code><a href="../glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> user_data</code></em>);</pre> |
| <p>This is a variant of <a class="link" href="gobject-The-Base-Object-Type.html#g-object-get-qdata" title="g_object_get_qdata ()"><code class="function">g_object_get_qdata()</code></a> which returns |
| a 'duplicate' of the value. <em class="parameter"><code>dup_func</code></em> |
| defines the |
| meaning of 'duplicate' in this context, it could e.g. |
| take a reference on a ref-counted object.</p> |
| <p>If the <em class="parameter"><code>quark</code></em> |
| is not set on the object then <em class="parameter"><code>dup_func</code></em> |
| |
| will be called with a <a href="../glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> argument.</p> |
| <p>Note that <em class="parameter"><code>dup_func</code></em> |
| is called while user data of <em class="parameter"><code>object</code></em> |
| |
| is locked.</p> |
| <p>This function can be useful to avoid races when multiple |
| threads are using object data on the same key on the same |
| object.</p> |
| <div class="refsect3"> |
| <a name="g-object-dup-qdata.parameters"></a><h4>Parameters</h4> |
| <div class="informaltable"><table class="informaltable" width="100%" border="0"> |
| <colgroup> |
| <col width="150px" class="parameters_name"> |
| <col class="parameters_description"> |
| <col width="200px" class="parameters_annotations"> |
| </colgroup> |
| <tbody> |
| <tr> |
| <td class="parameter_name"><p>object</p></td> |
| <td class="parameter_description"><p>the <a class="link" href="gobject-The-Base-Object-Type.html#GObject"><span class="type">GObject</span></a> to store user data on</p></td> |
| <td class="parameter_annotations"> </td> |
| </tr> |
| <tr> |
| <td class="parameter_name"><p>quark</p></td> |
| <td class="parameter_description"><p>a <a href="../glib-Quarks.html#GQuark"><span class="type">GQuark</span></a>, naming the user data pointer</p></td> |
| <td class="parameter_annotations"> </td> |
| </tr> |
| <tr> |
| <td class="parameter_name"><p>dup_func</p></td> |
| <td class="parameter_description"><p> function to dup the value. </p></td> |
| <td class="parameter_annotations"><span class="annotation">[<acronym title="NULL is OK, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span></td> |
| </tr> |
| <tr> |
| <td class="parameter_name"><p>user_data</p></td> |
| <td class="parameter_description"><p> passed as user_data to <em class="parameter"><code>dup_func</code></em> |
| . </p></td> |
| <td class="parameter_annotations"><span class="annotation">[<acronym title="NULL is OK, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span></td> |
| </tr> |
| </tbody> |
| </table></div> |
| </div> |
| <div class="refsect3"> |
| <a name="g-object-dup-qdata.returns"></a><h4>Returns</h4> |
| <p> the result of calling <em class="parameter"><code>dup_func</code></em> |
| on the value |
| associated with <em class="parameter"><code>quark</code></em> |
| on <em class="parameter"><code>object</code></em> |
| , or <a href="../glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> if not set. |
| If <em class="parameter"><code>dup_func</code></em> |
| is <a href="../glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>, the value is returned |
| unmodified.</p> |
| </div> |
| <p class="since">Since: <a class="link" href="api-index-2-34.html#api-index-2.34">2.34</a></p> |
| </div> |
| <hr> |
| <div class="refsect2"> |
| <a name="g-object-replace-qdata"></a><h3>g_object_replace_qdata ()</h3> |
| <pre class="programlisting"><a href="../glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a> |
| g_object_replace_qdata (<em class="parameter"><code><a class="link" href="gobject-The-Base-Object-Type.html#GObject"><span class="type">GObject</span></a> *object</code></em>, |
| <em class="parameter"><code><a href="../glib-Quarks.html#GQuark"><span class="type">GQuark</span></a> quark</code></em>, |
| <em class="parameter"><code><a href="../glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> oldval</code></em>, |
| <em class="parameter"><code><a href="../glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> newval</code></em>, |
| <em class="parameter"><code><a href="../glib-Datasets.html#GDestroyNotify"><span class="type">GDestroyNotify</span></a> destroy</code></em>, |
| <em class="parameter"><code><a href="../glib-Datasets.html#GDestroyNotify"><span class="type">GDestroyNotify</span></a> *old_destroy</code></em>);</pre> |
| <p>Compares the user data for the key <em class="parameter"><code>quark</code></em> |
| on <em class="parameter"><code>object</code></em> |
| with |
| <em class="parameter"><code>oldval</code></em> |
| , and if they are the same, replaces <em class="parameter"><code>oldval</code></em> |
| with |
| <em class="parameter"><code>newval</code></em> |
| .</p> |
| <p>This is like a typical atomic compare-and-exchange |
| operation, for user data on an object.</p> |
| <p>If the previous value was replaced then ownership of the |
| old value (<em class="parameter"><code>oldval</code></em> |
| ) is passed to the caller, including |
| the registered destroy notify for it (passed out in <em class="parameter"><code>old_destroy</code></em> |
| ). |
| Its up to the caller to free this as he wishes, which may |
| or may not include using <em class="parameter"><code>old_destroy</code></em> |
| as sometimes replacement |
| should not destroy the object in the normal way.</p> |
| <div class="refsect3"> |
| <a name="g-object-replace-qdata.parameters"></a><h4>Parameters</h4> |
| <div class="informaltable"><table class="informaltable" width="100%" border="0"> |
| <colgroup> |
| <col width="150px" class="parameters_name"> |
| <col class="parameters_description"> |
| <col width="200px" class="parameters_annotations"> |
| </colgroup> |
| <tbody> |
| <tr> |
| <td class="parameter_name"><p>object</p></td> |
| <td class="parameter_description"><p>the <a class="link" href="gobject-The-Base-Object-Type.html#GObject"><span class="type">GObject</span></a> to store user data on</p></td> |
| <td class="parameter_annotations"> </td> |
| </tr> |
| <tr> |
| <td class="parameter_name"><p>quark</p></td> |
| <td class="parameter_description"><p>a <a href="../glib-Quarks.html#GQuark"><span class="type">GQuark</span></a>, naming the user data pointer</p></td> |
| <td class="parameter_annotations"> </td> |
| </tr> |
| <tr> |
| <td class="parameter_name"><p>oldval</p></td> |
| <td class="parameter_description"><p> the old value to compare against. </p></td> |
| <td class="parameter_annotations"><span class="annotation">[<acronym title="NULL is OK, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span></td> |
| </tr> |
| <tr> |
| <td class="parameter_name"><p>newval</p></td> |
| <td class="parameter_description"><p> the new value. </p></td> |
| <td class="parameter_annotations"><span class="annotation">[<acronym title="NULL is OK, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span></td> |
| </tr> |
| <tr> |
| <td class="parameter_name"><p>destroy</p></td> |
| <td class="parameter_description"><p> a destroy notify for the new value. </p></td> |
| <td class="parameter_annotations"><span class="annotation">[<acronym title="NULL is OK, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span></td> |
| </tr> |
| <tr> |
| <td class="parameter_name"><p>old_destroy</p></td> |
| <td class="parameter_description"><p> destroy notify for the existing value. </p></td> |
| <td class="parameter_annotations"><span class="annotation">[<acronym title="NULL is OK, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span></td> |
| </tr> |
| </tbody> |
| </table></div> |
| </div> |
| <div class="refsect3"> |
| <a name="g-object-replace-qdata.returns"></a><h4>Returns</h4> |
| <p> <a href="../glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if the existing value for <em class="parameter"><code>quark</code></em> |
| was replaced |
| by <em class="parameter"><code>newval</code></em> |
| , <a href="../glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> otherwise.</p> |
| </div> |
| <p class="since">Since: <a class="link" href="api-index-2-34.html#api-index-2.34">2.34</a></p> |
| </div> |
| <hr> |
| <div class="refsect2"> |
| <a name="g-object-set-property"></a><h3>g_object_set_property ()</h3> |
| <pre class="programlisting"><span class="returnvalue">void</span> |
| g_object_set_property (<em class="parameter"><code><a class="link" href="gobject-The-Base-Object-Type.html#GObject"><span class="type">GObject</span></a> *object</code></em>, |
| <em class="parameter"><code>const <a href="../glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *property_name</code></em>, |
| <em class="parameter"><code>const <a class="link" href="gobject-Generic-values.html#GValue" title="GValue"><span class="type">GValue</span></a> *value</code></em>);</pre> |
| <p>Sets a property on an object.</p> |
| <div class="refsect3"> |
| <a name="g-object-set-property.parameters"></a><h4>Parameters</h4> |
| <div class="informaltable"><table class="informaltable" width="100%" border="0"> |
| <colgroup> |
| <col width="150px" class="parameters_name"> |
| <col class="parameters_description"> |
| <col width="200px" class="parameters_annotations"> |
| </colgroup> |
| <tbody> |
| <tr> |
| <td class="parameter_name"><p>object</p></td> |
| <td class="parameter_description"><p>a <a class="link" href="gobject-The-Base-Object-Type.html#GObject"><span class="type">GObject</span></a></p></td> |
| <td class="parameter_annotations"> </td> |
| </tr> |
| <tr> |
| <td class="parameter_name"><p>property_name</p></td> |
| <td class="parameter_description"><p>the name of the property to set</p></td> |
| <td class="parameter_annotations"> </td> |
| </tr> |
| <tr> |
| <td class="parameter_name"><p>value</p></td> |
| <td class="parameter_description"><p>the value</p></td> |
| <td class="parameter_annotations"> </td> |
| </tr> |
| </tbody> |
| </table></div> |
| </div> |
| </div> |
| <hr> |
| <div class="refsect2"> |
| <a name="g-object-get-property"></a><h3>g_object_get_property ()</h3> |
| <pre class="programlisting"><span class="returnvalue">void</span> |
| g_object_get_property (<em class="parameter"><code><a class="link" href="gobject-The-Base-Object-Type.html#GObject"><span class="type">GObject</span></a> *object</code></em>, |
| <em class="parameter"><code>const <a href="../glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *property_name</code></em>, |
| <em class="parameter"><code><a class="link" href="gobject-Generic-values.html#GValue" title="GValue"><span class="type">GValue</span></a> *value</code></em>);</pre> |
| <p>Gets a property of an object. <em class="parameter"><code>value</code></em> |
| must have been initialized to the |
| expected type of the property (or a type to which the expected type can be |
| transformed) using <a class="link" href="gobject-Generic-values.html#g-value-init" title="g_value_init ()"><code class="function">g_value_init()</code></a>.</p> |
| <p>In general, a copy is made of the property contents and the caller is |
| responsible for freeing the memory by calling <a class="link" href="gobject-Generic-values.html#g-value-unset" title="g_value_unset ()"><code class="function">g_value_unset()</code></a>.</p> |
| <p>Note that <a class="link" href="gobject-The-Base-Object-Type.html#g-object-get-property" title="g_object_get_property ()"><code class="function">g_object_get_property()</code></a> is really intended for language |
| bindings, <a class="link" href="gobject-The-Base-Object-Type.html#g-object-get" title="g_object_get ()"><code class="function">g_object_get()</code></a> is much more convenient for C programming.</p> |
| <div class="refsect3"> |
| <a name="g-object-get-property.parameters"></a><h4>Parameters</h4> |
| <div class="informaltable"><table class="informaltable" width="100%" border="0"> |
| <colgroup> |
| <col width="150px" class="parameters_name"> |
| <col class="parameters_description"> |
| <col width="200px" class="parameters_annotations"> |
| </colgroup> |
| <tbody> |
| <tr> |
| <td class="parameter_name"><p>object</p></td> |
| <td class="parameter_description"><p>a <a class="link" href="gobject-The-Base-Object-Type.html#GObject"><span class="type">GObject</span></a></p></td> |
| <td class="parameter_annotations"> </td> |
| </tr> |
| <tr> |
| <td class="parameter_name"><p>property_name</p></td> |
| <td class="parameter_description"><p>the name of the property to get</p></td> |
| <td class="parameter_annotations"> </td> |
| </tr> |
| <tr> |
| <td class="parameter_name"><p>value</p></td> |
| <td class="parameter_description"><p>return location for the property value</p></td> |
| <td class="parameter_annotations"> </td> |
| </tr> |
| </tbody> |
| </table></div> |
| </div> |
| </div> |
| <hr> |
| <div class="refsect2"> |
| <a name="g-object-new-valist"></a><h3>g_object_new_valist ()</h3> |
| <pre class="programlisting"><a class="link" href="gobject-The-Base-Object-Type.html#GObject"><span class="returnvalue">GObject</span></a> * |
| g_object_new_valist (<em class="parameter"><code><a class="link" href="gobject-Type-Information.html#GType" title="GType"><span class="type">GType</span></a> object_type</code></em>, |
| <em class="parameter"><code>const <a href="../glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *first_property_name</code></em>, |
| <em class="parameter"><code><span class="type">va_list</span> var_args</code></em>);</pre> |
| <p>Creates a new instance of a <a class="link" href="gobject-The-Base-Object-Type.html#GObject"><span class="type">GObject</span></a> subtype and sets its properties.</p> |
| <p>Construction parameters (see <a class="link" href="gobject-GParamSpec.html#G-PARAM-CONSTRUCT:CAPS"><span class="type">G_PARAM_CONSTRUCT</span></a>, <a class="link" href="gobject-GParamSpec.html#G-PARAM-CONSTRUCT-ONLY:CAPS"><span class="type">G_PARAM_CONSTRUCT_ONLY</span></a>) |
| which are not explicitly specified are set to their default values.</p> |
| <p><span class="annotation">[<acronym title="Exposed in C code, not necessarily available in other languages."><span class="acronym">skip</span></acronym>]</span></p> |
| <div class="refsect3"> |
| <a name="g-object-new-valist.parameters"></a><h4>Parameters</h4> |
| <div class="informaltable"><table class="informaltable" width="100%" border="0"> |
| <colgroup> |
| <col width="150px" class="parameters_name"> |
| <col class="parameters_description"> |
| <col width="200px" class="parameters_annotations"> |
| </colgroup> |
| <tbody> |
| <tr> |
| <td class="parameter_name"><p>object_type</p></td> |
| <td class="parameter_description"><p>the type id of the <a class="link" href="gobject-The-Base-Object-Type.html#GObject"><span class="type">GObject</span></a> subtype to instantiate</p></td> |
| <td class="parameter_annotations"> </td> |
| </tr> |
| <tr> |
| <td class="parameter_name"><p>first_property_name</p></td> |
| <td class="parameter_description"><p>the name of the first property</p></td> |
| <td class="parameter_annotations"> </td> |
| </tr> |
| <tr> |
| <td class="parameter_name"><p>var_args</p></td> |
| <td class="parameter_description"><p>the value of the first property, followed optionally by more |
| name/value pairs, followed by <a href="../glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a></p></td> |
| <td class="parameter_annotations"> </td> |
| </tr> |
| </tbody> |
| </table></div> |
| </div> |
| <div class="refsect3"> |
| <a name="g-object-new-valist.returns"></a><h4>Returns</h4> |
| <p> a new instance of <em class="parameter"><code>object_type</code></em> |
| </p> |
| </div> |
| </div> |
| <hr> |
| <div class="refsect2"> |
| <a name="g-object-set-valist"></a><h3>g_object_set_valist ()</h3> |
| <pre class="programlisting"><span class="returnvalue">void</span> |
| g_object_set_valist (<em class="parameter"><code><a class="link" href="gobject-The-Base-Object-Type.html#GObject"><span class="type">GObject</span></a> *object</code></em>, |
| <em class="parameter"><code>const <a href="../glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *first_property_name</code></em>, |
| <em class="parameter"><code><span class="type">va_list</span> var_args</code></em>);</pre> |
| <p>Sets properties on an object.</p> |
| <p><span class="annotation">[<acronym title="Exposed in C code, not necessarily available in other languages."><span class="acronym">skip</span></acronym>]</span></p> |
| <div class="refsect3"> |
| <a name="g-object-set-valist.parameters"></a><h4>Parameters</h4> |
| <div class="informaltable"><table class="informaltable" width="100%" border="0"> |
| <colgroup> |
| <col width="150px" class="parameters_name"> |
| <col class="parameters_description"> |
| <col width="200px" class="parameters_annotations"> |
| </colgroup> |
| <tbody> |
| <tr> |
| <td class="parameter_name"><p>object</p></td> |
| <td class="parameter_description"><p>a <a class="link" href="gobject-The-Base-Object-Type.html#GObject"><span class="type">GObject</span></a></p></td> |
| <td class="parameter_annotations"> </td> |
| </tr> |
| <tr> |
| <td class="parameter_name"><p>first_property_name</p></td> |
| <td class="parameter_description"><p>name of the first property to set</p></td> |
| <td class="parameter_annotations"> </td> |
| </tr> |
| <tr> |
| <td class="parameter_name"><p>var_args</p></td> |
| <td class="parameter_description"><p>value for the first property, followed optionally by more |
| name/value pairs, followed by <a href="../glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a></p></td> |
| <td class="parameter_annotations"> </td> |
| </tr> |
| </tbody> |
| </table></div> |
| </div> |
| </div> |
| <hr> |
| <div class="refsect2"> |
| <a name="g-object-get-valist"></a><h3>g_object_get_valist ()</h3> |
| <pre class="programlisting"><span class="returnvalue">void</span> |
| g_object_get_valist (<em class="parameter"><code><a class="link" href="gobject-The-Base-Object-Type.html#GObject"><span class="type">GObject</span></a> *object</code></em>, |
| <em class="parameter"><code>const <a href="../glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *first_property_name</code></em>, |
| <em class="parameter"><code><span class="type">va_list</span> var_args</code></em>);</pre> |
| <p>Gets properties of an object.</p> |
| <p>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 <a href="../glib-Memory-Allocation.html#g-free"><code class="function">g_free()</code></a> or <a class="link" href="gobject-The-Base-Object-Type.html#g-object-unref" title="g_object_unref ()"><code class="function">g_object_unref()</code></a>.</p> |
| <p>See <a class="link" href="gobject-The-Base-Object-Type.html#g-object-get" title="g_object_get ()"><code class="function">g_object_get()</code></a>.</p> |
| <p><span class="annotation">[<acronym title="Exposed in C code, not necessarily available in other languages."><span class="acronym">skip</span></acronym>]</span></p> |
| <div class="refsect3"> |
| <a name="g-object-get-valist.parameters"></a><h4>Parameters</h4> |
| <div class="informaltable"><table class="informaltable" width="100%" border="0"> |
| <colgroup> |
| <col width="150px" class="parameters_name"> |
| <col class="parameters_description"> |
| <col width="200px" class="parameters_annotations"> |
| </colgroup> |
| <tbody> |
| <tr> |
| <td class="parameter_name"><p>object</p></td> |
| <td class="parameter_description"><p>a <a class="link" href="gobject-The-Base-Object-Type.html#GObject"><span class="type">GObject</span></a></p></td> |
| <td class="parameter_annotations"> </td> |
| </tr> |
| <tr> |
| <td class="parameter_name"><p>first_property_name</p></td> |
| <td class="parameter_description"><p>name of the first property to get</p></td> |
| <td class="parameter_annotations"> </td> |
| </tr> |
| <tr> |
| <td class="parameter_name"><p>var_args</p></td> |
| <td class="parameter_description"><p>return location for the first property, followed optionally by more |
| name/return location pairs, followed by <a href="../glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a></p></td> |
| <td class="parameter_annotations"> </td> |
| </tr> |
| </tbody> |
| </table></div> |
| </div> |
| </div> |
| <hr> |
| <div class="refsect2"> |
| <a name="g-object-watch-closure"></a><h3>g_object_watch_closure ()</h3> |
| <pre class="programlisting"><span class="returnvalue">void</span> |
| g_object_watch_closure (<em class="parameter"><code><a class="link" href="gobject-The-Base-Object-Type.html#GObject"><span class="type">GObject</span></a> *object</code></em>, |
| <em class="parameter"><code><a class="link" href="gobject-Closures.html#GClosure" title="struct GClosure"><span class="type">GClosure</span></a> *closure</code></em>);</pre> |
| <p>This function essentially limits the life time of the <em class="parameter"><code>closure</code></em> |
| to |
| the life time of the object. That is, when the object is finalized, |
| the <em class="parameter"><code>closure</code></em> |
| is invalidated by calling <a class="link" href="gobject-Closures.html#g-closure-invalidate" title="g_closure_invalidate ()"><code class="function">g_closure_invalidate()</code></a> on |
| it, in order to prevent invocations of the closure with a finalized |
| (nonexisting) object. Also, <a class="link" href="gobject-The-Base-Object-Type.html#g-object-ref" title="g_object_ref ()"><code class="function">g_object_ref()</code></a> and <a class="link" href="gobject-The-Base-Object-Type.html#g-object-unref" title="g_object_unref ()"><code class="function">g_object_unref()</code></a> are |
| added as marshal guards to the <em class="parameter"><code>closure</code></em> |
| , to ensure that an extra |
| reference count is held on <em class="parameter"><code>object</code></em> |
| during invocation of the |
| <em class="parameter"><code>closure</code></em> |
| . Usually, this function will be called on closures that |
| use this <em class="parameter"><code>object</code></em> |
| as closure data.</p> |
| <div class="refsect3"> |
| <a name="g-object-watch-closure.parameters"></a><h4>Parameters</h4> |
| <div class="informaltable"><table class="informaltable" width="100%" border="0"> |
| <colgroup> |
| <col width="150px" class="parameters_name"> |
| <col class="parameters_description"> |
| <col width="200px" class="parameters_annotations"> |
| </colgroup> |
| <tbody> |
| <tr> |
| <td class="parameter_name"><p>object</p></td> |
| <td class="parameter_description"><p>GObject restricting lifetime of <em class="parameter"><code>closure</code></em> |
| </p></td> |
| <td class="parameter_annotations"> </td> |
| </tr> |
| <tr> |
| <td class="parameter_name"><p>closure</p></td> |
| <td class="parameter_description"><p>GClosure to watch</p></td> |
| <td class="parameter_annotations"> </td> |
| </tr> |
| </tbody> |
| </table></div> |
| </div> |
| </div> |
| <hr> |
| <div class="refsect2"> |
| <a name="g-object-run-dispose"></a><h3>g_object_run_dispose ()</h3> |
| <pre class="programlisting"><span class="returnvalue">void</span> |
| g_object_run_dispose (<em class="parameter"><code><a class="link" href="gobject-The-Base-Object-Type.html#GObject"><span class="type">GObject</span></a> *object</code></em>);</pre> |
| <p>Releases all references to other objects. This can be used to break |
| reference cycles.</p> |
| <p>This function should only be called from object system implementations.</p> |
| <div class="refsect3"> |
| <a name="g-object-run-dispose.parameters"></a><h4>Parameters</h4> |
| <div class="informaltable"><table class="informaltable" width="100%" border="0"> |
| <colgroup> |
| <col width="150px" class="parameters_name"> |
| <col class="parameters_description"> |
| <col width="200px" class="parameters_annotations"> |
| </colgroup> |
| <tbody><tr> |
| <td class="parameter_name"><p>object</p></td> |
| <td class="parameter_description"><p>a <a class="link" href="gobject-The-Base-Object-Type.html#GObject"><span class="type">GObject</span></a></p></td> |
| <td class="parameter_annotations"> </td> |
| </tr></tbody> |
| </table></div> |
| </div> |
| </div> |
| <hr> |
| <div class="refsect2"> |
| <a name="G-OBJECT-WARN-INVALID-PROPERTY-ID:CAPS"></a><h3>G_OBJECT_WARN_INVALID_PROPERTY_ID()</h3> |
| <pre class="programlisting">#define G_OBJECT_WARN_INVALID_PROPERTY_ID(object, property_id, pspec)</pre> |
| <p>This macro should be used to emit a standard warning about unexpected |
| properties in <code class="function">set_property()</code> and <code class="function">get_property()</code> implementations.</p> |
| <div class="refsect3"> |
| <a name="G-OBJECT-WARN-INVALID-PROPERTY-ID.parameters"></a><h4>Parameters</h4> |
| <div class="informaltable"><table class="informaltable" width="100%" border="0"> |
| <colgroup> |
| <col width="150px" class="parameters_name"> |
| <col class="parameters_description"> |
| <col width="200px" class="parameters_annotations"> |
| </colgroup> |
| <tbody> |
| <tr> |
| <td class="parameter_name"><p>object</p></td> |
| <td class="parameter_description"><p>the <a class="link" href="gobject-The-Base-Object-Type.html#GObject"><span class="type">GObject</span></a> on which <code class="function">set_property()</code> or <code class="function">get_property()</code> was called</p></td> |
| <td class="parameter_annotations"> </td> |
| </tr> |
| <tr> |
| <td class="parameter_name"><p>property_id</p></td> |
| <td class="parameter_description"><p>the numeric id of the property</p></td> |
| <td class="parameter_annotations"> </td> |
| </tr> |
| <tr> |
| <td class="parameter_name"><p>pspec</p></td> |
| <td class="parameter_description"><p>the <a class="link" href="gobject-GParamSpec.html#GParamSpec" title="struct GParamSpec"><span class="type">GParamSpec</span></a> of the property</p></td> |
| <td class="parameter_annotations"> </td> |
| </tr> |
| </tbody> |
| </table></div> |
| </div> |
| </div> |
| <hr> |
| <div class="refsect2"> |
| <a name="g-weak-ref-init"></a><h3>g_weak_ref_init ()</h3> |
| <pre class="programlisting"><span class="returnvalue">void</span> |
| g_weak_ref_init (<em class="parameter"><code><a class="link" href="gobject-The-Base-Object-Type.html#GWeakRef" title="GWeakRef"><span class="type">GWeakRef</span></a> *weak_ref</code></em>, |
| <em class="parameter"><code><a href="../glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> object</code></em>);</pre> |
| <p>Initialise a non-statically-allocated <a class="link" href="gobject-The-Base-Object-Type.html#GWeakRef" title="GWeakRef"><span class="type">GWeakRef</span></a>.</p> |
| <p>This function also calls <a class="link" href="gobject-The-Base-Object-Type.html#g-weak-ref-set" title="g_weak_ref_set ()"><code class="function">g_weak_ref_set()</code></a> with <em class="parameter"><code>object</code></em> |
| on the |
| freshly-initialised weak reference.</p> |
| <p>This function should always be matched with a call to |
| <a class="link" href="gobject-The-Base-Object-Type.html#g-weak-ref-clear" title="g_weak_ref_clear ()"><code class="function">g_weak_ref_clear()</code></a>. It is not necessary to use this function for a |
| <a class="link" href="gobject-The-Base-Object-Type.html#GWeakRef" title="GWeakRef"><span class="type">GWeakRef</span></a> in static storage because it will already be |
| properly initialised. Just use <a class="link" href="gobject-The-Base-Object-Type.html#g-weak-ref-set" title="g_weak_ref_set ()"><code class="function">g_weak_ref_set()</code></a> directly.</p> |
| <p><span class="annotation">[<acronym title="Exposed in C code, not necessarily available in other languages."><span class="acronym">skip</span></acronym>]</span></p> |
| <div class="refsect3"> |
| <a name="g-weak-ref-init.parameters"></a><h4>Parameters</h4> |
| <div class="informaltable"><table class="informaltable" width="100%" border="0"> |
| <colgroup> |
| <col width="150px" class="parameters_name"> |
| <col class="parameters_description"> |
| <col width="200px" class="parameters_annotations"> |
| </colgroup> |
| <tbody> |
| <tr> |
| <td class="parameter_name"><p>weak_ref</p></td> |
| <td class="parameter_description"><p> uninitialized or empty location for a weak |
| reference. </p></td> |
| <td class="parameter_annotations"><span class="annotation">[<acronym title="Parameter for input and for returning results. Default is transfer full."><span class="acronym">inout</span></acronym>]</span></td> |
| </tr> |
| <tr> |
| <td class="parameter_name"><p>object</p></td> |
| <td class="parameter_description"><p> a <a class="link" href="gobject-The-Base-Object-Type.html#GObject"><span class="type">GObject</span></a> or <a href="../glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>. </p></td> |
| <td class="parameter_annotations"><span class="annotation">[<acronym title="Override the parsed C type with given type."><span class="acronym">type</span></acronym> GObject.Object][<acronym title="NULL may be passed as the value in, out, in-out; or as a return value."><span class="acronym">nullable</span></acronym>]</span></td> |
| </tr> |
| </tbody> |
| </table></div> |
| </div> |
| <p class="since">Since: <a class="link" href="api-index-2-32.html#api-index-2.32">2.32</a></p> |
| </div> |
| <hr> |
| <div class="refsect2"> |
| <a name="g-weak-ref-clear"></a><h3>g_weak_ref_clear ()</h3> |
| <pre class="programlisting"><span class="returnvalue">void</span> |
| g_weak_ref_clear (<em class="parameter"><code><a class="link" href="gobject-The-Base-Object-Type.html#GWeakRef" title="GWeakRef"><span class="type">GWeakRef</span></a> *weak_ref</code></em>);</pre> |
| <p>Frees resources associated with a non-statically-allocated <a class="link" href="gobject-The-Base-Object-Type.html#GWeakRef" title="GWeakRef"><span class="type">GWeakRef</span></a>. |
| After this call, the <a class="link" href="gobject-The-Base-Object-Type.html#GWeakRef" title="GWeakRef"><span class="type">GWeakRef</span></a> is left in an undefined state.</p> |
| <p>You should only call this on a <a class="link" href="gobject-The-Base-Object-Type.html#GWeakRef" title="GWeakRef"><span class="type">GWeakRef</span></a> that previously had |
| <a class="link" href="gobject-The-Base-Object-Type.html#g-weak-ref-init" title="g_weak_ref_init ()"><code class="function">g_weak_ref_init()</code></a> called on it.</p> |
| <p><span class="annotation">[<acronym title="Exposed in C code, not necessarily available in other languages."><span class="acronym">skip</span></acronym>]</span></p> |
| <div class="refsect3"> |
| <a name="g-weak-ref-clear.parameters"></a><h4>Parameters</h4> |
| <div class="informaltable"><table class="informaltable" width="100%" border="0"> |
| <colgroup> |
| <col width="150px" class="parameters_name"> |
| <col class="parameters_description"> |
| <col width="200px" class="parameters_annotations"> |
| </colgroup> |
| <tbody><tr> |
| <td class="parameter_name"><p>weak_ref</p></td> |
| <td class="parameter_description"><p> location of a weak reference, which |
| may be empty. </p></td> |
| <td class="parameter_annotations"><span class="annotation">[<acronym title="Parameter for input and for returning results. Default is transfer full."><span class="acronym">inout</span></acronym>]</span></td> |
| </tr></tbody> |
| </table></div> |
| </div> |
| <p class="since">Since: <a class="link" href="api-index-2-32.html#api-index-2.32">2.32</a></p> |
| </div> |
| <hr> |
| <div class="refsect2"> |
| <a name="g-weak-ref-get"></a><h3>g_weak_ref_get ()</h3> |
| <pre class="programlisting"><a href="../glib-Basic-Types.html#gpointer"><span class="returnvalue">gpointer</span></a> |
| g_weak_ref_get (<em class="parameter"><code><a class="link" href="gobject-The-Base-Object-Type.html#GWeakRef" title="GWeakRef"><span class="type">GWeakRef</span></a> *weak_ref</code></em>);</pre> |
| <p>If <em class="parameter"><code>weak_ref</code></em> |
| is not empty, atomically acquire a strong |
| reference to the object it points to, and return that reference.</p> |
| <p>This function is needed because of the potential race between taking |
| the pointer value and <a class="link" href="gobject-The-Base-Object-Type.html#g-object-ref" title="g_object_ref ()"><code class="function">g_object_ref()</code></a> on it, if the object was losing |
| its last reference at the same time in a different thread.</p> |
| <p>The caller should release the resulting reference in the usual way, |
| by using <a class="link" href="gobject-The-Base-Object-Type.html#g-object-unref" title="g_object_unref ()"><code class="function">g_object_unref()</code></a>.</p> |
| <p><span class="annotation">[<acronym title="Exposed in C code, not necessarily available in other languages."><span class="acronym">skip</span></acronym>]</span></p> |
| <div class="refsect3"> |
| <a name="g-weak-ref-get.parameters"></a><h4>Parameters</h4> |
| <div class="informaltable"><table class="informaltable" width="100%" border="0"> |
| <colgroup> |
| <col width="150px" class="parameters_name"> |
| <col class="parameters_description"> |
| <col width="200px" class="parameters_annotations"> |
| </colgroup> |
| <tbody><tr> |
| <td class="parameter_name"><p>weak_ref</p></td> |
| <td class="parameter_description"><p> location of a weak reference to a <a class="link" href="gobject-The-Base-Object-Type.html#GObject"><span class="type">GObject</span></a>. </p></td> |
| <td class="parameter_annotations"><span class="annotation">[<acronym title="Parameter for input and for returning results. Default is transfer full."><span class="acronym">inout</span></acronym>]</span></td> |
| </tr></tbody> |
| </table></div> |
| </div> |
| <div class="refsect3"> |
| <a name="g-weak-ref-get.returns"></a><h4>Returns</h4> |
| <p> the object pointed to |
| by <em class="parameter"><code>weak_ref</code></em> |
| , or <a href="../glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> if it was empty. </p> |
| <p><span class="annotation">[<acronym title="Free data after the code is done."><span class="acronym">transfer full</span></acronym>][<acronym title="Override the parsed C type with given type."><span class="acronym">type</span></acronym> GObject.Object]</span></p> |
| </div> |
| <p class="since">Since: <a class="link" href="api-index-2-32.html#api-index-2.32">2.32</a></p> |
| </div> |
| <hr> |
| <div class="refsect2"> |
| <a name="g-weak-ref-set"></a><h3>g_weak_ref_set ()</h3> |
| <pre class="programlisting"><span class="returnvalue">void</span> |
| g_weak_ref_set (<em class="parameter"><code><a class="link" href="gobject-The-Base-Object-Type.html#GWeakRef" title="GWeakRef"><span class="type">GWeakRef</span></a> *weak_ref</code></em>, |
| <em class="parameter"><code><a href="../glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> object</code></em>);</pre> |
| <p>Change the object to which <em class="parameter"><code>weak_ref</code></em> |
| points, or set it to |
| <a href="../glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>.</p> |
| <p>You must own a strong reference on <em class="parameter"><code>object</code></em> |
| while calling this |
| function.</p> |
| <p><span class="annotation">[<acronym title="Exposed in C code, not necessarily available in other languages."><span class="acronym">skip</span></acronym>]</span></p> |
| <div class="refsect3"> |
| <a name="g-weak-ref-set.parameters"></a><h4>Parameters</h4> |
| <div class="informaltable"><table class="informaltable" width="100%" border="0"> |
| <colgroup> |
| <col width="150px" class="parameters_name"> |
| <col class="parameters_description"> |
| <col width="200px" class="parameters_annotations"> |
| </colgroup> |
| <tbody> |
| <tr> |
| <td class="parameter_name"><p>weak_ref</p></td> |
| <td class="parameter_description"><p>location for a weak reference</p></td> |
| <td class="parameter_annotations"> </td> |
| </tr> |
| <tr> |
| <td class="parameter_name"><p>object</p></td> |
| <td class="parameter_description"><p> a <a class="link" href="gobject-The-Base-Object-Type.html#GObject"><span class="type">GObject</span></a> or <a href="../glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>. </p></td> |
| <td class="parameter_annotations"><span class="annotation">[<acronym title="Override the parsed C type with given type."><span class="acronym">type</span></acronym> GObject.Object][<acronym title="NULL may be passed as the value in, out, in-out; or as a return value."><span class="acronym">nullable</span></acronym>]</span></td> |
| </tr> |
| </tbody> |
| </table></div> |
| </div> |
| <p class="since">Since: <a class="link" href="api-index-2-32.html#api-index-2.32">2.32</a></p> |
| </div> |
| </div> |
| <div class="refsect1"> |
| <a name="gobject-The-Base-Object-Type.other_details"></a><h2>Types and Values</h2> |
| <div class="refsect2"> |
| <a name="GObject-struct"></a><h3>struct GObject</h3> |
| <pre class="programlisting">struct GObject;</pre> |
| <p>All the fields in the GObject structure are private |
| to the <a class="link" href="gobject-The-Base-Object-Type.html#GObject"><span class="type">GObject</span></a> implementation and should never be accessed directly.</p> |
| </div> |
| <hr> |
| <div class="refsect2"> |
| <a name="GObjectClass"></a><h3>struct GObjectClass</h3> |
| <pre class="programlisting">struct GObjectClass { |
| GTypeClass g_type_class; |
| |
| /* seldom overidden */ |
| 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 overidden */ |
| void (*dispatch_properties_changed) (GObject *object, |
| guint n_pspecs, |
| GParamSpec **pspecs); |
| /* signals */ |
| void (*notify) (GObject *object, |
| GParamSpec *pspec); |
| |
| /* called when done constructing */ |
| void (*constructed) (GObject *object); |
| }; |
| </pre> |
| <p>The class structure for the GObject type.</p> |
| <p><example> |
| <title>Implementing singletons using a constructor</title> |
| <programlisting> |
| static MySingleton *the_singleton = NULL;</p> |
| <p>static GObject* |
| my_singleton_constructor (GType type, |
| guint n_construct_params, |
| GObjectConstructParam *construct_params) |
| { |
| GObject *object;</p> |
| <p> 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));</p> |
| <p> return object; |
| } |
| </programlisting></example></p> |
| <div class="refsect3"> |
| <a name="GObjectClass.members"></a><h4>Members</h4> |
| <div class="informaltable"><table class="informaltable" width="100%" border="0"> |
| <colgroup> |
| <col width="300px" class="struct_members_name"> |
| <col class="struct_members_description"> |
| <col width="200px" class="struct_members_annotations"> |
| </colgroup> |
| <tbody> |
| <tr> |
| <td class="struct_member_name"><p><a class="link" href="gobject-Type-Information.html#GTypeClass" title="struct GTypeClass"><span class="type">GTypeClass</span></a> <em class="structfield"><code><a name="GObjectClass.g-type-class"></a>g_type_class</code></em>;</p></td> |
| <td class="struct_member_description"><p>the parent class</p></td> |
| <td class="struct_member_annotations"> </td> |
| </tr> |
| <tr> |
| <td class="struct_member_name"><p><em class="structfield"><code><a name="GObjectClass.constructor"></a>constructor</code></em> ()</p></td> |
| <td class="struct_member_description"><p>the <em class="parameter"><code>constructor</code></em> |
| function is called by <a class="link" href="gobject-The-Base-Object-Type.html#g-object-new" title="g_object_new ()"><code class="function">g_object_new()</code></a> to |
| complete the object initialization after all the construction properties are |
| set. The first thing a <em class="parameter"><code>constructor</code></em> |
| implementation must do is chain up to the |
| <em class="parameter"><code>constructor</code></em> |
| of the parent class. Overriding <em class="parameter"><code>constructor</code></em> |
| should be rarely |
| needed, e.g. to handle construct properties, or to implement singletons.</p></td> |
| <td class="struct_member_annotations"> </td> |
| </tr> |
| <tr> |
| <td class="struct_member_name"><p><em class="structfield"><code><a name="GObjectClass.set-property"></a>set_property</code></em> ()</p></td> |
| <td class="struct_member_description"><p>the generic setter for all properties of this type. Should be |
| overridden for every type with properties. If implementations of |
| <em class="parameter"><code>set_property</code></em> |
| 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.</p></td> |
| <td class="struct_member_annotations"> </td> |
| </tr> |
| <tr> |
| <td class="struct_member_name"><p><em class="structfield"><code><a name="GObjectClass.get-property"></a>get_property</code></em> ()</p></td> |
| <td class="struct_member_description"><p>the generic getter for all properties of this type. Should be |
| overridden for every type with properties.</p></td> |
| <td class="struct_member_annotations"> </td> |
| </tr> |
| <tr> |
| <td class="struct_member_name"><p><em class="structfield"><code><a name="GObjectClass.dispose"></a>dispose</code></em> ()</p></td> |
| <td class="struct_member_description"><p>the <em class="parameter"><code>dispose</code></em> |
| 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, <em class="parameter"><code>dispose</code></em> |
| should chain up to the <em class="parameter"><code>dispose</code></em> |
| method |
| of the parent class.</p></td> |
| <td class="struct_member_annotations"> </td> |
| </tr> |
| <tr> |
| <td class="struct_member_name"><p><em class="structfield"><code><a name="GObjectClass.finalize"></a>finalize</code></em> ()</p></td> |
| <td class="struct_member_description"><p>instance finalization function, should finish the finalization of |
| the instance begun in <em class="parameter"><code>dispose</code></em> |
| and chain up to the <em class="parameter"><code>finalize</code></em> |
| method of the |
| parent class.</p></td> |
| <td class="struct_member_annotations"> </td> |
| </tr> |
| <tr> |
| <td class="struct_member_name"><p><em class="structfield"><code><a name="GObjectClass.dispatch-properties-changed"></a>dispatch_properties_changed</code></em> ()</p></td> |
| <td class="struct_member_description"><p>emits property change notification for a bunch |
| of properties. Overriding <em class="parameter"><code>dispatch_properties_changed</code></em> |
| should be rarely |
| needed.</p></td> |
| <td class="struct_member_annotations"> </td> |
| </tr> |
| <tr> |
| <td class="struct_member_name"><p><em class="structfield"><code><a name="GObjectClass.notify"></a>notify</code></em> ()</p></td> |
| <td class="struct_member_description"><p>the class closure for the notify signal</p></td> |
| <td class="struct_member_annotations"> </td> |
| </tr> |
| <tr> |
| <td class="struct_member_name"><p><em class="structfield"><code><a name="GObjectClass.constructed"></a>constructed</code></em> ()</p></td> |
| <td class="struct_member_description"><p>the <em class="parameter"><code>constructed</code></em> |
| function is called by <a class="link" href="gobject-The-Base-Object-Type.html#g-object-new" title="g_object_new ()"><code class="function">g_object_new()</code></a> 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. <em class="parameter"><code>constructed</code></em> |
| implementors |
| should chain up to the <em class="parameter"><code>constructed</code></em> |
| call of their parent class to allow it |
| to complete its initialisation.</p></td> |
| <td class="struct_member_annotations"> </td> |
| </tr> |
| </tbody> |
| </table></div> |
| </div> |
| </div> |
| <hr> |
| <div class="refsect2"> |
| <a name="GObjectConstructParam"></a><h3>struct GObjectConstructParam</h3> |
| <pre class="programlisting">struct GObjectConstructParam { |
| GParamSpec *pspec; |
| GValue *value; |
| }; |
| </pre> |
| <p>The GObjectConstructParam struct is an auxiliary |
| structure used to hand <a class="link" href="gobject-GParamSpec.html#GParamSpec" title="struct GParamSpec"><span class="type">GParamSpec</span></a>/<a class="link" href="gobject-Generic-values.html#GValue" title="GValue"><span class="type">GValue</span></a> pairs to the <em class="parameter"><code>constructor</code></em> |
| of |
| a <a class="link" href="gobject-The-Base-Object-Type.html#GObjectClass" title="struct GObjectClass"><span class="type">GObjectClass</span></a>.</p> |
| <div class="refsect3"> |
| <a name="GObjectConstructParam.members"></a><h4>Members</h4> |
| <div class="informaltable"><table class="informaltable" width="100%" border="0"> |
| <colgroup> |
| <col width="300px" class="struct_members_name"> |
| <col class="struct_members_description"> |
| <col width="200px" class="struct_members_annotations"> |
| </colgroup> |
| <tbody> |
| <tr> |
| <td class="struct_member_name"><p><a class="link" href="gobject-GParamSpec.html#GParamSpec" title="struct GParamSpec"><span class="type">GParamSpec</span></a> *<em class="structfield"><code><a name="GObjectConstructParam.pspec"></a>pspec</code></em>;</p></td> |
| <td class="struct_member_description"><p>the <a class="link" href="gobject-GParamSpec.html#GParamSpec" title="struct GParamSpec"><span class="type">GParamSpec</span></a> of the construct parameter</p></td> |
| <td class="struct_member_annotations"> </td> |
| </tr> |
| <tr> |
| <td class="struct_member_name"><p><a class="link" href="gobject-Generic-values.html#GValue" title="GValue"><span class="type">GValue</span></a> *<em class="structfield"><code><a name="GObjectConstructParam.value"></a>value</code></em>;</p></td> |
| <td class="struct_member_description"><p>the value to set the parameter to</p></td> |
| <td class="struct_member_annotations"> </td> |
| </tr> |
| </tbody> |
| </table></div> |
| </div> |
| </div> |
| <hr> |
| <div class="refsect2"> |
| <a name="GParameter"></a><h3>struct GParameter</h3> |
| <pre class="programlisting">struct GParameter { |
| const gchar *name; |
| GValue value; |
| }; |
| </pre> |
| <p>The GParameter struct is an auxiliary structure used |
| to hand parameter name/value pairs to <a class="link" href="gobject-The-Base-Object-Type.html#g-object-newv" title="g_object_newv ()"><code class="function">g_object_newv()</code></a>.</p> |
| <div class="refsect3"> |
| <a name="GParameter.members"></a><h4>Members</h4> |
| <div class="informaltable"><table class="informaltable" width="100%" border="0"> |
| <colgroup> |
| <col width="300px" class="struct_members_name"> |
| <col class="struct_members_description"> |
| <col width="200px" class="struct_members_annotations"> |
| </colgroup> |
| <tbody> |
| <tr> |
| <td class="struct_member_name"><p>const <a href="../glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *<em class="structfield"><code><a name="GParameter.name"></a>name</code></em>;</p></td> |
| <td class="struct_member_description"><p>the parameter name</p></td> |
| <td class="struct_member_annotations"> </td> |
| </tr> |
| <tr> |
| <td class="struct_member_name"><p><a class="link" href="gobject-Generic-values.html#GValue" title="GValue"><span class="type">GValue</span></a> <em class="structfield"><code><a name="GParameter.value"></a>value</code></em>;</p></td> |
| <td class="struct_member_description"><p>the parameter value</p></td> |
| <td class="struct_member_annotations"> </td> |
| </tr> |
| </tbody> |
| </table></div> |
| </div> |
| </div> |
| <hr> |
| <div class="refsect2"> |
| <a name="GInitiallyUnowned"></a><h3>GInitiallyUnowned</h3> |
| <pre class="programlisting">typedef struct _GObject GInitiallyUnowned; |
| </pre> |
| <p>All the fields in the GInitiallyUnowned structure |
| are private to the <a class="link" href="gobject-The-Base-Object-Type.html#GInitiallyUnowned" title="GInitiallyUnowned"><span class="type">GInitiallyUnowned</span></a> implementation and should never be |
| accessed directly.</p> |
| </div> |
| <hr> |
| <div class="refsect2"> |
| <a name="GInitiallyUnownedClass"></a><h3>GInitiallyUnownedClass</h3> |
| <pre class="programlisting">typedef struct _GObjectClass GInitiallyUnownedClass; |
| </pre> |
| <p>The class structure for the GInitiallyUnowned type.</p> |
| </div> |
| <hr> |
| <div class="refsect2"> |
| <a name="G-TYPE-INITIALLY-UNOWNED:CAPS"></a><h3>G_TYPE_INITIALLY_UNOWNED</h3> |
| <pre class="programlisting">#define G_TYPE_INITIALLY_UNOWNED (g_initially_unowned_get_type()) |
| </pre> |
| <p>The type for <a class="link" href="gobject-The-Base-Object-Type.html#GInitiallyUnowned" title="GInitiallyUnowned"><span class="type">GInitiallyUnowned</span></a>.</p> |
| </div> |
| <hr> |
| <div class="refsect2"> |
| <a name="GWeakRef"></a><h3>GWeakRef</h3> |
| <pre class="programlisting">typedef struct { |
| } GWeakRef; |
| </pre> |
| <p>A structure containing a weak reference to a <a class="link" href="gobject-The-Base-Object-Type.html#GObject"><span class="type">GObject</span></a>. It can either |
| be empty (i.e. point to <a href="../glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>), or point to an object for as long as |
| at least one "strong" reference to that object exists. Before the |
| object's <a class="link" href="gobject-The-Base-Object-Type.html#GObjectClass.dispose"><span class="type">GObjectClass.dispose</span></a> method is called, every <a class="link" href="gobject-The-Base-Object-Type.html#GWeakRef" title="GWeakRef"><span class="type">GWeakRef</span></a> |
| associated with becomes empty (i.e. points to <a href="../glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>).</p> |
| <p>Like <a class="link" href="gobject-Generic-values.html#GValue" title="GValue"><span class="type">GValue</span></a>, <a class="link" href="gobject-The-Base-Object-Type.html#GWeakRef" title="GWeakRef"><span class="type">GWeakRef</span></a> can be statically allocated, stack- or |
| heap-allocated, or embedded in larger structures.</p> |
| <p>Unlike <a class="link" href="gobject-The-Base-Object-Type.html#g-object-weak-ref" title="g_object_weak_ref ()"><code class="function">g_object_weak_ref()</code></a> and <a class="link" href="gobject-The-Base-Object-Type.html#g-object-add-weak-pointer" title="g_object_add_weak_pointer ()"><code class="function">g_object_add_weak_pointer()</code></a>, 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.</p> |
| <p>If the object's <a class="link" href="gobject-The-Base-Object-Type.html#GObjectClass.dispose"><span class="type">GObjectClass.dispose</span></a> method results in additional |
| references to the object being held, any <a href="gobject-The-Base-Object-Type.html#GWeakRef"><span class="type">GWeakRefs</span></a> taken |
| before it was disposed will continue to point to <a href="../glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>. If |
| <a href="gobject-The-Base-Object-Type.html#GWeakRef"><span class="type">GWeakRefs</span></a> 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.</p> |
| </div> |
| </div> |
| <div class="refsect1"> |
| <a name="gobject-The-Base-Object-Type.signal-details"></a><h2>Signal Details</h2> |
| <div class="refsect2"> |
| <a name="GObject-notify"></a><h3>The <code class="literal">“notify”</code> signal</h3> |
| <pre class="programlisting"><span class="returnvalue">void</span> |
| user_function (<a class="link" href="gobject-The-Base-Object-Type.html#GObject"><span class="type">GObject</span></a> *gobject, |
| <a class="link" href="gobject-GParamSpec.html#GParamSpec" title="struct GParamSpec"><span class="type">GParamSpec</span></a> *pspec, |
| <a href="../glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> user_data)</pre> |
| <p>The notify signal is emitted on an object when one of its |
| properties has been changed. Note that getting this signal |
| doesn't guarantee that the value of the property has actually |
| changed, it may also be emitted when the setter for the property |
| is called to reinstate the previous value.</p> |
| <p>This signal is typically used to obtain change notification for a |
| single property, by specifying the property name as a detail in the |
| <a class="link" href="gobject-Signals.html#g-signal-connect" title="g_signal_connect()"><code class="function">g_signal_connect()</code></a> call, like this:</p> |
| <div class="informalexample"> |
| <table class="listing_frame" border="0" cellpadding="0" cellspacing="0"> |
| <tbody> |
| <tr> |
| <td class="listing_lines" align="right"><pre>1 |
| 2 |
| 3</pre></td> |
| <td class="listing_code"><pre class="programlisting"><span class="function"><a href="gobject-Signals.html#g-signal-connect">g_signal_connect</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">text_view</span><span class="symbol">-></span><span class="normal">buffer</span><span class="symbol">,</span><span class="normal"> </span><span class="string">"notify::paste-target-list"</span><span class="symbol">,</span> |
| <span class="normal"> </span><span class="function"><a href="gobject-Closures.html#G-CALLBACK:CAPS">G_CALLBACK</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">gtk_text_view_target_list_notify</span><span class="symbol">),</span> |
| <span class="normal"> text_view</span><span class="symbol">)</span></pre></td> |
| </tr> |
| </tbody> |
| </table> |
| </div> |
| |
| <p> |
| It is important to note that you must use |
| canonical parameter names as |
| detail strings for the notify signal.</p> |
| <div class="refsect3"> |
| <a name="GObject-notify.parameters"></a><h4>Parameters</h4> |
| <div class="informaltable"><table class="informaltable" width="100%" border="0"> |
| <colgroup> |
| <col width="150px" class="parameters_name"> |
| <col class="parameters_description"> |
| <col width="200px" class="parameters_annotations"> |
| </colgroup> |
| <tbody> |
| <tr> |
| <td class="parameter_name"><p>gobject</p></td> |
| <td class="parameter_description"><p>the object which received the signal.</p></td> |
| <td class="parameter_annotations"> </td> |
| </tr> |
| <tr> |
| <td class="parameter_name"><p>pspec</p></td> |
| <td class="parameter_description"><p>the <a class="link" href="gobject-GParamSpec.html#GParamSpec" title="struct GParamSpec"><span class="type">GParamSpec</span></a> of the property which changed.</p></td> |
| <td class="parameter_annotations"> </td> |
| </tr> |
| <tr> |
| <td class="parameter_name"><p>user_data</p></td> |
| <td class="parameter_description"><p>user data set when the signal handler was connected.</p></td> |
| <td class="parameter_annotations"> </td> |
| </tr> |
| </tbody> |
| </table></div> |
| </div> |
| <p>Flags: <a class="link" href="gobject-Signals.html#G-SIGNAL-NO-HOOKS:CAPS">No Hooks</a></p> |
| </div> |
| </div> |
| <div class="refsect1"> |
| <a name="gobject-The-Base-Object-Type.see-also"></a><h2>See Also</h2> |
| <p><a class="link" href="gobject-Standard-Parameter-and-Value-Types.html#GParamSpecObject" title="struct GParamSpecObject"><span class="type">GParamSpecObject</span></a>, <a class="link" href="gobject-Standard-Parameter-and-Value-Types.html#g-param-spec-object" title="g_param_spec_object ()"><code class="function">g_param_spec_object()</code></a></p> |
| </div> |
| </div> |
| <div class="footer"> |
| <hr>Generated by GTK-Doc V1.25.1</div> |
| </body> |
| </html> |