diff options
author | Mathias Gumz <akira at fluxbox dot org> | 2008-08-14 05:52:39 (GMT) |
---|---|---|
committer | Mathias Gumz <akira at fluxbox dot org> | 2008-08-14 05:52:39 (GMT) |
commit | e169d33552c8e7070aa6e13da0187f2013b4cfc3 (patch) | |
tree | ae9e92c7e885791c7f47645184070cbcd441ab94 /src/SendToMenu.cc | |
parent | c82e7c0080f8a5c14dcf95ec92dc42f59ea9dd8b (diff) | |
parent | 91ca3bc5c8e2b892a9a81b18246f72aba7deebfd (diff) | |
download | fluxbox-e169d33552c8e7070aa6e13da0187f2013b4cfc3.zip fluxbox-e169d33552c8e7070aa6e13da0187f2013b4cfc3.tar.bz2 |
Merge branch 'master' into to_push
Diffstat (limited to 'src/SendToMenu.cc')
-rw-r--r-- | src/SendToMenu.cc | 31 |
1 files changed, 15 insertions, 16 deletions
diff --git a/src/SendToMenu.cc b/src/SendToMenu.cc index ae261b9..8ec2094 100644 --- a/src/SendToMenu.cc +++ b/src/SendToMenu.cc | |||
@@ -1,5 +1,5 @@ | |||
1 | // SendToMenu.cc for Fluxbox | 1 | // SendToMenu.cc for Fluxbox |
2 | // Copyright (c) 2003 - 2006 Henrik Kinnunen (fluxgen at fluxbox dot org) | 2 | // Copyright (c) 2003 - 2008 Henrik Kinnunen (fluxgen at fluxbox dot org) |
3 | // and Simon Bowden (rathnor at users.sourceforge.net) | 3 | // and Simon Bowden (rathnor at users.sourceforge.net) |
4 | // | 4 | // |
5 | // Permission is hereby granted, free of charge, to any person obtaining a | 5 | // Permission is hereby granted, free of charge, to any person obtaining a |
@@ -31,6 +31,7 @@ | |||
31 | 31 | ||
32 | #include "FbTk/MultiButtonMenuItem.hh" | 32 | #include "FbTk/MultiButtonMenuItem.hh" |
33 | #include "FbTk/Command.hh" | 33 | #include "FbTk/Command.hh" |
34 | #include "FbTk/SimpleObserver.hh" | ||
34 | 35 | ||
35 | class SendToCmd: public FbTk::Command<void> { | 36 | class SendToCmd: public FbTk::Command<void> { |
36 | public: | 37 | public: |
@@ -54,24 +55,21 @@ SendToMenu::SendToMenu(BScreen &screen): | |||
54 | // workspace count signal | 55 | // workspace count signal |
55 | // workspace names signal | 56 | // workspace names signal |
56 | // current workspace signal | 57 | // current workspace signal |
57 | screen.workspaceCountSig().attach(this); | 58 | m_rebuildObs = makeObserver(*this, &SendToMenu::rebuildMenu); |
58 | screen.workspaceNamesSig().attach(this); | 59 | screen.workspaceCountSig().attach(m_rebuildObs); |
59 | screen.currentWorkspaceSig().attach(this); | 60 | screen.workspaceNamesSig().attach(m_rebuildObs); |
60 | 61 | screen.currentWorkspaceSig().attach(m_rebuildObs); | |
62 | // no title for this menu, it should be a submenu in the window menu. | ||
61 | disableTitle(); | 63 | disableTitle(); |
62 | // build menu | 64 | // setup menu items |
63 | update(0); | 65 | rebuildMenu(); |
64 | } | 66 | } |
65 | 67 | ||
66 | void SendToMenu::update(FbTk::Subject *subj) { | 68 | SendToMenu::~SendToMenu() { |
67 | if (subj != 0) { | 69 | delete m_rebuildObs; |
68 | if (subj == &(theme().reconfigSig())) { | 70 | } |
69 | // we got reconfig Theme signal, let base menu handle it | 71 | |
70 | FbTk::Menu::update(subj); | 72 | void SendToMenu::rebuildMenu() { |
71 | return; | ||
72 | } | ||
73 | |||
74 | } | ||
75 | // rebuild menu | 73 | // rebuild menu |
76 | 74 | ||
77 | removeAll(); | 75 | removeAll(); |
@@ -95,6 +93,7 @@ void SendToMenu::show() { | |||
95 | if (WindowCmd<void>::window() != 0) { | 93 | if (WindowCmd<void>::window() != 0) { |
96 | for (unsigned int i=0; i < numberOfItems(); ++i) | 94 | for (unsigned int i=0; i < numberOfItems(); ++i) |
97 | setItemEnabled(i, true); | 95 | setItemEnabled(i, true); |
96 | // update the workspace for the current window | ||
98 | setItemEnabled(WindowCmd<void>::window()->workspaceNumber(), false); | 97 | setItemEnabled(WindowCmd<void>::window()->workspaceNumber(), false); |
99 | updateMenu(); | 98 | updateMenu(); |
100 | } | 99 | } |