summaryrefslogtreecommitdiff
path: root/plugins/power/gsd-power-enums-update.c
blob: bdc4e050d9fc83882f1dab314e9331b4ed01fb28 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#include <glib-object.h>
#include <gsd-power-enums.h>

static void
output_enum_values (GType class_type)
{
	GEnumClass *eclass;
	guint i;

	eclass = G_ENUM_CLASS (g_type_class_peek (class_type));
	for (i = 0; i < eclass->n_values; i++) {
		GEnumValue *value = &(eclass->values[i]);
		g_print ("%s = %d;\n", value->value_name, value->value);
	}
}

static void
output_flags_values (GType class_type)
{
	GFlagsClass *fclass;
	guint i;

	fclass = G_FLAGS_CLASS (g_type_class_peek (class_type));
	for (i = 0; i < fclass->n_values; i++) {
		GFlagsValue *value = &(fclass->values[i]);
		g_print ("%s = %d;\n", value->value_name, value->value);
	}
}

int
main (int argc, char **argv)
{
	g_type_class_ref (GSD_POWER_TYPE_INHIBITOR_FLAG);
	g_type_class_ref (GSD_POWER_TYPE_PRESENCE_STATUS);
	output_flags_values (GSD_POWER_TYPE_INHIBITOR_FLAG);
	output_enum_values (GSD_POWER_TYPE_PRESENCE_STATUS);
	return 0;
}