Fix inability to reset filetype colors without restarting
0ce42df
prevented read_color_theme_file() from being executed when applying settings (from a cfg file) if the filetype colors setting was set to "-". Resetting custom filetype colors happens in that function though and thus wouldn't work. You had to restart Rockbox for the setting to be applied (at which point read_color_theme_file() is called from filetype_init() which is called by the init() function in main.c) The safety check has been moved from settings.c directly into read_color_theme_file(). This has the added advantage that it will also apply during the init process where there existed no check before (prevents the problem mentioned in2e3a8c7
). Change-Id: I547fe180f0bac79889bf2c44778bb1cc4f9d4307
This commit is contained in:
parent
670812a44a
commit
640b14c08c
2 changed files with 5 additions and 7 deletions
|
@ -257,6 +257,8 @@ void read_color_theme_file(void) {
|
|||
for (i = 0; i < MAX_FILETYPES; i++) {
|
||||
custom_colors[i] = -1;
|
||||
}
|
||||
if (!global_settings.colors_file[0] || global_settings.colors_file[0] == '-')
|
||||
return;
|
||||
snprintf(buffer, MAX_PATH, THEME_DIR "/%s.colours",
|
||||
global_settings.colors_file);
|
||||
fd = open(buffer, O_RDONLY);
|
||||
|
|
|
@ -931,13 +931,9 @@ void settings_apply(bool read_disk)
|
|||
CHART("<icons_init");
|
||||
|
||||
#ifdef HAVE_LCD_COLOR
|
||||
if (global_settings.colors_file[0]
|
||||
&& global_settings.colors_file[0] != '-')
|
||||
{
|
||||
CHART(">read_color_theme_file");
|
||||
read_color_theme_file();
|
||||
CHART("<read_color_theme_file");
|
||||
}
|
||||
CHART(">read_color_theme_file");
|
||||
read_color_theme_file();
|
||||
CHART("<read_color_theme_file");
|
||||
#endif
|
||||
}
|
||||
#ifdef HAVE_LCD_COLOR
|
||||
|
|
Loading…
Reference in a new issue