[tracker/data-provider-monitor-interface] libtracker-miner: Use GFileMonitorEvent enum information to get type->str
- From: Martyn James Russell <mr src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker/data-provider-monitor-interface] libtracker-miner: Use GFileMonitorEvent enum information to get type->str
- Date: Tue, 23 Dec 2014 11:00:45 +0000 (UTC)
commit 777fb0ab2c4f8722c142363f337ee3128acedf81
Author: Martyn Russell <martyn lanedo com>
Date: Tue Dec 23 10:03:44 2014 +0000
libtracker-miner: Use GFileMonitorEvent enum information to get type->str
src/libtracker-miner/tracker-monitor.c | 35 ++++++++++++-------------------
1 files changed, 14 insertions(+), 21 deletions(-)
---
diff --git a/src/libtracker-miner/tracker-monitor.c b/src/libtracker-miner/tracker-monitor.c
index 8d23772..67be9e6 100644
--- a/src/libtracker-miner/tracker-monitor.c
+++ b/src/libtracker-miner/tracker-monitor.c
@@ -584,29 +584,22 @@ tracker_monitor_move (TrackerMonitor *monitor,
return items_moved > 0;
}
-static const gchar *
-monitor_event_to_string (GFileMonitorEvent event_type)
+inline static const gchar *
+monitor_event_to_string (GFileMonitorEvent value)
{
- switch (event_type) {
- case G_FILE_MONITOR_EVENT_CHANGED:
- return "G_FILE_MONITOR_EVENT_CHANGED";
- case G_FILE_MONITOR_EVENT_CHANGES_DONE_HINT:
- return "G_FILE_MONITOR_EVENT_CHANGES_DONE_HINT";
- case G_FILE_MONITOR_EVENT_DELETED:
- return "G_FILE_MONITOR_EVENT_DELETED";
- case G_FILE_MONITOR_EVENT_CREATED:
- return "G_FILE_MONITOR_EVENT_CREATED";
- case G_FILE_MONITOR_EVENT_ATTRIBUTE_CHANGED:
- return "G_FILE_MONITOR_EVENT_ATTRIBUTE_CHANGED";
- case G_FILE_MONITOR_EVENT_PRE_UNMOUNT:
- return "G_FILE_MONITOR_EVENT_PRE_UNMOUNT";
- case G_FILE_MONITOR_EVENT_UNMOUNTED:
- return "G_FILE_MONITOR_EVENT_UNMOUNTED";
- case G_FILE_MONITOR_EVENT_MOVED:
- return "G_FILE_MONITOR_EVENT_MOVED";
- }
+ GType type;
+ GEnumClass *enum_class;
+ GEnumValue *enum_value;
+
+ type = g_file_monitor_event_get_type ();
+ enum_class = G_ENUM_CLASS (g_type_class_peek (type));
+ enum_value = g_enum_get_value (enum_class, value);
+
+ if (!enum_value) {
+ return "unknown";
+ }
- return "unknown";
+ return enum_value->value_nick;
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]