diff options
author | Christian Soffke <christian.soffke@gmail.com> | 2021-03-01 10:19:20 +0100 |
---|---|---|
committer | Christian Soffke <christian.soffke@gmail.com> | 2021-03-01 13:33:43 +0100 |
commit | 640b14c08ccc885817cc697bfd1cde24479b8126 (patch) | |
tree | 4a0eab3de282afc4136ee51f91ea0bd338457d44 /apps | |
parent | 670812a44a3aed7f142548c2cfa5a5b36381b1a8 (diff) | |
download | rockbox-640b14c08ccc885817cc697bfd1cde24479b8126.tar.gz rockbox-640b14c08ccc885817cc697bfd1cde24479b8126.zip |
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 in 2e3a8c7).
Change-Id: I547fe180f0bac79889bf2c44778bb1cc4f9d4307
Diffstat (limited to 'apps')
-rw-r--r-- | apps/filetypes.c | 2 | ||||
-rw-r--r-- | apps/settings.c | 10 |
2 files changed, 5 insertions, 7 deletions
diff --git a/apps/filetypes.c b/apps/filetypes.c index 280cd8c4b4..0aebc7855b 100644 --- a/apps/filetypes.c +++ b/apps/filetypes.c | |||
@@ -257,6 +257,8 @@ void read_color_theme_file(void) { | |||
257 | for (i = 0; i < MAX_FILETYPES; i++) { | 257 | for (i = 0; i < MAX_FILETYPES; i++) { |
258 | custom_colors[i] = -1; | 258 | custom_colors[i] = -1; |
259 | } | 259 | } |
260 | if (!global_settings.colors_file[0] || global_settings.colors_file[0] == '-') | ||
261 | return; | ||
260 | snprintf(buffer, MAX_PATH, THEME_DIR "/%s.colours", | 262 | snprintf(buffer, MAX_PATH, THEME_DIR "/%s.colours", |
261 | global_settings.colors_file); | 263 | global_settings.colors_file); |
262 | fd = open(buffer, O_RDONLY); | 264 | fd = open(buffer, O_RDONLY); |
diff --git a/apps/settings.c b/apps/settings.c index 1a93a4de54..8b6db13234 100644 --- a/apps/settings.c +++ b/apps/settings.c | |||
@@ -931,13 +931,9 @@ void settings_apply(bool read_disk) | |||
931 | CHART("<icons_init"); | 931 | CHART("<icons_init"); |
932 | 932 | ||
933 | #ifdef HAVE_LCD_COLOR | 933 | #ifdef HAVE_LCD_COLOR |
934 | if (global_settings.colors_file[0] | 934 | CHART(">read_color_theme_file"); |
935 | && global_settings.colors_file[0] != '-') | 935 | read_color_theme_file(); |
936 | { | 936 | CHART("<read_color_theme_file"); |
937 | CHART(">read_color_theme_file"); | ||
938 | read_color_theme_file(); | ||
939 | CHART("<read_color_theme_file"); | ||
940 | } | ||
941 | #endif | 937 | #endif |
942 | } | 938 | } |
943 | #ifdef HAVE_LCD_COLOR | 939 | #ifdef HAVE_LCD_COLOR |