[glib: 1/2] doc: Interface for derivable object



commit 9e62a425bdc4f3bd37f8145596dd8430acda01a5
Author: Pavlo Solntsev <p sun fun gmail com>
Date:   Thu May 24 23:32:00 2018 -0500

    doc: Interface for derivable object

 docs/reference/gobject/tut_howto.xml | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
---
diff --git a/docs/reference/gobject/tut_howto.xml b/docs/reference/gobject/tut_howto.xml
index 0e119009b..daaad4697 100644
--- a/docs/reference/gobject/tut_howto.xml
+++ b/docs/reference/gobject/tut_howto.xml
@@ -1069,6 +1069,20 @@ viewer_file_init (ViewerFile *self)
 {
   /* Instance variable initialisation code. */
 }
+</programlisting></informalexample>
+    </para>
+    <para>
+      If the object is not of final type, e.g. was declared using
+      <function><link linkend="G-DECLARE-DERIVABLE-TYPE:CAPS">G_DECLARE_DERIVABLE_TYPE</link></function>
+      then
+      <function><link linkend="G-ADD-PRIVATE:CAPS">G_ADD_PRIVATE</link></function>
+      macro should be added. The private structure should be declared exactly
+      as for a normal derivable object, see <xref linkend="howto-gobject-code"/>.
+<informalexample><programlisting>
+G_DEFINE_TYPE_WITH_CODE (ViewerFile, viewer_file, G_TYPE_OBJECT,
+                         G_ADD_PRIVATE (ViewerFile)
+                         G_IMPLEMENT_INTERFACE (VIEWER_TYPE_EDITABLE,
+                                                viewer_file_editable_interface_init))
 </programlisting></informalexample>
     </para>
   </sect1>


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]