Initial packaging for Tizen
[profile/ivi/gobject-introspection.git] / tests / doctool / doc-examples-obj.c
1 /* doc-examples-obj.c */
2
3 #include "doc-examples-obj.h"
4
5 /**
6  * DocExamplesObj:
7  *
8  * This is an example of how to document a class
9  *
10  * This class has a signal: #DocExamplesObj::signal-example.
11  *
12  * And also has a property: #DocExamplesObj:property-example.
13  *
14  * Since: 0.99
15  */
16
17 G_DEFINE_TYPE (DocExamplesObj, doc_examples_obj, G_TYPE_OBJECT)
18
19 static void
20 doc_examples_obj_get_property (GObject    *object,
21                                guint       property_id,
22                                GValue     *value,
23                                GParamSpec *pspec)
24 {
25   switch (property_id)
26     {
27     default:
28       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
29     }
30 }
31
32 static void
33 doc_examples_obj_set_property (GObject      *object,
34                                guint         property_id,
35                                const GValue *value,
36                                GParamSpec   *pspec)
37 {
38   switch (property_id)
39     {
40     default:
41       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
42     }
43 }
44
45 static void
46 doc_examples_obj_class_init (DocExamplesObjClass *klass)
47 {
48   GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
49   GParamSpec *pspec;
50
51   gobject_class->get_property = doc_examples_obj_get_property;
52   gobject_class->set_property = doc_examples_obj_set_property;
53
54   /**
55    * DocExamplesObj::signal-example:
56    * @obj:
57    * @int_param: a parameter of type int
58    * @float_param: a parameter of type float
59    *
60    * This is an example of how to document a signal.
61    *
62    * Since: 0.99
63    */
64   g_signal_new ("signal-example",
65       G_TYPE_FROM_CLASS (gobject_class),
66       G_SIGNAL_RUN_LAST,
67       0, NULL, NULL,
68       NULL,
69       G_TYPE_NONE, 2, G_TYPE_UINT, G_TYPE_UINT);
70
71   /**
72    * DocExamplesObj:property-example:
73    *
74    * This is an example of how to document a property.
75    *
76    * Type: GLib.HashTable(utf8,gint8)
77    * Transfer: container
78    *
79    * Since: 0.99
80    */
81   pspec = g_param_spec_boxed ("property-example",
82                               "Example property",
83                               "A contained GHashTable",
84                               G_TYPE_HASH_TABLE,
85                               G_PARAM_READWRITE);
86   g_object_class_install_property (gobject_class,
87                                    1,
88                                    pspec);
89 }
90
91 static void
92 doc_examples_obj_init (DocExamplesObj *self)
93 {
94
95 }
96
97 DocExamplesObj *
98 doc_examples_obj_new (void)
99 {
100   return g_object_new (DOC_EXAMPLES_TYPE_OBJ, NULL);
101 }
102
103 /**
104  * doc_examples_obj_method:
105  * @first_arg: first argument
106  * @second_arg: second argument
107  *
108  * This is an example of how to document a method.
109  *
110  * Since: 0.99
111  */
112 void
113 doc_examples_obj_method (DocExamplesObj *self, gint first_arg, gfloat second_arg)
114 {
115
116 }