there is no need to load the filename settings unless reading from a .cfg, so stop them being read every time settings_apply() is called

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@16535 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Jonathan Gordon 2008-03-06 07:03:14 +00:00
parent 012833ce15
commit e1ba7f76ef
6 changed files with 79 additions and 75 deletions

View file

@ -293,7 +293,7 @@ static void init(void)
settings_reset();
settings_load(SETTINGS_ALL);
gui_sync_wps_init();
settings_apply();
settings_apply(true);
init_dircache(true);
init_dircache(false);
#ifdef HAVE_TAGCACHE
@ -519,7 +519,7 @@ static void init(void)
}
gui_sync_wps_init();
settings_apply();
settings_apply(true);
init_dircache(false);
#ifdef HAVE_TAGCACHE
init_tagcache();

View file

@ -304,7 +304,7 @@ int statusbar_callback(int action,const struct menu_item_ex *this_item)
{
case ACTION_EXIT_MENUITEM:
/* this should be changed so only the viewports are reloaded */
settings_apply();
settings_apply(false);
break;
}
return action;

View file

@ -69,7 +69,7 @@ static int reset_settings(void)
{
case YESNO_YES:
settings_reset();
settings_apply();
settings_apply(true);
settings_save();
break;
case YESNO_NO:

View file

@ -86,7 +86,7 @@ static int set_color_func(void* color)
res = (int)set_color(&screens[SCREEN_MAIN],str(colors[c].lang_id),
colors[c].setting,*colors[c].setting);
settings_save();
settings_apply();
settings_apply(false);
return res;
}
@ -99,7 +99,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),

View file

@ -355,7 +355,7 @@ bool settings_load_config(const char* file, bool apply)
close(fd);
settings_save();
if (apply)
settings_apply();
settings_apply(true);
return true;
}
@ -732,7 +732,7 @@ void sound_settings_apply(void)
#endif
}
void settings_apply(void)
void settings_apply(bool read_disk)
{
char buf[64];
#if CONFIG_CODEC == SWCODEC
@ -812,41 +812,88 @@ void settings_apply(void)
global_settings.peak_meter_clip_hold);
#endif
if (read_disk)
{
#if LCD_DEPTH > 1
unload_wps_backdrop();
unload_wps_backdrop();
#endif
#if defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1
unload_remote_wps_backdrop();
unload_remote_wps_backdrop();
#endif
if ( global_settings.wps_file[0] &&
global_settings.wps_file[0] != 0xff ) {
snprintf(buf, sizeof buf, WPS_DIR "/%s.wps",
global_settings.wps_file);
wps_data_load(gui_wps[0].data, buf, true);
}
else
{
wps_data_init(gui_wps[0].data);
if ( global_settings.wps_file[0] &&
global_settings.wps_file[0] != 0xff ) {
snprintf(buf, sizeof buf, WPS_DIR "/%s.wps",
global_settings.wps_file);
wps_data_load(gui_wps[0].data, buf, true);
}
else
{
wps_data_init(gui_wps[0].data);
#ifdef HAVE_REMOTE_LCD
gui_wps[0].data->remote_wps = false;
gui_wps[0].data->remote_wps = false;
#endif
}
}
#if LCD_DEPTH > 1
if ( global_settings.backdrop_file[0] &&
global_settings.backdrop_file[0] != 0xff ) {
snprintf(buf, sizeof buf, BACKDROP_DIR "/%s.bmp",
global_settings.backdrop_file);
load_main_backdrop(buf);
} else {
unload_main_backdrop();
}
show_main_backdrop();
if ( global_settings.backdrop_file[0] &&
global_settings.backdrop_file[0] != 0xff ) {
snprintf(buf, sizeof buf, BACKDROP_DIR "/%s.bmp",
global_settings.backdrop_file);
load_main_backdrop(buf);
} else {
unload_main_backdrop();
}
show_main_backdrop();
#endif
#if defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1
show_remote_main_backdrop();
show_remote_main_backdrop();
#endif
#if defined(HAVE_REMOTE_LCD) && (NB_SCREENS > 1)
if ( global_settings.rwps_file[0]) {
snprintf(buf, sizeof buf, WPS_DIR "/%s.rwps",
global_settings.rwps_file);
wps_data_load(gui_wps[1].data, buf, true);
}
else
{
wps_data_init(gui_wps[1].data);
gui_wps[1].data->remote_wps = true;
}
#endif
#ifdef HAVE_LCD_BITMAP
if ( global_settings.font_file[0]) {
snprintf(buf, sizeof buf, FONT_DIR "/%s.fnt",
global_settings.font_file);
font_load(buf);
}
else
font_reset();
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.lang_file[0]) {
snprintf(buf, sizeof buf, LANG_DIR "/%s.lng",
global_settings.lang_file);
lang_load(buf);
talk_init(); /* use voice of same language */
}
/* load the icon set */
icons_init();
#ifdef HAVE_LCD_COLOR
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);
@ -855,36 +902,6 @@ void settings_apply(void)
screens[SCREEN_MAIN].set_selector_text(global_settings.lst_color);
#endif
#if defined(HAVE_REMOTE_LCD) && (NB_SCREENS > 1)
if ( global_settings.rwps_file[0]) {
snprintf(buf, sizeof buf, WPS_DIR "/%s.rwps",
global_settings.rwps_file);
wps_data_load(gui_wps[1].data, buf, true);
}
else
{
wps_data_init(gui_wps[1].data);
gui_wps[1].data->remote_wps = true;
}
#endif
#ifdef HAVE_LCD_BITMAP
if ( global_settings.font_file[0]) {
snprintf(buf, sizeof buf, FONT_DIR "/%s.fnt",
global_settings.font_file);
font_load(buf);
}
else
font_reset();
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);
lcd_scroll_step(global_settings.scroll_step);
gui_list_screen_scroll_step(global_settings.screen_scroll_step);
gui_list_screen_scroll_out_of_view(global_settings.offset_out_of_view);
@ -895,12 +912,6 @@ void settings_apply(void)
lcd_bidir_scroll(global_settings.bidir_limit);
lcd_scroll_delay(global_settings.scroll_delay);
if ( global_settings.lang_file[0]) {
snprintf(buf, sizeof buf, LANG_DIR "/%s.lng",
global_settings.lang_file);
lang_load(buf);
talk_init(); /* use voice of same language */
}
set_codepage(global_settings.default_codepage);
@ -943,13 +954,6 @@ void settings_apply(void)
/* This should stay last */
#if defined(HAVE_RECORDING) && CONFIG_CODEC == SWCODEC
enc_global_settings_apply();
#endif
/* load the icon set */
icons_init();
#ifdef HAVE_LCD_COLOR
if (global_settings.colors_file[0])
read_color_theme_file();
#endif
list_init_viewports();
}

View file

@ -217,7 +217,7 @@ bool settings_save_config(int options);
void settings_reset(void);
void sound_settings_apply(void);
void settings_apply(void);
void settings_apply(bool read_disk);
void settings_apply_pm_range(void);
void settings_display(void);