[glib] docs: Tidy up GObject construction discussion in the GObject tutorial
- From: Philip Withnall <pwithnall src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib] docs: Tidy up GObject construction discussion in the GObject tutorial
- Date: Thu, 1 Oct 2015 14:27:30 +0000 (UTC)
commit 4a5a30f716ae260bd89416cda8dbdcc5cf6f2e62
Author: Philip Withnall <philip tecnocode co uk>
Date: Thu Oct 1 00:32:10 2015 +0100
docs: Tidy up GObject construction discussion in the GObject tutorial
Remove some outdated references to an old example, and add a row in the
table of steps in object initialization for the GObjectClass.constructed
virtual method.
https://bugzilla.gnome.org/show_bug.cgi?id=754855
docs/reference/gobject/tut_gobject.xml | 23 ++++++++++++++++-------
1 files changed, 16 insertions(+), 7 deletions(-)
---
diff --git a/docs/reference/gobject/tut_gobject.xml b/docs/reference/gobject/tut_gobject.xml
index 7468a6c..557615f 100644
--- a/docs/reference/gobject/tut_gobject.xml
+++ b/docs/reference/gobject/tut_gobject.xml
@@ -113,9 +113,8 @@ MamanBar *bar = g_object_new (MAMAN_TYPE_BAR, NULL);
<para>
Once <function><link linkend="g-object-new">g_object_new</link></function> has obtained a reference to
an initialized
class structure, it invokes its constructor method to create an instance of the new
- object. Since it has just been overridden by <function>maman_bar_class_init</function>
- to <function>maman_bar_constructor</function>, the latter is called and, because it
- was implemented correctly, it chains up to its parent's constructor. In
+ object, if the constructor has been overridden in <function>maman_bar_class_init</function>.
+ Overridden constructors must chain up to their parent’s constructor. In
order to find the parent class and chain up to the parent class
constructor, we can use the <literal>maman_bar_parent_class</literal>
pointer that has been set up for us by the
@@ -190,12 +189,12 @@ MamanBar *bar = g_object_new (MAMAN_TYPE_BAR, NULL);
<entry></entry>
</row>
<row>
- <entry morerows="1">Each call to <function><link
linkend="g-object-new">g_object_new</link></function> for target type</entry>
- <entry>target type's class constructor method: GObjectClass->constructor</entry>
+ <entry morerows="2">Each call to <function><link
linkend="g-object-new">g_object_new</link></function> for target type</entry>
+ <entry>target type's class <function>constructor</function> method:
<function>GObjectClass->constructor</function></entry>
<entry>On object's instance</entry>
<entry>
- If you need to complete the object initialization after all the construction properties
- are set, override the constructor method and make sure to chain up to the object's
+ If you need to handle construct properties in a custom way, or implement a singleton class,
override the constructor
+ method and make sure to chain up to the object's
parent class before doing your own initialization.
In doubt, do not override the constructor method.
</entry>
@@ -212,6 +211,16 @@ MamanBar *bar = g_object_new (MAMAN_TYPE_BAR, NULL);
This function is equivalent to C++ constructors.
</entry>
</row>
+ <row>
+ <!--entry>Each call to <function><link linkend="g-object-new">g_object_new</link></function>
for target type</entry-->
+ <entry>target type's class <function>constructed</function> method:
<function>GObjectClass->constructed</function></entry>
+ <entry>On object's instance</entry>
+ <entry>
+ If you need to perform object initialization steps after all construct properties have been
set.
+ This is the final step in the object initialization process, and is only called if the
<function>constructor</function>
+ method returned a new object instance (rather than, for example, an existing singleton).
+ </entry>
+ </row>
</tbody>
</tgroup>
</table>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]