diff options
author | rathnor <rathnor> | 2003-07-20 08:12:36 (GMT) |
---|---|---|
committer | rathnor <rathnor> | 2003-07-20 08:12:36 (GMT) |
commit | 1741ac072dd6516b4dcfdf6dbe9099a335c7bc7d (patch) | |
tree | 8dd1331222e35070a16aaae5d4bd059296dd341c /src/Remember.cc | |
parent | ace3e2e6293fa0ae5a2b9d971f24fa45b317ba2e (diff) | |
download | fluxbox-1741ac072dd6516b4dcfdf6dbe9099a335c7bc7d.zip fluxbox-1741ac072dd6516b4dcfdf6dbe9099a335c7bc7d.tar.bz2 |
fix menus for "extra" things, like remember, so that they will be
added back if the menu is rebuilt.
Diffstat (limited to 'src/Remember.cc')
-rw-r--r-- | src/Remember.cc | 38 |
1 files changed, 16 insertions, 22 deletions
diff --git a/src/Remember.cc b/src/Remember.cc index 883d00e..97466dc 100644 --- a/src/Remember.cc +++ b/src/Remember.cc | |||
@@ -21,7 +21,7 @@ | |||
21 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | 21 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
22 | // DEALINGS IN THE SOFTWARE. | 22 | // DEALINGS IN THE SOFTWARE. |
23 | 23 | ||
24 | // $Id: Remember.cc,v 1.27 2003/07/10 13:23:09 rathnor Exp $ | 24 | // $Id: Remember.cc,v 1.28 2003/07/20 08:12:36 rathnor Exp $ |
25 | 25 | ||
26 | #include "Remember.hh" | 26 | #include "Remember.hh" |
27 | #include "ClientPattern.hh" | 27 | #include "ClientPattern.hh" |
@@ -93,7 +93,7 @@ private: | |||
93 | Remember::Attribute m_attrib; | 93 | Remember::Attribute m_attrib; |
94 | }; | 94 | }; |
95 | 95 | ||
96 | FbTk::Menu *createRememberMenu(Remember &remember, FluxboxWindow &win) { | 96 | FbTk::Menu *createRememberMenu(Remember &remember, FluxboxWindow &win, bool enabled) { |
97 | // each fluxboxwindow has its own windowmenu | 97 | // each fluxboxwindow has its own windowmenu |
98 | // so we also create a remember menu just for it... | 98 | // so we also create a remember menu just for it... |
99 | BScreen &screen = win.screen(); | 99 | BScreen &screen = win.screen(); |
@@ -101,7 +101,16 @@ FbTk::Menu *createRememberMenu(Remember &remember, FluxboxWindow &win) { | |||
101 | screen.screenNumber(), | 101 | screen.screenNumber(), |
102 | screen.imageControl(), | 102 | screen.imageControl(), |
103 | *screen.layerManager().getLayer(Fluxbox::instance()->getMenuLayer())); | 103 | *screen.layerManager().getLayer(Fluxbox::instance()->getMenuLayer())); |
104 | menu->disableTitle(); | 104 | |
105 | // if enabled, then we want this to be a unavailable menu | ||
106 | if (!enabled) { | ||
107 | FbTk::MenuItem *item = new FbTk::MenuItem("unavailable"); | ||
108 | item->setEnabled(false); | ||
109 | menu->insert(item); | ||
110 | menu->update(); | ||
111 | return menu; | ||
112 | } | ||
113 | |||
105 | // TODO: nls | 114 | // TODO: nls |
106 | menu->insert(new RememberMenuItem("Workspace", remember, win, | 115 | menu->insert(new RememberMenuItem("Workspace", remember, win, |
107 | Remember::REM_WORKSPACE)); | 116 | Remember::REM_WORKSPACE)); |
@@ -676,28 +685,13 @@ void Remember::setupFrame(FluxboxWindow &win) { | |||
676 | 685 | ||
677 | // we don't touch the window if it is a transient | 686 | // we don't touch the window if it is a transient |
678 | // of something else | 687 | // of something else |
679 | int menupos = win.menu().numberOfItems()-2; | ||
680 | if (menupos < -1) | ||
681 | menupos = -1; | ||
682 | |||
683 | if (winclient.transientFor()) { | ||
684 | // still put something in the menu so people don't get confused | ||
685 | // so, we add a disabled item... | ||
686 | // TODO: nls | ||
687 | FbTk::MenuItem *item = new FbTk::MenuItem("Remember..."); | ||
688 | item->setEnabled(false); | ||
689 | win.menu().insert(item, menupos); | ||
690 | win.menu().update(); | ||
691 | return; | ||
692 | } | ||
693 | 688 | ||
694 | // add the menu, this -2 is somewhat dodgy... :-/ | ||
695 | // All windows get the remember menu. | 689 | // All windows get the remember menu. |
696 | // TODO: nls | 690 | // TODO: nls |
697 | win.menu().insert("Remember...", | 691 | win.addExtraMenu("Remember...", createRememberMenu(*this, win, (winclient.transientFor() == 0))); |
698 | createRememberMenu(*this, win), | 692 | |
699 | menupos); | 693 | if (winclient.transientFor()) |
700 | win.menu().reconfigure(); | 694 | return; |
701 | 695 | ||
702 | Application *app = find(winclient); | 696 | Application *app = find(winclient); |
703 | if (app == 0) | 697 | if (app == 0) |