all repos — fluxbox @ c8c5072fd1a542cc3783cb5b32e5e4b68e45efe7

custom fork of the fluxbox windowmanager

fix ~ to work properly in session.menuFile
rathnor rathnor
commit

c8c5072fd1a542cc3783cb5b32e5e4b68e45efe7

parent

babf480280200fa4af3d8ab917a9f9ad76a6309c

5 files changed, 17 insertions(+), 19 deletions(-)

jump to
M ChangeLogChangeLog

@@ -1,5 +1,8 @@

(Format: Year/Month/Day) Changes for 0.9.5: +*03/08/10: + * Fix session.menuFile to work with ~ properly (Simon) + fluxbox.hh/cc Screen.cc *03/08/07: * Updated fluxbox-generate_menu (Thanks Han) Test before warning, browser details, minor indent issues
M src/FbTk/StringUtil.ccsrc/FbTk/StringUtil.cc

@@ -19,7 +19,7 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING

// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: StringUtil.cc,v 1.3 2003/07/01 01:49:13 rathnor Exp $ +// $Id: StringUtil.cc,v 1.4 2003/08/10 12:50:04 rathnor Exp $ #include "StringUtil.hh"

@@ -73,7 +73,6 @@ if ~ then expand it to home of user

returns expanded filename */ string expandFilename(const std::string &filename) { - string retval; size_t pos = filename.find_first_not_of(" \t"); if (pos != std::string::npos && filename[pos] == '~') {

@@ -84,7 +83,7 @@ retval += static_cast<const char *>(filename.c_str() + pos + 1);

} } else return filename; //return unmodified value - + return retval; }
M src/Screen.ccsrc/Screen.cc

@@ -22,7 +22,7 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING

// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: Screen.cc,v 1.212 2003/08/04 12:50:06 fluxgen Exp $ +// $Id: Screen.cc,v 1.213 2003/08/10 12:50:04 rathnor Exp $ #include "Screen.hh"

@@ -1612,8 +1612,10 @@ m_rootmenu.reset(createMenuFromScreen(*this));

bool defaultMenu = true; Fluxbox * const fb = Fluxbox::instance(); - if (fb->getMenuFilename()) { - ifstream menu_file(fb->getMenuFilename()); + if (fb->getMenuFilename().size() > 0) { + std::string menufilestr = fb->getMenuFilename(); + menufilestr = FbTk::StringUtil::expandFilename(menufilestr); + ifstream menu_file(menufilestr.c_str()); if (!menu_file.fail()) { if (! menu_file.eof()) {

@@ -1650,11 +1652,11 @@ fprintf(stderr,

i18n->getMessage( FBNLS::ScreenSet, FBNLS::ScreenEmptyMenuFile, "%s: Empty menu file"), - fb->getMenuFilename()); + menufilestr.c_str()); } menu_file.close(); } else - perror(fb->getMenuFilename()); + perror(menufilestr.c_str()); } if (defaultMenu) {

@@ -1674,8 +1676,7 @@ m_rootmenu->insert(i18n->getMessage(

FBNLS::ScreenSet, FBNLS::ScreenExit, "Exit"), exit_fb); - } else - fb->saveMenuFilename(fb->getMenuFilename()); + } } /// looks through a menufile and adds correct items to the root-menu.
M src/fluxbox.ccsrc/fluxbox.cc

@@ -22,7 +22,7 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING

// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: fluxbox.cc,v 1.178 2003/08/04 18:16:22 fluxgen Exp $ +// $Id: fluxbox.cc,v 1.179 2003/08/10 12:50:04 rathnor Exp $ #include "fluxbox.hh"

@@ -1625,13 +1625,8 @@ }

XrmValue value; char *value_type; - - if (m_rc_menufile->size()) { - *m_rc_menufile = StringUtil::expandFilename(*m_rc_menufile); - if (!m_rc_menufile->size()) + if (m_rc_menufile->size() == 0) m_rc_menufile.setDefaultValue(); - } else - m_rc_menufile.setDefaultValue(); if (m_rc_slitlistfile->size() != 0) { *m_rc_slitlistfile = StringUtil::expandFilename(*m_rc_slitlistfile);
M src/fluxbox.hhsrc/fluxbox.hh

@@ -22,7 +22,7 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING

// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: fluxbox.hh,v 1.69 2003/07/28 15:06:36 rathnor Exp $ +// $Id: fluxbox.hh,v 1.70 2003/08/10 12:50:04 rathnor Exp $ #ifndef FLUXBOX_HH #define FLUXBOX_HH

@@ -113,7 +113,7 @@ inline const std::vector<Fluxbox::Titlebar>& getTitlebarRight() const { return *m_rc_titlebar_right; }

inline const std::vector<Fluxbox::Titlebar>& getTitlebarLeft() const { return *m_rc_titlebar_left; } inline const std::string &getStyleFilename() const { return *m_rc_stylefile; } - inline const char *getMenuFilename() const { return m_rc_menufile->c_str(); } + inline const std::string &getMenuFilename() const { return *m_rc_menufile; } inline const std::string &getSlitlistFilename() const { return *m_rc_slitlistfile; } inline int colorsPerChannel() const { return *m_rc_colors_per_channel; } inline int getNumberOfLayers() const { return *m_rc_numlayers; }