diff options
author | Max Kellermann <max@duempel.org> | 2013-01-14 11:00:22 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2013-01-14 11:00:22 +0100 |
commit | 92fb0e829a9b61d1b1db4bdbe6096c1772b7c819 (patch) | |
tree | 5445042f3932b283bb07e31d1d8c020ee5858581 /src/StateFile.hxx | |
parent | 43a99285378bb5d40ed311729ff1f507fbe37a34 (diff) | |
download | mpd-92fb0e829a9b61d1b1db4bdbe6096c1772b7c819.tar.gz mpd-92fb0e829a9b61d1b1db4bdbe6096c1772b7c819.tar.xz mpd-92fb0e829a9b61d1b1db4bdbe6096c1772b7c819.zip |
StateFile: convert to a class
Diffstat (limited to '')
-rw-r--r-- | src/StateFile.hxx | 35 |
1 files changed, 30 insertions, 5 deletions
diff --git a/src/StateFile.hxx b/src/StateFile.hxx index 35269fe40..0888b25ad 100644 --- a/src/StateFile.hxx +++ b/src/StateFile.hxx @@ -20,14 +20,39 @@ #ifndef MPD_STATE_FILE_HXX #define MPD_STATE_FILE_HXX +#include <glib.h> + +#include <string> + struct Partition; +class EventLoop; + +class StateFile { + std::string path; + + Partition &partition; + EventLoop &loop; + + /** the GLib source id for the save timer */ + guint source_id; + + /** + * These version numbers determine whether we need to save the state + * file. If nothing has changed, we won't let the hard drive spin up. + */ + unsigned prev_volume_version, prev_output_version, + prev_playlist_version; -void -state_file_init(const char *path, Partition &partition); +public: + StateFile(const char *path, Partition &partition, EventLoop &loop); + ~StateFile(); -void -state_file_finish(Partition &partition); + void Read(); + void Write(); + void AutoWrite(); -void write_state_file(void); +private: + static gboolean TimerCallback(gpointer data); +}; #endif /* STATE_FILE_H */ |