diff options
author | Tomeu Vizoso <tomeu.vizoso@collabora.com> | 2012-02-21 16:17:59 +0100 |
---|---|---|
committer | Tomeu Vizoso <tomeu.vizoso@collabora.com> | 2012-02-21 17:09:28 +0100 |
commit | 52c07daf1fa3a5d17957cc3e3d0d75c65b268b57 (patch) | |
tree | c403eaccd92fe0a9ee6df26338c01c77837e1b4d /tests/doctool/doc-examples-obj.c | |
parent | bd983994b9a63639fda836a06f4102776b9e1480 (diff) | |
download | gobject-introspection-52c07daf1fa3a5d17957cc3e3d0d75c65b268b57.tar.gz |
g-ir-doc-tool: Create a GIR file specific for testing doc generation
This will also serve as a reference of the syntax that is currently
supported by g-ir-doc-tool.
Diffstat (limited to 'tests/doctool/doc-examples-obj.c')
-rw-r--r-- | tests/doctool/doc-examples-obj.c | 103 |
1 files changed, 103 insertions, 0 deletions
diff --git a/tests/doctool/doc-examples-obj.c b/tests/doctool/doc-examples-obj.c new file mode 100644 index 00000000..ff866289 --- /dev/null +++ b/tests/doctool/doc-examples-obj.c @@ -0,0 +1,103 @@ +/* doc-examples-obj.c */ + +#include "doc-examples-obj.h" + +/** + * DocExamplesObj: + * + * This is an example of how to document a class + * + * This class has a signal: #DocExamplesObj::signal-example. + * + * And also has a property: #DocExamplesObj:property-example. + * + * Since: 0.99 + */ + +G_DEFINE_TYPE (DocExamplesObj, doc_examples_obj, G_TYPE_OBJECT) + +static void +doc_examples_obj_get_property (GObject *object, + guint property_id, + GValue *value, + GParamSpec *pspec) +{ + switch (property_id) + { + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); + } +} + +static void +doc_examples_obj_set_property (GObject *object, + guint property_id, + const GValue *value, + GParamSpec *pspec) +{ + switch (property_id) + { + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); + } +} + +static void +doc_examples_obj_class_init (DocExamplesObjClass *klass) +{ + GObjectClass *gobject_class = G_OBJECT_CLASS (klass); + GParamSpec *pspec; + + gobject_class->get_property = doc_examples_obj_get_property; + gobject_class->set_property = doc_examples_obj_set_property; + + /** + * DocExamplesObj::signal-example: + * @object: + * @int_param: a parameter of type int + * @float_param: a parameter of type float + * + * Emitted when the connection status on the account changes. + * + * The @dbus_error_name and @details parameters were present, but + * non-functional (always %NULL), in older versions. They have been + * available with their current behaviour since version 0.11.7. + * + * Since: 0.99 + */ + g_signal_new ("signal-example", + G_TYPE_FROM_CLASS (gobject_class), + G_SIGNAL_RUN_LAST, + 0, NULL, NULL, + NULL, + G_TYPE_NONE, 2, G_TYPE_UINT, G_TYPE_UINT); + + /** + * DocExamplesObj:property-example: + * + * This is an example of how to document a property. + * + * Type: GLib.HashTable(utf8,gint8) + * Transfer: container + */ + pspec = g_param_spec_boxed ("property-example", + "Example property", + "A contained GHashTable", + G_TYPE_HASH_TABLE, + G_PARAM_READWRITE); + g_object_class_install_property (gobject_class, + 1, + pspec); +} + +static void +doc_examples_obj_init (DocExamplesObj *self) +{ + +} + +DocExamplesObj * +doc_examples_obj_new (void) +{ + return g_object_new (DOC_EXAMPLES_TYPE_OBJ, NULL); +} |