Convert ToolbarItem::resizeSig to FbTk::Signal
Pavel Labath pavelo@centrum.sk
6 files changed,
11 insertions(+),
19 deletions(-)
M
src/ClockTool.cc
→
src/ClockTool.cc
@@ -260,7 +260,7 @@ new_width = m_theme->font().textWidth(text.c_str(), text.size());
translateSize(orientation(), new_width, new_height); if (new_width != m_button.width() || new_height != m_button.height()) { resize(new_width, new_height); - resizeSig().notify(); + resizeSig().emit(); } }@@ -305,7 +305,7 @@
unsigned int new_width = m_theme->font().textWidth(time_string, time_string_len) + 2; if (new_width > m_button.width()) { resize(new_width, m_button.height()); - resizeSig().notify(); + resizeSig().emit(); } #else // dont have strftime so we have to set it to hour:minut // sprintf(time_string, "%d:%d", );
M
src/SystemTray.cc
→
src/SystemTray.cc
@@ -246,7 +246,7 @@ height != m_window.height()) {
m_window.resize(width, height); if (m_num_visible_clients) rearrangeClients(); - resizeSig().notify(); + resizeSig().emit(); } }@@ -257,7 +257,7 @@ height != m_window.height()) {
m_window.moveResize(x, y, width, height); if (m_num_visible_clients) rearrangeClients(); - resizeSig().notify(); + resizeSig().emit(); } else { move(x, y); }@@ -435,7 +435,7 @@ // this was why gaim wasn't centring the icon
(*it)->sendConfigureNotify(0, 0, (*it)->width(), (*it)->height()); // so toolbar know that we changed size // done inside this loop, because otherwise we can get into nasty looping - resizeSig().notify(); + resizeSig().emit(); } }
M
src/Toolbar.cc
→
src/Toolbar.cc
@@ -51,7 +51,6 @@ #include "FbTk/Transparent.hh"
#include "FbTk/BoolMenuItem.hh" #include "FbTk/IntMenuItem.hh" #include "FbTk/Shape.hh" -#include "FbTk/SimpleObserver.hh" #include "FbTk/MemFun.hh" #include "FbTk/STLUtil.hh" #include "FbTk/Util.hh"@@ -227,8 +226,6 @@ scrn.name() + ".toolbar.tools", scrn.altName() + ".Toolbar.Tools"),
m_shape(new FbTk::Shape(frame.window, 0)), m_resize_lock(false) { _FB_USES_NLS; - // NOTE: first subject is always the rearrangeItem ! - m_observers.push_back(makeObserver(*this, &Toolbar::rearrangeItems)); // get this on antialias change m_signal_tracker.join(screen().reconfigureSig(),@@ -425,9 +422,8 @@ ToolbarItem *item = m_tool_factory.create(*item_it, frame.window, *this);
if (item == 0) continue; m_item_list.push_back(item); - // attach to first observer ( which must be rearrangeItems ) - item->resizeSig().attach(m_observers[0]); - + m_signal_tracker.join(item->resizeSig(), + FbTk::MemFun(*this, &Toolbar::rearrangeItems)); } // show all items frame.window.showSubwindows();
M
src/Toolbar.hh
→
src/Toolbar.hh
@@ -197,8 +197,6 @@ typedef std::list<std::string> StringList;
StringList m_tools; bool m_resize_lock; ///< to lock rearrangeItems or not - /// observers for various signals - std::vector<FbTk::Observer*> m_observers; FbTk::SignalTracker m_signal_tracker; };
M
src/ToolbarItem.hh
→
src/ToolbarItem.hh
@@ -23,7 +23,7 @@
#ifndef TOOLBARITEM_HH #define TOOLBARITEM_HH -#include "FbTk/Subject.hh" +#include "FbTk/Signal.hh" #include "FbTk/Orientation.hh" /// An item in the toolbar that has either fixed or relative size to the toolbar@@ -62,7 +62,7 @@
// just update theme items that affect the size virtual void updateSizing() = 0; - FbTk::Subject &resizeSig() { return m_resize_sig; } + FbTk::Signal<> &resizeSig() { return m_resize_sig; } void setType(Type type) { m_type = type; } Type type() const { return m_type; }@@ -70,14 +70,12 @@
FbTk::Orientation orientation() const { return m_orientation; } virtual void setOrientation(FbTk::Orientation orient) { m_orientation = orient; } - class ToolbarItemSubject : public FbTk::Subject {}; - private: Type m_type; FbTk::Orientation m_orientation; - ToolbarItemSubject m_resize_sig; + FbTk::Signal<> m_resize_sig; }; #endif // TOOLBARITEM_HH
M
src/WorkspaceNameTool.cc
→
src/WorkspaceNameTool.cc
@@ -74,7 +74,7 @@ void WorkspaceNameTool::update() {
m_button.setText(m_screen.currentWorkspace()->name()); if (m_button.width() != width()) { resize(width(), height()); - resizeSig().notify(); + resizeSig().emit(); } reRender(); m_button.clear();