summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog3
-rw-r--r--src/Remember.cc28
-rw-r--r--src/Remember.hh6
3 files changed, 21 insertions, 16 deletions
diff --git a/ChangeLog b/ChangeLog
index 690212b..e441093 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
1 (Format: Year/Month/Day) 1 (Format: Year/Month/Day)
2Changes for 1.1 2Changes for 1.1
3*08/05/12:
4 * Modifying the apps file no longer requires a reconfigure (Mark)
5 Remember.cc/hh
3*08/05/09: 6*08/05/09:
4 * Made tooltip in toolbar update when the title changes (Henrik) 7 * Made tooltip in toolbar update when the title changes (Henrik)
5 Tooltip.cc/hh, Screen.cc/cc, OSDWindow.hh 8 Tooltip.cc/hh, Screen.cc/cc, OSDWindow.hh
diff --git a/src/Remember.cc b/src/Remember.cc
index 8e133b8..825a070 100644
--- a/src/Remember.cc
+++ b/src/Remember.cc
@@ -281,14 +281,14 @@ void Application::reset() {
281Remember *Remember::s_instance = 0; 281Remember *Remember::s_instance = 0;
282 282
283Remember::Remember(): 283Remember::Remember():
284 m_pats(new Patterns()), 284 m_pats(new Patterns()) {
285 m_last_timestamp(0)
286{
287 if (s_instance != 0) 285 if (s_instance != 0)
288 throw string("Can not create more than one instance of Remember"); 286 throw string("Can not create more than one instance of Remember");
289 287
290 s_instance = this; 288 s_instance = this;
291 enableUpdate(); 289 enableUpdate();
290
291 m_reloader.setReloadCmd(FbTk::RefCount<FbTk::Command<void> >(new FbTk::SimpleCommand<Remember>(*this, &Remember::reload)));
292 reconfigure(); 292 reconfigure();
293} 293}
294 294
@@ -579,11 +579,12 @@ Application *Remember::findMatchingPatterns(ClientPattern *pat, Patterns *patlis
579 579
580 580
581void Remember::reconfigure() { 581void Remember::reconfigure() {
582 string apps_string = FbTk::StringUtil::expandFilename(Fluxbox::instance()->getAppsFilename()); 582 m_reloader.setMainFile(Fluxbox::instance()->getAppsFilename());
583 m_reloader.checkReload();
584}
583 585
584 time_t timestamp = FbTk::FileUtil::getLastStatusChangeTimestamp(apps_string.c_str()); 586void Remember::reload() {
585 if (m_last_timestamp > 0 && m_last_timestamp == timestamp) 587 string apps_string = FbTk::StringUtil::expandFilename(Fluxbox::instance()->getAppsFilename());
586 return;
587 588
588#ifdef DEBUG 589#ifdef DEBUG
589 cerr<<__FILE__<<"("<<__FUNCTION__<<"): Loading apps file ["<<apps_string<<"]"<<endl; 590 cerr<<__FILE__<<"("<<__FUNCTION__<<"): Loading apps file ["<<apps_string<<"]"<<endl;
@@ -598,7 +599,6 @@ void Remember::reconfigure() {
598 m_startups.clear(); 599 m_startups.clear();
599 600
600 if (!apps_file.fail()) { 601 if (!apps_file.fail()) {
601 m_last_timestamp = timestamp;
602 if (!apps_file.eof()) { 602 if (!apps_file.eof()) {
603 string line; 603 string line;
604 int row = 0; 604 int row = 0;
@@ -687,7 +687,7 @@ void Remember::reconfigure() {
687#endif 687#endif
688 } 688 }
689 } else { 689 } else {
690 cerr << "apps file failure" << endl; 690 cerr << "failed to open apps file" << endl;
691 } 691 }
692 692
693 // Clean up old state 693 // Clean up old state
@@ -895,11 +895,8 @@ void Remember::save() {
895 apps_file << "[end]" << endl; 895 apps_file << "[end]" << endl;
896 } 896 }
897 apps_file.close(); 897 apps_file.close();
898 898 // update timestamp to avoid unnecessary reload
899 time_t timestamp = FbTk::FileUtil::getLastStatusChangeTimestamp(apps_string.c_str()); 899 m_reloader.addFile(Fluxbox::instance()->getAppsFilename());
900 if (timestamp > 0)
901 m_last_timestamp = timestamp;
902
903} 900}
904 901
905bool Remember::isRemembered(WinClient &winclient, Attribute attrib) { 902bool Remember::isRemembered(WinClient &winclient, Attribute attrib) {
@@ -1216,6 +1213,9 @@ void Remember::setupClient(WinClient &winclient) {
1216 if (winclient.screen().isRestart()) 1213 if (winclient.screen().isRestart())
1217 return; 1214 return;
1218 1215
1216 // check if apps file has changed
1217 reconfigure();
1218
1219 Application *app = find(winclient); 1219 Application *app = find(winclient);
1220 if (app == 0) 1220 if (app == 0)
1221 return; // nothing to do 1221 return; // nothing to do
diff --git a/src/Remember.hh b/src/Remember.hh
index 4ab8f2a..107f1d2 100644
--- a/src/Remember.hh
+++ b/src/Remember.hh
@@ -29,6 +29,7 @@
29#include "AtomHandler.hh" 29#include "AtomHandler.hh"
30#include "ClientPattern.hh" 30#include "ClientPattern.hh"
31 31
32#include "FbTk/AutoReloadHelper.hh"
32#include "FbTk/RefCount.hh" 33#include "FbTk/RefCount.hh"
33 34
34#include <fstream> 35#include <fstream>
@@ -223,7 +224,8 @@ public:
223 Application* add(WinClient &winclient); 224 Application* add(WinClient &winclient);
224 FluxboxWindow* findGroup(Application *, BScreen &screen); 225 FluxboxWindow* findGroup(Application *, BScreen &screen);
225 226
226 void reconfigure(); // was load 227 void reconfigure();
228 void reload();
227 void save(); 229 void save();
228 230
229 bool isRemembered(WinClient &win, Attribute attrib); 231 bool isRemembered(WinClient &win, Attribute attrib);
@@ -277,7 +279,7 @@ private:
277 Startups m_startups; 279 Startups m_startups;
278 static Remember *s_instance; 280 static Remember *s_instance;
279 281
280 time_t m_last_timestamp; 282 FbTk::AutoReloadHelper m_reloader;
281}; 283};
282 284
283#endif // REMEMBER_HH 285#endif // REMEMBER_HH