Convert FbTk::Theme::reconfigSig and friends to the new Signal system I removed the const versions of reconfigSig() in the process since FbTk::Signal has no const methods anyway.
jump to
@@ -43,8 +43,7 @@ GC gc() const { return m_gc.gc(); }
int scale() const { return *m_scale; } // scale factor for inside objects const std::string &name() { return m_name; } - virtual FbTk::Subject &reconfigSig() { return FbTk::Theme::reconfigSig(); } - virtual const FbTk::Subject &reconfigSig() const { return FbTk::Theme::reconfigSig(); } + virtual FbTk::Signal<void> &reconfigSig() { return FbTk::Theme::reconfigSig(); } virtual ButtonTheme &operator *() { return *this; } virtual const ButtonTheme &operator *() const { return *this; }
@@ -25,6 +25,7 @@
#include "FbMenu.hh" #include "FbTk/Signal.hh" +#include "FbTk/Subject.hh" class BScreen; class FluxboxWindow;
@@ -28,6 +28,7 @@ #include "FbTk/CommandParser.hh"
#include "CommandDialog.hh" #include "fluxbox.hh" +#include "FbTk/MemFun.hh" #include "FbTk/SimpleCommand.hh" #include "FbTk/ImageControl.hh" #include "FbTk/TextUtils.hh"@@ -168,7 +169,7 @@ m_timeformat(screen.resourceManager(), std::string("%k:%M"),
screen.name() + ".strftimeFormat", screen.altName() + ".StrftimeFormat"), m_stringconvertor(FbTk::StringConvertor::ToFbString) { // attach signals - theme.reconfigSig().attach(this); + m_tracker.join(theme.reconfigSig(), FbTk::MemFun(*this, &ClockTool::themeReconfigured)); std::string time_locale = setlocale(LC_TIME, NULL); size_t pos = time_locale.find('.');@@ -197,7 +198,7 @@ FbTk::RefCount<FbTk::Command<void> > editformat_cmd(new EditClockFormatCmd());
menu.insert(_FB_XTEXT(Toolbar, ClockEditFormat, "Edit Clock Format", "edit Clock Format") , editformat_cmd); - update(0); + themeReconfigured(); } ClockTool::~ClockTool() {@@ -233,10 +234,10 @@ }
void ClockTool::setTimeFormat(const std::string &format) { *m_timeformat = format; - update(0); + themeReconfigured(); } -void ClockTool::update(FbTk::Subject *subj) { +void ClockTool::themeReconfigured() { updateTime(); // + 2 to make the entire text fit inside@@ -316,7 +317,7 @@ // Just change things that affect the size
void ClockTool::updateSizing() { m_button.setBorderWidth(m_theme->border().width()); // resizes if new timeformat - update(0); + themeReconfigured(); } void ClockTool::reRender() {
@@ -26,8 +26,8 @@
#include "ToolbarItem.hh" +#include "FbTk/Signal.hh" #include "FbTk/TextButton.hh" -#include "FbTk/Observer.hh" #include "FbTk/Resource.hh" #include "FbTk/Timer.hh" #include "FbTk/FbString.hh"@@ -37,12 +37,11 @@ class BScreen;
namespace FbTk { class ImageControl; -class Subject; class Menu; template <class T> class ThemeProxy; } -class ClockTool:public ToolbarItem, public FbTk::Observer { +class ClockTool:public ToolbarItem { public: ClockTool(const FbTk::FbWindow &parent, FbTk::ThemeProxy<ToolTheme> &theme, BScreen &screen, FbTk::Menu &menu);@@ -68,7 +67,7 @@ void parentMoved() { m_button.parentMoved(); }
private: void updateTime(); - void update(FbTk::Subject *subj); + void themeReconfigured(); void renderTheme(int alpha); void reRender(); void updateSizing();@@ -83,6 +82,8 @@
FbTk::Resource<std::string> m_timeformat; FbTk::StringConvertor m_stringconvertor; + + FbTk::SignalTracker m_tracker; }; #endif // CLOCKTOOL_HH
@@ -36,6 +36,7 @@
#include "MenuItem.hh" #include "MenuSeparator.hh" #include "ImageControl.hh" +#include "MemFun.hh" #include "MenuTheme.hh" #include "App.hh" #include "EventManager.hh"@@ -121,7 +122,7 @@ m_hide_timer.setCommand(hide_cmd);
m_hide_timer.fireOnce(true); // make sure we get updated when the theme is reloaded - tm.reconfigSig().attach(this); + m_tracker.join(tm.reconfigSig(), MemFun(*this, &Menu::themeReconfigured)); m_title_vis = true;@@ -1243,7 +1244,6 @@ (*it)->updateTheme(theme());
} reconfigure(); } - void Menu::setScreen(int x, int y, int w, int h) { m_screen_x = x;
@@ -195,6 +195,7 @@ void openSubmenu();
void closeMenu(); void startHide(); void stopHide(); + void themeReconfigured() { update(NULL); } FbTk::ThemeProxy<MenuTheme> &m_theme; Menu *m_parent;@@ -261,6 +262,8 @@ static Menu *s_focused; ///< holds current input focused menu, so one can determine if a menu is focused
bool m_need_update; Timer m_submenu_timer; Timer m_hide_timer; + + SignalTracker m_tracker; }; } // end namespace FbTk
@@ -130,8 +130,7 @@ if (is_imagecached)
m_hl_selected_pixmap->pixmap().dontFree(); } - virtual Subject &reconfigSig() { return Theme::reconfigSig(); } - virtual const Subject &reconfigSig() const { return Theme::reconfigSig(); } + virtual Signal<void> &reconfigSig() { return Theme::reconfigSig(); } virtual MenuTheme &operator *() { return *this; } virtual const MenuTheme &operator *() const { return *this; }
@@ -56,7 +56,7 @@ // send reconfiguration signal to theme and listeners
ThemeManager::ThemeList::iterator it = tmlist.begin(); ThemeManager::ThemeList::iterator it_end = tmlist.end(); for (; it != it_end; ++it) { - (*it)->reconfigSig().notify(); + (*it)->reconfigSig().emit(); } }
@@ -26,8 +26,8 @@
#ifndef FBTK_THEME_HH #define FBTK_THEME_HH +#include "Signal.hh" #include "XrmDatabaseHelper.hh" -#include "Subject.hh" #include <string> #include <list>@@ -107,15 +107,13 @@ /// remove ThemeItem
template <typename T> void remove(ThemeItem<T> &item); virtual bool fallback(ThemeItem_base &) { return false; } - FbTk::Subject &reconfigSig() { return m_reconfig_sig; } - const FbTk::Subject &reconfigSig() const { return m_reconfig_sig; } - + Signal<void> &reconfigSig() { return m_reconfig_sig; } private: const int m_screen_num; ItemList m_themeitems; - FbTk::Subject m_reconfig_sig; + Signal<void> m_reconfig_sig; }; /// Proxy interface for themes, so they can be substituted dynamically@@ -124,8 +122,7 @@ class ThemeProxy {
public: virtual ~ThemeProxy() { } - virtual Subject &reconfigSig() = 0; - virtual const Subject &reconfigSig() const = 0; + virtual Signal<void> &reconfigSig() = 0; virtual BaseTheme &operator *() = 0; virtual const BaseTheme &operator *() const = 0;
@@ -79,8 +79,7 @@ void setAlpha(int alpha) { m_alpha = alpha; }
IconbarTheme &iconbarTheme() { return m_iconbar_theme; } - virtual FbTk::Subject &reconfigSig() { return FbTk::Theme::reconfigSig(); } - virtual const FbTk::Subject &reconfigSig() const { return FbTk::Theme::reconfigSig(); } + virtual FbTk::Signal<void> &reconfigSig() { return FbTk::Theme::reconfigSig(); } virtual FbWinFrameTheme &operator *() { return *this; } virtual const FbWinFrameTheme &operator *() const { return *this; }
@@ -34,12 +34,15 @@ public:
FocusableTheme(Focusable &win, FbTk::ThemeProxy<BaseTheme> &focused, FbTk::ThemeProxy<BaseTheme> &unfocused): m_win(win), m_focused_theme(focused), m_unfocused_theme(unfocused) { - // relay focus signal to reconfig signal - FbTk::relaySignal(m_signals, m_win.focusSig(), m_reconfig_sig); + + m_signals.join(m_win.focusSig(), + FbTk::MemFunIgnoreArgs(m_reconfig_sig, &FbTk::Signal<void>::emit)); m_win.attentionSig().attach(this); - m_focused_theme.reconfigSig().attach(this); - m_unfocused_theme.reconfigSig().attach(this); + m_signals.join(m_focused_theme.reconfigSig(), + FbTk::MemFun(m_reconfig_sig, &FbTk::Signal<void>::emit)); + m_signals.join(m_unfocused_theme.reconfigSig(), + FbTk::MemFun(m_reconfig_sig, &FbTk::Signal<void>::emit)); } Focusable &win() { return m_win; }@@ -51,8 +54,7 @@
FbTk::ThemeProxy<BaseTheme> &unfocusedTheme() { return m_unfocused_theme; } const FbTk::ThemeProxy<BaseTheme> &unfocusedTheme() const { return m_unfocused_theme; } - FbTk::Subject &reconfigSig() { return m_reconfig_sig; } - const FbTk::Subject &reconfigSig() const { return m_reconfig_sig; } + FbTk::Signal<void> &reconfigSig() { return m_reconfig_sig; } virtual BaseTheme &operator *() { return (m_win.isFocused() || m_win.getAttentionState()) ?@@ -64,11 +66,11 @@ *m_focused_theme : *m_unfocused_theme;
} private: - void update(FbTk::Subject *subj) { m_reconfig_sig.notify(); } + void update(FbTk::Subject *subj) { m_reconfig_sig.emit(); } Focusable &m_win; FbTk::ThemeProxy<BaseTheme> &m_focused_theme, &m_unfocused_theme; - FbTk::Subject m_reconfig_sig; + FbTk::Signal<void> m_reconfig_sig; FbTk::SignalTracker m_signals; };
@@ -21,6 +21,7 @@ // DEALINGS IN THE SOFTWARE.
#include "GenericTool.hh" #include "FbTk/FbWindow.hh" +#include "FbTk/MemFun.hh" #include "ToolTheme.hh" #include <string>@@ -31,7 +32,7 @@ ToolbarItem(type),
m_window(new_window), m_theme(theme) { - theme.reconfigSig().attach(this); + m_tracker.join(theme.reconfigSig(), FbTk::MemFun(*this, &GenericTool::themeReconfigured)); if (new_window == 0) throw std::string("GenericTool: Error! Tried to create a tool with window = 0");@@ -80,7 +81,7 @@ m_window->setAlpha(alpha);
m_window->clear(); } -void GenericTool::update(FbTk::Subject *subj) { +void GenericTool::themeReconfigured() { m_window->clear(); }
@@ -25,7 +25,7 @@
#include "ToolbarItem.hh" #include "FbTk/NotCopyable.hh" -#include "FbTk/Observer.hh" +#include "FbTk/Signal.hh" #include <memory>@@ -37,7 +37,7 @@ template <class T> class ThemeProxy;
} /// helper class for simple tools, i.e buttons etc -class GenericTool: public ToolbarItem, public FbTk::Observer, private FbTk::NotCopyable { +class GenericTool: public ToolbarItem, private FbTk::NotCopyable { public: GenericTool(FbTk::FbWindow *new_window, ToolbarItem::Type type, FbTk::ThemeProxy<ToolTheme> &theme);@@ -63,10 +63,11 @@ protected:
virtual void renderTheme(int alpha); private: - void update(FbTk::Subject *subj); + void themeReconfigured(); std::auto_ptr<FbTk::FbWindow> m_window; FbTk::ThemeProxy<ToolTheme> &m_theme; + FbTk::SignalTracker m_tracker; }; #endif // GENERICTOOL_HH
@@ -41,8 +41,7 @@ const FbTk::BorderTheme &border() const { return m_border; }
const FbTk::Texture &texture() const { return *m_texture; } const FbTk::Texture &emptyTexture() const { return *m_empty_texture; } - virtual FbTk::Subject &reconfigSig() { return FbTk::Theme::reconfigSig(); } - virtual const FbTk::Subject &reconfigSig() const { return FbTk::Theme::reconfigSig(); } + virtual FbTk::Signal<void> &reconfigSig() { return FbTk::Theme::reconfigSig(); } virtual IconbarTheme &operator *() { return *this; } virtual const IconbarTheme &operator *() const { return *this; }
@@ -291,10 +291,12 @@ // add iconbar menu to toolbar menu
menu.insert(m_menu.label().logical(), &m_menu); // setup signals - theme.reconfigSig().attach(this); - focused_theme.reconfigSig().attach(this); - unfocused_theme.reconfigSig().attach(this); - setMode(*m_rc_mode); + m_tracker.join(theme.reconfigSig(), FbTk::MemFun(*this, &IconbarTool::themeReconfigured)); + m_tracker.join(focused_theme.reconfigSig(), + FbTk::MemFun(*this, &IconbarTool::themeReconfigured)); + m_tracker.join(unfocused_theme.reconfigSig(), + FbTk::MemFun(*this, &IconbarTool::themeReconfigured)); + themeReconfigured(); } IconbarTool::~IconbarTool() {@@ -383,6 +385,10 @@ unsigned int IconbarTool::borderWidth() const {
return m_icon_container.borderWidth(); } +void IconbarTool::themeReconfigured() { + setMode(*m_rc_mode); +} + void IconbarTool::update(FbTk::Subject *subj) { // ignore updates if we're shutting down if (m_screen.isShuttingdown()) {@@ -395,13 +401,6 @@ m_icon_container.setAlignment(*m_rc_alignment);
*m_rc_client_width = FbTk::Util::clamp(*m_rc_client_width, 10, 400); m_icon_container.setMaxSizePerClient(*m_rc_client_width); - - if (subj == &m_focused_theme.reconfigSig() || - subj == &m_unfocused_theme.reconfigSig() || - subj == &m_theme.reconfigSig()) { - setMode(*m_rc_mode); - return; - } // lock graphic update m_icon_container.setUpdateLock(true);
@@ -95,12 +95,15 @@ void reset();
/// add icons to the list void updateList(); + void themeReconfigured(); + BScreen &m_screen; FbTk::Container m_icon_container; IconbarTheme &m_theme; FbTk::ThemeProxy<IconbarTheme> &m_focused_theme, &m_unfocused_theme; FbTk::CachedPixmap m_empty_pm; ///< pixmap for empty container + FbTk::SignalTracker m_tracker; std::auto_ptr<FocusableList> m_winlist; IconMap m_icons;
@@ -48,8 +48,7 @@ void reset() { m_first = true; reconfigTheme(); }
GC opGC() const { return m_opgc.gc(); } - virtual FbTk::Subject &reconfigSig() { return FbTk::Theme::reconfigSig(); } - virtual const FbTk::Subject &reconfigSig() const { return FbTk::Theme::reconfigSig(); } + virtual FbTk::Signal<void> &reconfigSig() { return FbTk::Theme::reconfigSig(); } virtual RootTheme &operator *() { return *this; } virtual const RootTheme &operator *() const { return *this; }
@@ -435,7 +435,8 @@ clampMenuDelay(*resource.menu_delay);
m_menutheme->setDelay(*resource.menu_delay); - focusedWinFrameTheme()->reconfigSig().attach(this);// for geom window + m_tracker.join(focusedWinFrameTheme()->reconfigSig(), + FbTk::MemFun(*this, &BScreen::focusedWinFrameThemeReconfigured)); renderGeomWindow();@@ -749,10 +750,7 @@ else
return doFullMax() ? height() : height() - availableWorkspaceArea(head)->bottom(); } -void BScreen::update(FbTk::Subject *subj) { - // for now we're only listening to the theme sig, so no object check - // if another signal is added later, will need to differentiate here - +void BScreen::focusedWinFrameThemeReconfigured() { renderGeomWindow(); renderPosWindow();
@@ -75,7 +75,6 @@ class Menu;
class ImageControl; class LayerItem; class FbWindow; -class Subject; }@@ -83,8 +82,7 @@ /// Handles screen connection, screen clients and workspaces
/** Create workspaces, handles switching between workspaces and windows */ -class BScreen: public FbTk::EventHandler, public FbTk::Observer, - private FbTk::NotCopyable { +class BScreen: public FbTk::EventHandler, private FbTk::NotCopyable { public: typedef std::list<FluxboxWindow *> Icons;@@ -219,9 +217,6 @@ FbTk::Subject &reconfigureSig() { return m_reconfigure_sig; }
ScreenSignal &resizeSig() { return m_resize_sig; } ScreenSignal &bgChangeSig() { return m_bg_change_sig; } //@} - - /// called when the screen receives a signal from a subject - void update(FbTk::Subject *subj); void propertyNotify(Atom atom); void keyPressEvent(XKeyEvent &ke);@@ -476,9 +471,11 @@ private:
void setupConfigmenu(FbTk::Menu &menu); void renderGeomWindow(); void renderPosWindow(); + void focusedWinFrameThemeReconfigured(); const Strut* availableWorkspaceArea(int head) const; + FbTk::SignalTracker m_tracker; ScreenSubject m_reconfigure_sig; ///< reconfigure signal
@@ -263,13 +263,13 @@
_FB_USES_NLS; // attach to theme and root window change signal - theme().reconfigSig().attach(this); + join(theme().reconfigSig(), FbTk::MemFun(*this, &Slit::reconfigure)); join(scr.resizeSig(), FbTk::MemFun(*this, &Slit::screenSizeChanged)); join(scr.bgChangeSig(), - FbTk::MemFun(*this, &Slit::updateForScreen)); + FbTk::MemFunIgnoreArgs(*this, &Slit::reconfigure)); scr.reconfigureSig().attach(this); // if alpha changed (we disablethis signal when we get theme change sig)@@ -1042,12 +1042,8 @@ m_xineramaheadmenu->reloadHeads();
#endif // XINERAMA } -void Slit::updateForScreen(BScreen &screen) { - reconfigure(); -} - void Slit::update(FbTk::Subject*) { - updateForScreen(screen()); + reconfigure(); } void Slit::clearWindow() {
@@ -134,7 +134,6 @@ SlitClients &clients() { return m_client_list; }
private: /// Called when screen has changed void screenSizeChanged(BScreen &screen); - void updateForScreen(BScreen &screen); void updateAlpha(); void clearWindow();
@@ -38,8 +38,7 @@ const FbTk::Color &borderColor() const { return *m_border_color; }
int borderWidth() const { return *m_border_width; } int bevelWidth() const { return *m_bevel_width; } - virtual FbTk::Subject &reconfigSig() { return FbTk::Theme::reconfigSig(); } - virtual const FbTk::Subject &reconfigSig() const { return FbTk::Theme::reconfigSig(); } + virtual FbTk::Signal<void> &reconfigSig() { return FbTk::Theme::reconfigSig(); } virtual SlitTheme &operator *() { return *this; } virtual const SlitTheme &operator *() const { return *this; }
@@ -25,7 +25,6 @@ #include "FbTk/EventManager.hh"
#include "FbTk/ImageControl.hh" #include "FbTk/TextUtils.hh" #include "FbTk/MemFun.hh" -#include "FbTk/SimpleObserver.hh" #include "AtomHandler.hh" #include "fluxbox.hh"@@ -167,11 +166,10 @@
FbTk::EventManager::instance()->add(*this, m_window); FbTk::EventManager::instance()->add(*this, m_selection_owner); // setup signals - m_observer.reset(makeObserver(*this, &SystemTray::update)); - m_theme->reconfigSig().attach(m_observer.get()); + join(m_theme->reconfigSig(), FbTk::MemFun(*this, &SystemTray::update)); join(screen.bgChangeSig(), - FbTk::MemFun(*this, &SystemTray::updateForScreen)); + FbTk::MemFunIgnoreArgs(*this, &SystemTray::update)); Fluxbox* fluxbox = Fluxbox::instance();
@@ -40,7 +40,6 @@ class AtomHandler;
namespace FbTk { template <class T> class ThemeProxy; -class Observer; } class SystemTray: public ToolbarItem, public FbTk::EventHandler,@@ -89,10 +88,6 @@
static Atom getXEmbedInfoAtom(); private: - /// Called when an update for a screen is needed. - void updateForScreen(BScreen &screen) { - update(); - } void update(); typedef std::list<TrayWindow *> ClientList;@@ -116,7 +111,6 @@
// gaim/pidgin seems to barf if the selection is not an independent window. // I suspect it's an interacton with parent relationship and gdk window caching. FbTk::FbWindow m_selection_owner; - std::auto_ptr<FbTk::Observer> m_observer; }; #endif // SYSTEMTRAY_HH
@@ -23,7 +23,6 @@
#ifndef TOOLTHEME_HH #define TOOLTHEME_HH - #include "FbTk/TextTheme.hh" #include "FbTk/BorderTheme.hh" #include "FbTk/Texture.hh"@@ -44,8 +43,7 @@ const FbTk::BorderTheme &border() const { return m_border; }
int alpha() const { return m_alpha; } void setAlpha(int alpha) { m_alpha = alpha; } - virtual FbTk::Subject &reconfigSig() { return FbTk::Theme::reconfigSig(); } - virtual const FbTk::Subject &reconfigSig() const { return FbTk::Theme::reconfigSig(); } + virtual FbTk::Signal<void> &reconfigSig() { return FbTk::Theme::reconfigSig(); } virtual ToolTheme &operator *() { return *this; } virtual const ToolTheme &operator *() const { return *this; }
@@ -231,8 +231,8 @@ // NOTE: first subject is always the rearrangeItem !
m_observers.push_back(makeObserver(*this, &Toolbar::rearrangeItems)); // we need to get notified when the theme is reloaded m_observers.push_back(makeObserver(*this, &Toolbar::reconfigure)); - m_theme.reconfigSig().attach(m_observers.back()); screen().reconfigureSig().attach(m_observers.back()); // get this on antialias change + m_signal_tracker.join(m_theme.reconfigSig(), FbTk::MemFun(*this, &Toolbar::reconfigure)); // listen to screen size changes m_signal_tracker.join(screen().resizeSig(),
@@ -44,8 +44,7 @@ bool shape() const { return *m_shape; }
int height() const { return *m_height; } int buttonSize() const { return *m_button_size; } - virtual FbTk::Subject &reconfigSig() { return FbTk::Theme::reconfigSig(); } - virtual const FbTk::Subject &reconfigSig() const { return FbTk::Theme::reconfigSig(); } + virtual FbTk::Signal<void> &reconfigSig() { return FbTk::Theme::reconfigSig(); } virtual ToolbarTheme &operator *() { return *this; } virtual const ToolbarTheme &operator *() const { return *this; }
@@ -44,7 +44,8 @@ m_type(buttontype), m_listen_to(listen_to),
m_theme(theme), m_pressed_theme(pressed), m_icon_pixmap(0), m_icon_mask(0), overrode_bg(false), overrode_pressed(false) { - theme.reconfigSig().attach(this); + + join(theme.reconfigSig(), FbTk::MemFun(*this, &WinButton::updateAll)); if (buttontype == MENUICON) update(0);
@@ -65,8 +65,7 @@
FbTk::PixmapWithMask &titlePixmap() { return *m_title_pm; } const FbTk::PixmapWithMask &titlePixmap() const { return *m_title_pm; } - virtual FbTk::Subject &reconfigSig() { return FbTk::Theme::reconfigSig(); } - virtual const FbTk::Subject &reconfigSig() const { return FbTk::Theme::reconfigSig(); } + virtual FbTk::Signal<void> &reconfigSig() { return FbTk::Theme::reconfigSig(); } virtual WinButtonTheme &operator *() { return *this; } virtual const WinButtonTheme &operator *() const { return *this; }
@@ -291,7 +291,7 @@ m_old_layernum(0),
m_parent(client.screen().rootWindow()), m_resize_corner(RIGHTBOTTOM) { - m_theme.reconfigSig().attach(this); + join(m_theme.reconfigSig(), FbTk::MemFun(*this, &FluxboxWindow::themeReconfigured)); m_frame.frameExtentSig().attach(this); init();@@ -2682,13 +2682,15 @@ titleSig().emit(title, *this);
} void FluxboxWindow::update(FbTk::Subject *subj) { - if (subj == &m_theme.reconfigSig()) { - frame().applyDecorations(); - sendConfigureNotify(); - } else if (m_initialized && subj == &m_frame.frameExtentSig()) { + if (m_initialized && subj == &m_frame.frameExtentSig()) { Fluxbox::instance()->updateFrameExtents(*this); sendConfigureNotify(); } +} + +void FluxboxWindow::themeReconfigured() { + frame().applyDecorations(); + sendConfigureNotify(); } void FluxboxWindow::workspaceAreaChanged(BScreen &screen) {
@@ -492,6 +492,8 @@ void init();
void updateClientLeftWindow(); void grabButtons(); + void themeReconfigured(); + /** * Calculates insertition position in the list by * using pixel position x and y.
@@ -49,8 +49,7 @@
return ToolTheme::fallback(item); } - virtual FbTk::Subject &reconfigSig() { return FbTk::Theme::reconfigSig(); } - virtual const FbTk::Subject &reconfigSig() const { return FbTk::Theme::reconfigSig(); } + virtual FbTk::Signal<void> &reconfigSig() { return FbTk::Theme::reconfigSig(); } virtual WorkspaceNameTheme &operator *() { return *this; } virtual const WorkspaceNameTheme &operator *() const { return *this; }
@@ -44,11 +44,11 @@ m_button.setText(m_screen.currentWorkspace()->name());
// setup signals join(screen.currentWorkspaceSig(), - FbTk::MemFun(*this, &WorkspaceNameTool::updateForScreen)); + FbTk::MemFunIgnoreArgs(*this, &WorkspaceNameTool::update)); join(screen.workspaceNamesSig(), - FbTk::MemFun(*this, &WorkspaceNameTool::updateForScreen)); + FbTk::MemFunIgnoreArgs(*this, &WorkspaceNameTool::update)); - theme.reconfigSig().attach(this); + join(theme.reconfigSig(), FbTk::MemFun(*this, &WorkspaceNameTool::update)); } WorkspaceNameTool::~WorkspaceNameTool() {@@ -70,12 +70,8 @@ unsigned int width, unsigned int height) {
m_button.moveResize(x, y, width, height); } -void WorkspaceNameTool::update(FbTk::Subject *subj) { - updateForScreen(m_screen); -} - -void WorkspaceNameTool::updateForScreen(BScreen &screen) { - m_button.setText(screen.currentWorkspace()->name()); +void WorkspaceNameTool::update() { + m_button.setText(m_screen.currentWorkspace()->name()); if (m_button.width() != width()) { resize(width(), height()); resizeSig().notify();
@@ -26,7 +26,6 @@
#include "ToolbarItem.hh" #include "FbTk/TextButton.hh" -#include "FbTk/Observer.hh" #include "FbTk/Signal.hh" class BScreen;@@ -36,8 +35,7 @@ namespace FbTk {
template <class T> class ThemeProxy; } -class WorkspaceNameTool: public ToolbarItem, public FbTk::Observer, - private FbTk::SignalTracker { +class WorkspaceNameTool: public ToolbarItem, private FbTk::SignalTracker { public: WorkspaceNameTool(const FbTk::FbWindow &parent, FbTk::ThemeProxy<ToolTheme> &theme, BScreen &screen); virtual ~WorkspaceNameTool();@@ -53,7 +51,6 @@ unsigned int width() const;
unsigned int height() const; unsigned int borderWidth() const; - void update(FbTk::Subject *subj); FbTk::Button &button() { return m_button; } const FbTk::Button &button() const { return m_button; } void setOrientation(FbTk::Orientation orient);@@ -61,8 +58,7 @@
void parentMoved() { m_button.parentMoved(); } private: - /// Called when workspace changed on \c screen - void updateForScreen(BScreen &screen); + void update(); void renderTheme(int alpha); void reRender();