aboutsummaryrefslogtreecommitdiff
path: root/libdbusmenu-glib/enum-types.c.in
diff options
context:
space:
mode:
Diffstat (limited to 'libdbusmenu-glib/enum-types.c.in')
-rw-r--r--libdbusmenu-glib/enum-types.c.in25
1 files changed, 25 insertions, 0 deletions
diff --git a/libdbusmenu-glib/enum-types.c.in b/libdbusmenu-glib/enum-types.c.in
index d572d44..b0756d9 100644
--- a/libdbusmenu-glib/enum-types.c.in
+++ b/libdbusmenu-glib/enum-types.c.in
@@ -64,4 +64,29 @@ GType
return etype;
}
+/**
+ @enum_name@_get_nick:
+ @value: The value of @EnumName@ to get the nick of
+
+ Looks up in the enum table for the nick of @value.
+
+ Return value: The nick for the given value or #NULL on error
+*/
+const gchar *
+@enum_name@_get_nick (@EnumName@ value)
+{
+ GEnumClass * class = G_ENUM_CLASS(g_type_class_ref(@enum_name@_get_type()));
+ g_return_val_if_fail(class != NULL, NULL);
+
+ const gchar * ret = NULL;
+ GEnumValue * val = g_enum_get_value(class, value);
+ if (val != NULL) {
+ ret = val->value_nick;
+ }
+
+ g_type_class_unref(class);
+ return ret;
+}
+
+
/*** END value-tail ***/