aboutsummaryrefslogtreecommitdiff
path: root/src/MenuCreator.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/MenuCreator.cc')
-rw-r--r--src/MenuCreator.cc41
1 files changed, 12 insertions, 29 deletions
diff --git a/src/MenuCreator.cc b/src/MenuCreator.cc
index 3f184f7..25f99ca 100644
--- a/src/MenuCreator.cc
+++ b/src/MenuCreator.cc
@@ -255,13 +255,13 @@ void translateMenuItem(FbTk::Parser &parse, ParseItem &pitem, FbTk::StringConver
255 if (FbTk::FileUtil::isRegularFile(thisfile.c_str()) && 255 if (FbTk::FileUtil::isRegularFile(thisfile.c_str()) &&
256 (filelist[file_index][0] != '.') && 256 (filelist[file_index][0] != '.') &&
257 (thisfile[thisfile.length() - 1] != '~')) { 257 (thisfile[thisfile.length() - 1] != '~')) {
258 MenuCreator::createFromFile(thisfile, menu); 258 MenuCreator::createFromFile(thisfile, menu, false);
259 } 259 }
260 } 260 }
261 261
262 } else { 262 } else {
263 // inject this file into the current menu 263 // inject this file into the current menu
264 MenuCreator::createFromFile(newfile, menu); 264 MenuCreator::createFromFile(newfile, menu, false);
265 } 265 }
266 266
267 safe_counter--; 267 safe_counter--;
@@ -390,33 +390,8 @@ FbTk::Menu *MenuCreator::createMenu(const string &label, int screen_number) {
390 return menu; 390 return menu;
391} 391}
392 392
393FbTk::Menu *MenuCreator::createFromFile(const string &filename, int screen_number) {
394 string real_filename = FbTk::StringUtil::expandFilename(filename);
395 Fluxbox::instance()->saveMenuFilename(real_filename.c_str());
396
397 FbMenuParser parser(real_filename);
398 if (!parser.isLoaded())
399 return 0;
400
401 startFile();
402 string label;
403 if (!getStart(parser, label, m_stringconvertor)) {
404 endFile();
405 return 0;
406 }
407
408 FbTk::Menu *menu = createMenu(label, screen_number);
409 if (menu != 0)
410 parseMenu(parser, *menu, m_stringconvertor);
411
412 endFile();
413
414 return menu;
415}
416
417
418bool MenuCreator::createFromFile(const string &filename, 393bool MenuCreator::createFromFile(const string &filename,
419 FbTk::Menu &inject_into) { 394 FbTk::Menu &inject_into, bool begin) {
420 string real_filename = FbTk::StringUtil::expandFilename(filename); 395 string real_filename = FbTk::StringUtil::expandFilename(filename);
421 396
422 FbMenuParser parser(real_filename); 397 FbMenuParser parser(real_filename);
@@ -424,6 +399,14 @@ bool MenuCreator::createFromFile(const string &filename,
424 return false; 399 return false;
425 400
426 startFile(); 401 startFile();
402 if (begin) {
403 string label;
404 if (!getStart(parser, label, m_stringconvertor)) {
405 endFile();
406 return false;
407 }
408 inject_into.setLabel(label);
409 }
427 410
428 // save menu filename, so we can check if it changes 411 // save menu filename, so we can check if it changes
429 Fluxbox::instance()->saveMenuFilename(real_filename.c_str()); 412 Fluxbox::instance()->saveMenuFilename(real_filename.c_str());
@@ -467,7 +450,7 @@ FbTk::Menu *MenuCreator::createMenuType(const string &type, int screen_num) {
467 } else if (type == "workspacemenu") { 450 } else if (type == "workspacemenu") {
468 return new WorkspaceMenu(*screen); 451 return new WorkspaceMenu(*screen);
469 } else if (type == "windowmenu") { 452 } else if (type == "windowmenu") {
470 FbTk::Menu *menu = screen->createMenu(""); 453 FbTk::Menu *menu = createMenu("", screen_num);
471 454
472 menu->disableTitle(); // not titlebar 455 menu->disableTitle(); // not titlebar
473 if (screen->windowMenuFilename().empty() || 456 if (screen->windowMenuFilename().empty() ||