aboutsummaryrefslogtreecommitdiff
path: root/src/MenuCreator.cc
diff options
context:
space:
mode:
authorPavel Labath <pavelo@centrum.sk>2011-07-02 08:22:12 (GMT)
committerPavel Labath <pavelo@centrum.sk>2011-07-02 08:22:12 (GMT)
commit17dfe176b21fa9dd73194f86554f0fbb9dd4c019 (patch)
treed4cf9da313fabedf8a34db0d107023a49bac0dcb /src/MenuCreator.cc
parentc56da3e3ddce80f4e33a55a122611db8debcc8a5 (diff)
downloadfluxbox_pavel-17dfe176b21fa9dd73194f86554f0fbb9dd4c019.zip
fluxbox_pavel-17dfe176b21fa9dd73194f86554f0fbb9dd4c019.tar.bz2
Remove leftovers from old menus in MenuCreator.*
Diffstat (limited to 'src/MenuCreator.cc')
-rw-r--r--src/MenuCreator.cc71
1 files changed, 0 insertions, 71 deletions
diff --git a/src/MenuCreator.cc b/src/MenuCreator.cc
index 70075d1..6a6accc 100644
--- a/src/MenuCreator.cc
+++ b/src/MenuCreator.cc
@@ -64,11 +64,6 @@ using std::list;
64using std::less; 64using std::less;
65using FbTk::AutoReloadHelper; 65using FbTk::AutoReloadHelper;
66 66
67list<string> MenuCreator::encoding_stack;
68list<size_t> MenuCreator::stacksize_stack;
69
70FbTk::StringConvertor MenuCreator::m_stringconvertor(FbTk::StringConvertor::ToFbString);
71
72namespace { 67namespace {
73 68
74std::auto_ptr<FbMenu> createStyleMenu(int screen_number, const string &label, 69std::auto_ptr<FbMenu> createStyleMenu(int screen_number, const string &label,
@@ -542,69 +537,3 @@ bool MenuCreator::createWindowMenuItem(const string &type,
542 537
543 return true; 538 return true;
544} 539}
545
546/* push our encoding-stacksize onto the stack */
547void MenuCreator::startFile() {
548 if (encoding_stack.empty())
549 m_stringconvertor.setSource("");
550 stacksize_stack.push_back(encoding_stack.size());
551}
552
553/**
554 * Pop necessary encodings from the stack
555 * (and endEncoding the final one) to our matching encoding-stacksize.
556 */
557void MenuCreator::endFile() {
558 size_t target_size = stacksize_stack.back();
559 size_t curr_size = encoding_stack.size();
560
561 if (target_size != curr_size) {
562 _FB_USES_NLS;
563 cerr<<_FB_CONSOLETEXT(Menu, ErrorEndEncoding, "Warning: unbalanced [encoding] tags", "User menu file had unbalanced [encoding] tags")<<endl;
564 }
565
566 for (; curr_size > (target_size+1); --curr_size)
567 encoding_stack.pop_back();
568
569 if (curr_size == (target_size+1))
570 endEncoding();
571
572 stacksize_stack.pop_back();
573}
574
575/**
576 * Push the encoding onto the stack, and make it active.
577 */
578void MenuCreator::startEncoding(const string &encoding) {
579 // we push it regardless of whether it's valid, since we
580 // need to stay balanced with the endEncodings.
581 encoding_stack.push_back(encoding);
582
583 // this won't change if it doesn't succeed
584 m_stringconvertor.setSource(encoding);
585}
586
587/**
588 * Pop the encoding from the stack, unless we are at our stacksize limit.
589 * Restore the previous (valid) encoding.
590 */
591void MenuCreator::endEncoding() {
592 size_t min_size = stacksize_stack.back();
593 if (encoding_stack.size() <= min_size) {
594 _FB_USES_NLS;
595 cerr<<_FB_CONSOLETEXT(Menu, ErrorEndEncoding, "Warning: unbalanced [encoding] tags", "User menu file had unbalanced [encoding] tags")<<endl;
596 return;
597 }
598
599 encoding_stack.pop_back();
600 m_stringconvertor.reset();
601
602 list<string>::reverse_iterator it = encoding_stack.rbegin();
603 list<string>::reverse_iterator it_end = encoding_stack.rend();
604 while (it != it_end && !m_stringconvertor.setSource(*it))
605 ++it;
606
607 if (it == it_end)
608 m_stringconvertor.setSource("");
609}
610