fix ~ to work properly in session.menuFile
This commit is contained in:
parent
babf480280
commit
c8c5072fd1
5 changed files with 17 additions and 19 deletions
|
@ -1,5 +1,8 @@
|
||||||
(Format: Year/Month/Day)
|
(Format: Year/Month/Day)
|
||||||
Changes for 0.9.5:
|
Changes for 0.9.5:
|
||||||
|
*03/08/10:
|
||||||
|
* Fix session.menuFile to work with ~ properly (Simon)
|
||||||
|
fluxbox.hh/cc Screen.cc
|
||||||
*03/08/07:
|
*03/08/07:
|
||||||
* Updated fluxbox-generate_menu (Thanks Han)
|
* Updated fluxbox-generate_menu (Thanks Han)
|
||||||
Test before warning, browser details, minor indent issues
|
Test before warning, browser details, minor indent issues
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
// DEALINGS IN THE SOFTWARE.
|
// 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"
|
#include "StringUtil.hh"
|
||||||
|
|
||||||
|
@ -73,7 +73,6 @@ const char *strcasestr(const char *str, const char *ptn) {
|
||||||
returns expanded filename
|
returns expanded filename
|
||||||
*/
|
*/
|
||||||
string expandFilename(const std::string &filename) {
|
string expandFilename(const std::string &filename) {
|
||||||
|
|
||||||
string retval;
|
string retval;
|
||||||
size_t pos = filename.find_first_not_of(" \t");
|
size_t pos = filename.find_first_not_of(" \t");
|
||||||
if (pos != std::string::npos && filename[pos] == '~') {
|
if (pos != std::string::npos && filename[pos] == '~') {
|
||||||
|
@ -84,7 +83,7 @@ string expandFilename(const std::string &filename) {
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
return filename; //return unmodified value
|
return filename; //return unmodified value
|
||||||
|
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
// DEALINGS IN THE SOFTWARE.
|
// 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"
|
#include "Screen.hh"
|
||||||
|
@ -1612,8 +1612,10 @@ void BScreen::initMenu() {
|
||||||
|
|
||||||
bool defaultMenu = true;
|
bool defaultMenu = true;
|
||||||
Fluxbox * const fb = Fluxbox::instance();
|
Fluxbox * const fb = Fluxbox::instance();
|
||||||
if (fb->getMenuFilename()) {
|
if (fb->getMenuFilename().size() > 0) {
|
||||||
ifstream menu_file(fb->getMenuFilename());
|
std::string menufilestr = fb->getMenuFilename();
|
||||||
|
menufilestr = FbTk::StringUtil::expandFilename(menufilestr);
|
||||||
|
ifstream menu_file(menufilestr.c_str());
|
||||||
|
|
||||||
if (!menu_file.fail()) {
|
if (!menu_file.fail()) {
|
||||||
if (! menu_file.eof()) {
|
if (! menu_file.eof()) {
|
||||||
|
@ -1650,11 +1652,11 @@ void BScreen::initMenu() {
|
||||||
i18n->getMessage(
|
i18n->getMessage(
|
||||||
FBNLS::ScreenSet, FBNLS::ScreenEmptyMenuFile,
|
FBNLS::ScreenSet, FBNLS::ScreenEmptyMenuFile,
|
||||||
"%s: Empty menu file"),
|
"%s: Empty menu file"),
|
||||||
fb->getMenuFilename());
|
menufilestr.c_str());
|
||||||
}
|
}
|
||||||
menu_file.close();
|
menu_file.close();
|
||||||
} else
|
} else
|
||||||
perror(fb->getMenuFilename());
|
perror(menufilestr.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (defaultMenu) {
|
if (defaultMenu) {
|
||||||
|
@ -1674,8 +1676,7 @@ void BScreen::initMenu() {
|
||||||
FBNLS::ScreenSet, FBNLS::ScreenExit,
|
FBNLS::ScreenSet, FBNLS::ScreenExit,
|
||||||
"Exit"),
|
"Exit"),
|
||||||
exit_fb);
|
exit_fb);
|
||||||
} else
|
}
|
||||||
fb->saveMenuFilename(fb->getMenuFilename());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// looks through a menufile and adds correct items to the root-menu.
|
/// looks through a menufile and adds correct items to the root-menu.
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
// DEALINGS IN THE SOFTWARE.
|
// 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"
|
#include "fluxbox.hh"
|
||||||
|
|
||||||
|
@ -1625,13 +1625,8 @@ void Fluxbox::load_rc() {
|
||||||
|
|
||||||
XrmValue value;
|
XrmValue value;
|
||||||
char *value_type;
|
char *value_type;
|
||||||
|
if (m_rc_menufile->size() == 0)
|
||||||
if (m_rc_menufile->size()) {
|
|
||||||
*m_rc_menufile = StringUtil::expandFilename(*m_rc_menufile);
|
|
||||||
if (!m_rc_menufile->size())
|
|
||||||
m_rc_menufile.setDefaultValue();
|
m_rc_menufile.setDefaultValue();
|
||||||
} else
|
|
||||||
m_rc_menufile.setDefaultValue();
|
|
||||||
|
|
||||||
if (m_rc_slitlistfile->size() != 0) {
|
if (m_rc_slitlistfile->size() != 0) {
|
||||||
*m_rc_slitlistfile = StringUtil::expandFilename(*m_rc_slitlistfile);
|
*m_rc_slitlistfile = StringUtil::expandFilename(*m_rc_slitlistfile);
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
// DEALINGS IN THE SOFTWARE.
|
// 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
|
#ifndef FLUXBOX_HH
|
||||||
#define FLUXBOX_HH
|
#define FLUXBOX_HH
|
||||||
|
@ -113,7 +113,7 @@ public:
|
||||||
inline const std::vector<Fluxbox::Titlebar>& getTitlebarLeft() const { return *m_rc_titlebar_left; }
|
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 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 const std::string &getSlitlistFilename() const { return *m_rc_slitlistfile; }
|
||||||
inline int colorsPerChannel() const { return *m_rc_colors_per_channel; }
|
inline int colorsPerChannel() const { return *m_rc_colors_per_channel; }
|
||||||
inline int getNumberOfLayers() const { return *m_rc_numlayers; }
|
inline int getNumberOfLayers() const { return *m_rc_numlayers; }
|
||||||
|
|
Loading…
Reference in a new issue