aboutsummaryrefslogtreecommitdiff
path: root/util
diff options
context:
space:
mode:
authorPavel Labath <pavelo@centrum.sk>2011-06-11 11:00:45 (GMT)
committerPavel Labath <pavelo@centrum.sk>2011-11-01 09:52:46 (GMT)
commit8c208459910f1dddcfdeb00567b990eebfc218b8 (patch)
tree47c442f906124306a52e13641d28fc6cd1ac513e /util
parent60cd98604ae0ee62d64e3bc852898f69dae221d4 (diff)
downloadfluxbox_pavel-8c208459910f1dddcfdeb00567b990eebfc218b8.zip
fluxbox_pavel-8c208459910f1dddcfdeb00567b990eebfc218b8.tar.bz2
Simplify FbTk::Resource template class
by outsourcing the conversion from string/lua to the specific type (and back) to a separate class. This change touches a lot of files because the interface of FbTk::Resource changed slightly. However, the changes are minor.
Diffstat (limited to 'util')
-rw-r--r--util/fluxbox-update_configs.cc42
1 files changed, 21 insertions, 21 deletions
diff --git a/util/fluxbox-update_configs.cc b/util/fluxbox-update_configs.cc
index a8052a2..93acb04 100644
--- a/util/fluxbox-update_configs.cc
+++ b/util/fluxbox-update_configs.cc
@@ -89,10 +89,10 @@ void update_add_mouse_evens_to_keys(FbTk::ResourceManager& rm,
89 // hmmm, what are the odds that somebody wants this to be different on 89 // hmmm, what are the odds that somebody wants this to be different on
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::Resource<bool> rc_wheeling(rm, true, 92 FbTk::BoolResource rc_wheeling(rm, true,
93 "session.screen0.desktopwheeling", 93 "session.screen0.desktopwheeling",
94 "Session.Screen0.DesktopWheeling"); 94 "Session.Screen0.DesktopWheeling");
95 FbTk::Resource<bool> rc_reverse(rm, false, 95 FbTk::BoolResource rc_reverse(rm, false,
96 "session.screen0.reversewheeling", 96 "session.screen0.reversewheeling",
97 "Session.Screen0.ReverseWheeling"); 97 "Session.Screen0.ReverseWheeling");
98 if (*rc_wheeling) { 98 if (*rc_wheeling) {
@@ -114,7 +114,7 @@ void update_add_mouse_evens_to_keys(FbTk::ResourceManager& rm,
114void update_move_groups_entries_to_apps_file(FbTk::ResourceManager& rm, 114void 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::Resource<string> rc_groupfile(rm, "~/.fluxbox/groups", 117 FbTk::StringResource rc_groupfile(rm, "~/.fluxbox/groups",
118 "session.groupFile", "Session.GroupFile"); 118 "session.groupFile", "Session.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);
@@ -158,13 +158,13 @@ void update_move_toolbar_wheeling_to_keys_file(FbTk::ResourceManager& rm,
158 bool keep_changes = false; 158 bool keep_changes = false;
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::Resource<string> rc_wheeling(rm, "Off", 161 FbTk::StringResource rc_wheeling(rm, "Off",
162 "session.screen0.iconbar.wheelMode", 162 "session.screen0.iconbar.wheelMode",
163 "Session.Screen0.Iconbar.WheelMode"); 163 "Session.Screen0.Iconbar.WheelMode");
164 FbTk::Resource<bool> rc_screen(rm, true, 164 FbTk::BoolResource rc_screen(rm, true,
165 "session.screen0.desktopwheeling", 165 "session.screen0.desktopwheeling",
166 "Session.Screen0.DesktopWheeling"); 166 "Session.Screen0.DesktopWheeling");
167 FbTk::Resource<bool> rc_reverse(rm, false, 167 FbTk::BoolResource rc_reverse(rm, false,
168 "session.screen0.reversewheeling", 168 "session.screen0.reversewheeling",
169 "Session.Screen0.ReverseWheeling"); 169 "Session.Screen0.ReverseWheeling");
170 if (strcasecmp((*rc_wheeling).c_str(), "On") == 0 || 170 if (strcasecmp((*rc_wheeling).c_str(), "On") == 0 ||
@@ -195,10 +195,10 @@ void update_move_modkey_to_keys_file(FbTk::ResourceManager& rm,
195 new_keyfile += "!mouse actions added by fluxbox-update_configs\n"; 195 new_keyfile += "!mouse actions added by fluxbox-update_configs\n";
196 196
197 // need to match user's resize model 197 // need to match user's resize model
198 FbTk::Resource<string> rc_mode(rm, "Bottom", 198 FbTk::StringResource rc_mode(rm, "Bottom",
199 "session.screen0.resizeMode", 199 "session.screen0.resizeMode",
200 "Session.Screen0.ResizeMode"); 200 "Session.Screen0.ResizeMode");
201 FbTk::Resource<string> rc_modkey(rm, "Mod1", 201 FbTk::StringResource rc_modkey(rm, "Mod1",
202 "session.modKey", 202 "session.modKey",
203 "Session.ModKey"); 203 "Session.ModKey");
204 204
@@ -227,8 +227,8 @@ void update_window_patterns_for_iconbar(FbTk::ResourceManager& rm,
227 227
228 // this needs to survive after going out of scope 228 // this needs to survive after going out of scope
229 // it won't get freed, but that's ok 229 // it won't get freed, but that's ok
230 FbTk::Resource<string> *rc_mode = 230 FbTk::StringResource *rc_mode =
231 new FbTk::Resource<string>(rm, "Workspace", 231 new FbTk::StringResource(rm, "Workspace",
232 "session.screen0.iconbar.mode", 232 "session.screen0.iconbar.mode",
233 "Session.Screen0.Iconbar.Mode"); 233 "Session.Screen0.Iconbar.Mode");
234 234
@@ -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::Resource<bool> rc_reverse(rm, false,"session.screen0.reversewheeling", "Session.Screen0.ReverseWheeling"); 263 FbTk::BoolResource rc_reverse(rm, false,"session.screen0.reversewheeling", "Session.Screen0.ReverseWheeling");
264 FbTk::Resource<std::string> scroll_action(rm, "", "session.screen0.windowScrollAction", "Session.Screen0.WindowScrollAction"); 264 FbTk::StringResource scroll_action(rm, "", "session.screen0.windowScrollAction", "Session.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";
@@ -305,8 +305,8 @@ void update_added_starttabbing_command(FbTk::ResourceManager& rm,
305void update_disable_icons_in_tabs_for_backwards_compatibility(FbTk::ResourceManager& rm, 305void update_disable_icons_in_tabs_for_backwards_compatibility(FbTk::ResourceManager& rm,
306 const FbTk::FbString& keyfilename, const FbTk::FbString& appsfilename) { 306 const FbTk::FbString& keyfilename, const FbTk::FbString& appsfilename) {
307 307
308 FbTk::Resource<bool> *show = 308 FbTk::BoolResource *show =
309 new FbTk::Resource<bool>(rm, false, 309 new FbTk::BoolResource(rm, false,
310 "session.screen0.tabs.usePixmap", 310 "session.screen0.tabs.usePixmap",
311 "Session.Screen0.Tabs.UsePixmap"); 311 "Session.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
@@ -319,13 +319,13 @@ void update_disable_icons_in_tabs_for_backwards_compatibility(FbTk::ResourceMana
319void update_change_format_of_split_placement_menu(FbTk::ResourceManager& rm, 319void update_change_format_of_split_placement_menu(FbTk::ResourceManager& rm,
320 const FbTk::FbString& keyfilename, const FbTk::FbString& appsfilename) { 320 const FbTk::FbString& keyfilename, const FbTk::FbString& appsfilename) {
321 321
322 FbTk::Resource<string> *placement = 322 FbTk::StringResource *placement =
323 new FbTk::Resource<string>(rm, "BottomRight", 323 new FbTk::StringResource(rm, "BottomRight",
324 "session.screen0.slit.placement", 324 "session.screen0.slit.placement",
325 "Session.Screen0.Slit.Placement"); 325 "Session.Screen0.Slit.Placement");
326 326
327 FbTk::Resource<string> *direction = 327 FbTk::StringResource *direction =
328 new FbTk::Resource<string>(rm, "Vertical", 328 new FbTk::StringResource(rm, "Vertical",
329 "session.screen0.slit.direction", 329 "session.screen0.slit.direction",
330 "Session.Screen0.Slit.Direction"); 330 "Session.Screen0.Slit.Direction");
331 331
@@ -555,9 +555,9 @@ const Update UPDATES[] = {
555int run_updates(int old_version, FbTk::ResourceManager &rm) { 555int run_updates(int old_version, FbTk::ResourceManager &rm) {
556 int new_version = old_version; 556 int new_version = old_version;
557 557
558 FbTk::Resource<string> rc_keyfile(rm, "~/.fluxbox/keys", 558 FbTk::StringResource rc_keyfile(rm, "~/.fluxbox/keys",
559 "session.keyFile", "Session.KeyFile"); 559 "session.keyFile", "Session.KeyFile");
560 FbTk::Resource<string> rc_appsfile(rm, "~/.fluxbox/apps", 560 FbTk::StringResource rc_appsfile(rm, "~/.fluxbox/apps",
561 "session.appsFile", "Session.AppsFile"); 561 "session.appsFile", "Session.AppsFile");
562 562
563 string appsfilename = FbTk::StringUtil::expandFilename(*rc_appsfile); 563 string appsfilename = FbTk::StringUtil::expandFilename(*rc_appsfile);
@@ -633,7 +633,7 @@ int main(int argc, char **argv) {
633 // run updates here 633 // run updates here
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::Resource<int> config_version(resource_manager, 0, 636 FbTk::IntResource config_version(resource_manager, 0,
637 "session.configVersion", "Session.ConfigVersion"); 637 "session.configVersion", "Session.ConfigVersion");
638 638
639 if (check) { 639 if (check) {