From 969e8f867fb122628bd0a55e63d01639a8e312f2 Mon Sep 17 00:00:00 2001 From: Romain Bouvier Date: Sun, 23 Jan 2011 13:30:49 +0100 Subject: [PATCH 4/4] Port tap_provider_child_watch to GIO --- thunar-archive-plugin/tap-provider.c | 30 +++++++++++++----------------- 1 files changed, 13 insertions(+), 17 deletions(-) diff --git a/thunar-archive-plugin/tap-provider.c b/thunar-archive-plugin/tap-provider.c index 91a32bc..2086086 100644 --- a/thunar-archive-plugin/tap-provider.c +++ b/thunar-archive-plugin/tap-provider.c @@ -681,29 +681,25 @@ tap_provider_child_watch (GPid pid, gint status, gpointer user_data) { - //TODO: ThunarVfsMonitor *monitor; - //TODO: ThunarVfsPath *path; - //TODO: TapProvider *tap_provider = TAP_PROVIDER (user_data); + TapProvider *tap_provider = TAP_PROVIDER (user_data); + GFileMonitor *monitor; + GFile *path; GDK_THREADS_ENTER (); /* verify that we still have a valid child_watch_path */ - //TODO: if (G_LIKELY (tap_provider->child_watch_path != NULL)) + if (G_LIKELY (tap_provider->child_watch_path != NULL)) + { + path = g_file_new_for_uri (tap_provider->child_watch_path); + /* schedule a changed notification on the path */ + monitor = g_file_monitor (path, G_FILE_MONITOR_NONE, NULL, NULL); + if (monitor != NULL) { - /* determine the corresponding ThunarVfsPath */ - //TODO: path = thunar_vfs_path_new (tap_provider->child_watch_path, NULL); - //TODO: if (G_LIKELY (path != NULL)) - { - /* schedule a changed notification on the path */ - //TODO: monitor = thunar_vfs_monitor_get_default (); - //TODO: thunar_vfs_monitor_feed (monitor, THUNAR_VFS_MONITOR_EVENT_CHANGED, path); - //TODO: g_object_unref (G_OBJECT (monitor)); - - /* release the ThunarVfsPath */ - //TODO: thunar_vfs_path_unref (path); - } + g_file_monitor_emit_event (monitor, path, NULL,G_FILE_MONITOR_EVENT_CHANGED); + g_object_unref (monitor); } - + g_object_unref (path); + } /* need to cleanup */ g_spawn_close_pid (pid); -- 1.7.3.5