diff options
author | Pavel Labath <pavelo@centrum.sk> | 2011-07-13 08:33:14 (GMT) |
---|---|---|
committer | Pavel Labath <pavelo@centrum.sk> | 2011-11-01 09:57:22 (GMT) |
commit | 5b85f21a7ff560eafb1553b4529d2240000aa8b4 (patch) | |
tree | e3d595c3849f26038a7d8e7f588486d05d31e2ff | |
parent | aec059644893c1314203d501b1d80cfd439f4d2f (diff) | |
download | fluxbox_pavel-5b85f21a7ff560eafb1553b4529d2240000aa8b4.zip fluxbox_pavel-5b85f21a7ff560eafb1553b4529d2240000aa8b4.tar.bz2 |
Emit the "modified" signal when a resource value is changed through C++ code
-rw-r--r-- | src/FbTk/Resource.hh | 8 | ||||
-rw-r--r-- | src/IconbarTool.cc | 3 | ||||
-rw-r--r-- | src/IconbarTool.hh | 2 | ||||
-rw-r--r-- | src/Screen.cc | 5 | ||||
-rw-r--r-- | src/Window.cc | 2 | ||||
-rw-r--r-- | util/fluxbox-update_configs.cc | 26 |
6 files changed, 25 insertions, 21 deletions
diff --git a/src/FbTk/Resource.hh b/src/FbTk/Resource.hh index 37a7ed3..7a797a1 100644 --- a/src/FbTk/Resource.hh +++ b/src/FbTk/Resource.hh | |||
@@ -224,7 +224,11 @@ public: | |||
224 | setDefaultValue(); | 224 | setDefaultValue(); |
225 | } | 225 | } |
226 | } | 226 | } |
227 | Accessor<T> &operator =(const T& newvalue) { m_value = newvalue; return *this;} | 227 | Accessor<T> &operator =(const T& newvalue) { |
228 | m_value = newvalue; | ||
229 | m_modified_sig.emit(m_value); | ||
230 | return *this; | ||
231 | } | ||
228 | /// specialized, must be implemented | 232 | /// specialized, must be implemented |
229 | /// @return string value of resource | 233 | /// @return string value of resource |
230 | std::string getString() const { return Traits::toString(m_value); } | 234 | std::string getString() const { return Traits::toString(m_value); } |
@@ -243,7 +247,7 @@ public: | |||
243 | 247 | ||
244 | operator T() const { return m_value; } | 248 | operator T() const { return m_value; } |
245 | T& get() { return m_value; } | 249 | T& get() { return m_value; } |
246 | T& operator*() { return m_value; } | 250 | Accessor<T>& operator*() { return *this; } |
247 | const T& operator*() const { return m_value; } | 251 | const T& operator*() const { return m_value; } |
248 | T *operator->() { return &m_value; } | 252 | T *operator->() { return &m_value; } |
249 | const T *operator->() const { return &m_value; } | 253 | const T *operator->() const { return &m_value; } |
diff --git a/src/IconbarTool.cc b/src/IconbarTool.cc index 070e45b..73f0003 100644 --- a/src/IconbarTool.cc +++ b/src/IconbarTool.cc | |||
@@ -242,7 +242,7 @@ IconbarTool::IconbarTool(const FbTk::FbWindow &parent, IconbarTheme &theme, | |||
242 | screen.name() + ".iconbar.mode"), | 242 | screen.name() + ".iconbar.mode"), |
243 | m_rc_alignment(screen.resourceManager(), FbTk::Container::RELATIVE, | 243 | m_rc_alignment(screen.resourceManager(), FbTk::Container::RELATIVE, |
244 | screen.name() + ".iconbar.alignment"), | 244 | screen.name() + ".iconbar.alignment"), |
245 | m_rc_client_width(screen.resourceManager(), 128, screen.name() + ".iconbar.iconWidth"), | 245 | m_rc_client_width(screen.resourceManager(), 128, screen.name() + ".iconbar.iconWidth", FbTk::RangedIntTraits(10, 400)), |
246 | m_rc_client_padding(screen.resourceManager(), 10, | 246 | m_rc_client_padding(screen.resourceManager(), 10, |
247 | screen.name() + ".iconbar.iconTextPadding"), | 247 | screen.name() + ".iconbar.iconTextPadding"), |
248 | m_rc_use_pixmap(screen.resourceManager(), true, screen.name() + ".iconbar.usePixmap"), | 248 | m_rc_use_pixmap(screen.resourceManager(), true, screen.name() + ".iconbar.usePixmap"), |
@@ -380,7 +380,6 @@ void IconbarTool::update(UpdateReason reason, Focusable *win) { | |||
380 | 380 | ||
381 | m_icon_container.setAlignment(*m_rc_alignment); | 381 | m_icon_container.setAlignment(*m_rc_alignment); |
382 | 382 | ||
383 | *m_rc_client_width = FbTk::Util::clamp(*m_rc_client_width, 10, 400); | ||
384 | m_icon_container.setMaxSizePerClient(*m_rc_client_width); | 383 | m_icon_container.setMaxSizePerClient(*m_rc_client_width); |
385 | 384 | ||
386 | // lock graphic update | 385 | // lock graphic update |
diff --git a/src/IconbarTool.hh b/src/IconbarTool.hh index 754cd50..9091a91 100644 --- a/src/IconbarTool.hh +++ b/src/IconbarTool.hh | |||
@@ -113,7 +113,7 @@ private: | |||
113 | FbTk::StringResource m_rc_mode; | 113 | FbTk::StringResource m_rc_mode; |
114 | /// alignment of buttons | 114 | /// alignment of buttons |
115 | FbTk::Resource<FbTk::Container::Alignment, FbTk::EnumTraits<FbTk::Container::Alignment> > m_rc_alignment; | 115 | FbTk::Resource<FbTk::Container::Alignment, FbTk::EnumTraits<FbTk::Container::Alignment> > m_rc_alignment; |
116 | FbTk::IntResource m_rc_client_width; ///< size of client button in LEFT/RIGHT mode | 116 | FbTk::RangedIntResource m_rc_client_width; ///< size of client button in LEFT/RIGHT mode |
117 | FbTk::UIntResource m_rc_client_padding; ///< padding of the text | 117 | FbTk::UIntResource m_rc_client_padding; ///< padding of the text |
118 | FbTk::BoolResource m_rc_use_pixmap; ///< if iconbar should use win pixmap or not | 118 | FbTk::BoolResource m_rc_use_pixmap; ///< if iconbar should use win pixmap or not |
119 | FbTk::RefCount<FbMenu> m_menu; | 119 | FbTk::RefCount<FbMenu> m_menu; |
diff --git a/src/Screen.cc b/src/Screen.cc index d4a8a0a..622ba55 100644 --- a/src/Screen.cc +++ b/src/Screen.cc | |||
@@ -822,7 +822,7 @@ void BScreen::reconfigure() { | |||
822 | 822 | ||
823 | // and update their names | 823 | // and update their names |
824 | for(size_t i = 0; i < std::min(m_workspaces_list.size(), resource.workspace_names->size()); ++i) | 824 | for(size_t i = 0; i < std::min(m_workspaces_list.size(), resource.workspace_names->size()); ++i) |
825 | m_workspaces_list[i]->setName( (*resource.workspace_names)[i] ); | 825 | m_workspaces_list[i]->setName( resource.workspace_names.get()[i] ); |
826 | 826 | ||
827 | // update menu filenames | 827 | // update menu filenames |
828 | m_rootmenu->reloadHelper()->setMainFile(fluxbox->getMenuFilename()); | 828 | m_rootmenu->reloadHelper()->setMainFile(fluxbox->getMenuFilename()); |
@@ -862,7 +862,8 @@ void BScreen::reconfigureTabs() { | |||
862 | void BScreen::updateWorkspaceName(unsigned int w) { | 862 | void BScreen::updateWorkspaceName(unsigned int w) { |
863 | Workspace *space = getWorkspace(w); | 863 | Workspace *space = getWorkspace(w); |
864 | if (space) { | 864 | if (space) { |
865 | (*resource.workspace_names)[w] = space->name(); | 865 | resource.workspace_names.get()[w] = space->name(); |
866 | // XXX use resource.workspace_names.modifiedSig() instead | ||
866 | m_workspacenames_sig.emit(*this); | 867 | m_workspacenames_sig.emit(*this); |
867 | Fluxbox::instance()->save_rc(); | 868 | Fluxbox::instance()->save_rc(); |
868 | } | 869 | } |
diff --git a/src/Window.cc b/src/Window.cc index b1da798..474f839 100644 --- a/src/Window.cc +++ b/src/Window.cc | |||
@@ -3506,7 +3506,7 @@ void FluxboxWindow::updateButtons() { | |||
3506 | need_update = true; | 3506 | need_update = true; |
3507 | else { | 3507 | else { |
3508 | for (size_t j=0; j < new_size && !need_update; j++) { | 3508 | for (size_t j=0; j < new_size && !need_update; j++) { |
3509 | if ((*(*titlebar_side[i]))[j] != m_titlebar_buttons[i][j]) | 3509 | if ((*titlebar_side[i]).get()[j] != m_titlebar_buttons[i][j]) |
3510 | need_update = true; | 3510 | need_update = true; |
3511 | } | 3511 | } |
3512 | } | 3512 | } |
diff --git a/util/fluxbox-update_configs.cc b/util/fluxbox-update_configs.cc index 069b112..9062b57 100644 --- a/util/fluxbox-update_configs.cc +++ b/util/fluxbox-update_configs.cc | |||
@@ -167,8 +167,8 @@ void update_move_toolbar_wheeling_to_keys_file(FbTk::ResourceManager& rm, | |||
167 | FbTk::BoolResource rc_reverse(rm, false, | 167 | FbTk::BoolResource rc_reverse(rm, false, |
168 | "screen0.reversewheeling", | 168 | "screen0.reversewheeling", |
169 | "Screen0.ReverseWheeling"); | 169 | "Screen0.ReverseWheeling"); |
170 | if (strcasecmp((*rc_wheeling).c_str(), "On") == 0 || | 170 | if (strcasecmp(rc_wheeling->c_str(), "On") == 0 || |
171 | (strcasecmp((*rc_wheeling).c_str(), "Screen") == 0 && *rc_screen)) { | 171 | (strcasecmp(rc_wheeling->c_str(), "Screen") == 0 && *rc_screen)) { |
172 | keep_changes = true; | 172 | keep_changes = true; |
173 | if (*rc_reverse) { // if you ask me, this should have been default | 173 | if (*rc_reverse) { // if you ask me, this should have been default |
174 | new_keyfile += "OnToolbar Mouse4 :PrevWorkspace\n"; | 174 | new_keyfile += "OnToolbar Mouse4 :PrevWorkspace\n"; |
@@ -202,13 +202,13 @@ void update_move_modkey_to_keys_file(FbTk::ResourceManager& rm, | |||
202 | "modKey", | 202 | "modKey", |
203 | "ModKey"); | 203 | "ModKey"); |
204 | 204 | ||
205 | new_keyfile += "OnWindow " + *rc_modkey + | 205 | new_keyfile += "OnWindow " + rc_modkey.get() + |
206 | " Mouse1 :MacroCmd {Raise} {Focus} {StartMoving}\n"; | 206 | " Mouse1 :MacroCmd {Raise} {Focus} {StartMoving}\n"; |
207 | new_keyfile += "OnWindow " + *rc_modkey + | 207 | new_keyfile += "OnWindow " + rc_modkey.get() + |
208 | " Mouse3 :MacroCmd {Raise} {Focus} {StartResizing "; | 208 | " Mouse3 :MacroCmd {Raise} {Focus} {StartResizing "; |
209 | if (strcasecmp((*rc_mode).c_str(), "Quadrant") == 0) { | 209 | if (strcasecmp(rc_mode->c_str(), "Quadrant") == 0) { |
210 | new_keyfile += "NearestCorner}\n"; | 210 | new_keyfile += "NearestCorner}\n"; |
211 | } else if (strcasecmp((*rc_mode).c_str(), "Center") == 0) { | 211 | } else if (strcasecmp(rc_mode->c_str(), "Center") == 0) { |
212 | new_keyfile += "Center}\n"; | 212 | new_keyfile += "Center}\n"; |
213 | } else { | 213 | } else { |
214 | new_keyfile += "BottomRight}\n"; | 214 | new_keyfile += "BottomRight}\n"; |
@@ -262,7 +262,7 @@ void update_move_titlebar_actions_to_keys_file(FbTk::ResourceManager& rm, | |||
262 | 262 | ||
263 | FbTk::BoolResource rc_reverse(rm, false,"screen0.reversewheeling", "Screen0.ReverseWheeling"); | 263 | FbTk::BoolResource rc_reverse(rm, false,"screen0.reversewheeling", "Screen0.ReverseWheeling"); |
264 | FbTk::StringResource scroll_action(rm, "", "screen0.windowScrollAction", "Screen0.WindowScrollAction"); | 264 | FbTk::StringResource scroll_action(rm, "", "screen0.windowScrollAction", "Screen0.WindowScrollAction"); |
265 | if (strcasecmp((*scroll_action).c_str(), "shade") == 0) { | 265 | if (strcasecmp(scroll_action->c_str(), "shade") == 0) { |
266 | if (*rc_reverse) { | 266 | if (*rc_reverse) { |
267 | new_keyfile += "OnTitlebar Mouse5 :ShadeOn\n"; | 267 | new_keyfile += "OnTitlebar Mouse5 :ShadeOn\n"; |
268 | new_keyfile += "OnTitlebar Mouse4 :ShadeOff\n"; | 268 | new_keyfile += "OnTitlebar Mouse4 :ShadeOff\n"; |
@@ -270,7 +270,7 @@ void update_move_titlebar_actions_to_keys_file(FbTk::ResourceManager& rm, | |||
270 | new_keyfile += "OnTitlebar Mouse4 :ShadeOn\n"; | 270 | new_keyfile += "OnTitlebar Mouse4 :ShadeOn\n"; |
271 | new_keyfile += "OnTitlebar Mouse5 :ShadeOff\n"; | 271 | new_keyfile += "OnTitlebar Mouse5 :ShadeOff\n"; |
272 | } | 272 | } |
273 | } else if (strcasecmp((*scroll_action).c_str(), "nexttab") == 0) { | 273 | } else if (strcasecmp(scroll_action->c_str(), "nexttab") == 0) { |
274 | if (*rc_reverse) { | 274 | if (*rc_reverse) { |
275 | new_keyfile += "OnTitlebar Mouse5 :PrevTab\n"; | 275 | new_keyfile += "OnTitlebar Mouse5 :PrevTab\n"; |
276 | new_keyfile += "OnTitlebar Mouse4 :NextTab\n"; | 276 | new_keyfile += "OnTitlebar Mouse4 :NextTab\n"; |
@@ -329,14 +329,14 @@ void update_change_format_of_split_placement_menu(FbTk::ResourceManager& rm, | |||
329 | "screen0.slit.direction", | 329 | "screen0.slit.direction", |
330 | "Screen0.Slit.Direction"); | 330 | "Screen0.Slit.Direction"); |
331 | 331 | ||
332 | if (strcasecmp((**direction).c_str(), "vertical") == 0) { | 332 | if (strcasecmp((*direction)->c_str(), "vertical") == 0) { |
333 | if (strcasecmp((**placement).c_str(), "BottomRight") == 0) | 333 | if (strcasecmp((*placement)->c_str(), "BottomRight") == 0) |
334 | *placement = "RightBottom"; | 334 | *placement = "RightBottom"; |
335 | else if (strcasecmp((**placement).c_str(), "BottomLeft") == 0) | 335 | else if (strcasecmp((*placement)->c_str(), "BottomLeft") == 0) |
336 | *placement = "LeftBottom"; | 336 | *placement = "LeftBottom"; |
337 | else if (strcasecmp((**placement).c_str(), "TopRight") == 0) | 337 | else if (strcasecmp((*placement)->c_str(), "TopRight") == 0) |
338 | *placement = "RightTop"; | 338 | *placement = "RightTop"; |
339 | else if (strcasecmp((**placement).c_str(), "TopLeft") == 0) | 339 | else if (strcasecmp((*placement)->c_str(), "TopLeft") == 0) |
340 | *placement = "LeftTop"; | 340 | *placement = "LeftTop"; |
341 | } | 341 | } |
342 | } | 342 | } |