diff options
author | Pavel Labath <pavelo@centrum.sk> | 2011-08-09 08:25:28 (GMT) |
---|---|---|
committer | Pavel Labath <pavelo@centrum.sk> | 2011-11-01 10:04:02 (GMT) |
commit | 7a0a87b10174f2d546d96268cd63d91e7f0ae693 (patch) | |
tree | c70cb09d31bed06344a73ace3dfccd4f04666ae5 /src/FbTk/AutoReloadHelper.hh | |
parent | fd902cc2c9c6c06a0d6ea30fd00652814af91013 (diff) | |
download | fluxbox_paul-7a0a87b10174f2d546d96268cd63d91e7f0ae693.zip fluxbox_paul-7a0a87b10174f2d546d96268cd63d91e7f0ae693.tar.bz2 |
Make AutoReloadHelper truly "automatic"
by adding the ability to automatically check for modifications at specified intervals.
Using inotify() would be better, but that's not always present.
Diffstat (limited to 'src/FbTk/AutoReloadHelper.hh')
-rw-r--r-- | src/FbTk/AutoReloadHelper.hh | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/FbTk/AutoReloadHelper.hh b/src/FbTk/AutoReloadHelper.hh index b337a4a..216b3f5 100644 --- a/src/FbTk/AutoReloadHelper.hh +++ b/src/FbTk/AutoReloadHelper.hh | |||
@@ -28,11 +28,16 @@ | |||
28 | 28 | ||
29 | #include "Command.hh" | 29 | #include "Command.hh" |
30 | #include "RefCount.hh" | 30 | #include "RefCount.hh" |
31 | #include "Timer.hh" | ||
31 | 32 | ||
32 | namespace FbTk { | 33 | namespace FbTk { |
33 | 34 | ||
34 | class AutoReloadHelper { | 35 | class AutoReloadHelper: private NotCopyable { |
35 | public: | 36 | public: |
37 | /** | ||
38 | * @param interval time interval (in seconds) between automatic reload checks | ||
39 | */ | ||
40 | AutoReloadHelper(int interval = 0); | ||
36 | 41 | ||
37 | void setMainFile(const std::string& filename); | 42 | void setMainFile(const std::string& filename); |
38 | void addFile(const std::string& filename); | 43 | void addFile(const std::string& filename); |
@@ -44,6 +49,7 @@ public: | |||
44 | private: | 49 | private: |
45 | RefCount<Command<void> > m_reload_cmd; | 50 | RefCount<Command<void> > m_reload_cmd; |
46 | std::string m_main_file; | 51 | std::string m_main_file; |
52 | Timer m_timer; | ||
47 | 53 | ||
48 | typedef std::map<std::string, time_t> TimestampMap; | 54 | typedef std::map<std::string, time_t> TimestampMap; |
49 | TimestampMap m_timestamps; | 55 | TimestampMap m_timestamps; |