aboutsummaryrefslogtreecommitdiff
path: root/src/StateFile.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/StateFile.cxx
parent92fb0e829a9b61d1b1db4bdbe6096c1772b7c819 (diff)
event/TimeoutMonitor: wrapper for g_timeout_source_new()
Diffstat (limited to 'src/StateFile.cxx')
-rw-r--r--src/StateFile.cxx18
1 files changed, 5 insertions, 13 deletions
diff --git a/src/StateFile.cxx b/src/StateFile.cxx
index a19eac55..b7805652 100644
--- a/src/StateFile.cxx
+++ b/src/StateFile.cxx
@@ -35,17 +35,11 @@
#define G_LOG_DOMAIN "state_file"
StateFile::StateFile(const char *_path, Partition &_partition, EventLoop &_loop)
- :path(_path), partition(_partition), loop(_loop),
- source_id(0),
+ :TimeoutMonitor(_loop), path(_path), partition(_partition),
prev_volume_version(0), prev_output_version(0),
prev_playlist_version(0)
{
- source_id = loop.AddTimeoutSeconds(5 * 60, TimerCallback, this);
-}
-
-StateFile::~StateFile()
-{
- g_source_remove(source_id);
+ ScheduleSeconds(5 * 60);
}
void
@@ -120,11 +114,9 @@ StateFile::AutoWrite()
* This function is called every 5 minutes by the GLib main loop, and
* saves the state file.
*/
-gboolean
-StateFile::TimerCallback(gpointer data)
+bool
+StateFile::OnTimeout()
{
- StateFile &state_file = *(StateFile *)data;
-
- state_file.AutoWrite();
+ AutoWrite();
return true;
}