From d3a479b7fa1d1e52f9d3950139643fe7e3ff5a57 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Thu, 10 Jan 2013 19:08:42 +0100 Subject: event/TimeoutMonitor: wrapper for g_timeout_source_new() --- src/InotifyQueue.cxx | 24 +++--------------------- 1 file changed, 3 insertions(+), 21 deletions(-) (limited to 'src/InotifyQueue.cxx') diff --git a/src/InotifyQueue.cxx b/src/InotifyQueue.cxx index 2b7899ecb..3212f95f9 100644 --- a/src/InotifyQueue.cxx +++ b/src/InotifyQueue.cxx @@ -20,7 +20,6 @@ #include "config.h" #include "InotifyQueue.hxx" #include "UpdateGlue.hxx" -#include "Main.hxx" #include "event/Loop.hxx" #include @@ -39,14 +38,8 @@ enum { INOTIFY_UPDATE_DELAY_S = 5, }; -InotifyQueue::~InotifyQueue() -{ - if (source_id != 0) - g_source_remove(source_id); -} - -inline bool -InotifyQueue::Run() +bool +InotifyQueue::OnTimeout() { unsigned id; @@ -64,17 +57,9 @@ InotifyQueue::Run() } /* done, remove the timer event by returning false */ - source_id = 0; return false; } -gboolean -InotifyQueue::Run(gpointer data) -{ - InotifyQueue &queue = *(InotifyQueue *)data; - return queue.Run(); -} - static bool path_in(const char *path, const char *possible_parent) { @@ -88,10 +73,7 @@ path_in(const char *path, const char *possible_parent) void InotifyQueue::Enqueue(const char *uri_utf8) { - if (source_id != 0) - g_source_remove(source_id); - source_id = main_loop->AddTimeoutSeconds(INOTIFY_UPDATE_DELAY_S, - Run, nullptr); + ScheduleSeconds(INOTIFY_UPDATE_DELAY_S); for (auto i = queue.begin(), end = queue.end(); i != end;) { const char *current_uri = i->c_str(); -- cgit v1.2.3