summaryrefslogtreecommitdiff
path: root/apps
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 /apps
parent012833ce1561d9a9d864f608a63a9189ec29b023 (diff)
downloadrockbox-e1ba7f76efce1c9eabd33577ee4dc4efaa218f70.tar.gz
rockbox-e1ba7f76efce1c9eabd33577ee4dc4efaa218f70.zip
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
Diffstat (limited to 'apps')
-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 bb29eb73dc..15dd1bcef9 100644
--- a/apps/main.c
+++ b/apps/main.c
@@ -293,7 +293,7 @@ static void init(void)
293 settings_reset(); 293 settings_reset();
294 settings_load(SETTINGS_ALL); 294 settings_load(SETTINGS_ALL);
295 gui_sync_wps_init(); 295 gui_sync_wps_init();
296 settings_apply(); 296 settings_apply(true);
297 init_dircache(true); 297 init_dircache(true);
298 init_dircache(false); 298 init_dircache(false);
299#ifdef HAVE_TAGCACHE 299#ifdef HAVE_TAGCACHE
@@ -519,7 +519,7 @@ static void init(void)
519 } 519 }
520 520
521 gui_sync_wps_init(); 521 gui_sync_wps_init();
522 settings_apply(); 522 settings_apply(true);
523 init_dircache(false); 523 init_dircache(false);
524#ifdef HAVE_TAGCACHE 524#ifdef HAVE_TAGCACHE
525 init_tagcache(); 525 init_tagcache();
diff --git a/apps/menus/display_menu.c b/apps/menus/display_menu.c
index c8d39c7395..2a42a83b07 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)
304 { 304 {
305 case ACTION_EXIT_MENUITEM: 305 case ACTION_EXIT_MENUITEM:
306 /* this should be changed so only the viewports are reloaded */ 306 /* this should be changed so only the viewports are reloaded */
307 settings_apply(); 307 settings_apply(false);
308 break; 308 break;
309 } 309 }
310 return action; 310 return action;
diff --git a/apps/menus/main_menu.c b/apps/menus/main_menu.c
index b70295649e..7c2e87c410 100644
--- a/apps/menus/main_menu.c
+++ b/apps/menus/main_menu.c
@@ -69,7 +69,7 @@ static int reset_settings(void)
69 { 69 {
70 case YESNO_YES: 70 case YESNO_YES:
71 settings_reset(); 71 settings_reset();
72 settings_apply(); 72 settings_apply(true);
73 settings_save(); 73 settings_save();
74 break; 74 break;
75 case YESNO_NO: 75 case YESNO_NO:
diff --git a/apps/menus/theme_menu.c b/apps/menus/theme_menu.c
index 0c17c0c373..80da1aaab9 100644
--- a/apps/menus/theme_menu.c
+++ b/apps/menus/theme_menu.c
@@ -86,7 +86,7 @@ static int set_color_func(void* color)
86 res = (int)set_color(&screens[SCREEN_MAIN],str(colors[c].lang_id), 86 res = (int)set_color(&screens[SCREEN_MAIN],str(colors[c].lang_id),
87 colors[c].setting,*colors[c].setting); 87 colors[c].setting,*colors[c].setting);
88 settings_save(); 88 settings_save();
89 settings_apply(); 89 settings_apply(false);
90 return res; 90 return res;
91} 91}
92 92
@@ -99,7 +99,7 @@ static int reset_color(void)
99 global_settings.lst_color = LCD_DEFAULT_FG; 99 global_settings.lst_color = LCD_DEFAULT_FG;
100 100
101 settings_save(); 101 settings_save();
102 settings_apply(); 102 settings_apply(false);
103 return 0; 103 return 0;
104} 104}
105MENUITEM_FUNCTION(set_bg_col, MENU_FUNC_USEPARAM, ID2P(LANG_BACKGROUND_COLOR), 105MENUITEM_FUNCTION(set_bg_col, MENU_FUNC_USEPARAM, ID2P(LANG_BACKGROUND_COLOR),
diff --git a/apps/settings.c b/apps/settings.c
index 3cf5de58ac..1463176dc5 100644
--- a/apps/settings.c
+++ b/apps/settings.c
@@ -355,7 +355,7 @@ bool settings_load_config(const char* file, bool apply)
355 close(fd); 355 close(fd);
356 settings_save(); 356 settings_save();
357 if (apply) 357 if (apply)
358 settings_apply(); 358 settings_apply(true);
359 return true; 359 return true;
360} 360}
361 361
@@ -732,7 +732,7 @@ void sound_settings_apply(void)
732#endif 732#endif
733} 733}
734 734
735void settings_apply(void) 735void settings_apply(bool read_disk)
736{ 736{
737 char buf[64]; 737 char buf[64];
738#if CONFIG_CODEC == SWCODEC 738#if CONFIG_CODEC == SWCODEC
@@ -812,41 +812,88 @@ void settings_apply(void)
812 global_settings.peak_meter_clip_hold); 812 global_settings.peak_meter_clip_hold);
813#endif 813#endif
814 814
815 if (read_disk)
816 {
815#if LCD_DEPTH > 1 817#if LCD_DEPTH > 1
816 unload_wps_backdrop(); 818 unload_wps_backdrop();
817#endif 819#endif
818#if defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1 820#if defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1
819 unload_remote_wps_backdrop(); 821 unload_remote_wps_backdrop();
820#endif 822#endif
821 if ( global_settings.wps_file[0] && 823 if ( global_settings.wps_file[0] &&
822 global_settings.wps_file[0] != 0xff ) { 824 global_settings.wps_file[0] != 0xff ) {
823 snprintf(buf, sizeof buf, WPS_DIR "/%s.wps", 825 snprintf(buf, sizeof buf, WPS_DIR "/%s.wps",
824 global_settings.wps_file); 826 global_settings.wps_file);
825 wps_data_load(gui_wps[0].data, buf, true); 827 wps_data_load(gui_wps[0].data, buf, true);
826 } 828 }
827 else 829 else
828 { 830 {
829 wps_data_init(gui_wps[0].data); 831 wps_data_init(gui_wps[0].data);
830#ifdef HAVE_REMOTE_LCD 832#ifdef HAVE_REMOTE_LCD
831 gui_wps[0].data->remote_wps = false; 833 gui_wps[0].data->remote_wps = false;
832#endif 834#endif
833 } 835 }
834 836
835#if LCD_DEPTH > 1 837#if LCD_DEPTH > 1
836 if ( global_settings.backdrop_file[0] && 838 if ( global_settings.backdrop_file[0] &&
837 global_settings.backdrop_file[0] != 0xff ) { 839 global_settings.backdrop_file[0] != 0xff ) {
838 snprintf(buf, sizeof buf, BACKDROP_DIR "/%s.bmp", 840 snprintf(buf, sizeof buf, BACKDROP_DIR "/%s.bmp",
839 global_settings.backdrop_file); 841 global_settings.backdrop_file);
840 load_main_backdrop(buf); 842 load_main_backdrop(buf);
841 } else { 843 } else {
842 unload_main_backdrop(); 844 unload_main_backdrop();
843 } 845 }
844 show_main_backdrop(); 846 show_main_backdrop();
845#endif 847#endif
846#if defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1 848#if defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1
847 show_remote_main_backdrop(); 849 show_remote_main_backdrop();
848#endif 850#endif
849 851
852#if defined(HAVE_REMOTE_LCD) && (NB_SCREENS > 1)
853 if ( global_settings.rwps_file[0]) {
854 snprintf(buf, sizeof buf, WPS_DIR "/%s.rwps",
855 global_settings.rwps_file);
856 wps_data_load(gui_wps[1].data, buf, true);
857 }
858 else
859 {
860 wps_data_init(gui_wps[1].data);
861 gui_wps[1].data->remote_wps = true;
862 }
863#endif
864
865#ifdef HAVE_LCD_BITMAP
866 if ( global_settings.font_file[0]) {
867 snprintf(buf, sizeof buf, FONT_DIR "/%s.fnt",
868 global_settings.font_file);
869 font_load(buf);
870 }
871 else
872 font_reset();
873
874 if ( global_settings.kbd_file[0]) {
875 snprintf(buf, sizeof buf, ROCKBOX_DIR "/%s.kbd",
876 global_settings.kbd_file);
877 load_kbd(buf);
878 }
879 else
880 load_kbd(NULL);
881
882 if ( global_settings.lang_file[0]) {
883 snprintf(buf, sizeof buf, LANG_DIR "/%s.lng",
884 global_settings.lang_file);
885 lang_load(buf);
886 talk_init(); /* use voice of same language */
887 }
888 /* load the icon set */
889 icons_init();
890
891#ifdef HAVE_LCD_COLOR
892 if (global_settings.colors_file[0])
893 read_color_theme_file();
894#endif
895 }
896
850#ifdef HAVE_LCD_COLOR 897#ifdef HAVE_LCD_COLOR
851 screens[SCREEN_MAIN].set_foreground(global_settings.fg_color); 898 screens[SCREEN_MAIN].set_foreground(global_settings.fg_color);
852 screens[SCREEN_MAIN].set_background(global_settings.bg_color); 899 screens[SCREEN_MAIN].set_background(global_settings.bg_color);
@@ -855,36 +902,6 @@ void settings_apply(void)
855 screens[SCREEN_MAIN].set_selector_text(global_settings.lst_color); 902 screens[SCREEN_MAIN].set_selector_text(global_settings.lst_color);
856#endif 903#endif
857 904
858#if defined(HAVE_REMOTE_LCD) && (NB_SCREENS > 1)
859 if ( global_settings.rwps_file[0]) {
860 snprintf(buf, sizeof buf, WPS_DIR "/%s.rwps",
861 global_settings.rwps_file);
862 wps_data_load(gui_wps[1].data, buf, true);
863 }
864 else
865 {
866 wps_data_init(gui_wps[1].data);
867 gui_wps[1].data->remote_wps = true;
868 }
869#endif
870
871#ifdef HAVE_LCD_BITMAP
872 if ( global_settings.font_file[0]) {
873 snprintf(buf, sizeof buf, FONT_DIR "/%s.fnt",
874 global_settings.font_file);
875 font_load(buf);
876 }
877 else
878 font_reset();
879
880 if ( global_settings.kbd_file[0]) {
881 snprintf(buf, sizeof buf, ROCKBOX_DIR "/%s.kbd",
882 global_settings.kbd_file);
883 load_kbd(buf);
884 }
885 else
886 load_kbd(NULL);
887
888 lcd_scroll_step(global_settings.scroll_step); 905 lcd_scroll_step(global_settings.scroll_step);
889 gui_list_screen_scroll_step(global_settings.screen_scroll_step); 906 gui_list_screen_scroll_step(global_settings.screen_scroll_step);
890 gui_list_screen_scroll_out_of_view(global_settings.offset_out_of_view); 907 gui_list_screen_scroll_out_of_view(global_settings.offset_out_of_view);
@@ -895,12 +912,6 @@ void settings_apply(void)
895 lcd_bidir_scroll(global_settings.bidir_limit); 912 lcd_bidir_scroll(global_settings.bidir_limit);
896 lcd_scroll_delay(global_settings.scroll_delay); 913 lcd_scroll_delay(global_settings.scroll_delay);
897 914
898 if ( global_settings.lang_file[0]) {
899 snprintf(buf, sizeof buf, LANG_DIR "/%s.lng",
900 global_settings.lang_file);
901 lang_load(buf);
902 talk_init(); /* use voice of same language */
903 }
904 915
905 set_codepage(global_settings.default_codepage); 916 set_codepage(global_settings.default_codepage);
906 917
@@ -944,13 +955,6 @@ void settings_apply(void)
944#if defined(HAVE_RECORDING) && CONFIG_CODEC == SWCODEC 955#if defined(HAVE_RECORDING) && CONFIG_CODEC == SWCODEC
945 enc_global_settings_apply(); 956 enc_global_settings_apply();
946#endif 957#endif
947 /* load the icon set */
948 icons_init();
949
950#ifdef HAVE_LCD_COLOR
951 if (global_settings.colors_file[0])
952 read_color_theme_file();
953#endif
954 list_init_viewports(); 958 list_init_viewports();
955} 959}
956 960
diff --git a/apps/settings.h b/apps/settings.h
index 06c9c8ba73..1a2c2ee444 100644
--- a/apps/settings.h
+++ b/apps/settings.h
@@ -217,7 +217,7 @@ bool settings_save_config(int options);
217 217
218void settings_reset(void); 218void settings_reset(void);
219void sound_settings_apply(void); 219void sound_settings_apply(void);
220void settings_apply(void); 220void settings_apply(bool read_disk);
221void settings_apply_pm_range(void); 221void settings_apply_pm_range(void);
222void settings_display(void); 222void settings_display(void);
223 223