aboutsummaryrefslogtreecommitdiff
path: root/src/InotifyQueue.cxx
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2013-01-10 19:08:42 +0100
committerMax Kellermann <max@duempel.org>2013-01-14 11:12:28 +0100
commitd3a479b7fa1d1e52f9d3950139643fe7e3ff5a57 (patch)
tree4996c42d621876770a6d80bc8d031be9ee97676a /src/InotifyQueue.cxx
parent92fb0e829a9b61d1b1db4bdbe6096c1772b7c819 (diff)
event/TimeoutMonitor: wrapper for g_timeout_source_new()
Diffstat (limited to 'src/InotifyQueue.cxx')
-rw-r--r--src/InotifyQueue.cxx24
1 files changed, 3 insertions, 21 deletions
diff --git a/src/InotifyQueue.cxx b/src/InotifyQueue.cxx
index 2b7899ec..3212f95f 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 <glib.h>
@@ -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();