X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=docs%2Freference%2Fgobject%2Fhtml%2Fhowto-gobject-construction.html;h=962a4a9b4d293052bf18a50d7fcaaab4b1894890;hb=147c398cd05d71fb172d3788b9dc576c67141811;hp=df13a8dd82c84c94b082aad34c91420005b8cbc1;hpb=5e3c122e6c1fb35ed1a2cb0b76e62a519251fb33;p=platform%2Fupstream%2Fglib2.0.git diff --git a/docs/reference/gobject/html/howto-gobject-construction.html b/docs/reference/gobject/html/howto-gobject-construction.html index df13a8d..962a4a9 100644 --- a/docs/reference/gobject/html/howto-gobject-construction.html +++ b/docs/reference/gobject/html/howto-gobject-construction.html @@ -3,43 +3,13 @@ Object Construction - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -49,7 +19,7 @@ -
+

Object Construction

@@ -93,29 +63,76 @@ maman_bar_init (MamanBar *self) Now, if you need special construction properties, install the properties in the class_init function, override the set and get methods and implement the get and set methods as described in the section called “Object properties”. Make sure that these properties use a construct only - GParamSpec by setting the param spec's flag field to G_PARAM_CONSTRUCT_ONLY: this helps + GParamSpec by setting the param spec's flag field to G_PARAM_CONSTRUCT_ONLY: this helps GType ensure that these properties are not set again later by malicious user code.

-
-static void
-bar_class_init (MamanBarClass *klass)
-{
-  GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
-  GParamSpec *maman_param_spec;
+
+ + + + + + + +
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
+29
enum {
+  PROP_0,
 
-  gobject_class->set_property = bar_set_property;
-  gobject_class->get_property = bar_get_property;
+  PROP_MAMAN,
+
+  N_PROPERTIES
+};
+
+static GParamSpec *obj_properties[N_PROPERTIES] = { NULL, };
+
+static void
+bar_class_init (MamanBarClass *klass)
+{
+  GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
+
+  gobject_class->set_property = bar_set_property;
+  gobject_class->get_property = bar_get_property;
+
+  obj_properties[PROP_MAMAN] =
+    g_param_spec_string ("maman",
+                         "Maman construct prop",
+                         "Set maman's name",
+                         "no-name-set" /* default value */,
+                         G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE);
+
+  g_object_class_install_properties (gobject_class,
+                                     N_PROPERTIES,
+                                     obj_properties);
+}
+
- maman_param_spec = g_param_spec_string ("maman", - "Maman construct prop", - "Set maman's name", - "no-name-set" /* default value */, - G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE); - g_object_class_install_property (gobject_class, - PROP_MAMAN, - maman_param_spec); -} -

If you need this, make sure you can build and run code similar to the code shown above. Make sure your construct properties can set correctly during construction, make sure you cannot set them @@ -138,6 +155,6 @@ bar_class_init (MamanBarClass *klass)

+ Generated by GTK-Doc V1.18
\ No newline at end of file