projects/package-update-indicator

view pui-types.c.in @ 52:707e9e3deeac

Do not hardcode pkg-config

Using a macro allows passing a different executable in case of
cross-compilation.
author Helmut Grohne <helmut@subdivi.de>
date Sat Dec 12 01:08:21 2020 -0500 (11 months ago)
parents
children
line source
1 /*** BEGIN file-header ***/
2 #include "pui-types.h"
3 /*** END file-header ***/
5 /*** BEGIN file-production ***/
7 /* enumerations from "@filename@" */
8 #include "@filename@"
9 /*** END file-production ***/
11 /*** BEGIN value-header ***/
13 GType
14 @enum_name@_get_type (void)
15 {
16 static volatile gsize g_define_type_id__volatile;
17 GType g_@type@_type_id;
19 if (g_once_init_enter(&g_define_type_id__volatile)) {
20 static const G@Type@Value values[] = {
21 /*** END value-header ***/
23 /*** BEGIN value-production ***/
24 { @VALUENAME@, "@VALUENAME@", "@valuenick@" },
25 /*** END value-production ***/
27 /*** BEGIN value-tail ***/
28 { 0 }
29 };
31 g_@type@_type_id = g_@type@_register_static(
32 g_intern_static_string("@EnumName@"), values);
34 g_once_init_leave(&g_define_type_id__volatile,
35 g_@type@_type_id);
36 }
38 return (g_define_type_id__volatile);
39 }
40 /*** END value-tail ***/
42 /*** BEGIN file-tail ***/
44 gchar *
45 pui_types_enum_to_string(GType type, gint value)
46 {
47 GTypeClass *type_class;
48 GEnumValue *enum_value;
50 type_class = g_type_class_ref(type);
52 g_return_val_if_fail(G_IS_ENUM_CLASS(type_class), NULL);
54 enum_value = g_enum_get_value(G_ENUM_CLASS(type_class), value);
55 if (enum_value == NULL) {
56 return (g_strdup_printf("%d", value));
57 }
59 return (g_strdup(enum_value->value_nick));
60 }
61 /*** END file-tail ***/