summaryrefslogtreecommitdiff
path: root/src/fluxbox.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/fluxbox.cc')
-rw-r--r--src/fluxbox.cc37
1 files changed, 18 insertions, 19 deletions
diff --git a/src/fluxbox.cc b/src/fluxbox.cc
index ec8537c..ae27828 100644
--- a/src/fluxbox.cc
+++ b/src/fluxbox.cc
@@ -522,16 +522,15 @@ void Fluxbox::ungrab() {
522void Fluxbox::setupConfigFiles() { 522void Fluxbox::setupConfigFiles() {
523 523
524 bool create_init = false, create_keys = false, create_menu = false, 524 bool create_init = false, create_keys = false, create_menu = false,
525 create_apps = false, create_overlay = false; 525 create_apps = false, create_overlay = false, create_windowmenu = false;
526 526
527 string dirname = getenv("HOME") + string("/.") + m_RC_PATH + "/"; 527 string dirname = getDefaultDataFilename("");
528 string init_file, keys_file, menu_file, slitlist_file, apps_file, 528 string init_file = getDefaultDataFilename(m_RC_INIT_FILE);
529 overlay_file; 529 string keys_file = getDefaultDataFilename("keys");
530 init_file = dirname + m_RC_INIT_FILE; 530 string menu_file = getDefaultDataFilename("menu");
531 keys_file = dirname + "keys"; 531 string apps_file = getDefaultDataFilename("apps");
532 menu_file = dirname + "menu"; 532 string overlay_file = getDefaultDataFilename("overlay");
533 apps_file = dirname + "apps"; 533 string windowmenu_file = getDefaultDataFilename("windowmenu");
534 overlay_file = dirname + "overlay";
535 534
536 struct stat buf; 535 struct stat buf;
537 536
@@ -549,6 +548,8 @@ void Fluxbox::setupConfigFiles() {
549 create_apps = true; 548 create_apps = true;
550 if (stat(overlay_file.c_str(), &buf)) 549 if (stat(overlay_file.c_str(), &buf))
551 create_overlay = true; 550 create_overlay = true;
551 if (stat(windowmenu_file.c_str(), &buf))
552 create_windowmenu = true;
552 553
553 } else { 554 } else {
554#ifdef DEBUG 555#ifdef DEBUG
@@ -590,6 +591,9 @@ void Fluxbox::setupConfigFiles() {
590 if (create_init) 591 if (create_init)
591 FbTk::FileUtil::copyFile(DEFAULT_INITFILE, init_file.c_str()); 592 FbTk::FileUtil::copyFile(DEFAULT_INITFILE, init_file.c_str());
592 593
594 if (create_windowmenu)
595 FbTk::FileUtil::copyFile(DEFAULT_WINDOWMENU, windowmenu_file.c_str());
596
593#define CONFIG_VERSION 8 597#define CONFIG_VERSION 8
594 FbTk::Resource<int> config_version(m_resourcemanager, 0, 598 FbTk::Resource<int> config_version(m_resourcemanager, 0,
595 "session.configVersion", "Session.ConfigVersion"); 599 "session.configVersion", "Session.ConfigVersion");
@@ -1319,18 +1323,14 @@ void Fluxbox::save_rc() {
1319 1323
1320/// @return filename of resource file 1324/// @return filename of resource file
1321string Fluxbox::getRcFilename() { 1325string Fluxbox::getRcFilename() {
1322 1326 if (m_rc_file.empty())
1323 if (m_rc_file.empty()) { // set default filename 1327 return getDefaultDataFilename(m_RC_INIT_FILE);
1324 string defaultfile(getenv("HOME") + string("/.") + m_RC_PATH + string("/") + m_RC_INIT_FILE);
1325 return defaultfile;
1326 }
1327
1328 return m_rc_file; 1328 return m_rc_file;
1329} 1329}
1330 1330
1331/// Provides default filename of data file 1331/// Provides default filename of data file
1332void Fluxbox::getDefaultDataFilename(const char *name, string &filename) const { 1332string Fluxbox::getDefaultDataFilename(const char *name) const {
1333 filename = string(getenv("HOME") + string("/.") + m_RC_PATH + string("/") + name); 1333 return (getenv("HOME") + string("/.") + m_RC_PATH + string("/") + name);
1334} 1334}
1335 1335
1336/// loads resources 1336/// loads resources
@@ -1359,8 +1359,7 @@ void Fluxbox::load_rc() {
1359 if (!m_rc_slitlistfile->empty()) { 1359 if (!m_rc_slitlistfile->empty()) {
1360 *m_rc_slitlistfile = StringUtil::expandFilename(*m_rc_slitlistfile); 1360 *m_rc_slitlistfile = StringUtil::expandFilename(*m_rc_slitlistfile);
1361 } else { 1361 } else {
1362 string filename; 1362 string filename = getDefaultDataFilename("slitlist");
1363 getDefaultDataFilename("slitlist", filename);
1364 m_rc_slitlistfile.setFromString(filename.c_str()); 1363 m_rc_slitlistfile.setFromString(filename.c_str());
1365 } 1364 }
1366 1365