aboutsummaryrefslogtreecommitdiff
path: root/src/IconbarTool.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/IconbarTool.cc')
-rw-r--r--src/IconbarTool.cc47
1 files changed, 25 insertions, 22 deletions
diff --git a/src/IconbarTool.cc b/src/IconbarTool.cc
index 42817c5..45e3a45 100644
--- a/src/IconbarTool.cc
+++ b/src/IconbarTool.cc
@@ -331,7 +331,7 @@ void IconbarTool::hide() {
331 331
332void IconbarTool::setAlignment(FbTk::Container::Alignment align) { 332void IconbarTool::setAlignment(FbTk::Container::Alignment align) {
333 *m_rc_alignment = align; 333 *m_rc_alignment = align;
334 update(0); 334 update(ALIGN, NULL);
335 m_menu.reconfigure(); 335 m_menu.reconfigure();
336} 336}
337 337
@@ -344,22 +344,24 @@ void IconbarTool::setMode(string mode) {
344 // lock graphics update 344 // lock graphics update
345 m_icon_container.setUpdateLock(true); 345 m_icon_container.setUpdateLock(true);
346 346
347 if (m_winlist.get()) {
348 m_winlist->addSig().detach(this);
349 m_winlist->removeSig().detach(this);
350 m_winlist->orderSig().detach(this);
351 m_winlist->resetSig().detach(this);
352 }
353 if (mode == "none") 347 if (mode == "none")
354 m_winlist.reset(new FocusableList(m_screen)); 348 m_winlist.reset(new FocusableList(m_screen));
355 else 349 else
356 m_winlist.reset(new FocusableList(m_screen, 350 m_winlist.reset(new FocusableList(m_screen,
357 mode + " (iconhidden=no)")); 351 mode + " (iconhidden=no)"));
358 if (m_winlist.get()) { 352 if (m_winlist.get()) {
359 m_winlist->addSig().attach(this); 353 m_winlist->addSig().connect(
360 m_winlist->removeSig().attach(this); 354 std::bind1st(FbTk::MemFun(*this, &IconbarTool::update), LIST_ADD)
361 m_winlist->orderSig().attach(this); 355 );
362 m_winlist->resetSig().attach(this); 356 m_winlist->removeSig().connect(
357 std::bind1st(FbTk::MemFun(*this, &IconbarTool::update), LIST_REMOVE)
358 );
359 m_winlist->addSig().connect(
360 std::bind1st(FbTk::MemFun(*this, &IconbarTool::update), LIST_ORDER)
361 );
362 m_winlist->resetSig().connect(FbTk::MemFunBind(
363 *this, &IconbarTool::update, LIST_RESET, static_cast<Focusable *>(0)
364 ));
363 } 365 }
364 reset(); 366 reset();
365 367
@@ -389,7 +391,7 @@ void IconbarTool::themeReconfigured() {
389 setMode(*m_rc_mode); 391 setMode(*m_rc_mode);
390} 392}
391 393
392void IconbarTool::update(FbTk::Subject *subj) { 394void IconbarTool::update(UpdateReason reason, Focusable *win) {
393 // ignore updates if we're shutting down 395 // ignore updates if we're shutting down
394 if (m_screen.isShuttingdown()) { 396 if (m_screen.isShuttingdown()) {
395 if (!m_icons.empty()) 397 if (!m_icons.empty())
@@ -405,17 +407,18 @@ void IconbarTool::update(FbTk::Subject *subj) {
405 // lock graphic update 407 // lock graphic update
406 m_icon_container.setUpdateLock(true); 408 m_icon_container.setUpdateLock(true);
407 409
408 if (subj && typeid(*subj) == typeid(FocusableList::FocusableListSubject)) { 410 switch(reason) {
409 FocusableList::FocusableListSubject *fsubj = 411 case LIST_ADD: case LIST_ORDER:
410 static_cast<FocusableList::FocusableListSubject *>(subj); 412 insertWindow(*win);
411 if (subj == &m_winlist->addSig()) 413 break;
412 insertWindow(*fsubj->win()); 414 case LIST_REMOVE:
413 else if (subj == &m_winlist->removeSig()) 415 removeWindow(*win);
414 removeWindow(*fsubj->win()); 416 break;
415 else if (subj == &m_winlist->resetSig()) 417 case LIST_RESET:
416 reset(); 418 reset();
417 else if (subj == &m_winlist->orderSig()) 419 break;
418 insertWindow(*fsubj->win()); 420 case ALIGN:
421 break;
419 } 422 }
420 423
421 // unlock container and update graphics 424 // unlock container and update graphics