From ce8669f0491cf6bdd691d46918a42e3172460dab Mon Sep 17 00:00:00 2001 From: Dan Guzek Date: Mon, 6 Apr 2015 21:18:47 -0400 Subject: [PATCH] default theme doesn't need ThemePrefs.ForceSave() As noted in my previous commit message, I think ThemePrefs.ForceSave() can safely be deprecated. Since many novice themers look to default when learning, I think it's better to use ThemePrefs.Save() as the system was originally designed. I moved the ThemePrefs.Save() call out of ScreenTitleMenu decoration to ScreenOptionsService in. This seems safer to me; Pay/Freeplay never hit ScreenTitleMenu which could be another reason ThemePrefs would never get saved. Additionally, moving the call to ScreenOptionsService in also seems to have fixed a bug where switching themes via the Appearance Options service menu would cause the new theme to inherit all of the previous theme's ini settings. I'm still not entirely sure why. I've done a fair amount of testing with this. I've tried deleting the ThemePrefs.ini file outright and booting fresh into both default and Simply Love. In both cases, the ThemePrefs.ini file is written when StepMania exits or when the user hit ScreenOptionsService, whichever comes first. I've tried switching between various themes, including those that did not use ThemePrefs. I haven't seen any sections being created erroneously and themes that do use ThemePrefs don't seem to inherit the previous theme's settings any longer. Still, it *very* possible that I've missed some edge case(s) and is probably worth a few people testing before merging. --- .../default/BGAnimations/ScreenOptionsService in.lua | 5 +++++ .../BGAnimations/ScreenTitleMenu decorations.lua | 11 ----------- 2 files changed, 5 insertions(+), 11 deletions(-) create mode 100644 Themes/default/BGAnimations/ScreenOptionsService in.lua diff --git a/Themes/default/BGAnimations/ScreenOptionsService in.lua b/Themes/default/BGAnimations/ScreenOptionsService in.lua new file mode 100644 index 0000000000..c5355f0dde --- /dev/null +++ b/Themes/default/BGAnimations/ScreenOptionsService in.lua @@ -0,0 +1,5 @@ +return Def.Actor{ + StartTransitioningCommand=function(self) + ThemePrefs.Save() + end +} \ No newline at end of file diff --git a/Themes/default/BGAnimations/ScreenTitleMenu decorations.lua b/Themes/default/BGAnimations/ScreenTitleMenu decorations.lua index f2288395f7..e942af2272 100644 --- a/Themes/default/BGAnimations/ScreenTitleMenu decorations.lua +++ b/Themes/default/BGAnimations/ScreenTitleMenu decorations.lua @@ -2,17 +2,6 @@ InitUserPrefs(); local t = Def.ActorFrame {} -t[#t+1] = Def.ActorFrame { - OnCommand=function(self) - if not FILEMAN:DoesFileExist("Save/ThemePrefs.ini") then - Trace("ThemePrefs doesn't exist; creating file") - ThemePrefs.ForceSave() - end - - ThemePrefs.Save() - end; -}; - t[#t+1] = StandardDecorationFromFileOptional("Footer","Footer"); t[#t+1] = StandardDecorationFromFileOptional("Logo","Logo"); t[#t+1] = StandardDecorationFromFileOptional("VersionInfo","VersionInfo");