summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog2
-rw-r--r--src/MenuCreator.cc20
-rw-r--r--src/MenuCreator.hh5
-rw-r--r--src/Screen.cc4
-rw-r--r--src/Window.cc4
5 files changed, 19 insertions, 16 deletions
diff --git a/ChangeLog b/ChangeLog
index 073d536..eb97024 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,8 @@
1(Format: Year/Month/Day) 1(Format: Year/Month/Day)
2Changes for 0.9.11 2Changes for 0.9.11
3*04/10/04: 3*04/10/04:
4 * Don't require [begin] tag for included menu files (Simon)
5 MenuCreator.hh/cc Screen.cc Window.cc
4 * Fix handling of setlocale return (Thanks Victor Yegorov) 6 * Fix handling of setlocale return (Thanks Victor Yegorov)
5 FbTk/XmbFontImp.cc 7 FbTk/XmbFontImp.cc
6*04/09/30: 8*04/09/30:
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);
diff --git a/src/MenuCreator.hh b/src/MenuCreator.hh
index f916bfd..8e51948 100644
--- a/src/MenuCreator.hh
+++ b/src/MenuCreator.hh
@@ -36,9 +36,10 @@ public:
36 static FbTk::Menu *createMenu(const std::string &label, int screen_num); 36 static FbTk::Menu *createMenu(const std::string &label, int screen_num);
37 static FbTk::Menu *createFromFile(const std::string &filename, int screen_num); 37 static FbTk::Menu *createFromFile(const std::string &filename, int screen_num);
38 static FbTk::Menu *createMenuType(const std::string &label, int screen_num); 38 static FbTk::Menu *createMenuType(const std::string &label, int screen_num);
39 static bool createFromFile(const std::string &filename, FbTk::Menu &inject_into); 39 static bool createFromFile(const std::string &filename, FbTk::Menu &inject_into,
40 bool require_begin);
40 static bool createFromFile(const std::string &filename, FbTk::Menu &inject_into, 41 static bool createFromFile(const std::string &filename, FbTk::Menu &inject_into,
41 FluxboxWindow &win); 42 FluxboxWindow &win, bool require_begin);
42 static bool createWindowMenuItem(const std::string &type, const std::string &label, 43 static bool createWindowMenuItem(const std::string &type, const std::string &label,
43 FbTk::Menu &inject_into, FluxboxWindow &win); 44 FbTk::Menu &inject_into, FluxboxWindow &win);
44}; 45};
diff --git a/src/Screen.cc b/src/Screen.cc
index e06d071..24e75b0 100644
--- a/src/Screen.cc
+++ b/src/Screen.cc
@@ -22,7 +22,7 @@
22// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 22// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23// DEALINGS IN THE SOFTWARE. 23// DEALINGS IN THE SOFTWARE.
24 24
25// $Id: Screen.cc,v 1.293 2004/09/16 10:10:36 fluxgen Exp $ 25// $Id: Screen.cc,v 1.294 2004/10/04 15:37:58 rathnor Exp $
26 26
27 27
28#include "Screen.hh" 28#include "Screen.hh"
@@ -1670,7 +1670,7 @@ void BScreen::initMenu() {
1670 Fluxbox * const fb = Fluxbox::instance(); 1670 Fluxbox * const fb = Fluxbox::instance();
1671 if (fb->getMenuFilename().size() > 0) { 1671 if (fb->getMenuFilename().size() > 0) {
1672 m_rootmenu.reset(MenuCreator::createFromFile(fb->getMenuFilename(), 1672 m_rootmenu.reset(MenuCreator::createFromFile(fb->getMenuFilename(),
1673 screenNumber())); 1673 screenNumber(), true));
1674 1674
1675 } 1675 }
1676 1676
diff --git a/src/Window.cc b/src/Window.cc
index 2185a2b..e95629d 100644
--- a/src/Window.cc
+++ b/src/Window.cc
@@ -22,7 +22,7 @@
22// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 22// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23// DEALINGS IN THE SOFTWARE. 23// DEALINGS IN THE SOFTWARE.
24 24
25// $Id: Window.cc,v 1.300 2004/09/30 18:45:26 akir Exp $ 25// $Id: Window.cc,v 1.301 2004/10/04 15:37:58 rathnor Exp $
26 26
27#include "Window.hh" 27#include "Window.hh"
28 28
@@ -3583,7 +3583,7 @@ void FluxboxWindow::setupMenu() {
3583 menu().disableTitle(); // not titlebar 3583 menu().disableTitle(); // not titlebar
3584 3584
3585 if (screen().windowMenuFilename().empty() || 3585 if (screen().windowMenuFilename().empty() ||
3586 ! MenuCreator::createFromFile(screen().windowMenuFilename(), menu(), *this)) 3586 ! MenuCreator::createFromFile(screen().windowMenuFilename(), menu(), *this, true))
3587 3587
3588 { 3588 {
3589 MenuCreator::createWindowMenuItem("shade", "", menu(), *this); 3589 MenuCreator::createWindowMenuItem("shade", "", menu(), *this);