After committing FS#10093, which will center the currently loaded file in
the WPS, Font, FM Preset and Language selection the theme selection stood
out like a sore thumb.
To this end, I've created FS#10391, which fixes this by remembering each
time a theme is loaded (the actual check is "a config file from
THEME_DIR"). The filename is saved in the global_settings struct, which is
checked when browsing themes. The setting will not be used for anything
else (so no auto-loading of the theme or anything like that).
There is the issue that this will not technically be 100% correct if the
user has changed a theme setting (say, colours or backdrop). I don't think
this will cause any confusion, since a user with that attention to detail
shouldn't forget that he's changed anything. It could also be seen as a
quick way to reset settings to the loaded theme.
In the course of writing FS#10391, I discovered that set_file(const char*
filename, char* setting, int maxlen) from settings.c will in fact modify
the filename argument. Line 1157 sets the location of the last '/' in the
string to \0, which of course wreaks havoc if you try to use the filename
after calling set_file. As far as I can tell, this is completely
unnecessary, since the filename argument is only used in the following
statement: strncasecmp(ROCKBOX_DIR, filename ,strlen(ROCKBOX_DIR)) which
will give the same result regardless where the filename string is
terminated, since it will only compare up to strlen(ROCKBOX_DIR)
FS#10392 simply removes line 1157.
Any objections to committing both of these?
Received on 2009-06-28