aboutsummaryrefslogtreecommitdiff
path: root/src/WorkspaceMenu.cc
diff options
context:
space:
mode:
authorHenrik Kinnunen <fluxgen@fluxbox.org>2008-09-21 11:44:48 (GMT)
committerHenrik Kinnunen <fluxgen@fluxbox.org>2008-09-21 11:44:48 (GMT)
commit86819abab91cf3ea20540278d00bad6a6b86d4b0 (patch)
treec8020d6015f3607a67730c6873a062fe29743356 /src/WorkspaceMenu.cc
parentf5113e2ec1743d76ac414a020f617917c7933bb7 (diff)
downloadfluxbox-86819abab91cf3ea20540278d00bad6a6b86d4b0.zip
fluxbox-86819abab91cf3ea20540278d00bad6a6b86d4b0.tar.bz2
Changed current workspace signal in BScreen to use the new signal system
Diffstat (limited to 'src/WorkspaceMenu.cc')
-rw-r--r--src/WorkspaceMenu.cc35
1 files changed, 19 insertions, 16 deletions
diff --git a/src/WorkspaceMenu.cc b/src/WorkspaceMenu.cc
index 33cfb7f..dd7b96e 100644
--- a/src/WorkspaceMenu.cc
+++ b/src/WorkspaceMenu.cc
@@ -83,24 +83,26 @@ void WorkspaceMenu::workspaceInfoChanged( BScreen& screen ) {
83 updateMenu(-1); 83 updateMenu(-1);
84} 84}
85 85
86void WorkspaceMenu::workspaceChanged(BScreen& screen) {
87 FbTk::MenuItem *item = 0;
88 for (unsigned int i = 0; i < screen.numberOfWorkspaces(); ++i) {
89 item = find(i + IDX_AFTER_ICONS);
90 if (item && item->isSelected()) {
91 setItemSelected(i + IDX_AFTER_ICONS, false);
92 updateMenu(i + IDX_AFTER_ICONS);
93 break;
94 }
95 }
96 setItemSelected(screen.currentWorkspace()->workspaceID() + IDX_AFTER_ICONS, true);
97 updateMenu(screen.currentWorkspace()->workspaceID() + IDX_AFTER_ICONS);
98}
99
86void WorkspaceMenu::update(FbTk::Subject *subj) { 100void WorkspaceMenu::update(FbTk::Subject *subj) {
87 101
88 if (subj != 0 && typeid(*subj) == typeid(BScreen::ScreenSubject)) { 102 if (subj != 0 && typeid(*subj) == typeid(BScreen::ScreenSubject)) {
89 BScreen::ScreenSubject &screen_subj = *static_cast<BScreen::ScreenSubject *>(subj); 103 BScreen::ScreenSubject &screen_subj = *static_cast<BScreen::ScreenSubject *>(subj);
90 BScreen &screen = screen_subj.screen(); 104 BScreen &screen = screen_subj.screen();
91 if (subj == &screen.currentWorkspaceSig()) { 105 if ( subj == &screen.workspaceNamesSig() ) {
92 FbTk::MenuItem *item = 0;
93 for (unsigned int i = 0; i < screen.numberOfWorkspaces(); ++i) {
94 item = find(i + IDX_AFTER_ICONS);
95 if (item && item->isSelected()) {
96 setItemSelected(i + IDX_AFTER_ICONS, false);
97 updateMenu(i + IDX_AFTER_ICONS);
98 break;
99 }
100 }
101 setItemSelected(screen.currentWorkspace()->workspaceID() + IDX_AFTER_ICONS, true);
102 updateMenu(screen.currentWorkspace()->workspaceID() + IDX_AFTER_ICONS);
103 } else if ( subj == &screen.workspaceNamesSig() ) {
104 workspaceInfoChanged( screen ); 106 workspaceInfoChanged( screen );
105 } 107 }
106 } else { 108 } else {
@@ -109,12 +111,13 @@ void WorkspaceMenu::update(FbTk::Subject *subj) {
109} 111}
110 112
111void WorkspaceMenu::init(BScreen &screen) { 113void WorkspaceMenu::init(BScreen &screen) {
112 screen.currentWorkspaceSig().attach(this);
113 114
114 screen.workspaceNamesSig().attach(this); 115 screen.workspaceNamesSig().attach(this);
115 116
116 join( screen.workspaceCountSig(), 117 join(screen.currentWorkspaceSig(),
117 FbTk::MemFun( *this, &WorkspaceMenu::workspaceInfoChanged ) ); 118 FbTk::MemFun(*this, &WorkspaceMenu::workspaceChanged));
119 join(screen.workspaceCountSig(),
120 FbTk::MemFun(*this, &WorkspaceMenu::workspaceInfoChanged));
118 121
119 using namespace FbTk; 122 using namespace FbTk;
120 _FB_USES_NLS; 123 _FB_USES_NLS;