From 48e9c810d769efd733eecd8c3b0ea04b5fb6008e Mon Sep 17 00:00:00 2001 From: rathnor Date: Thu, 16 Sep 2004 14:08:46 +0000 Subject: fix menu creator not using args for some commands --- ChangeLog | 3 +++ src/MenuCreator.cc | 34 ++++++++++++++-------------------- 2 files changed, 17 insertions(+), 20 deletions(-) diff --git a/ChangeLog b/ChangeLog index a508ff6..150eea6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ (Format: Year/Month/Day) Changes for 0.9.11 +*04/09/16: + * Fix restart command not reading its args (Simon) + MenuCreator.cc *04/09/12: * Preliminary support for Composite extension (Simon) - Relies on external compositing manager using _NET_WM_WINDOW_OPACITY diff --git a/src/MenuCreator.cc b/src/MenuCreator.cc index 12bec82..4a72fae 100644 --- a/src/MenuCreator.cc +++ b/src/MenuCreator.cc @@ -20,7 +20,7 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: MenuCreator.cc,v 1.15 2004/09/12 00:31:11 fluxgen Exp $ +// $Id: MenuCreator.cc,v 1.16 2004/09/16 14:08:46 rathnor Exp $ #include "MenuCreator.hh" @@ -278,24 +278,7 @@ static void translateMenuItem(Parser &parse, ParseItem &pitem) { screen->saveMenu(*submenu); } // end of submenu - else if (str_key == "restart") { - FbTk::RefCount restart_fb(CommandParser::instance(). - parseLine("restart")); - if (str_label.empty()) - menu.insert(_FBTEXT(Menu, Restart, "Restart", "Restart Command"), restart_fb); - else - menu.insert(str_label.c_str(), restart_fb); - } // end of restart - else if (str_key == "reconfig") { // reconf - FbTk::RefCount - reconfig_fb_cmd(CommandParser::instance(). - parseLine("reconfigure")); - if (str_label.empty()) - menu.insert(_FBTEXT(Menu, Reconfigure, "Reload Config", "Reload all the configs"), reconfig_fb_cmd); - else - menu.insert(str_label.c_str(), reconfig_fb_cmd); - - } else if (str_key == "stylesdir" || str_key == "stylesmenu") { + else if (str_key == "stylesdir" || str_key == "stylesmenu") { createStyleMenu(menu, str_label, str_key == "stylesmenu" ? str_cmd : str_label); } // end of stylesdir @@ -321,8 +304,19 @@ static void translateMenuItem(Parser &parse, ParseItem &pitem) { // we need to attach command with arguments so command parser can parse it string line = str_key + " " + str_cmd; FbTk::RefCount command(CommandParser::instance().parseLine(line)); - if (*command != 0) + if (*command != 0) { + // special NLS default labels + if (str_label.empty()) { + if (str_key == "reconfig" || str_key == "reconfigure") { + menu.insert(_FBTEXT(Menu, Reconfigure, "Reload Config", "Reload all the configs"), command); + return; + } else if (str_key == "restart") { + menu.insert(_FBTEXT(Menu, Restart, "Restart", "Restart Command"), command); + return; + } + } menu.insert(str_label.c_str(), command); + } } if (menu.numberOfItems() != 0) { FbTk::MenuItem *item = menu.find(menu.numberOfItems() - 1); -- cgit v0.11.2