From 9f4d10256d27f60c09bb2a4b87805e308a3d52a6 Mon Sep 17 00:00:00 2001 From: fluxgen Date: Fri, 28 Nov 2003 13:39:41 +0000 Subject: disable current workspace in menu --- src/SendToMenu.cc | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/src/SendToMenu.cc b/src/SendToMenu.cc index 9677107..a64e594 100644 --- a/src/SendToMenu.cc +++ b/src/SendToMenu.cc @@ -20,7 +20,7 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: SendToMenu.cc,v 1.2 2003/11/27 22:01:11 fluxgen Exp $ +// $Id: SendToMenu.cc,v 1.3 2003/11/28 13:39:41 fluxgen Exp $ #include "SendToMenu.hh" @@ -49,15 +49,32 @@ SendToMenu::SendToMenu(FluxboxWindow &win): win.screen().imageControl(), *win.screen().layerManager().getLayer(Fluxbox::instance()->getMenuLayer())), m_win(win) { - + // listen to: + // workspace count signal + // workspace names signal + // current workspace signal win.screen().workspaceCountSig().attach(this); win.screen().workspaceNamesSig().attach(this); + win.screen().currentWorkspaceSig().attach(this); disableTitle(); + // build menu update(0); } void SendToMenu::update(FbTk::Subject *subj) { + // if workspace changed we enable all workspaces except the current one + if (subj != 0 && subj == &(m_win.screen().currentWorkspaceSig())) { + // enabled all workspaces + const BScreen::Workspaces &wlist = m_win.screen().getWorkspacesList(); + for (size_t i = 0; i < wlist.size(); ++i) + setItemEnabled(i, true); + // disable current workspace + setItemEnabled(m_win.screen().currentWorkspaceID(), false); + // we're done + return; + } + // rebuild menu removeAll(); -- cgit v0.11.2