[gnome-settings-daemon/wip/hadess/xsettings-enum] xsettings: Simplify fetching string for an enum value
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-settings-daemon/wip/hadess/xsettings-enum] xsettings: Simplify fetching string for an enum value
- Date: Wed, 30 Mar 2022 16:43:03 +0000 (UTC)
commit a91616597f3c45a47ff1219a85c32718d57b9329
Author: Bastien Nocera <hadess hadess net>
Date: Wed Mar 30 18:41:56 2022 +0200
xsettings: Simplify fetching string for an enum value
plugins/xsettings/fc-monitor.c | 13 +------------
1 file changed, 1 insertion(+), 12 deletions(-)
---
diff --git a/plugins/xsettings/fc-monitor.c b/plugins/xsettings/fc-monitor.c
index 63e87125..cafc8bf5 100644
--- a/plugins/xsettings/fc-monitor.c
+++ b/plugins/xsettings/fc-monitor.c
@@ -187,17 +187,6 @@ monitor_files (FcMonitor *self,
FcStrListDone (list);
}
-static const gchar *
-get_name (GType enum_type,
- gint enum_value)
-{
- GEnumClass *klass = g_type_class_ref (enum_type);
- GEnumValue *value = g_enum_get_value (klass, enum_value);
- const gchar *name = value ? value->value_name : "(unknown)";
- g_type_class_unref (klass);
- return name;
-}
-
static void
stuff_changed (GFileMonitor *monitor G_GNUC_UNUSED,
GFile *file G_GNUC_UNUSED,
@@ -206,7 +195,7 @@ stuff_changed (GFileMonitor *monitor G_GNUC_UNUSED,
gpointer data)
{
FcMonitor *self = FC_MONITOR (data);
- const gchar *event_name = get_name (G_TYPE_FILE_MONITOR_EVENT, event_type);
+ const gchar *event_name = g_enum_to_string (G_TYPE_FILE_MONITOR_EVENT, event_type);
switch (self->state) {
case UPDATE_IDLE:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]