diff options
author | Pavel Labath <pavelo@centrum.sk> | 2011-06-12 13:17:47 (GMT) |
---|---|---|
committer | Pavel Labath <pavelo@centrum.sk> | 2011-06-15 23:12:52 (GMT) |
commit | fe4b924bcb7d059e5ca059f88ba863a74c0d8760 (patch) | |
tree | 23b2fb89b1301b586a67edb17bac43b8b0df73f7 | |
parent | ba6a65c3d020e2a57eb805da6ed30d796b383060 (diff) | |
download | fluxbox_pavel-fe4b924bcb7d059e5ca059f88ba863a74c0d8760.zip fluxbox_pavel-fe4b924bcb7d059e5ca059f88ba863a74c0d8760.tar.bz2 |
Factor out "session." from resource names
this reduces typing and it makes more sense in lua, since there the resources are implemented as
hierarchical tables and the topmost table has to be handled a bit specially.
-rw-r--r-- | src/FbTk/LResource.cc | 4 | ||||
-rw-r--r-- | src/FbTk/LResource.hh | 3 | ||||
-rw-r--r-- | src/FbTk/Resource.cc | 18 | ||||
-rw-r--r-- | src/FbTk/Resource.hh | 7 | ||||
-rw-r--r-- | src/fluxbox.cc | 42 | ||||
-rw-r--r-- | src/main.cc | 9 | ||||
-rw-r--r-- | util/fluxbox-update_configs.cc | 58 |
7 files changed, 74 insertions, 67 deletions
diff --git a/src/FbTk/LResource.cc b/src/FbTk/LResource.cc index 5842b65..78511eb 100644 --- a/src/FbTk/LResource.cc +++ b/src/FbTk/LResource.cc | |||
@@ -82,8 +82,8 @@ void LResourceManager::initState(lua::state &l) { | |||
82 | l.setfield(lua::REGISTRYINDEX, make_root); | 82 | l.setfield(lua::REGISTRYINDEX, make_root); |
83 | } | 83 | } |
84 | 84 | ||
85 | LResourceManager::LResourceManager(lua::state &l, const std::string &root) | 85 | LResourceManager::LResourceManager(const std::string &root, lua::state &l) |
86 | : m_l(&l), m_root(root) { | 86 | : ResourceManager_base(root), m_l(&l) { |
87 | l.checkstack(2); | 87 | l.checkstack(2); |
88 | lua::stack_sentry s(l); | 88 | lua::stack_sentry s(l); |
89 | 89 | ||
diff --git a/src/FbTk/LResource.hh b/src/FbTk/LResource.hh index 0853687..185a029 100644 --- a/src/FbTk/LResource.hh +++ b/src/FbTk/LResource.hh | |||
@@ -39,7 +39,7 @@ class LResourceManager: public ResourceManager_base { | |||
39 | public: | 39 | public: |
40 | static void initState(lua::state &l); | 40 | static void initState(lua::state &l); |
41 | 41 | ||
42 | LResourceManager(lua::state &l, const std::string &root); | 42 | LResourceManager(const std::string &root, lua::state &l); |
43 | virtual bool save(const char *filename, const char *); | 43 | virtual bool save(const char *filename, const char *); |
44 | virtual void addResource(Resource_base &r); | 44 | virtual void addResource(Resource_base &r); |
45 | virtual void removeResource(Resource_base &r); | 45 | virtual void removeResource(Resource_base &r); |
@@ -47,7 +47,6 @@ public: | |||
47 | private: | 47 | private: |
48 | 48 | ||
49 | lua::state *m_l; | 49 | lua::state *m_l; |
50 | std::string m_root; | ||
51 | }; | 50 | }; |
52 | 51 | ||
53 | } // end namespace FbTk | 52 | } // end namespace FbTk |
diff --git a/src/FbTk/Resource.cc b/src/FbTk/Resource.cc index fb0f595..37555b3 100644 --- a/src/FbTk/Resource.cc +++ b/src/FbTk/Resource.cc | |||
@@ -82,10 +82,13 @@ void ResourceManager_base::setResourceValue(const string &resname, const string | |||
82 | 82 | ||
83 | } | 83 | } |
84 | 84 | ||
85 | ResourceManager::ResourceManager(const char *filename, bool lock_db) : | 85 | ResourceManager::ResourceManager(const std::string &root, const std::string &alt_root, |
86 | const char *filename, bool lock_db) : | ||
87 | ResourceManager_base(root), | ||
86 | m_db_lock(0), | 88 | m_db_lock(0), |
87 | m_database(0), | 89 | m_database(0), |
88 | m_filename(filename ? filename : "") | 90 | m_filename(filename ? filename : ""), |
91 | m_alt_root(alt_root) | ||
89 | { | 92 | { |
90 | static bool xrm_initialized = false; | 93 | static bool xrm_initialized = false; |
91 | if (!xrm_initialized) { | 94 | if (!xrm_initialized) { |
@@ -131,8 +134,8 @@ bool ResourceManager::load(const char *filename) { | |||
131 | for (; i != i_end; ++i) { | 134 | for (; i != i_end; ++i) { |
132 | 135 | ||
133 | Resource_base *resource = *i; | 136 | Resource_base *resource = *i; |
134 | if (XrmGetResource(**m_database, resource->name().c_str(), | 137 | if (XrmGetResource(**m_database, (m_root + '.' + resource->name()).c_str(), |
135 | resource->altName().c_str(), &value_type, &value)) | 138 | (m_alt_root + '.' + resource->altName()).c_str(), &value_type, &value)) |
136 | resource->setFromString(value.addr); | 139 | resource->setFromString(value.addr); |
137 | else { | 140 | else { |
138 | _FB_USES_NLS; | 141 | _FB_USES_NLS; |
@@ -166,13 +169,12 @@ bool ResourceManager::save(const char *filename, const char *mergefilename) { | |||
166 | // empty database | 169 | // empty database |
167 | XrmDatabaseHelper database; | 170 | XrmDatabaseHelper database; |
168 | 171 | ||
169 | string rc_string; | ||
170 | ResourceList::iterator i = m_resourcelist.begin(); | 172 | ResourceList::iterator i = m_resourcelist.begin(); |
171 | ResourceList::iterator i_end = m_resourcelist.end(); | 173 | ResourceList::iterator i_end = m_resourcelist.end(); |
172 | //write all resources to database | 174 | //write all resources to database |
173 | for (; i != i_end; ++i) { | 175 | for (; i != i_end; ++i) { |
174 | Resource_base *resource = *i; | 176 | Resource_base *resource = *i; |
175 | rc_string = resource->name() + string(": ") + resource->getString(); | 177 | const string &rc_string = m_root + '.' + resource->name() + ": " + resource->getString(); |
176 | XrmPutLineResource(&*database, rc_string.c_str()); | 178 | XrmPutLineResource(&*database, rc_string.c_str()); |
177 | } | 179 | } |
178 | 180 | ||
@@ -248,8 +250,8 @@ void ResourceManager::addResource(Resource_base &r) { | |||
248 | char *value_type; | 250 | char *value_type; |
249 | 251 | ||
250 | // now, load the value for this resource | 252 | // now, load the value for this resource |
251 | if (XrmGetResource(**m_database, r.name().c_str(), | 253 | if (XrmGetResource(**m_database, (m_root + '.' + r.name()).c_str(), |
252 | r.altName().c_str(), &value_type, &value)) { | 254 | (m_alt_root + '.' + r.altName()).c_str(), &value_type, &value)) { |
253 | r.setFromString(value.addr); | 255 | r.setFromString(value.addr); |
254 | } else { | 256 | } else { |
255 | std::cerr<<"Failed to read: "<<r.name()<<std::endl; | 257 | std::cerr<<"Failed to read: "<<r.name()<<std::endl; |
diff --git a/src/FbTk/Resource.hh b/src/FbTk/Resource.hh index 33a6bb2..744178b 100644 --- a/src/FbTk/Resource.hh +++ b/src/FbTk/Resource.hh | |||
@@ -87,6 +87,8 @@ class ResourceManager_base | |||
87 | public: | 87 | public: |
88 | typedef std::list<Resource_base *> ResourceList; | 88 | typedef std::list<Resource_base *> ResourceList; |
89 | 89 | ||
90 | ResourceManager_base(const std::string &root) : m_root(root) {} | ||
91 | |||
90 | virtual ~ResourceManager_base() {} | 92 | virtual ~ResourceManager_base() {} |
91 | 93 | ||
92 | /// Save all resouces registered to this class | 94 | /// Save all resouces registered to this class |
@@ -123,6 +125,7 @@ public: | |||
123 | 125 | ||
124 | protected: | 126 | protected: |
125 | ResourceList m_resourcelist; | 127 | ResourceList m_resourcelist; |
128 | const std::string m_root; | ||
126 | }; | 129 | }; |
127 | 130 | ||
128 | class ResourceManager: public ResourceManager_base | 131 | class ResourceManager: public ResourceManager_base |
@@ -130,7 +133,8 @@ class ResourceManager: public ResourceManager_base | |||
130 | public: | 133 | public: |
131 | // lock specifies if the database should be opened with one level locked | 134 | // lock specifies if the database should be opened with one level locked |
132 | // (useful for constructing inside initial set of constructors) | 135 | // (useful for constructing inside initial set of constructors) |
133 | ResourceManager(const char *filename, bool lock_db); | 136 | ResourceManager(const std::string &root, const std::string &alt_root, |
137 | const char *filename, bool lock_db); | ||
134 | virtual ~ResourceManager(); | 138 | virtual ~ResourceManager(); |
135 | 139 | ||
136 | /// Load all resources registered to this class | 140 | /// Load all resources registered to this class |
@@ -169,6 +173,7 @@ private: | |||
169 | XrmDatabaseHelper *m_database; | 173 | XrmDatabaseHelper *m_database; |
170 | 174 | ||
171 | std::string m_filename; | 175 | std::string m_filename; |
176 | std::string m_alt_root; | ||
172 | }; | 177 | }; |
173 | 178 | ||
174 | 179 | ||
diff --git a/src/fluxbox.cc b/src/fluxbox.cc index 0dc958d..590a946 100644 --- a/src/fluxbox.cc +++ b/src/fluxbox.cc | |||
@@ -233,28 +233,28 @@ Fluxbox::Fluxbox(int argc, char **argv, | |||
233 | const std::string& rc_path, const std::string& rc_filename, bool xsync) | 233 | const std::string& rc_path, const std::string& rc_filename, bool xsync) |
234 | : FbTk::App(dpy_name.c_str()), | 234 | : FbTk::App(dpy_name.c_str()), |
235 | m_fbatoms(FbAtoms::instance()), | 235 | m_fbatoms(FbAtoms::instance()), |
236 | m_resourcemanager(rc_filename.c_str(), true), | 236 | m_resourcemanager("session", "Session", rc_filename.c_str(), true), |
237 | // TODO: shouldn't need a separate one for screen | 237 | // TODO: shouldn't need a separate one for screen |
238 | m_screen_rm(m_resourcemanager), | 238 | m_screen_rm(m_resourcemanager), |
239 | 239 | ||
240 | m_RC_PATH(rc_path), | 240 | m_RC_PATH(rc_path), |
241 | m_RC_INIT_FILE("init"), | 241 | m_RC_INIT_FILE("init"), |
242 | m_rc_ignoreborder(m_resourcemanager, false, "session.ignoreBorder", "Session.IgnoreBorder"), | 242 | m_rc_ignoreborder(m_resourcemanager, false, "ignoreBorder", "IgnoreBorder"), |
243 | m_rc_pseudotrans(m_resourcemanager, false, "session.forcePseudoTransparency", "Session.forcePseudoTransparency"), | 243 | m_rc_pseudotrans(m_resourcemanager, false, "forcePseudoTransparency", "forcePseudoTransparency"), |
244 | m_rc_colors_per_channel(m_resourcemanager, 4, | 244 | m_rc_colors_per_channel(m_resourcemanager, 4, |
245 | "session.colorsPerChannel", "Session.ColorsPerChannel"), | 245 | "colorsPerChannel", "ColorsPerChannel"), |
246 | m_rc_double_click_interval(m_resourcemanager, 250, "session.doubleClickInterval", "Session.DoubleClickInterval"), | 246 | m_rc_double_click_interval(m_resourcemanager, 250, "doubleClickInterval", "DoubleClickInterval"), |
247 | m_rc_tabs_padding(m_resourcemanager, 0, "session.tabPadding", "Session.TabPadding"), | 247 | m_rc_tabs_padding(m_resourcemanager, 0, "tabPadding", "TabPadding"), |
248 | m_rc_stylefile(m_resourcemanager, DEFAULTSTYLE, "session.styleFile", "Session.StyleFile"), | 248 | m_rc_stylefile(m_resourcemanager, DEFAULTSTYLE, "styleFile", "StyleFile"), |
249 | m_rc_styleoverlayfile(m_resourcemanager, m_RC_PATH + "/overlay", "session.styleOverlay", "Session.StyleOverlay"), | 249 | m_rc_styleoverlayfile(m_resourcemanager, m_RC_PATH + "/overlay", "styleOverlay", "StyleOverlay"), |
250 | m_rc_menufile(m_resourcemanager, m_RC_PATH + "/menu", "session.menuFile", "Session.MenuFile"), | 250 | m_rc_menufile(m_resourcemanager, m_RC_PATH + "/menu", "menuFile", "MenuFile"), |
251 | m_rc_keyfile(m_resourcemanager, m_RC_PATH + "/keys", "session.keyFile", "Session.KeyFile"), | 251 | m_rc_keyfile(m_resourcemanager, m_RC_PATH + "/keys", "keyFile", "KeyFile"), |
252 | m_rc_slitlistfile(m_resourcemanager, m_RC_PATH + "/slitlist", "session.slitlistFile", "Session.SlitlistFile"), | 252 | m_rc_slitlistfile(m_resourcemanager, m_RC_PATH + "/slitlist", "slitlistFile", "SlitlistFile"), |
253 | m_rc_appsfile(m_resourcemanager, m_RC_PATH + "/apps", "session.appsFile", "Session.AppsFile"), | 253 | m_rc_appsfile(m_resourcemanager, m_RC_PATH + "/apps", "appsFile", "AppsFile"), |
254 | m_rc_tabs_attach_area(m_resourcemanager, ATTACH_AREA_WINDOW, "session.tabsAttachArea", "Session.TabsAttachArea"), | 254 | m_rc_tabs_attach_area(m_resourcemanager, ATTACH_AREA_WINDOW, "tabsAttachArea", "TabsAttachArea"), |
255 | m_rc_cache_life(m_resourcemanager, 5, "session.cacheLife", "Session.CacheLife"), | 255 | m_rc_cache_life(m_resourcemanager, 5, "cacheLife", "CacheLife"), |
256 | m_rc_cache_max(m_resourcemanager, 200, "session.cacheMax", "Session.CacheMax"), | 256 | m_rc_cache_max(m_resourcemanager, 200, "cacheMax", "CacheMax"), |
257 | m_rc_auto_raise_delay(m_resourcemanager, 250, "session.autoRaiseDelay", "Session.AutoRaiseDelay"), | 257 | m_rc_auto_raise_delay(m_resourcemanager, 250, "autoRaiseDelay", "AutoRaiseDelay"), |
258 | m_masked_window(0), | 258 | m_masked_window(0), |
259 | m_mousescreen(0), | 259 | m_mousescreen(0), |
260 | m_keyscreen(0), | 260 | m_keyscreen(0), |
@@ -399,8 +399,8 @@ Fluxbox::Fluxbox(int argc, char **argv, | |||
399 | for (size_t s = 0; s < screens.size(); s++) { | 399 | for (size_t s = 0; s < screens.size(); s++) { |
400 | std::string sc_nr = FbTk::StringUtil::number2String(screens[s]); | 400 | std::string sc_nr = FbTk::StringUtil::number2String(screens[s]); |
401 | BScreen *screen = new BScreen(m_screen_rm.lock(), | 401 | BScreen *screen = new BScreen(m_screen_rm.lock(), |
402 | std::string("session.screen") + sc_nr, | 402 | std::string("screen") + sc_nr, |
403 | std::string("session.Screen") + sc_nr, | 403 | std::string("Screen") + sc_nr, |
404 | screens[s], ::ResourceLayer::NUM_LAYERS); | 404 | screens[s], ::ResourceLayer::NUM_LAYERS); |
405 | 405 | ||
406 | // already handled | 406 | // already handled |
@@ -1147,7 +1147,7 @@ void Fluxbox::save_rc() { | |||
1147 | for (; it != it_end; ++it) { | 1147 | for (; it != it_end; ++it) { |
1148 | BScreen *screen = *it; | 1148 | BScreen *screen = *it; |
1149 | 1149 | ||
1150 | std::string workspaces_string("session.screen"); | 1150 | std::string workspaces_string("screen"); |
1151 | workspaces_string += FbTk::StringUtil::number2String(screen->screenNumber()); | 1151 | workspaces_string += FbTk::StringUtil::number2String(screen->screenNumber()); |
1152 | workspaces_string += ".workspaceNames: "; | 1152 | workspaces_string += ".workspaceNames: "; |
1153 | 1153 | ||
@@ -1240,10 +1240,10 @@ void Fluxbox::load_rc(BScreen &screen) { | |||
1240 | 1240 | ||
1241 | std::string screen_number = FbTk::StringUtil::number2String(screen.screenNumber()); | 1241 | std::string screen_number = FbTk::StringUtil::number2String(screen.screenNumber()); |
1242 | 1242 | ||
1243 | std::string name_lookup("session.screen"); | 1243 | std::string name_lookup("screen"); |
1244 | name_lookup += screen_number; | 1244 | name_lookup += screen_number; |
1245 | name_lookup += ".workspaceNames"; | 1245 | name_lookup += ".workspaceNames"; |
1246 | std::string class_lookup("session.screen"); | 1246 | std::string class_lookup("screen"); |
1247 | class_lookup += screen_number; | 1247 | class_lookup += screen_number; |
1248 | class_lookup += ".WorkspaceNames"; | 1248 | class_lookup += ".WorkspaceNames"; |
1249 | 1249 | ||
diff --git a/src/main.cc b/src/main.cc index a18ae56..4723c09 100644 --- a/src/main.cc +++ b/src/main.cc | |||
@@ -383,8 +383,8 @@ void updateConfigFilesIfNeeded(const std::string& rc_file) { | |||
383 | 383 | ||
384 | const int CONFIG_VERSION = 13; // TODO: move this to 'defaults.hh' or 'config.h' | 384 | const int CONFIG_VERSION = 13; // TODO: move this to 'defaults.hh' or 'config.h' |
385 | 385 | ||
386 | FbTk::ResourceManager r_mgr(rc_file.c_str(), false); | 386 | FbTk::ResourceManager r_mgr("session", "Session", rc_file.c_str(), false); |
387 | FbTk::IntResource c_version(r_mgr, 0, "session.configVersion", "Session.ConfigVersion"); | 387 | FbTk::IntResource c_version(r_mgr, 0, "configVersion", "ConfigVersion"); |
388 | 388 | ||
389 | if (!r_mgr.load(rc_file.c_str())) { | 389 | if (!r_mgr.load(rc_file.c_str())) { |
390 | _FB_USES_NLS; | 390 | _FB_USES_NLS; |
@@ -416,9 +416,10 @@ void updateConfigFilesIfNeeded(const std::string& rc_file) { | |||
416 | #include "WinButton.hh" | 416 | #include "WinButton.hh" |
417 | int main(int argc, char **argv) { | 417 | int main(int argc, char **argv) { |
418 | 418 | ||
419 | #if 0 | ||
419 | lua::state l; | 420 | lua::state l; |
420 | FbTk::LResourceManager::initState(l); | 421 | FbTk::LResourceManager::initState(l); |
421 | FbTk::LResourceManager man(l, "session"); | 422 | FbTk::LResourceManager man("session", l); |
422 | l.loadstring("session.asdf = {'close', 'close'}; session.q={{1,2,{3,4}},{{z={{5}}}}};"); | 423 | l.loadstring("session.asdf = {'close', 'close'}; session.q={{1,2,{3,4}},{{z={{5}}}}};"); |
423 | l.call(0,0); | 424 | l.call(0,0); |
424 | man.save("/dev/stdout", NULL); | 425 | man.save("/dev/stdout", NULL); |
@@ -426,7 +427,7 @@ int main(int argc, char **argv) { | |||
426 | cout << "asdf: " << asdf.getString() << endl; | 427 | cout << "asdf: " << asdf.getString() << endl; |
427 | man.save("/dev/stdout", NULL); | 428 | man.save("/dev/stdout", NULL); |
428 | return 0; | 429 | return 0; |
429 | 430 | #endif | |
430 | 431 | ||
431 | FbTk::NLSInit("fluxbox.cat"); | 432 | FbTk::NLSInit("fluxbox.cat"); |
432 | 433 | ||
diff --git a/util/fluxbox-update_configs.cc b/util/fluxbox-update_configs.cc index a12ef95..9f9dcfe 100644 --- a/util/fluxbox-update_configs.cc +++ b/util/fluxbox-update_configs.cc | |||
@@ -90,11 +90,11 @@ void update_add_mouse_evens_to_keys(FbTk::ResourceManager& rm, | |||
90 | // different screens? the ability is going away until we make per-screen | 90 | // different screens? the ability is going away until we make per-screen |
91 | // keys files, anyway, so let's just use the first screen's setting | 91 | // keys files, anyway, so let's just use the first screen's setting |
92 | FbTk::BoolResource rc_wheeling(rm, true, | 92 | FbTk::BoolResource rc_wheeling(rm, true, |
93 | "session.screen0.desktopwheeling", | 93 | "screen0.desktopwheeling", |
94 | "Session.Screen0.DesktopWheeling"); | 94 | "Screen0.DesktopWheeling"); |
95 | FbTk::BoolResource rc_reverse(rm, false, | 95 | FbTk::BoolResource rc_reverse(rm, false, |
96 | "session.screen0.reversewheeling", | 96 | "screen0.reversewheeling", |
97 | "Session.Screen0.ReverseWheeling"); | 97 | "Screen0.ReverseWheeling"); |
98 | if (*rc_wheeling) { | 98 | if (*rc_wheeling) { |
99 | if (*rc_reverse) { // if you ask me, this should have been default | 99 | if (*rc_reverse) { // if you ask me, this should have been default |
100 | new_keyfile += "OnDesktop Mouse4 :PrevWorkspace\n"; | 100 | new_keyfile += "OnDesktop Mouse4 :PrevWorkspace\n"; |
@@ -115,7 +115,7 @@ void update_move_groups_entries_to_apps_file(FbTk::ResourceManager& rm, | |||
115 | const FbTk::FbString& keyfilename, const FbTk::FbString& appsfilename) { | 115 | const FbTk::FbString& keyfilename, const FbTk::FbString& appsfilename) { |
116 | 116 | ||
117 | FbTk::StringResource rc_groupfile(rm, "~/.fluxbox/groups", | 117 | FbTk::StringResource rc_groupfile(rm, "~/.fluxbox/groups", |
118 | "session.groupFile", "Session.GroupFile"); | 118 | "groupFile", "GroupFile"); |
119 | string groupfilename = FbTk::StringUtil::expandFilename(*rc_groupfile); | 119 | string groupfilename = FbTk::StringUtil::expandFilename(*rc_groupfile); |
120 | string whole_groupfile = read_file(groupfilename); | 120 | string whole_groupfile = read_file(groupfilename); |
121 | string whole_appsfile = read_file(appsfilename); | 121 | string whole_appsfile = read_file(appsfilename); |
@@ -159,14 +159,14 @@ void update_move_toolbar_wheeling_to_keys_file(FbTk::ResourceManager& rm, | |||
159 | 159 | ||
160 | // scrolling on toolbar needs to match user's toolbar wheeling settings | 160 | // scrolling on toolbar needs to match user's toolbar wheeling settings |
161 | FbTk::StringResource rc_wheeling(rm, "Off", | 161 | FbTk::StringResource rc_wheeling(rm, "Off", |
162 | "session.screen0.iconbar.wheelMode", | 162 | "screen0.iconbar.wheelMode", |
163 | "Session.Screen0.Iconbar.WheelMode"); | 163 | "Screen0.Iconbar.WheelMode"); |
164 | FbTk::BoolResource rc_screen(rm, true, | 164 | FbTk::BoolResource rc_screen(rm, true, |
165 | "session.screen0.desktopwheeling", | 165 | "screen0.desktopwheeling", |
166 | "Session.Screen0.DesktopWheeling"); | 166 | "Screen0.DesktopWheeling"); |
167 | FbTk::BoolResource rc_reverse(rm, false, | 167 | FbTk::BoolResource rc_reverse(rm, false, |
168 | "session.screen0.reversewheeling", | 168 | "screen0.reversewheeling", |
169 | "Session.Screen0.ReverseWheeling"); | 169 | "Screen0.ReverseWheeling"); |
170 | if (strcasecmp((*rc_wheeling).c_str(), "On") == 0 || | 170 | if (strcasecmp((*rc_wheeling).c_str(), "On") == 0 || |
171 | (strcasecmp((*rc_wheeling).c_str(), "Screen") == 0 && *rc_screen)) { | 171 | (strcasecmp((*rc_wheeling).c_str(), "Screen") == 0 && *rc_screen)) { |
172 | keep_changes = true; | 172 | keep_changes = true; |
@@ -196,11 +196,11 @@ void update_move_modkey_to_keys_file(FbTk::ResourceManager& rm, | |||
196 | 196 | ||
197 | // need to match user's resize model | 197 | // need to match user's resize model |
198 | FbTk::StringResource rc_mode(rm, "Bottom", | 198 | FbTk::StringResource rc_mode(rm, "Bottom", |
199 | "session.screen0.resizeMode", | 199 | "screen0.resizeMode", |
200 | "Session.Screen0.ResizeMode"); | 200 | "Screen0.ResizeMode"); |
201 | FbTk::StringResource rc_modkey(rm, "Mod1", | 201 | FbTk::StringResource rc_modkey(rm, "Mod1", |
202 | "session.modKey", | 202 | "modKey", |
203 | "Session.ModKey"); | 203 | "ModKey"); |
204 | 204 | ||
205 | new_keyfile += "OnWindow " + *rc_modkey + | 205 | new_keyfile += "OnWindow " + *rc_modkey + |
206 | " Mouse1 :MacroCmd {Raise} {Focus} {StartMoving}\n"; | 206 | " Mouse1 :MacroCmd {Raise} {Focus} {StartMoving}\n"; |
@@ -229,8 +229,8 @@ void update_window_patterns_for_iconbar(FbTk::ResourceManager& rm, | |||
229 | // it won't get freed, but that's ok | 229 | // it won't get freed, but that's ok |
230 | FbTk::StringResource *rc_mode = | 230 | FbTk::StringResource *rc_mode = |
231 | new FbTk::StringResource(rm, "Workspace", | 231 | new FbTk::StringResource(rm, "Workspace", |
232 | "session.screen0.iconbar.mode", | 232 | "screen0.iconbar.mode", |
233 | "Session.Screen0.Iconbar.Mode"); | 233 | "Screen0.Iconbar.Mode"); |
234 | 234 | ||
235 | std::string mode = FbTk::StringUtil::toLower(**rc_mode); | 235 | std::string mode = FbTk::StringUtil::toLower(**rc_mode); |
236 | if (mode == "none") | 236 | if (mode == "none") |
@@ -260,8 +260,8 @@ void update_move_titlebar_actions_to_keys_file(FbTk::ResourceManager& rm, | |||
260 | new_keyfile += "OnTitlebar Double Mouse1 :Shade\n"; | 260 | new_keyfile += "OnTitlebar Double Mouse1 :Shade\n"; |
261 | new_keyfile += "OnTitlebar Mouse3 :WindowMenu\n"; | 261 | new_keyfile += "OnTitlebar Mouse3 :WindowMenu\n"; |
262 | 262 | ||
263 | FbTk::BoolResource rc_reverse(rm, false,"session.screen0.reversewheeling", "Session.Screen0.ReverseWheeling"); | 263 | FbTk::BoolResource rc_reverse(rm, false,"screen0.reversewheeling", "Screen0.ReverseWheeling"); |
264 | FbTk::StringResource scroll_action(rm, "", "session.screen0.windowScrollAction", "Session.Screen0.WindowScrollAction"); | 264 | FbTk::StringResource scroll_action(rm, "", "screen0.windowScrollAction", "Screen0.WindowScrollAction"); |
265 | if (strcasecmp((*scroll_action).c_str(), "shade") == 0) { | 265 | if (strcasecmp((*scroll_action).c_str(), "shade") == 0) { |
266 | if (*rc_reverse) { | 266 | if (*rc_reverse) { |
267 | new_keyfile += "OnTitlebar Mouse5 :ShadeOn\n"; | 267 | new_keyfile += "OnTitlebar Mouse5 :ShadeOn\n"; |
@@ -307,8 +307,8 @@ void update_disable_icons_in_tabs_for_backwards_compatibility(FbTk::ResourceMana | |||
307 | 307 | ||
308 | FbTk::BoolResource *show = | 308 | FbTk::BoolResource *show = |
309 | new FbTk::BoolResource(rm, false, | 309 | new FbTk::BoolResource(rm, false, |
310 | "session.screen0.tabs.usePixmap", | 310 | "screen0.tabs.usePixmap", |
311 | "Session.Screen0.Tabs.UsePixmap"); | 311 | "Screen0.Tabs.UsePixmap"); |
312 | if (!*show) // only change if the setting didn't already exist | 312 | if (!*show) // only change if the setting didn't already exist |
313 | *show = false; | 313 | *show = false; |
314 | } | 314 | } |
@@ -321,13 +321,13 @@ void update_change_format_of_split_placement_menu(FbTk::ResourceManager& rm, | |||
321 | 321 | ||
322 | FbTk::StringResource *placement = | 322 | FbTk::StringResource *placement = |
323 | new FbTk::StringResource(rm, "BottomRight", | 323 | new FbTk::StringResource(rm, "BottomRight", |
324 | "session.screen0.slit.placement", | 324 | "screen0.slit.placement", |
325 | "Session.Screen0.Slit.Placement"); | 325 | "Screen0.Slit.Placement"); |
326 | 326 | ||
327 | FbTk::StringResource *direction = | 327 | FbTk::StringResource *direction = |
328 | new FbTk::StringResource(rm, "Vertical", | 328 | new FbTk::StringResource(rm, "Vertical", |
329 | "session.screen0.slit.direction", | 329 | "screen0.slit.direction", |
330 | "Session.Screen0.Slit.Direction"); | 330 | "Screen0.Slit.Direction"); |
331 | 331 | ||
332 | if (strcasecmp((**direction).c_str(), "vertical") == 0) { | 332 | if (strcasecmp((**direction).c_str(), "vertical") == 0) { |
333 | if (strcasecmp((**placement).c_str(), "BottomRight") == 0) | 333 | if (strcasecmp((**placement).c_str(), "BottomRight") == 0) |
@@ -556,9 +556,9 @@ int run_updates(int old_version, FbTk::ResourceManager &rm) { | |||
556 | int new_version = old_version; | 556 | int new_version = old_version; |
557 | 557 | ||
558 | FbTk::StringResource rc_keyfile(rm, "~/.fluxbox/keys", | 558 | FbTk::StringResource rc_keyfile(rm, "~/.fluxbox/keys", |
559 | "session.keyFile", "Session.KeyFile"); | 559 | "keyFile", "KeyFile"); |
560 | FbTk::StringResource rc_appsfile(rm, "~/.fluxbox/apps", | 560 | FbTk::StringResource rc_appsfile(rm, "~/.fluxbox/apps", |
561 | "session.appsFile", "Session.AppsFile"); | 561 | "appsFile", "AppsFile"); |
562 | 562 | ||
563 | string appsfilename = FbTk::StringUtil::expandFilename(*rc_appsfile); | 563 | string appsfilename = FbTk::StringUtil::expandFilename(*rc_appsfile); |
564 | string keyfilename = FbTk::StringUtil::expandFilename(*rc_keyfile); | 564 | string keyfilename = FbTk::StringUtil::expandFilename(*rc_keyfile); |
@@ -617,7 +617,7 @@ int main(int argc, char **argv) { | |||
617 | if (rc_filename.empty()) | 617 | if (rc_filename.empty()) |
618 | rc_filename = getenv("HOME") + string("/.fluxbox/init"); | 618 | rc_filename = getenv("HOME") + string("/.fluxbox/init"); |
619 | 619 | ||
620 | FbTk::ResourceManager resource_manager(rc_filename.c_str(),false); | 620 | FbTk::ResourceManager resource_manager("session", "Session", rc_filename.c_str(),false); |
621 | if (!resource_manager.load(rc_filename.c_str())) { | 621 | if (!resource_manager.load(rc_filename.c_str())) { |
622 | // couldn't load rc file | 622 | // couldn't load rc file |
623 | cerr<<_FB_CONSOLETEXT(Fluxbox, CantLoadRCFile, "Failed to load database", "Failed trying to read rc file")<<":"<<rc_filename<<endl; | 623 | cerr<<_FB_CONSOLETEXT(Fluxbox, CantLoadRCFile, "Failed to load database", "Failed trying to read rc file")<<":"<<rc_filename<<endl; |
@@ -634,7 +634,7 @@ int main(int argc, char **argv) { | |||
634 | // I feel like putting this in a separate function for no apparent reason | 634 | // I feel like putting this in a separate function for no apparent reason |
635 | 635 | ||
636 | FbTk::IntResource config_version(resource_manager, 0, | 636 | FbTk::IntResource config_version(resource_manager, 0, |
637 | "session.configVersion", "Session.ConfigVersion"); | 637 | "configVersion", "ConfigVersion"); |
638 | 638 | ||
639 | if (check) { | 639 | if (check) { |
640 | cout << rc_filename << ": " << *config_version << endl | 640 | cout << rc_filename << ": " << *config_version << endl |