aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/Screen.cc42
1 files changed, 26 insertions, 16 deletions
diff --git a/src/Screen.cc b/src/Screen.cc
index 5a62820..54432b3 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.199 2003/07/01 12:39:09 fluxgen Exp $ 25// $Id: Screen.cc,v 1.200 2003/07/03 13:57:58 fluxgen Exp $
26 26
27 27
28#include "Screen.hh" 28#include "Screen.hh"
@@ -178,6 +178,25 @@ private:
178 178
179namespace { 179namespace {
180 180
181class StyleMenuItem: public FbTk::MenuItem {
182public:
183 StyleMenuItem(const std::string &label, const std::string &filename):FbTk::MenuItem(label.c_str()),
184 m_filename(FbTk::StringUtil::
185 expandFilename(filename)) {
186 // perform shell style ~ home directory expansion
187 // and insert style
188 FbTk::RefCount<FbTk::Command>
189 setstyle_cmd(new FbCommands::
190 SetStyleCmd(m_filename));
191 setCommand(setstyle_cmd);
192 }
193 bool isSelected() const {
194 return Fluxbox::instance()->getStyleFilename() == m_filename;
195 }
196private:
197 const std::string m_filename;
198};
199
181class AddWorkspaceCmd:public FbTk::Command { 200class AddWorkspaceCmd:public FbTk::Command {
182public: 201public:
183 explicit AddWorkspaceCmd(BScreen &scrn):m_screen(scrn) { } 202 explicit AddWorkspaceCmd(BScreen &scrn):m_screen(scrn) { }
@@ -1745,21 +1764,13 @@ bool BScreen::parseMenuFile(ifstream &file, FbTk::Menu &menu, int &row) {
1745 if (!( str_label.size() && str_cmd.size())) { 1764 if (!( str_label.size() && str_cmd.size())) {
1746 fprintf(stderr, 1765 fprintf(stderr,
1747 i18n-> 1766 i18n->
1748 getMessage( 1767 getMessage(FBNLS::ScreenSet, FBNLS::ScreenSTYLEError,
1749 FBNLS::ScreenSet, FBNLS::ScreenSTYLEError,
1750 "BScreen::parseMenuFile: [style] error, " 1768 "BScreen::parseMenuFile: [style] error, "
1751 "no menu label and/or filename defined\n")); 1769 "no menu label and/or filename defined\n"));
1752 cerr<<"Row: "<<row<<endl; 1770 cerr<<"Row: "<<row<<endl;
1753 } else { 1771 } else
1754 // perform shell style ~ home directory expansion 1772 menu.insert(new StyleMenuItem(str_label, str_cmd));
1755 // and insert style 1773
1756 FbTk::RefCount<FbTk::Command>
1757 setstyle_cmd(new FbCommands::
1758 SetStyleCmd(FbTk::StringUtil::
1759 expandFilename(str_cmd)));
1760 menu.insert(str_label.c_str(), setstyle_cmd);
1761
1762 }
1763 } else if (str_key == "config") { 1774 } else if (str_key == "config") {
1764 if (! str_label.size()) { 1775 if (! str_label.size()) {
1765 fprintf(stderr, 1776 fprintf(stderr,
@@ -2055,9 +2066,8 @@ void BScreen::createStyleMenu(FbTk::Menu &menu,
2055 strncpy(style + slen + 1, filelist[file_index].c_str(), nlen + 1); 2066 strncpy(style + slen + 1, filelist[file_index].c_str(), nlen + 1);
2056 2067
2057 if ( !stat(style, &statbuf) && S_ISREG(statbuf.st_mode)) { 2068 if ( !stat(style, &statbuf) && S_ISREG(statbuf.st_mode)) {
2058 FbTk::RefCount<FbTk::Command> setstyle_cmd(new FbCommands:: 2069 FbTk::MenuItem *item = new StyleMenuItem(filelist[file_index], style);
2059 SetStyleCmd(style)); 2070 menu.insert(item);
2060 menu.insert(filelist[file_index].c_str(), setstyle_cmd);
2061 } 2071 }
2062 } 2072 }
2063 // update menu graphics 2073 // update menu graphics