annotate pui-types.c.in @ 33:8c5aee997afa version-5

Release version 5
author Guido Berhoerster <guido+pui@berhoerster.name>
date Fri, 30 Aug 2019 13:32:52 +0200
parents adba37525ee5
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
10
adba37525ee5 Notify about required session or system restarts
Guido Berhoerster <guido+pui@berhoerster.name>
parents:
diff changeset
1 /*** BEGIN file-header ***/
adba37525ee5 Notify about required session or system restarts
Guido Berhoerster <guido+pui@berhoerster.name>
parents:
diff changeset
2 #include "pui-types.h"
adba37525ee5 Notify about required session or system restarts
Guido Berhoerster <guido+pui@berhoerster.name>
parents:
diff changeset
3 /*** END file-header ***/
adba37525ee5 Notify about required session or system restarts
Guido Berhoerster <guido+pui@berhoerster.name>
parents:
diff changeset
4
adba37525ee5 Notify about required session or system restarts
Guido Berhoerster <guido+pui@berhoerster.name>
parents:
diff changeset
5 /*** BEGIN file-production ***/
adba37525ee5 Notify about required session or system restarts
Guido Berhoerster <guido+pui@berhoerster.name>
parents:
diff changeset
6
adba37525ee5 Notify about required session or system restarts
Guido Berhoerster <guido+pui@berhoerster.name>
parents:
diff changeset
7 /* enumerations from "@filename@" */
adba37525ee5 Notify about required session or system restarts
Guido Berhoerster <guido+pui@berhoerster.name>
parents:
diff changeset
8 #include "@filename@"
adba37525ee5 Notify about required session or system restarts
Guido Berhoerster <guido+pui@berhoerster.name>
parents:
diff changeset
9 /*** END file-production ***/
adba37525ee5 Notify about required session or system restarts
Guido Berhoerster <guido+pui@berhoerster.name>
parents:
diff changeset
10
adba37525ee5 Notify about required session or system restarts
Guido Berhoerster <guido+pui@berhoerster.name>
parents:
diff changeset
11 /*** BEGIN value-header ***/
adba37525ee5 Notify about required session or system restarts
Guido Berhoerster <guido+pui@berhoerster.name>
parents:
diff changeset
12
adba37525ee5 Notify about required session or system restarts
Guido Berhoerster <guido+pui@berhoerster.name>
parents:
diff changeset
13 GType
adba37525ee5 Notify about required session or system restarts
Guido Berhoerster <guido+pui@berhoerster.name>
parents:
diff changeset
14 @enum_name@_get_type (void)
adba37525ee5 Notify about required session or system restarts
Guido Berhoerster <guido+pui@berhoerster.name>
parents:
diff changeset
15 {
adba37525ee5 Notify about required session or system restarts
Guido Berhoerster <guido+pui@berhoerster.name>
parents:
diff changeset
16 static volatile gsize g_define_type_id__volatile;
adba37525ee5 Notify about required session or system restarts
Guido Berhoerster <guido+pui@berhoerster.name>
parents:
diff changeset
17 GType g_@type@_type_id;
adba37525ee5 Notify about required session or system restarts
Guido Berhoerster <guido+pui@berhoerster.name>
parents:
diff changeset
18
adba37525ee5 Notify about required session or system restarts
Guido Berhoerster <guido+pui@berhoerster.name>
parents:
diff changeset
19 if (g_once_init_enter(&g_define_type_id__volatile)) {
adba37525ee5 Notify about required session or system restarts
Guido Berhoerster <guido+pui@berhoerster.name>
parents:
diff changeset
20 static const G@Type@Value values[] = {
adba37525ee5 Notify about required session or system restarts
Guido Berhoerster <guido+pui@berhoerster.name>
parents:
diff changeset
21 /*** END value-header ***/
adba37525ee5 Notify about required session or system restarts
Guido Berhoerster <guido+pui@berhoerster.name>
parents:
diff changeset
22
adba37525ee5 Notify about required session or system restarts
Guido Berhoerster <guido+pui@berhoerster.name>
parents:
diff changeset
23 /*** BEGIN value-production ***/
adba37525ee5 Notify about required session or system restarts
Guido Berhoerster <guido+pui@berhoerster.name>
parents:
diff changeset
24 { @VALUENAME@, "@VALUENAME@", "@valuenick@" },
adba37525ee5 Notify about required session or system restarts
Guido Berhoerster <guido+pui@berhoerster.name>
parents:
diff changeset
25 /*** END value-production ***/
adba37525ee5 Notify about required session or system restarts
Guido Berhoerster <guido+pui@berhoerster.name>
parents:
diff changeset
26
adba37525ee5 Notify about required session or system restarts
Guido Berhoerster <guido+pui@berhoerster.name>
parents:
diff changeset
27 /*** BEGIN value-tail ***/
adba37525ee5 Notify about required session or system restarts
Guido Berhoerster <guido+pui@berhoerster.name>
parents:
diff changeset
28 { 0 }
adba37525ee5 Notify about required session or system restarts
Guido Berhoerster <guido+pui@berhoerster.name>
parents:
diff changeset
29 };
adba37525ee5 Notify about required session or system restarts
Guido Berhoerster <guido+pui@berhoerster.name>
parents:
diff changeset
30
adba37525ee5 Notify about required session or system restarts
Guido Berhoerster <guido+pui@berhoerster.name>
parents:
diff changeset
31 g_@type@_type_id = g_@type@_register_static(
adba37525ee5 Notify about required session or system restarts
Guido Berhoerster <guido+pui@berhoerster.name>
parents:
diff changeset
32 g_intern_static_string("@EnumName@"), values);
adba37525ee5 Notify about required session or system restarts
Guido Berhoerster <guido+pui@berhoerster.name>
parents:
diff changeset
33
adba37525ee5 Notify about required session or system restarts
Guido Berhoerster <guido+pui@berhoerster.name>
parents:
diff changeset
34 g_once_init_leave(&g_define_type_id__volatile,
adba37525ee5 Notify about required session or system restarts
Guido Berhoerster <guido+pui@berhoerster.name>
parents:
diff changeset
35 g_@type@_type_id);
adba37525ee5 Notify about required session or system restarts
Guido Berhoerster <guido+pui@berhoerster.name>
parents:
diff changeset
36 }
adba37525ee5 Notify about required session or system restarts
Guido Berhoerster <guido+pui@berhoerster.name>
parents:
diff changeset
37
adba37525ee5 Notify about required session or system restarts
Guido Berhoerster <guido+pui@berhoerster.name>
parents:
diff changeset
38 return (g_define_type_id__volatile);
adba37525ee5 Notify about required session or system restarts
Guido Berhoerster <guido+pui@berhoerster.name>
parents:
diff changeset
39 }
adba37525ee5 Notify about required session or system restarts
Guido Berhoerster <guido+pui@berhoerster.name>
parents:
diff changeset
40 /*** END value-tail ***/
adba37525ee5 Notify about required session or system restarts
Guido Berhoerster <guido+pui@berhoerster.name>
parents:
diff changeset
41
adba37525ee5 Notify about required session or system restarts
Guido Berhoerster <guido+pui@berhoerster.name>
parents:
diff changeset
42 /*** BEGIN file-tail ***/
adba37525ee5 Notify about required session or system restarts
Guido Berhoerster <guido+pui@berhoerster.name>
parents:
diff changeset
43
adba37525ee5 Notify about required session or system restarts
Guido Berhoerster <guido+pui@berhoerster.name>
parents:
diff changeset
44 gchar *
adba37525ee5 Notify about required session or system restarts
Guido Berhoerster <guido+pui@berhoerster.name>
parents:
diff changeset
45 pui_types_enum_to_string(GType type, gint value)
adba37525ee5 Notify about required session or system restarts
Guido Berhoerster <guido+pui@berhoerster.name>
parents:
diff changeset
46 {
adba37525ee5 Notify about required session or system restarts
Guido Berhoerster <guido+pui@berhoerster.name>
parents:
diff changeset
47 GTypeClass *type_class;
adba37525ee5 Notify about required session or system restarts
Guido Berhoerster <guido+pui@berhoerster.name>
parents:
diff changeset
48 GEnumValue *enum_value;
adba37525ee5 Notify about required session or system restarts
Guido Berhoerster <guido+pui@berhoerster.name>
parents:
diff changeset
49
adba37525ee5 Notify about required session or system restarts
Guido Berhoerster <guido+pui@berhoerster.name>
parents:
diff changeset
50 type_class = g_type_class_ref(type);
adba37525ee5 Notify about required session or system restarts
Guido Berhoerster <guido+pui@berhoerster.name>
parents:
diff changeset
51
adba37525ee5 Notify about required session or system restarts
Guido Berhoerster <guido+pui@berhoerster.name>
parents:
diff changeset
52 g_return_val_if_fail(G_IS_ENUM_CLASS(type_class), NULL);
adba37525ee5 Notify about required session or system restarts
Guido Berhoerster <guido+pui@berhoerster.name>
parents:
diff changeset
53
adba37525ee5 Notify about required session or system restarts
Guido Berhoerster <guido+pui@berhoerster.name>
parents:
diff changeset
54 enum_value = g_enum_get_value(G_ENUM_CLASS(type_class), value);
adba37525ee5 Notify about required session or system restarts
Guido Berhoerster <guido+pui@berhoerster.name>
parents:
diff changeset
55 if (enum_value == NULL) {
adba37525ee5 Notify about required session or system restarts
Guido Berhoerster <guido+pui@berhoerster.name>
parents:
diff changeset
56 return (g_strdup_printf("%d", value));
adba37525ee5 Notify about required session or system restarts
Guido Berhoerster <guido+pui@berhoerster.name>
parents:
diff changeset
57 }
adba37525ee5 Notify about required session or system restarts
Guido Berhoerster <guido+pui@berhoerster.name>
parents:
diff changeset
58
adba37525ee5 Notify about required session or system restarts
Guido Berhoerster <guido+pui@berhoerster.name>
parents:
diff changeset
59 return (g_strdup(enum_value->value_nick));
adba37525ee5 Notify about required session or system restarts
Guido Berhoerster <guido+pui@berhoerster.name>
parents:
diff changeset
60 }
adba37525ee5 Notify about required session or system restarts
Guido Berhoerster <guido+pui@berhoerster.name>
parents:
diff changeset
61 /*** END file-tail ***/