aboutsummaryrefslogtreecommitdiff
path: root/src/fluxbox.cc
diff options
context:
space:
mode:
authorPavel Labath <pavelo@centrum.sk>2011-06-16 20:36:18 (GMT)
committerPavel Labath <pavelo@centrum.sk>2011-11-01 09:57:19 (GMT)
commit7c46623b6f990b6e0a93b8424e37967462c4f6e7 (patch)
tree5a7df8b057105b7119f5a6b829c1ef0e9eade230 /src/fluxbox.cc
parent49ad95dd5fd6b6472c7048b155038721a2ea06ad (diff)
downloadfluxbox_pavel-7c46623b6f990b6e0a93b8424e37967462c4f6e7.zip
fluxbox_pavel-7c46623b6f990b6e0a93b8424e37967462c4f6e7.tar.bz2
Make session.screenX.workspace_names a real FbTk::Resource
instead of the add-on hack it was. This also fixes a lot of problems with saving of config.
Diffstat (limited to 'src/fluxbox.cc')
-rw-r--r--src/fluxbox.cc79
1 files changed, 0 insertions, 79 deletions
diff --git a/src/fluxbox.cc b/src/fluxbox.cc
index 0c391dc..162a409 100644
--- a/src/fluxbox.cc
+++ b/src/fluxbox.cc
@@ -1131,36 +1131,6 @@ void Fluxbox::save_rc() {
1131 cerr<<_FB_CONSOLETEXT(Fluxbox, BadRCFile, "rc filename is invalid!", "Bad settings file")<<endl; 1131 cerr<<_FB_CONSOLETEXT(Fluxbox, BadRCFile, "rc filename is invalid!", "Bad settings file")<<endl;
1132 1132
1133 1133
1134 ScreenList::iterator it = m_screen_list.begin();
1135 ScreenList::iterator it_end = m_screen_list.end();
1136 for (; it != it_end; ++it) {
1137 BScreen *screen = *it;
1138
1139 std::string workspaces_string("screen");
1140 workspaces_string += FbTk::StringUtil::number2String(screen->screenNumber());
1141 workspaces_string += ".workspaceNames: ";
1142
1143 // these are static, but may not be saved in the users resource file,
1144 // writing these resources will allow the user to edit them at a later
1145 // time... but loading the defaults before saving allows us to rewrite the
1146 // users changes...
1147
1148 const BScreen::WorkspaceNames& names = screen->getWorkspaceNames();
1149 for (size_t i=0; i < names.size(); i++) {
1150 workspaces_string += FbTk::FbStringUtil::FbStrToLocale(names[i]);
1151 workspaces_string += ',';
1152 }
1153
1154 XrmPutLineResource(&new_rc, workspaces_string.c_str());
1155
1156 }
1157
1158 XrmDatabase old_rc = XrmGetFileDatabase(dbfile.c_str());
1159
1160 XrmMergeDatabases(new_rc, &old_rc);
1161 XrmPutFileDatabase(old_rc, dbfile.c_str());
1162 XrmDestroyDatabase(old_rc);
1163
1164 fbdbg<<__FILE__<<"("<<__LINE__<<"): ------------ SAVING DONE"<<endl; 1134 fbdbg<<__FILE__<<"("<<__LINE__<<"): ------------ SAVING DONE"<<endl;
1165 1135
1166} 1136}
@@ -1218,50 +1188,6 @@ void Fluxbox::load_rc() {
1218 *m_rc_stylefile = DEFAULTSTYLE; 1188 *m_rc_stylefile = DEFAULTSTYLE;
1219} 1189}
1220 1190
1221void Fluxbox::load_rc(BScreen &screen) {
1222 //get resource filename
1223 _FB_USES_NLS;
1224 string dbfile(getRcFilename());
1225
1226 XrmDatabaseHelper database;
1227
1228 // XXX make this a regular resource
1229 database = XrmGetFileDatabase(dbfile.c_str());
1230 if (database==0)
1231 database = XrmGetFileDatabase(DEFAULT_INITFILE);
1232
1233
1234 screen.removeWorkspaceNames();
1235
1236 std::string screen_number = FbTk::StringUtil::number2String(screen.screenNumber());
1237
1238 std::string name_lookup("screen");
1239 name_lookup += screen_number;
1240 name_lookup += ".workspaceNames";
1241 std::string class_lookup("screen");
1242 class_lookup += screen_number;
1243 class_lookup += ".WorkspaceNames";
1244
1245 XrmValue value;
1246 char *value_type;
1247 if (XrmGetResource(*database, name_lookup.c_str(), class_lookup.c_str(), &value_type,
1248 &value)) {
1249
1250 string values(value.addr);
1251 BScreen::WorkspaceNames names;
1252
1253 StringUtil::removeTrailingWhitespace(values);
1254 StringUtil::removeFirstWhitespace(values);
1255 StringUtil::stringtok<BScreen::WorkspaceNames>(names, values, ",");
1256 BScreen::WorkspaceNames::iterator it;
1257 for(it = names.begin(); it != names.end(); it++) {
1258 if (!(*it).empty() && (*it) != "")
1259 screen.addWorkspaceName((*it).c_str());
1260 }
1261
1262 }
1263}
1264
1265void Fluxbox::reconfigure() { 1191void Fluxbox::reconfigure() {
1266 load_rc(); 1192 load_rc();
1267 m_reconfigure_wait = true; 1193 m_reconfigure_wait = true;
@@ -1273,11 +1199,6 @@ void Fluxbox::real_reconfigure() {
1273 1199
1274 FbTk::Transparent::usePseudoTransparent(*m_rc_pseudotrans); 1200 FbTk::Transparent::usePseudoTransparent(*m_rc_pseudotrans);
1275 1201
1276 ScreenList::iterator screen_it = m_screen_list.begin();
1277 ScreenList::iterator screen_it_end = m_screen_list.end();
1278 for (; screen_it != screen_it_end; ++screen_it)
1279 load_rc(*(*screen_it));
1280
1281 STLUtil::forAll(m_screen_list, mem_fun(&BScreen::reconfigure)); 1202 STLUtil::forAll(m_screen_list, mem_fun(&BScreen::reconfigure));
1282 m_key->reconfigure(); 1203 m_key->reconfigure();
1283 STLUtil::forAll(m_atomhandler, mem_fun(&AtomHandler::reconfigure)); 1204 STLUtil::forAll(m_atomhandler, mem_fun(&AtomHandler::reconfigure));