diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 17:51:51 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 17:51:51 +0000 |
commit | b0e30ceba2288eab10c6ff7be0ac0cb05a9ed0b7 (patch) | |
tree | 9f1d8a08a8cbd19d28ec2d31027f8a7ccd90de0d /plugins/power/gsd-power-enums-update.c | |
parent | Initial commit. (diff) | |
download | gnome-settings-daemon-b0e30ceba2288eab10c6ff7be0ac0cb05a9ed0b7.tar.xz gnome-settings-daemon-b0e30ceba2288eab10c6ff7be0ac0cb05a9ed0b7.zip |
Adding upstream version 43.0.upstream/43.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'plugins/power/gsd-power-enums-update.c')
-rw-r--r-- | plugins/power/gsd-power-enums-update.c | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/plugins/power/gsd-power-enums-update.c b/plugins/power/gsd-power-enums-update.c new file mode 100644 index 0000000..546e494 --- /dev/null +++ b/plugins/power/gsd-power-enums-update.c @@ -0,0 +1,44 @@ +#include <glib-object.h> +#include <gsd-power-enums.h> +#include <stdio.h> + +/* XXX: The following functions use printf, because otherwise there were + * build failures when the building with the memory sanitizer enabled. + * These may be false positives though. + */ + +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]); + printf ("%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]); + printf ("%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; +} |