aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPavel Labath <pavelo@centrum.sk>2011-04-29 08:52:28 (GMT)
committerPavel Labath <pavelo@centrum.sk>2011-05-10 11:00:45 (GMT)
commitf7d7dfd2a8047207dbe90bc77592c25acf4ca15c (patch)
tree46eb8596d15fb0450f07e3e5d58e2c5449c4c020
parent54230c9a4474baf4f1c56773992212093e222349 (diff)
downloadfluxbox_pavel-f7d7dfd2a8047207dbe90bc77592c25acf4ca15c.zip
fluxbox_pavel-f7d7dfd2a8047207dbe90bc77592c25acf4ca15c.tar.bz2
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.
-rw-r--r--src/ButtonTheme.hh3
-rw-r--r--src/ClientMenu.hh1
-rw-r--r--src/ClockTool.cc11
-rw-r--r--src/ClockTool.hh9
-rw-r--r--src/FbTk/Menu.cc4
-rw-r--r--src/FbTk/Menu.hh3
-rw-r--r--src/FbTk/MenuTheme.hh3
-rw-r--r--src/FbTk/Theme.cc2
-rw-r--r--src/FbTk/Theme.hh11
-rw-r--r--src/FbWinFrameTheme.hh3
-rw-r--r--src/FocusableTheme.hh18
-rw-r--r--src/GenericTool.cc5
-rw-r--r--src/GenericTool.hh7
-rw-r--r--src/IconbarTheme.hh3
-rw-r--r--src/IconbarTool.cc21
-rw-r--r--src/IconbarTool.hh3
-rw-r--r--src/RootTheme.hh3
-rw-r--r--src/Screen.cc8
-rw-r--r--src/Screen.hh9
-rw-r--r--src/Slit.cc10
-rw-r--r--src/Slit.hh1
-rw-r--r--src/SlitTheme.hh3
-rw-r--r--src/SystemTray.cc6
-rw-r--r--src/SystemTray.hh6
-rw-r--r--src/ToolTheme.hh4
-rw-r--r--src/Toolbar.cc2
-rw-r--r--src/ToolbarTheme.hh3
-rw-r--r--src/WinButton.cc3
-rw-r--r--src/WinButtonTheme.hh3
-rw-r--r--src/Window.cc12
-rw-r--r--src/Window.hh2
-rw-r--r--src/WorkspaceNameTheme.hh3
-rw-r--r--src/WorkspaceNameTool.cc14
-rw-r--r--src/WorkspaceNameTool.hh8
34 files changed, 92 insertions, 115 deletions
diff --git a/src/ButtonTheme.hh b/src/ButtonTheme.hh
index 95a4e32..77cc159 100644
--- a/src/ButtonTheme.hh
+++ b/src/ButtonTheme.hh
@@ -43,8 +43,7 @@ public:
43 int scale() const { return *m_scale; } // scale factor for inside objects 43 int scale() const { return *m_scale; } // scale factor for inside objects
44 const std::string &name() { return m_name; } 44 const std::string &name() { return m_name; }
45 45
46 virtual FbTk::Subject &reconfigSig() { return FbTk::Theme::reconfigSig(); } 46 virtual FbTk::Signal<void> &reconfigSig() { return FbTk::Theme::reconfigSig(); }
47 virtual const FbTk::Subject &reconfigSig() const { return FbTk::Theme::reconfigSig(); }
48 47
49 virtual ButtonTheme &operator *() { return *this; } 48 virtual ButtonTheme &operator *() { return *this; }
50 virtual const ButtonTheme &operator *() const { return *this; } 49 virtual const ButtonTheme &operator *() const { return *this; }
diff --git a/src/ClientMenu.hh b/src/ClientMenu.hh
index 4b5cedb..6b59e71 100644
--- a/src/ClientMenu.hh
+++ b/src/ClientMenu.hh
@@ -25,6 +25,7 @@
25#include "FbMenu.hh" 25#include "FbMenu.hh"
26 26
27#include "FbTk/Signal.hh" 27#include "FbTk/Signal.hh"
28#include "FbTk/Subject.hh"
28 29
29class BScreen; 30class BScreen;
30class FluxboxWindow; 31class FluxboxWindow;
diff --git a/src/ClockTool.cc b/src/ClockTool.cc
index 257058f..6642985 100644
--- a/src/ClockTool.cc
+++ b/src/ClockTool.cc
@@ -28,6 +28,7 @@
28#include "CommandDialog.hh" 28#include "CommandDialog.hh"
29#include "fluxbox.hh" 29#include "fluxbox.hh"
30 30
31#include "FbTk/MemFun.hh"
31#include "FbTk/SimpleCommand.hh" 32#include "FbTk/SimpleCommand.hh"
32#include "FbTk/ImageControl.hh" 33#include "FbTk/ImageControl.hh"
33#include "FbTk/TextUtils.hh" 34#include "FbTk/TextUtils.hh"
@@ -168,7 +169,7 @@ ClockTool::ClockTool(const FbTk::FbWindow &parent,
168 screen.name() + ".strftimeFormat", screen.altName() + ".StrftimeFormat"), 169 screen.name() + ".strftimeFormat", screen.altName() + ".StrftimeFormat"),
169 m_stringconvertor(FbTk::StringConvertor::ToFbString) { 170 m_stringconvertor(FbTk::StringConvertor::ToFbString) {
170 // attach signals 171 // attach signals
171 theme.reconfigSig().attach(this); 172 m_tracker.join(theme.reconfigSig(), FbTk::MemFun(*this, &ClockTool::themeReconfigured));
172 173
173 std::string time_locale = setlocale(LC_TIME, NULL); 174 std::string time_locale = setlocale(LC_TIME, NULL);
174 size_t pos = time_locale.find('.'); 175 size_t pos = time_locale.find('.');
@@ -197,7 +198,7 @@ ClockTool::ClockTool(const FbTk::FbWindow &parent,
197 menu.insert(_FB_XTEXT(Toolbar, ClockEditFormat, "Edit Clock Format", "edit Clock Format") , editformat_cmd); 198 menu.insert(_FB_XTEXT(Toolbar, ClockEditFormat, "Edit Clock Format", "edit Clock Format") , editformat_cmd);
198 199
199 200
200 update(0); 201 themeReconfigured();
201} 202}
202 203
203ClockTool::~ClockTool() { 204ClockTool::~ClockTool() {
@@ -233,10 +234,10 @@ void ClockTool::hide() {
233 234
234void ClockTool::setTimeFormat(const std::string &format) { 235void ClockTool::setTimeFormat(const std::string &format) {
235 *m_timeformat = format; 236 *m_timeformat = format;
236 update(0); 237 themeReconfigured();
237} 238}
238 239
239void ClockTool::update(FbTk::Subject *subj) { 240void ClockTool::themeReconfigured() {
240 updateTime(); 241 updateTime();
241 242
242 // + 2 to make the entire text fit inside 243 // + 2 to make the entire text fit inside
@@ -316,7 +317,7 @@ void ClockTool::updateTime() {
316void ClockTool::updateSizing() { 317void ClockTool::updateSizing() {
317 m_button.setBorderWidth(m_theme->border().width()); 318 m_button.setBorderWidth(m_theme->border().width());
318 // resizes if new timeformat 319 // resizes if new timeformat
319 update(0); 320 themeReconfigured();
320} 321}
321 322
322void ClockTool::reRender() { 323void ClockTool::reRender() {
diff --git a/src/ClockTool.hh b/src/ClockTool.hh
index d2b9dca..4f89b36 100644
--- a/src/ClockTool.hh
+++ b/src/ClockTool.hh
@@ -26,8 +26,8 @@
26 26
27#include "ToolbarItem.hh" 27#include "ToolbarItem.hh"
28 28
29#include "FbTk/Signal.hh"
29#include "FbTk/TextButton.hh" 30#include "FbTk/TextButton.hh"
30#include "FbTk/Observer.hh"
31#include "FbTk/Resource.hh" 31#include "FbTk/Resource.hh"
32#include "FbTk/Timer.hh" 32#include "FbTk/Timer.hh"
33#include "FbTk/FbString.hh" 33#include "FbTk/FbString.hh"
@@ -37,12 +37,11 @@ class BScreen;
37 37
38namespace FbTk { 38namespace FbTk {
39class ImageControl; 39class ImageControl;
40class Subject;
41class Menu; 40class Menu;
42template <class T> class ThemeProxy; 41template <class T> class ThemeProxy;
43} 42}
44 43
45class ClockTool:public ToolbarItem, public FbTk::Observer { 44class ClockTool:public ToolbarItem {
46public: 45public:
47 ClockTool(const FbTk::FbWindow &parent, FbTk::ThemeProxy<ToolTheme> &theme, 46 ClockTool(const FbTk::FbWindow &parent, FbTk::ThemeProxy<ToolTheme> &theme,
48 BScreen &screen, FbTk::Menu &menu); 47 BScreen &screen, FbTk::Menu &menu);
@@ -68,7 +67,7 @@ public:
68 67
69private: 68private:
70 void updateTime(); 69 void updateTime();
71 void update(FbTk::Subject *subj); 70 void themeReconfigured();
72 void renderTheme(int alpha); 71 void renderTheme(int alpha);
73 void reRender(); 72 void reRender();
74 void updateSizing(); 73 void updateSizing();
@@ -83,6 +82,8 @@ private:
83 FbTk::Resource<std::string> m_timeformat; 82 FbTk::Resource<std::string> m_timeformat;
84 83
85 FbTk::StringConvertor m_stringconvertor; 84 FbTk::StringConvertor m_stringconvertor;
85
86 FbTk::SignalTracker m_tracker;
86}; 87};
87 88
88#endif // CLOCKTOOL_HH 89#endif // CLOCKTOOL_HH
diff --git a/src/FbTk/Menu.cc b/src/FbTk/Menu.cc
index 48636ce..da5760d 100644
--- a/src/FbTk/Menu.cc
+++ b/src/FbTk/Menu.cc
@@ -36,6 +36,7 @@
36#include "MenuItem.hh" 36#include "MenuItem.hh"
37#include "MenuSeparator.hh" 37#include "MenuSeparator.hh"
38#include "ImageControl.hh" 38#include "ImageControl.hh"
39#include "MemFun.hh"
39#include "MenuTheme.hh" 40#include "MenuTheme.hh"
40#include "App.hh" 41#include "App.hh"
41#include "EventManager.hh" 42#include "EventManager.hh"
@@ -121,7 +122,7 @@ Menu::Menu(FbTk::ThemeProxy<MenuTheme> &tm, ImageControl &imgctrl):
121 m_hide_timer.fireOnce(true); 122 m_hide_timer.fireOnce(true);
122 123
123 // make sure we get updated when the theme is reloaded 124 // make sure we get updated when the theme is reloaded
124 tm.reconfigSig().attach(this); 125 m_tracker.join(tm.reconfigSig(), MemFun(*this, &Menu::themeReconfigured));
125 126
126 m_title_vis = true; 127 m_title_vis = true;
127 128
@@ -1244,7 +1245,6 @@ void Menu::update(FbTk::Subject *subj) {
1244 reconfigure(); 1245 reconfigure();
1245} 1246}
1246 1247
1247
1248void Menu::setScreen(int x, int y, int w, int h) { 1248void Menu::setScreen(int x, int y, int w, int h) {
1249 m_screen_x = x; 1249 m_screen_x = x;
1250 m_screen_y = y; 1250 m_screen_y = y;
diff --git a/src/FbTk/Menu.hh b/src/FbTk/Menu.hh
index f3ec820..7b59cf7 100644
--- a/src/FbTk/Menu.hh
+++ b/src/FbTk/Menu.hh
@@ -195,6 +195,7 @@ private:
195 void closeMenu(); 195 void closeMenu();
196 void startHide(); 196 void startHide();
197 void stopHide(); 197 void stopHide();
198 void themeReconfigured() { update(NULL); }
198 199
199 FbTk::ThemeProxy<MenuTheme> &m_theme; 200 FbTk::ThemeProxy<MenuTheme> &m_theme;
200 Menu *m_parent; 201 Menu *m_parent;
@@ -261,6 +262,8 @@ private:
261 bool m_need_update; 262 bool m_need_update;
262 Timer m_submenu_timer; 263 Timer m_submenu_timer;
263 Timer m_hide_timer; 264 Timer m_hide_timer;
265
266 SignalTracker m_tracker;
264}; 267};
265 268
266} // end namespace FbTk 269} // end namespace FbTk
diff --git a/src/FbTk/MenuTheme.hh b/src/FbTk/MenuTheme.hh
index eb19798..b575860 100644
--- a/src/FbTk/MenuTheme.hh
+++ b/src/FbTk/MenuTheme.hh
@@ -130,8 +130,7 @@ public:
130 m_hl_selected_pixmap->pixmap().dontFree(); 130 m_hl_selected_pixmap->pixmap().dontFree();
131 } 131 }
132 132
133 virtual Subject &reconfigSig() { return Theme::reconfigSig(); } 133 virtual Signal<void> &reconfigSig() { return Theme::reconfigSig(); }
134 virtual const Subject &reconfigSig() const { return Theme::reconfigSig(); }
135 134
136 virtual MenuTheme &operator *() { return *this; } 135 virtual MenuTheme &operator *() { return *this; }
137 virtual const MenuTheme &operator *() const { return *this; } 136 virtual const MenuTheme &operator *() const { return *this; }
diff --git a/src/FbTk/Theme.cc b/src/FbTk/Theme.cc
index c92e563..c252275 100644
--- a/src/FbTk/Theme.cc
+++ b/src/FbTk/Theme.cc
@@ -56,7 +56,7 @@ struct LoadThemeHelper {
56 ThemeManager::ThemeList::iterator it = tmlist.begin(); 56 ThemeManager::ThemeList::iterator it = tmlist.begin();
57 ThemeManager::ThemeList::iterator it_end = tmlist.end(); 57 ThemeManager::ThemeList::iterator it_end = tmlist.end();
58 for (; it != it_end; ++it) { 58 for (; it != it_end; ++it) {
59 (*it)->reconfigSig().notify(); 59 (*it)->reconfigSig().emit();
60 } 60 }
61 } 61 }
62 62
diff --git a/src/FbTk/Theme.hh b/src/FbTk/Theme.hh
index c331ba5..c700f9b 100644
--- a/src/FbTk/Theme.hh
+++ b/src/FbTk/Theme.hh
@@ -26,8 +26,8 @@
26#ifndef FBTK_THEME_HH 26#ifndef FBTK_THEME_HH
27#define FBTK_THEME_HH 27#define FBTK_THEME_HH
28 28
29#include "Signal.hh"
29#include "XrmDatabaseHelper.hh" 30#include "XrmDatabaseHelper.hh"
30#include "Subject.hh"
31 31
32#include <string> 32#include <string>
33#include <list> 33#include <list>
@@ -107,15 +107,13 @@ public:
107 template <typename T> 107 template <typename T>
108 void remove(ThemeItem<T> &item); 108 void remove(ThemeItem<T> &item);
109 virtual bool fallback(ThemeItem_base &) { return false; } 109 virtual bool fallback(ThemeItem_base &) { return false; }
110 FbTk::Subject &reconfigSig() { return m_reconfig_sig; } 110 Signal<void> &reconfigSig() { return m_reconfig_sig; }
111 const FbTk::Subject &reconfigSig() const { return m_reconfig_sig; }
112
113 111
114private: 112private:
115 const int m_screen_num; 113 const int m_screen_num;
116 114
117 ItemList m_themeitems; 115 ItemList m_themeitems;
118 FbTk::Subject m_reconfig_sig; 116 Signal<void> m_reconfig_sig;
119}; 117};
120 118
121/// Proxy interface for themes, so they can be substituted dynamically 119/// Proxy interface for themes, so they can be substituted dynamically
@@ -124,8 +122,7 @@ class ThemeProxy {
124public: 122public:
125 virtual ~ThemeProxy() { } 123 virtual ~ThemeProxy() { }
126 124
127 virtual Subject &reconfigSig() = 0; 125 virtual Signal<void> &reconfigSig() = 0;
128 virtual const Subject &reconfigSig() const = 0;
129 126
130 virtual BaseTheme &operator *() = 0; 127 virtual BaseTheme &operator *() = 0;
131 virtual const BaseTheme &operator *() const = 0; 128 virtual const BaseTheme &operator *() const = 0;
diff --git a/src/FbWinFrameTheme.hh b/src/FbWinFrameTheme.hh
index 3c28cbd..613c66a 100644
--- a/src/FbWinFrameTheme.hh
+++ b/src/FbWinFrameTheme.hh
@@ -79,8 +79,7 @@ public:
79 79
80 IconbarTheme &iconbarTheme() { return m_iconbar_theme; } 80 IconbarTheme &iconbarTheme() { return m_iconbar_theme; }
81 81
82 virtual FbTk::Subject &reconfigSig() { return FbTk::Theme::reconfigSig(); } 82 virtual FbTk::Signal<void> &reconfigSig() { return FbTk::Theme::reconfigSig(); }
83 virtual const FbTk::Subject &reconfigSig() const { return FbTk::Theme::reconfigSig(); }
84 83
85 virtual FbWinFrameTheme &operator *() { return *this; } 84 virtual FbWinFrameTheme &operator *() { return *this; }
86 virtual const FbWinFrameTheme &operator *() const { return *this; } 85 virtual const FbWinFrameTheme &operator *() const { return *this; }
diff --git a/src/FocusableTheme.hh b/src/FocusableTheme.hh
index cc14e62..6643b43 100644
--- a/src/FocusableTheme.hh
+++ b/src/FocusableTheme.hh
@@ -34,12 +34,15 @@ public:
34 FocusableTheme(Focusable &win, FbTk::ThemeProxy<BaseTheme> &focused, 34 FocusableTheme(Focusable &win, FbTk::ThemeProxy<BaseTheme> &focused,
35 FbTk::ThemeProxy<BaseTheme> &unfocused): 35 FbTk::ThemeProxy<BaseTheme> &unfocused):
36 m_win(win), m_focused_theme(focused), m_unfocused_theme(unfocused) { 36 m_win(win), m_focused_theme(focused), m_unfocused_theme(unfocused) {
37 // relay focus signal to reconfig signal 37
38 FbTk::relaySignal(m_signals, m_win.focusSig(), m_reconfig_sig); 38 m_signals.join(m_win.focusSig(),
39 FbTk::MemFunIgnoreArgs(m_reconfig_sig, &FbTk::Signal<void>::emit));
39 40
40 m_win.attentionSig().attach(this); 41 m_win.attentionSig().attach(this);
41 m_focused_theme.reconfigSig().attach(this); 42 m_signals.join(m_focused_theme.reconfigSig(),
42 m_unfocused_theme.reconfigSig().attach(this); 43 FbTk::MemFun(m_reconfig_sig, &FbTk::Signal<void>::emit));
44 m_signals.join(m_unfocused_theme.reconfigSig(),
45 FbTk::MemFun(m_reconfig_sig, &FbTk::Signal<void>::emit));
43 } 46 }
44 47
45 Focusable &win() { return m_win; } 48 Focusable &win() { return m_win; }
@@ -51,8 +54,7 @@ public:
51 FbTk::ThemeProxy<BaseTheme> &unfocusedTheme() { return m_unfocused_theme; } 54 FbTk::ThemeProxy<BaseTheme> &unfocusedTheme() { return m_unfocused_theme; }
52 const FbTk::ThemeProxy<BaseTheme> &unfocusedTheme() const { return m_unfocused_theme; } 55 const FbTk::ThemeProxy<BaseTheme> &unfocusedTheme() const { return m_unfocused_theme; }
53 56
54 FbTk::Subject &reconfigSig() { return m_reconfig_sig; } 57 FbTk::Signal<void> &reconfigSig() { return m_reconfig_sig; }
55 const FbTk::Subject &reconfigSig() const { return m_reconfig_sig; }
56 58
57 virtual BaseTheme &operator *() { 59 virtual BaseTheme &operator *() {
58 return (m_win.isFocused() || m_win.getAttentionState()) ? 60 return (m_win.isFocused() || m_win.getAttentionState()) ?
@@ -64,11 +66,11 @@ public:
64 } 66 }
65 67
66private: 68private:
67 void update(FbTk::Subject *subj) { m_reconfig_sig.notify(); } 69 void update(FbTk::Subject *subj) { m_reconfig_sig.emit(); }
68 70
69 Focusable &m_win; 71 Focusable &m_win;
70 FbTk::ThemeProxy<BaseTheme> &m_focused_theme, &m_unfocused_theme; 72 FbTk::ThemeProxy<BaseTheme> &m_focused_theme, &m_unfocused_theme;
71 FbTk::Subject m_reconfig_sig; 73 FbTk::Signal<void> m_reconfig_sig;
72 FbTk::SignalTracker m_signals; 74 FbTk::SignalTracker m_signals;
73}; 75};
74 76
diff --git a/src/GenericTool.cc b/src/GenericTool.cc
index 41388ce..f589f4c 100644
--- a/src/GenericTool.cc
+++ b/src/GenericTool.cc
@@ -21,6 +21,7 @@
21 21
22#include "GenericTool.hh" 22#include "GenericTool.hh"
23#include "FbTk/FbWindow.hh" 23#include "FbTk/FbWindow.hh"
24#include "FbTk/MemFun.hh"
24#include "ToolTheme.hh" 25#include "ToolTheme.hh"
25 26
26#include <string> 27#include <string>
@@ -31,7 +32,7 @@ GenericTool::GenericTool(FbTk::FbWindow *new_window, ToolbarItem::Type type,
31 m_window(new_window), 32 m_window(new_window),
32 m_theme(theme) { 33 m_theme(theme) {
33 34
34 theme.reconfigSig().attach(this); 35 m_tracker.join(theme.reconfigSig(), FbTk::MemFun(*this, &GenericTool::themeReconfigured));
35 36
36 if (new_window == 0) 37 if (new_window == 0)
37 throw std::string("GenericTool: Error! Tried to create a tool with window = 0"); 38 throw std::string("GenericTool: Error! Tried to create a tool with window = 0");
@@ -80,7 +81,7 @@ void GenericTool::renderTheme(int alpha) {
80 m_window->clear(); 81 m_window->clear();
81} 82}
82 83
83void GenericTool::update(FbTk::Subject *subj) { 84void GenericTool::themeReconfigured() {
84 m_window->clear(); 85 m_window->clear();
85} 86}
86 87
diff --git a/src/GenericTool.hh b/src/GenericTool.hh
index 5d7c8d4..72ff462 100644
--- a/src/GenericTool.hh
+++ b/src/GenericTool.hh
@@ -25,7 +25,7 @@
25#include "ToolbarItem.hh" 25#include "ToolbarItem.hh"
26 26
27#include "FbTk/NotCopyable.hh" 27#include "FbTk/NotCopyable.hh"
28#include "FbTk/Observer.hh" 28#include "FbTk/Signal.hh"
29 29
30#include <memory> 30#include <memory>
31 31
@@ -37,7 +37,7 @@ template <class T> class ThemeProxy;
37} 37}
38 38
39/// helper class for simple tools, i.e buttons etc 39/// helper class for simple tools, i.e buttons etc
40class GenericTool: public ToolbarItem, public FbTk::Observer, private FbTk::NotCopyable { 40class GenericTool: public ToolbarItem, private FbTk::NotCopyable {
41public: 41public:
42 GenericTool(FbTk::FbWindow *new_window, ToolbarItem::Type type, 42 GenericTool(FbTk::FbWindow *new_window, ToolbarItem::Type type,
43 FbTk::ThemeProxy<ToolTheme> &theme); 43 FbTk::ThemeProxy<ToolTheme> &theme);
@@ -63,10 +63,11 @@ protected:
63 virtual void renderTheme(int alpha); 63 virtual void renderTheme(int alpha);
64 64
65private: 65private:
66 void update(FbTk::Subject *subj); 66 void themeReconfigured();
67 67
68 std::auto_ptr<FbTk::FbWindow> m_window; 68 std::auto_ptr<FbTk::FbWindow> m_window;
69 FbTk::ThemeProxy<ToolTheme> &m_theme; 69 FbTk::ThemeProxy<ToolTheme> &m_theme;
70 FbTk::SignalTracker m_tracker;
70}; 71};
71 72
72#endif // GENERICTOOL_HH 73#endif // GENERICTOOL_HH
diff --git a/src/IconbarTheme.hh b/src/IconbarTheme.hh
index e4b3c8b..f43a915 100644
--- a/src/IconbarTheme.hh
+++ b/src/IconbarTheme.hh
@@ -41,8 +41,7 @@ public:
41 const FbTk::Texture &texture() const { return *m_texture; } 41 const FbTk::Texture &texture() const { return *m_texture; }
42 const FbTk::Texture &emptyTexture() const { return *m_empty_texture; } 42 const FbTk::Texture &emptyTexture() const { return *m_empty_texture; }
43 43
44 virtual FbTk::Subject &reconfigSig() { return FbTk::Theme::reconfigSig(); } 44 virtual FbTk::Signal<void> &reconfigSig() { return FbTk::Theme::reconfigSig(); }
45 virtual const FbTk::Subject &reconfigSig() const { return FbTk::Theme::reconfigSig(); }
46 45
47 virtual IconbarTheme &operator *() { return *this; } 46 virtual IconbarTheme &operator *() { return *this; }
48 virtual const IconbarTheme &operator *() const { return *this; } 47 virtual const IconbarTheme &operator *() const { return *this; }
diff --git a/src/IconbarTool.cc b/src/IconbarTool.cc
index 28e4aeb..42817c5 100644
--- a/src/IconbarTool.cc
+++ b/src/IconbarTool.cc
@@ -291,10 +291,12 @@ IconbarTool::IconbarTool(const FbTk::FbWindow &parent, IconbarTheme &theme,
291 menu.insert(m_menu.label().logical(), &m_menu); 291 menu.insert(m_menu.label().logical(), &m_menu);
292 292
293 // setup signals 293 // setup signals
294 theme.reconfigSig().attach(this); 294 m_tracker.join(theme.reconfigSig(), FbTk::MemFun(*this, &IconbarTool::themeReconfigured));
295 focused_theme.reconfigSig().attach(this); 295 m_tracker.join(focused_theme.reconfigSig(),
296 unfocused_theme.reconfigSig().attach(this); 296 FbTk::MemFun(*this, &IconbarTool::themeReconfigured));
297 setMode(*m_rc_mode); 297 m_tracker.join(unfocused_theme.reconfigSig(),
298 FbTk::MemFun(*this, &IconbarTool::themeReconfigured));
299 themeReconfigured();
298} 300}
299 301
300IconbarTool::~IconbarTool() { 302IconbarTool::~IconbarTool() {
@@ -383,6 +385,10 @@ unsigned int IconbarTool::borderWidth() const {
383 return m_icon_container.borderWidth(); 385 return m_icon_container.borderWidth();
384} 386}
385 387
388void IconbarTool::themeReconfigured() {
389 setMode(*m_rc_mode);
390}
391
386void IconbarTool::update(FbTk::Subject *subj) { 392void IconbarTool::update(FbTk::Subject *subj) {
387 // ignore updates if we're shutting down 393 // ignore updates if we're shutting down
388 if (m_screen.isShuttingdown()) { 394 if (m_screen.isShuttingdown()) {
@@ -396,13 +402,6 @@ void IconbarTool::update(FbTk::Subject *subj) {
396 *m_rc_client_width = FbTk::Util::clamp(*m_rc_client_width, 10, 400); 402 *m_rc_client_width = FbTk::Util::clamp(*m_rc_client_width, 10, 400);
397 m_icon_container.setMaxSizePerClient(*m_rc_client_width); 403 m_icon_container.setMaxSizePerClient(*m_rc_client_width);
398 404
399 if (subj == &m_focused_theme.reconfigSig() ||
400 subj == &m_unfocused_theme.reconfigSig() ||
401 subj == &m_theme.reconfigSig()) {
402 setMode(*m_rc_mode);
403 return;
404 }
405
406 // lock graphic update 405 // lock graphic update
407 m_icon_container.setUpdateLock(true); 406 m_icon_container.setUpdateLock(true);
408 407
diff --git a/src/IconbarTool.hh b/src/IconbarTool.hh
index cb8304f..92fbe63 100644
--- a/src/IconbarTool.hh
+++ b/src/IconbarTool.hh
@@ -95,12 +95,15 @@ private:
95 /// add icons to the list 95 /// add icons to the list
96 void updateList(); 96 void updateList();
97 97
98 void themeReconfigured();
99
98 BScreen &m_screen; 100 BScreen &m_screen;
99 FbTk::Container m_icon_container; 101 FbTk::Container m_icon_container;
100 IconbarTheme &m_theme; 102 IconbarTheme &m_theme;
101 FbTk::ThemeProxy<IconbarTheme> &m_focused_theme, &m_unfocused_theme; 103 FbTk::ThemeProxy<IconbarTheme> &m_focused_theme, &m_unfocused_theme;
102 FbTk::CachedPixmap m_empty_pm; ///< pixmap for empty container 104 FbTk::CachedPixmap m_empty_pm; ///< pixmap for empty container
103 105
106 FbTk::SignalTracker m_tracker;
104 107
105 std::auto_ptr<FocusableList> m_winlist; 108 std::auto_ptr<FocusableList> m_winlist;
106 IconMap m_icons; 109 IconMap m_icons;
diff --git a/src/RootTheme.hh b/src/RootTheme.hh
index 0867430..6485448 100644
--- a/src/RootTheme.hh
+++ b/src/RootTheme.hh
@@ -48,8 +48,7 @@ public:
48 48
49 GC opGC() const { return m_opgc.gc(); } 49 GC opGC() const { return m_opgc.gc(); }
50 50
51 virtual FbTk::Subject &reconfigSig() { return FbTk::Theme::reconfigSig(); } 51 virtual FbTk::Signal<void> &reconfigSig() { return FbTk::Theme::reconfigSig(); }
52 virtual const FbTk::Subject &reconfigSig() const { return FbTk::Theme::reconfigSig(); }
53 52
54 virtual RootTheme &operator *() { return *this; } 53 virtual RootTheme &operator *() { return *this; }
55 virtual const RootTheme &operator *() const { return *this; } 54 virtual const RootTheme &operator *() const { return *this; }
diff --git a/src/Screen.cc b/src/Screen.cc
index a8eca72..ce1f8ed 100644
--- a/src/Screen.cc
+++ b/src/Screen.cc
@@ -435,7 +435,8 @@ BScreen::BScreen(FbTk::ResourceManager &rm,
435 435
436 m_menutheme->setDelay(*resource.menu_delay); 436 m_menutheme->setDelay(*resource.menu_delay);
437 437
438 focusedWinFrameTheme()->reconfigSig().attach(this);// for geom window 438 m_tracker.join(focusedWinFrameTheme()->reconfigSig(),
439 FbTk::MemFun(*this, &BScreen::focusedWinFrameThemeReconfigured));
439 440
440 441
441 renderGeomWindow(); 442 renderGeomWindow();
@@ -749,10 +750,7 @@ unsigned int BScreen::maxBottom(int head) const {
749 return doFullMax() ? height() : height() - availableWorkspaceArea(head)->bottom(); 750 return doFullMax() ? height() : height() - availableWorkspaceArea(head)->bottom();
750} 751}
751 752
752void BScreen::update(FbTk::Subject *subj) { 753void BScreen::focusedWinFrameThemeReconfigured() {
753 // for now we're only listening to the theme sig, so no object check
754 // if another signal is added later, will need to differentiate here
755
756 renderGeomWindow(); 754 renderGeomWindow();
757 renderPosWindow(); 755 renderPosWindow();
758 756
diff --git a/src/Screen.hh b/src/Screen.hh
index 729461a..4d1d933 100644
--- a/src/Screen.hh
+++ b/src/Screen.hh
@@ -75,7 +75,6 @@ class Menu;
75class ImageControl; 75class ImageControl;
76class LayerItem; 76class LayerItem;
77class FbWindow; 77class FbWindow;
78class Subject;
79} 78}
80 79
81 80
@@ -83,8 +82,7 @@ class Subject;
83/** 82/**
84 Create workspaces, handles switching between workspaces and windows 83 Create workspaces, handles switching between workspaces and windows
85 */ 84 */
86class BScreen: public FbTk::EventHandler, public FbTk::Observer, 85class BScreen: public FbTk::EventHandler, private FbTk::NotCopyable {
87 private FbTk::NotCopyable {
88public: 86public:
89 typedef std::list<FluxboxWindow *> Icons; 87 typedef std::list<FluxboxWindow *> Icons;
90 88
@@ -220,9 +218,6 @@ public:
220 ScreenSignal &bgChangeSig() { return m_bg_change_sig; } 218 ScreenSignal &bgChangeSig() { return m_bg_change_sig; }
221 //@} 219 //@}
222 220
223 /// called when the screen receives a signal from a subject
224 void update(FbTk::Subject *subj);
225
226 void propertyNotify(Atom atom); 221 void propertyNotify(Atom atom);
227 void keyPressEvent(XKeyEvent &ke); 222 void keyPressEvent(XKeyEvent &ke);
228 void keyReleaseEvent(XKeyEvent &ke); 223 void keyReleaseEvent(XKeyEvent &ke);
@@ -476,9 +471,11 @@ private:
476 void setupConfigmenu(FbTk::Menu &menu); 471 void setupConfigmenu(FbTk::Menu &menu);
477 void renderGeomWindow(); 472 void renderGeomWindow();
478 void renderPosWindow(); 473 void renderPosWindow();
474 void focusedWinFrameThemeReconfigured();
479 475
480 const Strut* availableWorkspaceArea(int head) const; 476 const Strut* availableWorkspaceArea(int head) const;
481 477
478 FbTk::SignalTracker m_tracker;
482 ScreenSubject m_reconfigure_sig; ///< reconfigure signal 479 ScreenSubject m_reconfigure_sig; ///< reconfigure signal
483 480
484 481
diff --git a/src/Slit.cc b/src/Slit.cc
index ef1564a..f3e24a9 100644
--- a/src/Slit.cc
+++ b/src/Slit.cc
@@ -263,13 +263,13 @@ Slit::Slit(BScreen &scr, FbTk::Layer &layer, const char *filename)
263 _FB_USES_NLS; 263 _FB_USES_NLS;
264 264
265 // attach to theme and root window change signal 265 // attach to theme and root window change signal
266 theme().reconfigSig().attach(this); 266 join(theme().reconfigSig(), FbTk::MemFun(*this, &Slit::reconfigure));
267 267
268 join(scr.resizeSig(), 268 join(scr.resizeSig(),
269 FbTk::MemFun(*this, &Slit::screenSizeChanged)); 269 FbTk::MemFun(*this, &Slit::screenSizeChanged));
270 270
271 join(scr.bgChangeSig(), 271 join(scr.bgChangeSig(),
272 FbTk::MemFun(*this, &Slit::updateForScreen)); 272 FbTk::MemFunIgnoreArgs(*this, &Slit::reconfigure));
273 273
274 scr.reconfigureSig().attach(this); // if alpha changed (we disablethis signal when we get theme change sig) 274 scr.reconfigureSig().attach(this); // if alpha changed (we disablethis signal when we get theme change sig)
275 275
@@ -1042,12 +1042,8 @@ void Slit::screenSizeChanged(BScreen &screen) {
1042#endif // XINERAMA 1042#endif // XINERAMA
1043} 1043}
1044 1044
1045void Slit::updateForScreen(BScreen &screen) {
1046 reconfigure();
1047}
1048
1049void Slit::update(FbTk::Subject*) { 1045void Slit::update(FbTk::Subject*) {
1050 updateForScreen(screen()); 1046 reconfigure();
1051} 1047}
1052 1048
1053void Slit::clearWindow() { 1049void Slit::clearWindow() {
diff --git a/src/Slit.hh b/src/Slit.hh
index 7f2729d..2f2eac8 100644
--- a/src/Slit.hh
+++ b/src/Slit.hh
@@ -134,7 +134,6 @@ public:
134private: 134private:
135 /// Called when screen has changed 135 /// Called when screen has changed
136 void screenSizeChanged(BScreen &screen); 136 void screenSizeChanged(BScreen &screen);
137 void updateForScreen(BScreen &screen);
138 137
139 void updateAlpha(); 138 void updateAlpha();
140 void clearWindow(); 139 void clearWindow();
diff --git a/src/SlitTheme.hh b/src/SlitTheme.hh
index d6b410b..5a1b9d1 100644
--- a/src/SlitTheme.hh
+++ b/src/SlitTheme.hh
@@ -38,8 +38,7 @@ public:
38 int borderWidth() const { return *m_border_width; } 38 int borderWidth() const { return *m_border_width; }
39 int bevelWidth() const { return *m_bevel_width; } 39 int bevelWidth() const { return *m_bevel_width; }
40 40
41 virtual FbTk::Subject &reconfigSig() { return FbTk::Theme::reconfigSig(); } 41 virtual FbTk::Signal<void> &reconfigSig() { return FbTk::Theme::reconfigSig(); }
42 virtual const FbTk::Subject &reconfigSig() const { return FbTk::Theme::reconfigSig(); }
43 42
44 virtual SlitTheme &operator *() { return *this; } 43 virtual SlitTheme &operator *() { return *this; }
45 virtual const SlitTheme &operator *() const { return *this; } 44 virtual const SlitTheme &operator *() const { return *this; }
diff --git a/src/SystemTray.cc b/src/SystemTray.cc
index a8c4d5d..66e350f 100644
--- a/src/SystemTray.cc
+++ b/src/SystemTray.cc
@@ -25,7 +25,6 @@
25#include "FbTk/ImageControl.hh" 25#include "FbTk/ImageControl.hh"
26#include "FbTk/TextUtils.hh" 26#include "FbTk/TextUtils.hh"
27#include "FbTk/MemFun.hh" 27#include "FbTk/MemFun.hh"
28#include "FbTk/SimpleObserver.hh"
29 28
30#include "AtomHandler.hh" 29#include "AtomHandler.hh"
31#include "fluxbox.hh" 30#include "fluxbox.hh"
@@ -167,11 +166,10 @@ SystemTray::SystemTray(const FbTk::FbWindow& parent,
167 FbTk::EventManager::instance()->add(*this, m_window); 166 FbTk::EventManager::instance()->add(*this, m_window);
168 FbTk::EventManager::instance()->add(*this, m_selection_owner); 167 FbTk::EventManager::instance()->add(*this, m_selection_owner);
169 // setup signals 168 // setup signals
170 m_observer.reset(makeObserver(*this, &SystemTray::update)); 169 join(m_theme->reconfigSig(), FbTk::MemFun(*this, &SystemTray::update));
171 m_theme->reconfigSig().attach(m_observer.get());
172 170
173 join(screen.bgChangeSig(), 171 join(screen.bgChangeSig(),
174 FbTk::MemFun(*this, &SystemTray::updateForScreen)); 172 FbTk::MemFunIgnoreArgs(*this, &SystemTray::update));
175 173
176 174
177 Fluxbox* fluxbox = Fluxbox::instance(); 175 Fluxbox* fluxbox = Fluxbox::instance();
diff --git a/src/SystemTray.hh b/src/SystemTray.hh
index 3209790..d92e437 100644
--- a/src/SystemTray.hh
+++ b/src/SystemTray.hh
@@ -40,7 +40,6 @@ class AtomHandler;
40 40
41namespace FbTk { 41namespace FbTk {
42template <class T> class ThemeProxy; 42template <class T> class ThemeProxy;
43class Observer;
44} 43}
45 44
46class SystemTray: public ToolbarItem, public FbTk::EventHandler, 45class SystemTray: public ToolbarItem, public FbTk::EventHandler,
@@ -89,10 +88,6 @@ public:
89 static Atom getXEmbedInfoAtom(); 88 static Atom getXEmbedInfoAtom();
90 89
91private: 90private:
92 /// Called when an update for a screen is needed.
93 void updateForScreen(BScreen &screen) {
94 update();
95 }
96 void update(); 91 void update();
97 92
98 typedef std::list<TrayWindow *> ClientList; 93 typedef std::list<TrayWindow *> ClientList;
@@ -116,7 +111,6 @@ private:
116 // gaim/pidgin seems to barf if the selection is not an independent window. 111 // gaim/pidgin seems to barf if the selection is not an independent window.
117 // I suspect it's an interacton with parent relationship and gdk window caching. 112 // I suspect it's an interacton with parent relationship and gdk window caching.
118 FbTk::FbWindow m_selection_owner; 113 FbTk::FbWindow m_selection_owner;
119 std::auto_ptr<FbTk::Observer> m_observer;
120}; 114};
121 115
122#endif // SYSTEMTRAY_HH 116#endif // SYSTEMTRAY_HH
diff --git a/src/ToolTheme.hh b/src/ToolTheme.hh
index 693aac6..8daad7d 100644
--- a/src/ToolTheme.hh
+++ b/src/ToolTheme.hh
@@ -23,7 +23,6 @@
23#ifndef TOOLTHEME_HH 23#ifndef TOOLTHEME_HH
24#define TOOLTHEME_HH 24#define TOOLTHEME_HH
25 25
26
27#include "FbTk/TextTheme.hh" 26#include "FbTk/TextTheme.hh"
28#include "FbTk/BorderTheme.hh" 27#include "FbTk/BorderTheme.hh"
29#include "FbTk/Texture.hh" 28#include "FbTk/Texture.hh"
@@ -44,8 +43,7 @@ public:
44 int alpha() const { return m_alpha; } 43 int alpha() const { return m_alpha; }
45 void setAlpha(int alpha) { m_alpha = alpha; } 44 void setAlpha(int alpha) { m_alpha = alpha; }
46 45
47 virtual FbTk::Subject &reconfigSig() { return FbTk::Theme::reconfigSig(); } 46 virtual FbTk::Signal<void> &reconfigSig() { return FbTk::Theme::reconfigSig(); }
48 virtual const FbTk::Subject &reconfigSig() const { return FbTk::Theme::reconfigSig(); }
49 47
50 virtual ToolTheme &operator *() { return *this; } 48 virtual ToolTheme &operator *() { return *this; }
51 virtual const ToolTheme &operator *() const { return *this; } 49 virtual const ToolTheme &operator *() const { return *this; }
diff --git a/src/Toolbar.cc b/src/Toolbar.cc
index 471f5ec..1778a02 100644
--- a/src/Toolbar.cc
+++ b/src/Toolbar.cc
@@ -231,8 +231,8 @@ Toolbar::Toolbar(BScreen &scrn, FbTk::Layer &layer, size_t width):
231 m_observers.push_back(makeObserver(*this, &Toolbar::rearrangeItems)); 231 m_observers.push_back(makeObserver(*this, &Toolbar::rearrangeItems));
232 // we need to get notified when the theme is reloaded 232 // we need to get notified when the theme is reloaded
233 m_observers.push_back(makeObserver(*this, &Toolbar::reconfigure)); 233 m_observers.push_back(makeObserver(*this, &Toolbar::reconfigure));
234 m_theme.reconfigSig().attach(m_observers.back());
235 screen().reconfigureSig().attach(m_observers.back()); // get this on antialias change 234 screen().reconfigureSig().attach(m_observers.back()); // get this on antialias change
235 m_signal_tracker.join(m_theme.reconfigSig(), FbTk::MemFun(*this, &Toolbar::reconfigure));
236 236
237 // listen to screen size changes 237 // listen to screen size changes
238 m_signal_tracker.join(screen().resizeSig(), 238 m_signal_tracker.join(screen().resizeSig(),
diff --git a/src/ToolbarTheme.hh b/src/ToolbarTheme.hh
index 077198f..dbb6786 100644
--- a/src/ToolbarTheme.hh
+++ b/src/ToolbarTheme.hh
@@ -44,8 +44,7 @@ public:
44 int height() const { return *m_height; } 44 int height() const { return *m_height; }
45 int buttonSize() const { return *m_button_size; } 45 int buttonSize() const { return *m_button_size; }
46 46
47 virtual FbTk::Subject &reconfigSig() { return FbTk::Theme::reconfigSig(); } 47 virtual FbTk::Signal<void> &reconfigSig() { return FbTk::Theme::reconfigSig(); }
48 virtual const FbTk::Subject &reconfigSig() const { return FbTk::Theme::reconfigSig(); }
49 48
50 virtual ToolbarTheme &operator *() { return *this; } 49 virtual ToolbarTheme &operator *() { return *this; }
51 virtual const ToolbarTheme &operator *() const { return *this; } 50 virtual const ToolbarTheme &operator *() const { return *this; }
diff --git a/src/WinButton.cc b/src/WinButton.cc
index 9ecbb9c..22fe29c 100644
--- a/src/WinButton.cc
+++ b/src/WinButton.cc
@@ -44,7 +44,8 @@ WinButton::WinButton(FluxboxWindow &listen_to,
44 m_theme(theme), m_pressed_theme(pressed), 44 m_theme(theme), m_pressed_theme(pressed),
45 m_icon_pixmap(0), m_icon_mask(0), 45 m_icon_pixmap(0), m_icon_mask(0),
46 overrode_bg(false), overrode_pressed(false) { 46 overrode_bg(false), overrode_pressed(false) {
47 theme.reconfigSig().attach(this); 47
48 join(theme.reconfigSig(), FbTk::MemFun(*this, &WinButton::updateAll));
48 49
49 if (buttontype == MENUICON) 50 if (buttontype == MENUICON)
50 update(0); 51 update(0);
diff --git a/src/WinButtonTheme.hh b/src/WinButtonTheme.hh
index 5436237..f7f2337 100644
--- a/src/WinButtonTheme.hh
+++ b/src/WinButtonTheme.hh
@@ -65,8 +65,7 @@ public:
65 FbTk::PixmapWithMask &titlePixmap() { return *m_title_pm; } 65 FbTk::PixmapWithMask &titlePixmap() { return *m_title_pm; }
66 const FbTk::PixmapWithMask &titlePixmap() const { return *m_title_pm; } 66 const FbTk::PixmapWithMask &titlePixmap() const { return *m_title_pm; }
67 67
68 virtual FbTk::Subject &reconfigSig() { return FbTk::Theme::reconfigSig(); } 68 virtual FbTk::Signal<void> &reconfigSig() { return FbTk::Theme::reconfigSig(); }
69 virtual const FbTk::Subject &reconfigSig() const { return FbTk::Theme::reconfigSig(); }
70 69
71 virtual WinButtonTheme &operator *() { return *this; } 70 virtual WinButtonTheme &operator *() { return *this; }
72 virtual const WinButtonTheme &operator *() const { return *this; } 71 virtual const WinButtonTheme &operator *() const { return *this; }
diff --git a/src/Window.cc b/src/Window.cc
index 369b480..756c358 100644
--- a/src/Window.cc
+++ b/src/Window.cc
@@ -291,7 +291,7 @@ FluxboxWindow::FluxboxWindow(WinClient &client):
291 m_parent(client.screen().rootWindow()), 291 m_parent(client.screen().rootWindow()),
292 m_resize_corner(RIGHTBOTTOM) { 292 m_resize_corner(RIGHTBOTTOM) {
293 293
294 m_theme.reconfigSig().attach(this); 294 join(m_theme.reconfigSig(), FbTk::MemFun(*this, &FluxboxWindow::themeReconfigured));
295 m_frame.frameExtentSig().attach(this); 295 m_frame.frameExtentSig().attach(this);
296 296
297 init(); 297 init();
@@ -2682,15 +2682,17 @@ void FluxboxWindow::setTitle(const std::string& title, Focusable &client) {
2682} 2682}
2683 2683
2684void FluxboxWindow::update(FbTk::Subject *subj) { 2684void FluxboxWindow::update(FbTk::Subject *subj) {
2685 if (subj == &m_theme.reconfigSig()) { 2685 if (m_initialized && subj == &m_frame.frameExtentSig()) {
2686 frame().applyDecorations();
2687 sendConfigureNotify();
2688 } else if (m_initialized && subj == &m_frame.frameExtentSig()) {
2689 Fluxbox::instance()->updateFrameExtents(*this); 2686 Fluxbox::instance()->updateFrameExtents(*this);
2690 sendConfigureNotify(); 2687 sendConfigureNotify();
2691 } 2688 }
2692} 2689}
2693 2690
2691void FluxboxWindow::themeReconfigured() {
2692 frame().applyDecorations();
2693 sendConfigureNotify();
2694}
2695
2694void FluxboxWindow::workspaceAreaChanged(BScreen &screen) { 2696void FluxboxWindow::workspaceAreaChanged(BScreen &screen) {
2695 frame().applyState(); 2697 frame().applyState();
2696} 2698}
diff --git a/src/Window.hh b/src/Window.hh
index 8f599a4..cbbb817 100644
--- a/src/Window.hh
+++ b/src/Window.hh
@@ -492,6 +492,8 @@ private:
492 void updateClientLeftWindow(); 492 void updateClientLeftWindow();
493 void grabButtons(); 493 void grabButtons();
494 494
495 void themeReconfigured();
496
495 /** 497 /**
496 * Calculates insertition position in the list by 498 * Calculates insertition position in the list by
497 * using pixel position x and y. 499 * using pixel position x and y.
diff --git a/src/WorkspaceNameTheme.hh b/src/WorkspaceNameTheme.hh
index e90ef01..0096682 100644
--- a/src/WorkspaceNameTheme.hh
+++ b/src/WorkspaceNameTheme.hh
@@ -49,8 +49,7 @@ public:
49 return ToolTheme::fallback(item); 49 return ToolTheme::fallback(item);
50 } 50 }
51 51
52 virtual FbTk::Subject &reconfigSig() { return FbTk::Theme::reconfigSig(); } 52 virtual FbTk::Signal<void> &reconfigSig() { return FbTk::Theme::reconfigSig(); }
53 virtual const FbTk::Subject &reconfigSig() const { return FbTk::Theme::reconfigSig(); }
54 53
55 virtual WorkspaceNameTheme &operator *() { return *this; } 54 virtual WorkspaceNameTheme &operator *() { return *this; }
56 virtual const WorkspaceNameTheme &operator *() const { return *this; } 55 virtual const WorkspaceNameTheme &operator *() const { return *this; }
diff --git a/src/WorkspaceNameTool.cc b/src/WorkspaceNameTool.cc
index 3a4b275..6451a0a 100644
--- a/src/WorkspaceNameTool.cc
+++ b/src/WorkspaceNameTool.cc
@@ -44,11 +44,11 @@ WorkspaceNameTool::WorkspaceNameTool(const FbTk::FbWindow &parent,
44 44
45 // setup signals 45 // setup signals
46 join(screen.currentWorkspaceSig(), 46 join(screen.currentWorkspaceSig(),
47 FbTk::MemFun(*this, &WorkspaceNameTool::updateForScreen)); 47 FbTk::MemFunIgnoreArgs(*this, &WorkspaceNameTool::update));
48 join(screen.workspaceNamesSig(), 48 join(screen.workspaceNamesSig(),
49 FbTk::MemFun(*this, &WorkspaceNameTool::updateForScreen)); 49 FbTk::MemFunIgnoreArgs(*this, &WorkspaceNameTool::update));
50 50
51 theme.reconfigSig().attach(this); 51 join(theme.reconfigSig(), FbTk::MemFun(*this, &WorkspaceNameTool::update));
52} 52}
53 53
54WorkspaceNameTool::~WorkspaceNameTool() { 54WorkspaceNameTool::~WorkspaceNameTool() {
@@ -70,12 +70,8 @@ void WorkspaceNameTool::moveResize(int x, int y,
70 m_button.moveResize(x, y, width, height); 70 m_button.moveResize(x, y, width, height);
71} 71}
72 72
73void WorkspaceNameTool::update(FbTk::Subject *subj) { 73void WorkspaceNameTool::update() {
74 updateForScreen(m_screen); 74 m_button.setText(m_screen.currentWorkspace()->name());
75}
76
77void WorkspaceNameTool::updateForScreen(BScreen &screen) {
78 m_button.setText(screen.currentWorkspace()->name());
79 if (m_button.width() != width()) { 75 if (m_button.width() != width()) {
80 resize(width(), height()); 76 resize(width(), height());
81 resizeSig().notify(); 77 resizeSig().notify();
diff --git a/src/WorkspaceNameTool.hh b/src/WorkspaceNameTool.hh
index de95663..195dc1f 100644
--- a/src/WorkspaceNameTool.hh
+++ b/src/WorkspaceNameTool.hh
@@ -26,7 +26,6 @@
26#include "ToolbarItem.hh" 26#include "ToolbarItem.hh"
27 27
28#include "FbTk/TextButton.hh" 28#include "FbTk/TextButton.hh"
29#include "FbTk/Observer.hh"
30#include "FbTk/Signal.hh" 29#include "FbTk/Signal.hh"
31 30
32class BScreen; 31class BScreen;
@@ -36,8 +35,7 @@ namespace FbTk {
36template <class T> class ThemeProxy; 35template <class T> class ThemeProxy;
37} 36}
38 37
39class WorkspaceNameTool: public ToolbarItem, public FbTk::Observer, 38class WorkspaceNameTool: public ToolbarItem, private FbTk::SignalTracker {
40 private FbTk::SignalTracker {
41public: 39public:
42 WorkspaceNameTool(const FbTk::FbWindow &parent, FbTk::ThemeProxy<ToolTheme> &theme, BScreen &screen); 40 WorkspaceNameTool(const FbTk::FbWindow &parent, FbTk::ThemeProxy<ToolTheme> &theme, BScreen &screen);
43 virtual ~WorkspaceNameTool(); 41 virtual ~WorkspaceNameTool();
@@ -53,7 +51,6 @@ public:
53 unsigned int height() const; 51 unsigned int height() const;
54 unsigned int borderWidth() const; 52 unsigned int borderWidth() const;
55 53
56 void update(FbTk::Subject *subj);
57 FbTk::Button &button() { return m_button; } 54 FbTk::Button &button() { return m_button; }
58 const FbTk::Button &button() const { return m_button; } 55 const FbTk::Button &button() const { return m_button; }
59 void setOrientation(FbTk::Orientation orient); 56 void setOrientation(FbTk::Orientation orient);
@@ -61,8 +58,7 @@ public:
61 void parentMoved() { m_button.parentMoved(); } 58 void parentMoved() { m_button.parentMoved(); }
62 59
63private: 60private:
64 /// Called when workspace changed on \c screen 61 void update();
65 void updateForScreen(BScreen &screen);
66 62
67 void renderTheme(int alpha); 63 void renderTheme(int alpha);
68 void reRender(); 64 void reRender();