Be less smart about when to reload skins as it caused more problems than it was worth. If any theme setting is loading from a .cfg reload all skins. Fixes FS#12410

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31081 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Jonathan Gordon 2011-11-28 10:58:15 +00:00
parent 25bce232f2
commit d66592bad1
2 changed files with 14 additions and 19 deletions

View file

@ -139,29 +139,20 @@ void settings_apply_skins(void)
{ {
FOR_NB_SCREENS(j) FOR_NB_SCREENS(j)
{ {
bool load = false;
get_skin_filename(filename, MAX_PATH, i,j); get_skin_filename(filename, MAX_PATH, i,j);
if (filename[0] && (strcmp(filename, skins[i][j].filename) || skins[i][j].failsafe_loaded)) if (!first_run)
load = true;
else if (first_run || (!filename[0] && !skins[i][j].failsafe_loaded))
load = true;
if (load)
{ {
if (!first_run) skin_data_free_buflib_allocs(&skins[i][j].data);
{
skin_data_free_buflib_allocs(&skins[i][j].data);
#ifdef HAVE_BACKDROP_IMAGE #ifdef HAVE_BACKDROP_IMAGE
if (skins[i][j].data.backdrop_id >= 0) if (skins[i][j].data.backdrop_id >= 0)
skin_backdrop_unload(skins[i][j].data.backdrop_id); skin_backdrop_unload(skins[i][j].data.backdrop_id);
#endif #endif
}
gui_skin_reset(&skins[i][j]);
skins[i][j].gui_wps.display = &screens[j];
if (skin_helpers[i].load_on_boot)
skin_get_gwps(i, j);
} }
gui_skin_reset(&skins[i][j]);
skins[i][j].gui_wps.display = &screens[j];
if (skin_helpers[i].load_on_boot)
skin_get_gwps(i, j);
} }
} }
first_run = false; first_run = false;

View file

@ -268,6 +268,7 @@ bool settings_load_config(const char* file, bool apply)
char* name; char* name;
char* value; char* value;
int i; int i;
bool theme_changed = false;
fd = open_utf8(file, O_RDONLY); fd = open_utf8(file, O_RDONLY);
if (fd < 0) if (fd < 0)
return false; return false;
@ -275,13 +276,15 @@ bool settings_load_config(const char* file, bool apply)
while (read_line(fd, line, sizeof line) > 0) while (read_line(fd, line, sizeof line) > 0)
{ {
if (!settings_parseline(line, &name, &value)) if (!settings_parseline(line, &name, &value))
continue; continue;
for(i=0; i<nb_settings; i++) for(i=0; i<nb_settings; i++)
{ {
if (settings[i].cfg_name == NULL) if (settings[i].cfg_name == NULL)
continue; continue;
if (!strcasecmp(name,settings[i].cfg_name)) if (!strcasecmp(name,settings[i].cfg_name))
{ {
if (settings[i].flags&F_THEMESETTING)
theme_changed = true;
switch (settings[i].flags&F_T_MASK) switch (settings[i].flags&F_T_MASK)
{ {
case F_T_CUSTOM: case F_T_CUSTOM:
@ -363,7 +366,8 @@ bool settings_load_config(const char* file, bool apply)
{ {
settings_save(); settings_save();
settings_apply(true); settings_apply(true);
settings_apply_skins(); if (theme_changed)
settings_apply_skins();
} }
return true; return true;
} }