+static gboolean
+emit_cb (gpointer data)
+{
+ GFileMonitor *monitor = G_FILE_MONITOR (data);
+ GSList *pending, *iter;
+
+ g_mutex_lock (&monitor->priv->mutex);
+ pending = g_slist_reverse (monitor->priv->pending_file_changes);
+ monitor->priv->pending_file_changes = NULL;
+ if (monitor->priv->pending_file_change_source)
+ {
+ g_source_unref (monitor->priv->pending_file_change_source);
+ monitor->priv->pending_file_change_source = NULL;
+ }
+ g_mutex_unlock (&monitor->priv->mutex);
+
+ g_object_ref (monitor);
+ for (iter = pending; iter; iter = iter->next)
+ {
+ FileChange *change = iter->data;
+
+ g_signal_emit (monitor, signals[CHANGED], 0,
+ change->child, change->other_file, change->event_type);
+ file_change_free (change);
+ }
+ g_slist_free (pending);
+ g_object_unref (monitor);
+
+ return FALSE;
+}
+