summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Hughes <richard@hughsie.com>2016-10-19 13:35:34 +0100
committerRichard Hughes <richard@hughsie.com>2016-10-19 13:35:39 +0100
commit2bcc90e2941357002249166b46ab8f18890851f2 (patch)
treed0ef5a72bf7b4146323c36240551b8be3468acda
parent210988cc41ae81f1f59847475602be016dc5b12a (diff)
downloadappstream-glib-2bcc90e2941357002249166b46ab8f18890851f2.tar.gz
Handle files being moved into monitored AppStream directories
This handles the case where we 'mv' a file to or from a monitored directory, rather than creating it and ensures the file gets parsed or invalidated correctly.
-rw-r--r--libappstream-glib/as-monitor.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/libappstream-glib/as-monitor.c b/libappstream-glib/as-monitor.c
index bec94f7..44a8d50 100644
--- a/libappstream-glib/as-monitor.c
+++ b/libappstream-glib/as-monitor.c
@@ -171,6 +171,11 @@ _g_file_monitor_to_string (GFileMonitorEvent ev)
return "MOVED";
if (ev == G_FILE_MONITOR_EVENT_RENAMED)
return "RENAMED";
+ if (ev == G_FILE_MONITOR_EVENT_MOVED_IN)
+ return "MOVED_IN";
+ if (ev == G_FILE_MONITOR_EVENT_MOVED_OUT)
+ return "MOVED_OUT";
+ g_warning ("Failed to convert GFileMonitorEvent %u", ev);
return NULL;
}
@@ -339,6 +344,7 @@ as_monitor_file_changed_cb (GFileMonitor *mon,
as_monitor_process_pending_trigger (monitor, 50);
break;
case G_FILE_MONITOR_EVENT_CREATED:
+ case G_FILE_MONITOR_EVENT_MOVED_IN:
if (!is_temp) {
_g_ptr_array_str_add (priv->queue_add, filename);
} else {
@@ -348,6 +354,7 @@ as_monitor_file_changed_cb (GFileMonitor *mon,
as_monitor_process_pending_trigger (monitor, 800);
break;
case G_FILE_MONITOR_EVENT_DELETED:
+ case G_FILE_MONITOR_EVENT_MOVED_OUT:
/* only emit notifications for files we know about */
if (_g_ptr_array_str_find (priv->files, filename)) {
as_monitor_emit_removed (monitor, filename);