aboutsummaryrefslogtreecommitdiff
path: root/src/MenuCreator.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/MenuCreator.cc')
-rw-r--r--src/MenuCreator.cc20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/MenuCreator.cc b/src/MenuCreator.cc
index 4a72fae..964fc74 100644
--- a/src/MenuCreator.cc
+++ b/src/MenuCreator.cc
@@ -20,7 +20,7 @@
20// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 20// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21// DEALINGS IN THE SOFTWARE. 21// DEALINGS IN THE SOFTWARE.
22 22
23// $Id: MenuCreator.cc,v 1.16 2004/09/16 14:08:46 rathnor Exp $ 23// $Id: MenuCreator.cc,v 1.17 2004/10/04 15:37:58 rathnor Exp $
24 24
25#include "MenuCreator.hh" 25#include "MenuCreator.hh"
26 26
@@ -244,14 +244,14 @@ static void translateMenuItem(Parser &parse, ParseItem &pitem) {
244 if (FbTk::Directory::isRegularFile(thisfile) && 244 if (FbTk::Directory::isRegularFile(thisfile) &&
245 (filelist[file_index][0] != '.') && 245 (filelist[file_index][0] != '.') &&
246 (thisfile[thisfile.length() - 1] != '~')) { 246 (thisfile[thisfile.length() - 1] != '~')) {
247 MenuCreator::createFromFile(thisfile, menu); 247 MenuCreator::createFromFile(thisfile, menu, false);
248 Fluxbox::instance()->saveMenuFilename(thisfile.c_str()); 248 Fluxbox::instance()->saveMenuFilename(thisfile.c_str());
249 } 249 }
250 } 250 }
251 251
252 } else { 252 } else {
253 // inject this file into the current menu 253 // inject this file into the current menu
254 MenuCreator::createFromFile(newfile, menu); 254 MenuCreator::createFromFile(newfile, menu, false);
255 Fluxbox::instance()->saveMenuFilename(newfile.c_str()); 255 Fluxbox::instance()->saveMenuFilename(newfile.c_str());
256 } 256 }
257 257
@@ -379,7 +379,7 @@ bool getStart(FbMenuParser &parser, std::string &label) {
379 return true; 379 return true;
380} 380}
381 381
382FbTk::Menu *MenuCreator::createFromFile(const std::string &filename, int screen_number) { 382FbTk::Menu *MenuCreator::createFromFile(const std::string &filename, int screen_number, bool require_begin) {
383 std::string real_filename = FbTk::StringUtil::expandFilename(filename); 383 std::string real_filename = FbTk::StringUtil::expandFilename(filename);
384 FbMenuParser parser(real_filename); 384 FbMenuParser parser(real_filename);
385 if (!parser.isLoaded()) 385 if (!parser.isLoaded())
@@ -388,7 +388,7 @@ FbTk::Menu *MenuCreator::createFromFile(const std::string &filename, int screen_
388 Fluxbox::instance()->saveMenuFilename(real_filename.c_str()); 388 Fluxbox::instance()->saveMenuFilename(real_filename.c_str());
389 389
390 std::string label; 390 std::string label;
391 if (!getStart(parser, label)) 391 if (require_begin && !getStart(parser, label))
392 return 0; 392 return 0;
393 393
394 FbTk::Menu *menu = createMenu(label, screen_number); 394 FbTk::Menu *menu = createMenu(label, screen_number);
@@ -399,8 +399,8 @@ FbTk::Menu *MenuCreator::createFromFile(const std::string &filename, int screen_
399} 399}
400 400
401 401
402bool MenuCreator::createFromFile(const std::string &filename, 402bool MenuCreator::createFromFile(const std::string &filename,
403 FbTk::Menu &inject_into) { 403 FbTk::Menu &inject_into, bool require_begin) {
404 404
405 std::string real_filename = FbTk::StringUtil::expandFilename(filename); 405 std::string real_filename = FbTk::StringUtil::expandFilename(filename);
406 FbMenuParser parser(real_filename); 406 FbMenuParser parser(real_filename);
@@ -408,7 +408,7 @@ bool MenuCreator::createFromFile(const std::string &filename,
408 return false; 408 return false;
409 409
410 std::string label; 410 std::string label;
411 if (!getStart(parser, label)) 411 if (require_begin && !getStart(parser, label))
412 return false; 412 return false;
413 413
414 parseMenu(parser, inject_into); 414 parseMenu(parser, inject_into);
@@ -418,7 +418,7 @@ bool MenuCreator::createFromFile(const std::string &filename,
418 418
419bool MenuCreator::createFromFile(const std::string &filename, 419bool MenuCreator::createFromFile(const std::string &filename,
420 FbTk::Menu &inject_into, 420 FbTk::Menu &inject_into,
421 FluxboxWindow &win) { 421 FluxboxWindow &win, bool require_begin) {
422 std::string real_filename = FbTk::StringUtil::expandFilename(filename); 422 std::string real_filename = FbTk::StringUtil::expandFilename(filename);
423 FbMenuParser parser(real_filename); 423 FbMenuParser parser(real_filename);
424 if (!parser.isLoaded()) 424 if (!parser.isLoaded())
@@ -426,7 +426,7 @@ bool MenuCreator::createFromFile(const std::string &filename,
426 426
427 std::string label; 427 std::string label;
428 428
429 if (!getStart(parser, label)) 429 if (require_begin && !getStart(parser, label))
430 return false; 430 return false;
431 431
432 parseWindowMenu(parser, inject_into, win); 432 parseWindowMenu(parser, inject_into, win);