diff options
author | Pavel Labath <pavelo@centrum.sk> | 2011-07-10 12:55:53 (GMT) |
---|---|---|
committer | Pavel Labath <pavelo@centrum.sk> | 2013-02-17 09:36:39 (GMT) |
commit | 6a701da32042b61a23fdd95c7bdfa84c2fb20e3e (patch) | |
tree | 3ecc5db6eb07541cf1ad9412bb574709d9335615 | |
parent | d418cf3631286c146dd7fae5176eb834dcd69aa4 (diff) | |
download | fluxbox_pavel-6a701da32042b61a23fdd95c7bdfa84c2fb20e3e.zip fluxbox_pavel-6a701da32042b61a23fdd95c7bdfa84c2fb20e3e.tar.bz2 |
Attach a modifiedSig handler to the session.appsFile resource
-rw-r--r-- | src/AtomHandler.hh | 2 | ||||
-rw-r--r-- | src/Remember.cc | 17 | ||||
-rw-r--r-- | src/Remember.hh | 4 | ||||
-rw-r--r-- | src/fluxbox.cc | 1 | ||||
-rw-r--r-- | src/fluxbox.hh | 2 |
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 6364f37..594a8b0 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 | ||
659 | Remember::~Remember() { | 661 | Remember::~Remember() { |
@@ -720,19 +722,12 @@ Application * Remember::add(WinClient &winclient) { | |||
720 | return app; | 722 | return app; |
721 | } | 723 | } |
722 | 724 | ||
723 | |||
724 | |||
725 | |||
726 | void Remember::reconfigure() { | ||
727 | m_reloader->setMainFile(Fluxbox::instance()->getAppsFilename()); | ||
728 | } | ||
729 | |||
730 | void Remember::checkReload() { | 725 | void Remember::checkReload() { |
731 | m_reloader->checkReload(); | 726 | m_reloader->checkReload(); |
732 | } | 727 | } |
733 | 728 | ||
734 | void Remember::reload() { | 729 | void 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 | ||
879 | void Remember::save() { | 874 | void 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 | ||
1068 | bool Remember::isRemembered(WinClient &winclient, Attribute attrib) { | 1063 | bool 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 | */ |
53 | class Remember : public AtomHandler { | 54 | class Remember : public AtomHandler, private FbTk::SignalTracker { |
54 | public: | 55 | public: |
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 99b00ee..7b46123 100644 --- a/src/fluxbox.cc +++ b/src/fluxbox.cc | |||
@@ -1203,7 +1203,6 @@ void Fluxbox::reconfigure() { | |||
1203 | void Fluxbox::real_reconfigure() { | 1203 | void Fluxbox::real_reconfigure() { |
1204 | STLUtil::forAll(m_screen_list, mem_fun(&BScreen::reconfigure)); | 1204 | STLUtil::forAll(m_screen_list, mem_fun(&BScreen::reconfigure)); |
1205 | m_key->reconfigure(); | 1205 | m_key->reconfigure(); |
1206 | STLUtil::forAll(m_atomhandler, mem_fun(&AtomHandler::reconfigure)); | ||
1207 | } | 1206 | } |
1208 | 1207 | ||
1209 | BScreen *Fluxbox::findScreen(int id) { | 1208 | BScreen *Fluxbox::findScreen(int id) { |
diff --git a/src/fluxbox.hh b/src/fluxbox.hh index e433c46..b028363 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 | ||