don't require [begin] in included files
rathnor rathnor
5 files changed,
19 insertions(+),
16 deletions(-)
M
src/MenuCreator.cc
→
src/MenuCreator.cc
@@ -20,7 +20,7 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: MenuCreator.cc,v 1.16 2004/09/16 14:08:46 rathnor Exp $ +// $Id: MenuCreator.cc,v 1.17 2004/10/04 15:37:58 rathnor Exp $ #include "MenuCreator.hh"@@ -244,14 +244,14 @@
if (FbTk::Directory::isRegularFile(thisfile) && (filelist[file_index][0] != '.') && (thisfile[thisfile.length() - 1] != '~')) { - MenuCreator::createFromFile(thisfile, menu); + MenuCreator::createFromFile(thisfile, menu, false); Fluxbox::instance()->saveMenuFilename(thisfile.c_str()); } } } else { // inject this file into the current menu - MenuCreator::createFromFile(newfile, menu); + MenuCreator::createFromFile(newfile, menu, false); Fluxbox::instance()->saveMenuFilename(newfile.c_str()); }@@ -379,7 +379,7 @@ label = pitem.label();
return true; } -FbTk::Menu *MenuCreator::createFromFile(const std::string &filename, int screen_number) { +FbTk::Menu *MenuCreator::createFromFile(const std::string &filename, int screen_number, bool require_begin) { std::string real_filename = FbTk::StringUtil::expandFilename(filename); FbMenuParser parser(real_filename); if (!parser.isLoaded())@@ -388,7 +388,7 @@
Fluxbox::instance()->saveMenuFilename(real_filename.c_str()); std::string label; - if (!getStart(parser, label)) + if (require_begin && !getStart(parser, label)) return 0; FbTk::Menu *menu = createMenu(label, screen_number);@@ -399,8 +399,8 @@ return menu;
} -bool MenuCreator::createFromFile(const std::string &filename, - FbTk::Menu &inject_into) { +bool MenuCreator::createFromFile(const std::string &filename, + FbTk::Menu &inject_into, bool require_begin) { std::string real_filename = FbTk::StringUtil::expandFilename(filename); FbMenuParser parser(real_filename);@@ -408,7 +408,7 @@ if (!parser.isLoaded())
return false; std::string label; - if (!getStart(parser, label)) + if (require_begin && !getStart(parser, label)) return false; parseMenu(parser, inject_into);@@ -418,7 +418,7 @@
bool MenuCreator::createFromFile(const std::string &filename, FbTk::Menu &inject_into, - FluxboxWindow &win) { + FluxboxWindow &win, bool require_begin) { std::string real_filename = FbTk::StringUtil::expandFilename(filename); FbMenuParser parser(real_filename); if (!parser.isLoaded())@@ -426,7 +426,7 @@ return false;
std::string label; - if (!getStart(parser, label)) + if (require_begin && !getStart(parser, label)) return false; parseWindowMenu(parser, inject_into, win);
M
src/MenuCreator.hh
→
src/MenuCreator.hh
@@ -36,9 +36,10 @@ public:
static FbTk::Menu *createMenu(const std::string &label, int screen_num); static FbTk::Menu *createFromFile(const std::string &filename, int screen_num); static FbTk::Menu *createMenuType(const std::string &label, int screen_num); - static bool createFromFile(const std::string &filename, FbTk::Menu &inject_into); + static bool createFromFile(const std::string &filename, FbTk::Menu &inject_into, + bool require_begin); static bool createFromFile(const std::string &filename, FbTk::Menu &inject_into, - FluxboxWindow &win); + FluxboxWindow &win, bool require_begin); static bool createWindowMenuItem(const std::string &type, const std::string &label, FbTk::Menu &inject_into, FluxboxWindow &win); };
M
src/Screen.cc
→
src/Screen.cc
@@ -22,7 +22,7 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: Screen.cc,v 1.293 2004/09/16 10:10:36 fluxgen Exp $ +// $Id: Screen.cc,v 1.294 2004/10/04 15:37:58 rathnor Exp $ #include "Screen.hh"@@ -1670,7 +1670,7 @@
Fluxbox * const fb = Fluxbox::instance(); if (fb->getMenuFilename().size() > 0) { m_rootmenu.reset(MenuCreator::createFromFile(fb->getMenuFilename(), - screenNumber())); + screenNumber(), true)); }
M
src/Window.cc
→
src/Window.cc
@@ -22,7 +22,7 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: Window.cc,v 1.300 2004/09/30 18:45:26 akir Exp $ +// $Id: Window.cc,v 1.301 2004/10/04 15:37:58 rathnor Exp $ #include "Window.hh"@@ -3583,7 +3583,7 @@ menu().removeAll(); // clear old items
menu().disableTitle(); // not titlebar if (screen().windowMenuFilename().empty() || - ! MenuCreator::createFromFile(screen().windowMenuFilename(), menu(), *this)) + ! MenuCreator::createFromFile(screen().windowMenuFilename(), menu(), *this, true)) { MenuCreator::createWindowMenuItem("shade", "", menu(), *this);