diff options
author | rathnor <rathnor> | 2003-08-10 12:50:04 (GMT) |
---|---|---|
committer | rathnor <rathnor> | 2003-08-10 12:50:04 (GMT) |
commit | c8c5072fd1a542cc3783cb5b32e5e4b68e45efe7 (patch) | |
tree | 29e6bab43c762e475844e8d42080ffd939db870b /src | |
parent | babf480280200fa4af3d8ab917a9f9ad76a6309c (diff) | |
download | fluxbox_paul-c8c5072fd1a542cc3783cb5b32e5e4b68e45efe7.zip fluxbox_paul-c8c5072fd1a542cc3783cb5b32e5e4b68e45efe7.tar.bz2 |
fix ~ to work properly in session.menuFile
Diffstat (limited to 'src')
-rw-r--r-- | src/FbTk/StringUtil.cc | 5 | ||||
-rw-r--r-- | src/Screen.cc | 15 | ||||
-rw-r--r-- | src/fluxbox.cc | 9 | ||||
-rw-r--r-- | src/fluxbox.hh | 4 |
4 files changed, 14 insertions, 19 deletions
diff --git a/src/FbTk/StringUtil.cc b/src/FbTk/StringUtil.cc index 761014f..8532662 100644 --- a/src/FbTk/StringUtil.cc +++ b/src/FbTk/StringUtil.cc | |||
@@ -19,7 +19,7 @@ | |||
19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | 19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
20 | // DEALINGS IN THE SOFTWARE. | 20 | // DEALINGS IN THE SOFTWARE. |
21 | 21 | ||
22 | // $Id: StringUtil.cc,v 1.3 2003/07/01 01:49:13 rathnor Exp $ | 22 | // $Id: StringUtil.cc,v 1.4 2003/08/10 12:50:04 rathnor Exp $ |
23 | 23 | ||
24 | #include "StringUtil.hh" | 24 | #include "StringUtil.hh" |
25 | 25 | ||
@@ -73,7 +73,6 @@ const char *strcasestr(const char *str, const char *ptn) { | |||
73 | returns expanded filename | 73 | returns expanded filename |
74 | */ | 74 | */ |
75 | string expandFilename(const std::string &filename) { | 75 | string expandFilename(const std::string &filename) { |
76 | |||
77 | string retval; | 76 | string retval; |
78 | size_t pos = filename.find_first_not_of(" \t"); | 77 | size_t pos = filename.find_first_not_of(" \t"); |
79 | if (pos != std::string::npos && filename[pos] == '~') { | 78 | if (pos != std::string::npos && filename[pos] == '~') { |
@@ -84,7 +83,7 @@ string expandFilename(const std::string &filename) { | |||
84 | } | 83 | } |
85 | } else | 84 | } else |
86 | return filename; //return unmodified value | 85 | return filename; //return unmodified value |
87 | 86 | ||
88 | return retval; | 87 | return retval; |
89 | } | 88 | } |
90 | 89 | ||
diff --git a/src/Screen.cc b/src/Screen.cc index 0ec1655..593dd69 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.212 2003/08/04 12:50:06 fluxgen Exp $ | 25 | // $Id: Screen.cc,v 1.213 2003/08/10 12:50:04 rathnor Exp $ |
26 | 26 | ||
27 | 27 | ||
28 | #include "Screen.hh" | 28 | #include "Screen.hh" |
@@ -1612,8 +1612,10 @@ void BScreen::initMenu() { | |||
1612 | 1612 | ||
1613 | bool defaultMenu = true; | 1613 | bool defaultMenu = true; |
1614 | Fluxbox * const fb = Fluxbox::instance(); | 1614 | Fluxbox * const fb = Fluxbox::instance(); |
1615 | if (fb->getMenuFilename()) { | 1615 | if (fb->getMenuFilename().size() > 0) { |
1616 | ifstream menu_file(fb->getMenuFilename()); | 1616 | std::string menufilestr = fb->getMenuFilename(); |
1617 | menufilestr = FbTk::StringUtil::expandFilename(menufilestr); | ||
1618 | ifstream menu_file(menufilestr.c_str()); | ||
1617 | 1619 | ||
1618 | if (!menu_file.fail()) { | 1620 | if (!menu_file.fail()) { |
1619 | if (! menu_file.eof()) { | 1621 | if (! menu_file.eof()) { |
@@ -1650,11 +1652,11 @@ void BScreen::initMenu() { | |||
1650 | i18n->getMessage( | 1652 | i18n->getMessage( |
1651 | FBNLS::ScreenSet, FBNLS::ScreenEmptyMenuFile, | 1653 | FBNLS::ScreenSet, FBNLS::ScreenEmptyMenuFile, |
1652 | "%s: Empty menu file"), | 1654 | "%s: Empty menu file"), |
1653 | fb->getMenuFilename()); | 1655 | menufilestr.c_str()); |
1654 | } | 1656 | } |
1655 | menu_file.close(); | 1657 | menu_file.close(); |
1656 | } else | 1658 | } else |
1657 | perror(fb->getMenuFilename()); | 1659 | perror(menufilestr.c_str()); |
1658 | } | 1660 | } |
1659 | 1661 | ||
1660 | if (defaultMenu) { | 1662 | if (defaultMenu) { |
@@ -1674,8 +1676,7 @@ void BScreen::initMenu() { | |||
1674 | FBNLS::ScreenSet, FBNLS::ScreenExit, | 1676 | FBNLS::ScreenSet, FBNLS::ScreenExit, |
1675 | "Exit"), | 1677 | "Exit"), |
1676 | exit_fb); | 1678 | exit_fb); |
1677 | } else | 1679 | } |
1678 | fb->saveMenuFilename(fb->getMenuFilename()); | ||
1679 | } | 1680 | } |
1680 | 1681 | ||
1681 | /// looks through a menufile and adds correct items to the root-menu. | 1682 | /// looks through a menufile and adds correct items to the root-menu. |
diff --git a/src/fluxbox.cc b/src/fluxbox.cc index 342338c..f910e7b 100644 --- a/src/fluxbox.cc +++ b/src/fluxbox.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: fluxbox.cc,v 1.178 2003/08/04 18:16:22 fluxgen Exp $ | 25 | // $Id: fluxbox.cc,v 1.179 2003/08/10 12:50:04 rathnor Exp $ |
26 | 26 | ||
27 | #include "fluxbox.hh" | 27 | #include "fluxbox.hh" |
28 | 28 | ||
@@ -1625,13 +1625,8 @@ void Fluxbox::load_rc() { | |||
1625 | 1625 | ||
1626 | XrmValue value; | 1626 | XrmValue value; |
1627 | char *value_type; | 1627 | char *value_type; |
1628 | 1628 | if (m_rc_menufile->size() == 0) | |
1629 | if (m_rc_menufile->size()) { | ||
1630 | *m_rc_menufile = StringUtil::expandFilename(*m_rc_menufile); | ||
1631 | if (!m_rc_menufile->size()) | ||
1632 | m_rc_menufile.setDefaultValue(); | 1629 | m_rc_menufile.setDefaultValue(); |
1633 | } else | ||
1634 | m_rc_menufile.setDefaultValue(); | ||
1635 | 1630 | ||
1636 | if (m_rc_slitlistfile->size() != 0) { | 1631 | if (m_rc_slitlistfile->size() != 0) { |
1637 | *m_rc_slitlistfile = StringUtil::expandFilename(*m_rc_slitlistfile); | 1632 | *m_rc_slitlistfile = StringUtil::expandFilename(*m_rc_slitlistfile); |
diff --git a/src/fluxbox.hh b/src/fluxbox.hh index 4f32ea3..1d35f83 100644 --- a/src/fluxbox.hh +++ b/src/fluxbox.hh | |||
@@ -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: fluxbox.hh,v 1.69 2003/07/28 15:06:36 rathnor Exp $ | 25 | // $Id: fluxbox.hh,v 1.70 2003/08/10 12:50:04 rathnor Exp $ |
26 | 26 | ||
27 | #ifndef FLUXBOX_HH | 27 | #ifndef FLUXBOX_HH |
28 | #define FLUXBOX_HH | 28 | #define FLUXBOX_HH |
@@ -113,7 +113,7 @@ public: | |||
113 | inline const std::vector<Fluxbox::Titlebar>& getTitlebarLeft() const { return *m_rc_titlebar_left; } | 113 | inline const std::vector<Fluxbox::Titlebar>& getTitlebarLeft() const { return *m_rc_titlebar_left; } |
114 | inline const std::string &getStyleFilename() const { return *m_rc_stylefile; } | 114 | inline const std::string &getStyleFilename() const { return *m_rc_stylefile; } |
115 | 115 | ||
116 | inline const char *getMenuFilename() const { return m_rc_menufile->c_str(); } | 116 | inline const std::string &getMenuFilename() const { return *m_rc_menufile; } |
117 | inline const std::string &getSlitlistFilename() const { return *m_rc_slitlistfile; } | 117 | inline const std::string &getSlitlistFilename() const { return *m_rc_slitlistfile; } |
118 | inline int colorsPerChannel() const { return *m_rc_colors_per_channel; } | 118 | inline int colorsPerChannel() const { return *m_rc_colors_per_channel; } |
119 | inline int getNumberOfLayers() const { return *m_rc_numlayers; } | 119 | inline int getNumberOfLayers() const { return *m_rc_numlayers; } |