summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Gordon <rockbox@jdgordon.info>2008-03-06 07:03:14 +0000
committerJonathan Gordon <rockbox@jdgordon.info>2008-03-06 07:03:14 +0000
commite1ba7f76efce1c9eabd33577ee4dc4efaa218f70 (patch)
treeaf35f13d4d9554a6f017811763172810337acec0
parent012833ce1561d9a9d864f608a63a9189ec29b023 (diff)
downloadrockbox-e1ba7f76efce1c9eabd33577ee4dc4efaa218f70.zip
rockbox-e1ba7f76efce1c9eabd33577ee4dc4efaa218f70.tar.gz
rockbox-e1ba7f76efce1c9eabd33577ee4dc4efaa218f70.tar.bz2
rockbox-e1ba7f76efce1c9eabd33577ee4dc4efaa218f70.tar.xz
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
-rw-r--r--apps/main.c4
-rw-r--r--apps/menus/display_menu.c2
-rw-r--r--apps/menus/main_menu.c2
-rw-r--r--apps/menus/theme_menu.c4
-rw-r--r--apps/settings.c140
-rw-r--r--apps/settings.h2
6 files changed, 79 insertions, 75 deletions
diff --git a/apps/main.c b/apps/main.c
index bb29eb7..15dd1bc 100644
--- a/apps/main.c
+++ b/apps/main.c
@@ -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();
diff --git a/apps/menus/display_menu.c b/apps/menus/display_menu.c
index c8d39c7..2a42a83 100644
--- a/apps/menus/display_menu.c
+++ b/apps/menus/display_menu.c
@@ -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;
diff --git a/apps/menus/main_menu.c b/apps/menus/main_menu.c
index b702956..7c2e87c 100644
--- a/apps/menus/main_menu.c
+++ b/apps/menus/main_menu.c
@@ -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:
diff --git a/apps/menus/theme_menu.c b/apps/menus/theme_menu.c
index 0c17c0c..80da1aa 100644
--- a/apps/menus/theme_menu.c
+++ b/apps/menus/theme_menu.c
@@ -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),
diff --git a/apps/settings.c b/apps/settings.c
index 3cf5de5..1463176 100644
--- a/apps/settings.c
+++ b/apps/settings.c
@@ -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);
@@ -944,13 +955,6 @@ void settings_apply(void)
#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();
}
diff --git a/apps/settings.h b/apps/settings.h
index 06c9c8b..1a2c2ee 100644
--- a/apps/settings.h
+++ b/apps/settings.h
@@ -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);