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-06-16 20:37:47 (GMT)
commit25e1ea47997fc8bd858400cdf89dbe32db97bbcc (patch)
tree95819011a3371d2ce93b68d9e955632b71d52018 /src/fluxbox.cc
parent56ca54a6f0e1c1dd806e9e93579c168b337e438c (diff)
downloadfluxbox_pavel-25e1ea47997fc8bd858400cdf89dbe32db97bbcc.zip
fluxbox_pavel-25e1ea47997fc8bd858400cdf89dbe32db97bbcc.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 635f383..8520298 100644
--- a/src/fluxbox.cc
+++ b/src/fluxbox.cc
@@ -1132,36 +1132,6 @@ void Fluxbox::save_rc() {
1132 cerr<<_FB_CONSOLETEXT(Fluxbox, BadRCFile, "rc filename is invalid!", "Bad settings file")<<endl; 1132 cerr<<_FB_CONSOLETEXT(Fluxbox, BadRCFile, "rc filename is invalid!", "Bad settings file")<<endl;
1133 1133
1134 1134
1135 ScreenList::iterator it = m_screen_list.begin();
1136 ScreenList::iterator it_end = m_screen_list.end();
1137 for (; it != it_end; ++it) {
1138 BScreen *screen = *it;
1139
1140 std::string workspaces_string("screen");
1141 workspaces_string += FbTk::StringUtil::number2String(screen->screenNumber());
1142 workspaces_string += ".workspaceNames: ";
1143
1144 // these are static, but may not be saved in the users resource file,
1145 // writing these resources will allow the user to edit them at a later
1146 // time... but loading the defaults before saving allows us to rewrite the
1147 // users changes...
1148
1149 const BScreen::WorkspaceNames& names = screen->getWorkspaceNames();
1150 for (size_t i=0; i < names.size(); i++) {
1151 workspaces_string += FbTk::FbStringUtil::FbStrToLocale(names[i]);
1152 workspaces_string += ',';
1153 }
1154
1155 XrmPutLineResource(&new_rc, workspaces_string.c_str());
1156
1157 }
1158
1159 XrmDatabase old_rc = XrmGetFileDatabase(dbfile.c_str());
1160
1161 XrmMergeDatabases(new_rc, &old_rc);
1162 XrmPutFileDatabase(old_rc, dbfile.c_str());
1163 XrmDestroyDatabase(old_rc);
1164
1165 fbdbg<<__FILE__<<"("<<__LINE__<<"): ------------ SAVING DONE"<<endl; 1135 fbdbg<<__FILE__<<"("<<__LINE__<<"): ------------ SAVING DONE"<<endl;
1166 1136
1167} 1137}
@@ -1219,50 +1189,6 @@ void Fluxbox::load_rc() {
1219 *m_rc_stylefile = DEFAULTSTYLE; 1189 *m_rc_stylefile = DEFAULTSTYLE;
1220} 1190}
1221 1191
1222void Fluxbox::load_rc(BScreen &screen) {
1223 //get resource filename
1224 _FB_USES_NLS;
1225 string dbfile(getRcFilename());
1226
1227 XrmDatabaseHelper database;
1228
1229 // XXX make this a regular resource
1230 database = XrmGetFileDatabase(dbfile.c_str());
1231 if (database==0)
1232 database = XrmGetFileDatabase(DEFAULT_INITFILE);
1233
1234
1235 screen.removeWorkspaceNames();
1236
1237 std::string screen_number = FbTk::StringUtil::number2String(screen.screenNumber());
1238
1239 std::string name_lookup("screen");
1240 name_lookup += screen_number;
1241 name_lookup += ".workspaceNames";
1242 std::string class_lookup("screen");
1243 class_lookup += screen_number;
1244 class_lookup += ".WorkspaceNames";
1245
1246 XrmValue value;
1247 char *value_type;
1248 if (XrmGetResource(*database, name_lookup.c_str(), class_lookup.c_str(), &value_type,
1249 &value)) {
1250
1251 string values(value.addr);
1252 BScreen::WorkspaceNames names;
1253
1254 StringUtil::removeTrailingWhitespace(values);
1255 StringUtil::removeFirstWhitespace(values);
1256 StringUtil::stringtok<BScreen::WorkspaceNames>(names, values, ",");
1257 BScreen::WorkspaceNames::iterator it;
1258 for(it = names.begin(); it != names.end(); it++) {
1259 if (!(*it).empty() && (*it) != "")
1260 screen.addWorkspaceName((*it).c_str());
1261 }
1262
1263 }
1264}
1265
1266void Fluxbox::reconfigure() { 1192void Fluxbox::reconfigure() {
1267 load_rc(); 1193 load_rc();
1268 m_reconfigure_wait = true; 1194 m_reconfigure_wait = true;
@@ -1274,11 +1200,6 @@ void Fluxbox::real_reconfigure() {
1274 1200
1275 FbTk::Transparent::usePseudoTransparent(*m_rc_pseudotrans); 1201 FbTk::Transparent::usePseudoTransparent(*m_rc_pseudotrans);
1276 1202
1277 ScreenList::iterator screen_it = m_screen_list.begin();
1278 ScreenList::iterator screen_it_end = m_screen_list.end();
1279 for (; screen_it != screen_it_end; ++screen_it)
1280 load_rc(*(*screen_it));
1281
1282 STLUtil::forAll(m_screen_list, mem_fun(&BScreen::reconfigure)); 1203 STLUtil::forAll(m_screen_list, mem_fun(&BScreen::reconfigure));
1283 m_key->reconfigure(); 1204 m_key->reconfigure();
1284 STLUtil::forAll(m_atomhandler, mem_fun(&AtomHandler::reconfigure)); 1205 STLUtil::forAll(m_atomhandler, mem_fun(&AtomHandler::reconfigure));