summaryrefslogtreecommitdiff
path: root/gobject
diff options
context:
space:
mode:
authorSébastien Wilmet <swilmet@gnome.org>2014-09-18 17:16:59 +0200
committerSébastien Wilmet <swilmet@gnome.org>2015-02-08 16:06:17 +0100
commit3f6d233e872e5d8a520486a644fb118d358a9be8 (patch)
tree5e52818eee1ffdcd4d1eb089a98321c60ba7d4eb /gobject
parent0110f2a810cfd638a0a6525deb69aeec7a0f0cab (diff)
docs: code example for enumeration types
I had to read the GTK+ code recently to have an example. https://bugzilla.gnome.org/show_bug.cgi?id=736914
Diffstat (limited to 'gobject')
-rw-r--r--gobject/genums.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/gobject/genums.c b/gobject/genums.c
index d6dc5598f..a4f22c98a 100644
--- a/gobject/genums.c
+++ b/gobject/genums.c
@@ -50,6 +50,19 @@
* GObject ships with a utility called [glib-mkenums][glib-mkenums],
* that can construct suitable type registration functions from C enumeration
* definitions.
+ *
+ * Example of how to get a string representation of an enum value:
+ * |[<!-- language="C" -->
+ * GEnumClass *enum_class;
+ * GEnumValue *enum_value;
+ *
+ * enum_class = g_type_class_ref (MAMAN_TYPE_MY_ENUM);
+ * enum_value = g_enum_get_value (enum_class, MAMAN_MY_ENUM_FOO);
+ *
+ * g_print ("Name: %s\n", enum_value->value_name);
+ *
+ * g_type_class_unref (enum_class);
+ * ]|
*/