aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPavel Labath <pavelo@centrum.sk>2011-07-10 12:55:53 (GMT)
committerPaul Tagliamonte <paultag@fluxbox.org>2012-04-07 02:11:31 (GMT)
commit7d488e2df6095fdd81b42c2d469c416b9b4d9144 (patch)
treec5175606dda7ee2adc2ed13824008d8a6d075219
parentaf96798a8bbba9a9d30f04e8b7ae825508f77c33 (diff)
downloadfluxbox_paul-7d488e2df6095fdd81b42c2d469c416b9b4d9144.zip
fluxbox_paul-7d488e2df6095fdd81b42c2d469c416b9b4d9144.tar.bz2
Attach a modifiedSig handler to the session.appsFile resource
-rw-r--r--src/AtomHandler.hh2
-rw-r--r--src/Remember.cc17
-rw-r--r--src/Remember.hh4
-rw-r--r--src/fluxbox.cc1
-rw-r--r--src/fluxbox.hh2
5 files changed, 9 insertions, 17 deletions
diff --git a/src/AtomHandler.hh b/src/AtomHandler.hh
index 6e517d0..7dd6f54 100644
--- a/src/AtomHandler.hh
+++ b/src/AtomHandler.hh
@@ -58,8 +58,6 @@ public:
58 58
59 virtual bool propertyNotify(WinClient &winclient, Atom the_property) = 0; 59 virtual bool propertyNotify(WinClient &winclient, Atom the_property) = 0;
60 60
61 virtual void reconfigure() {}
62
63 /// should this object be updated or not? 61 /// should this object be updated or not?
64 bool update() const { return m_update; } 62 bool update() const { return m_update; }
65 63
diff --git a/src/Remember.cc b/src/Remember.cc
index 294e1d5..8d8cfc5 100644
--- a/src/Remember.cc
+++ b/src/Remember.cc
@@ -653,7 +653,9 @@ Remember::Remember():
653 enableUpdate(); 653 enableUpdate();
654 654
655 m_reloader->setReloadCmd(FbTk::RefCount<FbTk::Command<void> >(new FbTk::SimpleCommand<Remember>(*this, &Remember::reload))); 655 m_reloader->setReloadCmd(FbTk::RefCount<FbTk::Command<void> >(new FbTk::SimpleCommand<Remember>(*this, &Remember::reload)));
656 reconfigure(); 656 m_reloader->setMainFile(*Fluxbox::instance()->getAppsResource());
657 join(Fluxbox::instance()->getAppsResource().modifiedSig(),
658 FbTk::MemFun(*m_reloader, &FbTk::AutoReloadHelper::setMainFile));
657} 659}
658 660
659Remember::~Remember() { 661Remember::~Remember() {
@@ -720,19 +722,12 @@ Application * Remember::add(WinClient &winclient) {
720 return app; 722 return app;
721} 723}
722 724
723
724
725
726void Remember::reconfigure() {
727 m_reloader->setMainFile(Fluxbox::instance()->getAppsFilename());
728}
729
730void Remember::checkReload() { 725void Remember::checkReload() {
731 m_reloader->checkReload(); 726 m_reloader->checkReload();
732} 727}
733 728
734void Remember::reload() { 729void Remember::reload() {
735 string apps_string = FbTk::StringUtil::expandFilename(Fluxbox::instance()->getAppsFilename()); 730 const string &apps_string = FbTk::StringUtil::expandFilename(*Fluxbox::instance()->getAppsResource());
736 731
737 732
738 fbdbg<<"("<<__FUNCTION__<<"): Loading apps file ["<<apps_string<<"]"<<endl; 733 fbdbg<<"("<<__FUNCTION__<<"): Loading apps file ["<<apps_string<<"]"<<endl;
@@ -878,7 +873,7 @@ void Remember::reload() {
878 873
879void Remember::save() { 874void Remember::save() {
880 875
881 string apps_string = FbTk::StringUtil::expandFilename(Fluxbox::instance()->getAppsFilename()); 876 const string &apps_string = FbTk::StringUtil::expandFilename(*Fluxbox::instance()->getAppsResource());
882 877
883 fbdbg<<"("<<__FUNCTION__<<"): Saving apps file ["<<apps_string<<"]"<<endl; 878 fbdbg<<"("<<__FUNCTION__<<"): Saving apps file ["<<apps_string<<"]"<<endl;
884 879
@@ -1062,7 +1057,7 @@ void Remember::save() {
1062 } 1057 }
1063 apps_file.close(); 1058 apps_file.close();
1064 // update timestamp to avoid unnecessary reload 1059 // update timestamp to avoid unnecessary reload
1065 m_reloader->addFile(Fluxbox::instance()->getAppsFilename()); 1060 m_reloader->addFile(*Fluxbox::instance()->getAppsResource());
1066} 1061}
1067 1062
1068bool Remember::isRemembered(WinClient &winclient, Attribute attrib) { 1063bool Remember::isRemembered(WinClient &winclient, Attribute attrib) {
diff --git a/src/Remember.hh b/src/Remember.hh
index a1abf5a..c2489dd 100644
--- a/src/Remember.hh
+++ b/src/Remember.hh
@@ -26,6 +26,7 @@
26#ifndef REMEMBER_HH 26#ifndef REMEMBER_HH
27#define REMEMBER_HH 27#define REMEMBER_HH
28 28
29#include "FbTk/Signal.hh"
29#include "AtomHandler.hh" 30#include "AtomHandler.hh"
30#include "ClientPattern.hh" 31#include "ClientPattern.hh"
31 32
@@ -50,7 +51,7 @@ class AutoReloadHelper;
50 * of modular plugin. Doing this should help give an idea of what 51 * of modular plugin. Doing this should help give an idea of what
51 * sort of interface abilities we'll need... 52 * sort of interface abilities we'll need...
52 */ 53 */
53class Remember : public AtomHandler { 54class Remember : public AtomHandler, private FbTk::SignalTracker {
54public: 55public:
55 /** 56 /**
56 * holds which attributes to remember 57 * holds which attributes to remember
@@ -107,7 +108,6 @@ public:
107 Application* add(WinClient &winclient); 108 Application* add(WinClient &winclient);
108 FluxboxWindow* findGroup(Application *, BScreen &screen); 109 FluxboxWindow* findGroup(Application *, BScreen &screen);
109 110
110 void reconfigure();
111 void checkReload(); 111 void checkReload();
112 void reload(); 112 void reload();
113 void save(); 113 void save();
diff --git a/src/fluxbox.cc b/src/fluxbox.cc
index 33c2623..fb56571 100644
--- a/src/fluxbox.cc
+++ b/src/fluxbox.cc
@@ -1238,7 +1238,6 @@ void Fluxbox::reconfigure() {
1238void Fluxbox::real_reconfigure() { 1238void Fluxbox::real_reconfigure() {
1239 STLUtil::forAll(m_screen_list, mem_fun(&BScreen::reconfigure)); 1239 STLUtil::forAll(m_screen_list, mem_fun(&BScreen::reconfigure));
1240 m_key->reconfigure(); 1240 m_key->reconfigure();
1241 STLUtil::forAll(m_atomhandler, mem_fun(&AtomHandler::reconfigure));
1242} 1241}
1243 1242
1244BScreen *Fluxbox::findScreen(int id) { 1243BScreen *Fluxbox::findScreen(int id) {
diff --git a/src/fluxbox.hh b/src/fluxbox.hh
index c241fb7..f8a27bc 100644
--- a/src/fluxbox.hh
+++ b/src/fluxbox.hh
@@ -121,8 +121,8 @@ public:
121 const std::string &getStyleOverlayFilename() const { return *m_rc_styleoverlayfile; } 121 const std::string &getStyleOverlayFilename() const { return *m_rc_styleoverlayfile; }
122 122
123 const std::string &getMenuFilename() const { return *m_rc_menufile; } 123 const std::string &getMenuFilename() const { return *m_rc_menufile; }
124 const std::string &getAppsFilename() const { return *m_rc_appsfile; }
125 const std::string &getKeysFilename() const { return *m_rc_keyfile; } 124 const std::string &getKeysFilename() const { return *m_rc_keyfile; }
125 FbTk::StringResource &getAppsResource() { return m_rc_appsfile; }
126 int colorsPerChannel() const { return *m_rc_colors_per_channel; } 126 int colorsPerChannel() const { return *m_rc_colors_per_channel; }
127 int getTabsPadding() const { return *m_rc_tabs_padding; } 127 int getTabsPadding() const { return *m_rc_tabs_padding; }
128 128