From 22713a05e1f0b25cdf3a34f6cf7eb1f3c4250ffe Mon Sep 17 00:00:00 2001 From: Pavel Labath Date: Sun, 10 Jul 2011 14:55:53 +0200 Subject: Attach a modifiedSig handler to the session.appsFile resource --- src/AtomHandler.hh | 2 -- src/Remember.cc | 17 ++++++----------- src/Remember.hh | 4 ++-- src/fluxbox.cc | 1 - 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: virtual bool propertyNotify(WinClient &winclient, Atom the_property) = 0; - virtual void reconfigure() {} - /// should this object be updated or not? bool update() const { return m_update; } diff --git a/src/Remember.cc b/src/Remember.cc index c010d07..544fed8 100644 --- a/src/Remember.cc +++ b/src/Remember.cc @@ -635,7 +635,9 @@ Remember::Remember(): enableUpdate(); m_reloader->setReloadCmd(FbTk::RefCount >(new FbTk::SimpleCommand(*this, &Remember::reload))); - reconfigure(); + m_reloader->setMainFile(*Fluxbox::instance()->getAppsResource()); + join(Fluxbox::instance()->getAppsResource().modifiedSig(), + FbTk::MemFun(*m_reloader, &FbTk::AutoReloadHelper::setMainFile)); } Remember::~Remember() { @@ -702,19 +704,12 @@ Application * Remember::add(WinClient &winclient) { return app; } - - - -void Remember::reconfigure() { - m_reloader->setMainFile(Fluxbox::instance()->getAppsFilename()); -} - void Remember::checkReload() { m_reloader->checkReload(); } void Remember::reload() { - string apps_string = FbTk::StringUtil::expandFilename(Fluxbox::instance()->getAppsFilename()); + const string &apps_string = FbTk::StringUtil::expandFilename(*Fluxbox::instance()->getAppsResource()); fbdbg<<"("<<__FUNCTION__<<"): Loading apps file ["<getAppsFilename()); + const string &apps_string = FbTk::StringUtil::expandFilename(*Fluxbox::instance()->getAppsResource()); fbdbg<<"("<<__FUNCTION__<<"): Saving apps file ["<addFile(Fluxbox::instance()->getAppsFilename()); + m_reloader->addFile(*Fluxbox::instance()->getAppsResource()); } 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 @@ #ifndef REMEMBER_HH #define REMEMBER_HH +#include "FbTk/Signal.hh" #include "AtomHandler.hh" #include "ClientPattern.hh" @@ -50,7 +51,7 @@ class AutoReloadHelper; * of modular plugin. Doing this should help give an idea of what * sort of interface abilities we'll need... */ -class Remember : public AtomHandler { +class Remember : public AtomHandler, private FbTk::SignalTracker { public: /** * holds which attributes to remember @@ -107,7 +108,6 @@ public: Application* add(WinClient &winclient); FluxboxWindow* findGroup(Application *, BScreen &screen); - void reconfigure(); void checkReload(); void reload(); void save(); diff --git a/src/fluxbox.cc b/src/fluxbox.cc index f4d7c84..1cf97a4 100644 --- a/src/fluxbox.cc +++ b/src/fluxbox.cc @@ -1194,7 +1194,6 @@ void Fluxbox::reconfigure() { void Fluxbox::real_reconfigure() { STLUtil::forAll(m_screen_list, mem_fun(&BScreen::reconfigure)); m_key->reconfigure(); - STLUtil::forAll(m_atomhandler, mem_fun(&AtomHandler::reconfigure)); } BScreen *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: const std::string &getStyleOverlayFilename() const { return *m_rc_styleoverlayfile; } const std::string &getMenuFilename() const { return *m_rc_menufile; } - const std::string &getAppsFilename() const { return *m_rc_appsfile; } const std::string &getKeysFilename() const { return *m_rc_keyfile; } + FbTk::StringResource &getAppsResource() { return m_rc_appsfile; } int colorsPerChannel() const { return *m_rc_colors_per_channel; } int getTabsPadding() const { return *m_rc_tabs_padding; } -- cgit v0.11.2