From a14f4acb0c9ecdb11845a84e6d83b1a7bdbd5c7b Mon Sep 17 00:00:00 2001 From: Magnus Holmgren Date: Sat, 6 Mar 2010 12:14:12 +0000 Subject: Restore the 'read_disk' flag for settings_apply that was removed in r24922. It is still needed to prevent uncessary disk I/O for fonts etc. Should fix FS#11071 (I haven't tested it on a HD-based player). git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25042 a1c6a512-1295-4272-9138-f99709370657 --- apps/gui/quickscreen.c | 4 +-- apps/main.c | 6 ++-- apps/menus/main_menu.c | 2 +- apps/menus/theme_menu.c | 4 +-- apps/settings.c | 76 +++++++++++++++++++++++++------------------------ apps/settings.h | 2 +- 6 files changed, 49 insertions(+), 45 deletions(-) diff --git a/apps/gui/quickscreen.c b/apps/gui/quickscreen.c index 1a22f69341..d092f0b04a 100644 --- a/apps/gui/quickscreen.c +++ b/apps/gui/quickscreen.c @@ -400,7 +400,7 @@ bool quick_screen_quick(int button_enter) if (gui_syncquickscreen_run(&qs, button_enter)) { settings_save(); - settings_apply(); + settings_apply(false); /* make sure repeat/shuffle/any other nasty ones get updated */ if ( oldrepeat != global_settings.repeat_mode && (audio_status() & AUDIO_STATUS_PLAY) ) @@ -437,7 +437,7 @@ bool quick_screen_f3(int button_enter) if (gui_syncquickscreen_run(&qs, button_enter)) { settings_save(); - settings_apply(); + settings_apply(false); } return(0); } diff --git a/apps/main.c b/apps/main.c index dd41559328..e05bd7bdfa 100644 --- a/apps/main.c +++ b/apps/main.c @@ -337,7 +337,7 @@ static void init(void) storage_init(); settings_reset(); settings_load(SETTINGS_ALL); - settings_apply(); + settings_apply(false); init_dircache(true); init_dircache(false); #ifdef HAVE_TAGCACHE @@ -376,6 +376,7 @@ static void init(void) audio_init(); button_clear_queue(); /* Empty the keyboard buffer */ + settings_apply(true); settings_apply_skins(); } @@ -570,7 +571,7 @@ static void init(void) #endif } - settings_apply(); + settings_apply(false); init_dircache(false); #ifdef HAVE_TAGCACHE init_tagcache(); @@ -635,6 +636,7 @@ static void init(void) #ifdef HAVE_HOTSWAP_STORAGE_AS_MAIN check_bootfile(false); /* remember write time and filesize */ #endif + settings_apply(true); settings_apply_skins(); } diff --git a/apps/menus/main_menu.c b/apps/menus/main_menu.c index 2d3a65a7b2..59a72e1ad7 100644 --- a/apps/menus/main_menu.c +++ b/apps/menus/main_menu.c @@ -77,7 +77,7 @@ static int reset_settings(void) case YESNO_YES: settings_reset(); settings_save(); - settings_apply(); + settings_apply(true); settings_apply_skins(); break; case YESNO_NO: diff --git a/apps/menus/theme_menu.c b/apps/menus/theme_menu.c index 7d2a05c67f..4427e4aeca 100644 --- a/apps/menus/theme_menu.c +++ b/apps/menus/theme_menu.c @@ -96,7 +96,7 @@ static int set_color_func(void* color) res = (int)set_color(&screens[SCREEN_MAIN],str(colors[c].lang_id), colors[c].setting, banned_color); settings_save(); - settings_apply(); + settings_apply(false); return res; } @@ -109,7 +109,7 @@ static int reset_color(void) global_settings.lst_color = LCD_DEFAULT_FG; settings_save(); - settings_apply(); + settings_apply(false); return 0; } MENUITEM_FUNCTION(set_bg_col, MENU_FUNC_USEPARAM, ID2P(LANG_BACKGROUND_COLOR), diff --git a/apps/settings.c b/apps/settings.c index 954b7d3dcf..51846fa2b2 100644 --- a/apps/settings.c +++ b/apps/settings.c @@ -360,7 +360,7 @@ bool settings_load_config(const char* file, bool apply) settings_save(); if (apply) { - settings_apply(); + settings_apply(true); settings_apply_skins(); } return true; @@ -741,7 +741,7 @@ void sound_settings_apply(void) } -void settings_apply(void) +void settings_apply(bool read_disk) { char buf[64]; @@ -833,52 +833,54 @@ void settings_apply(void) audiohw_enable_speaker(global_settings.speaker_enabled); #endif + if (read_disk) + { #ifdef HAVE_LCD_BITMAP - /* fonts need to be loaded before the WPS */ - if (global_settings.font_file[0] - && global_settings.font_file[0] != '-') { - snprintf(buf, sizeof buf, FONT_DIR "/%s.fnt", - global_settings.font_file); - if (font_load(NULL, buf) < 0) + /* fonts need to be loaded before the WPS */ + if (global_settings.font_file[0] + && global_settings.font_file[0] != '-') { + snprintf(buf, sizeof buf, FONT_DIR "/%s.fnt", + global_settings.font_file); + if (font_load(NULL, buf) < 0) + font_reset(NULL); + } + else font_reset(NULL); - } - else - font_reset(NULL); #ifdef HAVE_REMOTE_LCD - if ( global_settings.remote_font_file[0] - && global_settings.remote_font_file[0] != '-') { - snprintf(buf, sizeof buf, FONT_DIR "/%s.fnt", - global_settings.remote_font_file); - if (font_load_remoteui(buf) < 0) + if ( global_settings.remote_font_file[0] + && global_settings.remote_font_file[0] != '-') { + snprintf(buf, sizeof buf, FONT_DIR "/%s.fnt", + global_settings.remote_font_file); + if (font_load_remoteui(buf) < 0) + font_load_remoteui(NULL); + } + else font_load_remoteui(NULL); - } - else - font_load_remoteui(NULL); #endif - if ( global_settings.kbd_file[0]) { - snprintf(buf, sizeof buf, ROCKBOX_DIR "/%s.kbd", - global_settings.kbd_file); - load_kbd(buf); - } - else - load_kbd(NULL); + if ( global_settings.kbd_file[0]) { + snprintf(buf, sizeof buf, ROCKBOX_DIR "/%s.kbd", + global_settings.kbd_file); + load_kbd(buf); + } + else + load_kbd(NULL); #endif - if ( global_settings.lang_file[0]) { - snprintf(buf, sizeof buf, LANG_DIR "/%s.lng", - global_settings.lang_file); - lang_core_load(buf); - talk_init(); /* use voice of same language */ - } + if ( global_settings.lang_file[0]) { + snprintf(buf, sizeof buf, LANG_DIR "/%s.lng", + global_settings.lang_file); + lang_core_load(buf); + talk_init(); /* use voice of same language */ + } - /* load the icon set */ - icons_init(); + /* load the icon set */ + icons_init(); #ifdef HAVE_LCD_COLOR - if (global_settings.colors_file[0]) - read_color_theme_file(); + if (global_settings.colors_file[0]) + read_color_theme_file(); #endif - + } #ifdef HAVE_LCD_COLOR screens[SCREEN_MAIN].set_foreground(global_settings.fg_color); screens[SCREEN_MAIN].set_background(global_settings.bg_color); diff --git a/apps/settings.h b/apps/settings.h index 1186f47fb0..4cc2bd521e 100644 --- a/apps/settings.h +++ b/apps/settings.h @@ -260,7 +260,7 @@ void sound_settings_apply(void); */ void settings_apply_skins(void); -void settings_apply(void); +void settings_apply(bool read_disk); void settings_apply_pm_range(void); void settings_display(void); -- cgit v1.2.3