From ffbf15dd45734c06a27896a54b1ab62adb8918a0 Mon Sep 17 00:00:00 2001 From: fluxgen Date: Wed, 29 May 2002 06:22:31 +0000 Subject: slit order filename --- src/fluxbox.cc | 23 +++++++++++++++++++++-- src/fluxbox.hh | 9 ++++++--- 2 files changed, 27 insertions(+), 5 deletions(-) diff --git a/src/fluxbox.cc b/src/fluxbox.cc index 34752a3..3fcf743 100644 --- a/src/fluxbox.cc +++ b/src/fluxbox.cc @@ -22,7 +22,7 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: fluxbox.cc,v 1.59 2002/05/24 13:25:25 fluxgen Exp $ +// $Id: fluxbox.cc,v 1.60 2002/05/29 06:22:31 fluxgen Exp $ //Use GNU extensions #ifndef _GNU_SOURCE @@ -300,6 +300,7 @@ m_rc_colors_per_channel(m_resourcemanager, 4, "session.colorsPerChannel", "Sessi m_rc_stylefile(m_resourcemanager, "", "session.styleFile", "Session.StyleFile"), m_rc_menufile(m_resourcemanager, DEFAULTMENU, "session.menuFile", "Session.MenuFile"), m_rc_keyfile(m_resourcemanager, DEFAULTKEYSFILE, "session.keyFile", "Session.KeyFile"), +m_rc_slitlistfile(m_resourcemanager, "", "session.slitlistFile", "Session.SlitlistFile"), m_rc_titlebar_left(m_resourcemanager, TitlebarList(&m_titlebar_left[0], &m_titlebar_left[1]), "session.titlebar.left", "Session.Titlebar.Left"), m_rc_titlebar_right(m_resourcemanager, TitlebarList(&m_titlebar_right[0], &m_titlebar_right[3]), "session.titlebar.right", "Session.Titlebar.Right"), m_rc_cache_life(m_resourcemanager, 5, "session.cacheLife", "Session.CacheLife"), @@ -415,7 +416,7 @@ void Fluxbox::setupConfigFiles() { createInit = createKeys = createMenu = false; string dirname = getenv("HOME")+string("/.")+string(RC_PATH) + "/"; - string initFile, keysFile, menuFile; + string initFile, keysFile, menuFile, slitlistFile; initFile = dirname+RC_INIT_FILE; keysFile = dirname+"keys"; menuFile = dirname+"menu"; @@ -1923,6 +1924,13 @@ char *Fluxbox::getRcFilename() { return dbfile; } +//-------- getDefaultDataFilename ------------- +// Provides default filename of data file +//--------------------------------------------- +void Fluxbox::getDefaultDataFilename(char *name, string &filename) { + filename = string(getenv("HOME")+string("/.")+RC_PATH+string("/")+name); +} + void Fluxbox::load_rc(void) { XrmDatabaseHelper database; @@ -1952,6 +1960,17 @@ void Fluxbox::load_rc(void) { delete [] tmpvar; } else m_rc_menufile.setDefaultValue(); + + if (m_rc_slitlistfile->size()) { + char *tmpvar =StringUtil::expandFilename(m_rc_slitlistfile->c_str()); + *m_rc_slitlistfile = (tmpvar==0 ? "" : tmpvar); + delete [] tmpvar; + } + if (!m_rc_slitlistfile->size()) { + string filename; + getDefaultDataFilename("slitlist", filename); + m_rc_slitlistfile.setFromString(filename.c_str()); + } if (*m_rc_colors_per_channel < 2) *m_rc_colors_per_channel = 2; diff --git a/src/fluxbox.hh b/src/fluxbox.hh index 73daa94..137d818 100644 --- a/src/fluxbox.hh +++ b/src/fluxbox.hh @@ -22,7 +22,7 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: fluxbox.hh,v 1.19 2002/05/17 11:07:36 fluxgen Exp $ +// $Id: fluxbox.hh,v 1.20 2002/05/29 06:22:31 fluxgen Exp $ #ifndef FLUXBOX_HH #define FLUXBOX_HH @@ -104,7 +104,7 @@ public: inline const char *getStyleFilename(void) const { return m_rc_stylefile->c_str(); } inline const char *getMenuFilename(void) const { return m_rc_menufile->c_str(); } - + inline const std::string &getSlitlistFilename(void) const { return *m_rc_slitlistfile; } inline int getColorsPerChannel(void) const { return *m_rc_colors_per_channel; } inline const timeval &getAutoRaiseDelay(void) const { return resource.auto_raise_delay; } @@ -124,6 +124,7 @@ public: void saveStyleFilename(const char *val) { m_rc_stylefile = (val == 0 ? "" : val); } void saveMenuFilename(const char *); void saveTitlebarFilename(const char *); + void saveSlitlistFilename(const char *val) { m_rc_slitlistfile = (val == 0 ? "" : val); } void saveMenuSearch(Window, Basemenu *); void saveWindowSearch(Window, FluxboxWindow *); void saveToolbarSearch(Window, Toolbar *); @@ -188,7 +189,7 @@ private: Resource m_rc_tabs, m_rc_iconbar; Resource m_rc_colors_per_channel; Resource m_rc_stylefile, - m_rc_menufile, m_rc_keyfile; + m_rc_menufile, m_rc_keyfile, m_rc_slitlistfile; Resource m_rc_titlebar_left, m_rc_titlebar_right; Resource m_rc_cache_life, m_rc_cache_max; @@ -229,12 +230,14 @@ private: char *rc_file, **argv; int argc; Keys *key; + std::string slitlist_path; //default arguments for titlebar left and right static Fluxbox::Titlebar m_titlebar_left[], m_titlebar_right[]; protected: Fluxbox(int, char **, char * = 0, char * = 0); char *getRcFilename(); + void getDefaultDataFilename(char *, std::string &); void load_rc(void); void reload_rc(void); -- cgit v0.11.2