From ec0ca10ddf58604d8ce2a5f73cedabbaa8965a75 Mon Sep 17 00:00:00 2001 From: Thomas Martitz Date: Sun, 21 Feb 2010 20:34:27 +0000 Subject: [PATCH] Properly generate (with "Save Theme Settings") and handle filename settings with "-". git-svn-id: svn://svn.rockbox.org/rockbox/trunk@24816 a1c6a512-1295-4272-9138-f99709370657 --- apps/menus/theme_menu.c | 3 ++- apps/settings.c | 16 ++++++++++++---- apps/settings_list.c | 14 +++++++------- 3 files changed, 21 insertions(+), 12 deletions(-) diff --git a/apps/menus/theme_menu.c b/apps/menus/theme_menu.c index 7c19335df9..038f9079d9 100644 --- a/apps/menus/theme_menu.c +++ b/apps/menus/theme_menu.c @@ -47,7 +47,8 @@ */ static int clear_main_backdrop(void) { - global_settings.backdrop_file[0]=0; + global_settings.backdrop_file[0] = '-'; + global_settings.backdrop_file[1] = '\0'; sb_set_backdrop(SCREEN_MAIN, NULL); viewportmanager_theme_enable(SCREEN_MAIN, false, NULL); viewportmanager_theme_undo(SCREEN_MAIN, true); diff --git a/apps/settings.c b/apps/settings.c index 536e5e90ee..0bd073e66d 100644 --- a/apps/settings.c +++ b/apps/settings.c @@ -465,10 +465,18 @@ bool cfg_to_string(int i/*setting_id*/, char* buf, int buf_len) if (((char*)settings[i].setting)[0] && settings[i].filename_setting->prefix) { - snprintf(buf,buf_len,"%s%s%s", - settings[i].filename_setting->prefix, - (char*)settings[i].setting, - settings[i].filename_setting->suffix); + if (((char*)settings[i].setting)[0] == '-') + { + buf[0] = '-'; + buf[1] = '\0'; + } + else + { + snprintf(buf,buf_len,"%s%s%s", + settings[i].filename_setting->prefix, + (char*)settings[i].setting, + settings[i].filename_setting->suffix); + } } else strlcpy(buf,(char*)settings[i].setting, settings[i].filename_setting->max_len); diff --git a/apps/settings_list.c b/apps/settings_list.c index d2700b39c4..c9a4fe36c4 100644 --- a/apps/settings_list.c +++ b/apps/settings_list.c @@ -199,7 +199,7 @@ static const char graphic_numeric[] = "graphic,numeric"; /* Default theme settings */ #define DEFAULT_WPSNAME "cabbiev2" -#define DEFAULT_SBS_NAME DEFAULT_WPSNAME +#define DEFAULT_SBS_NAME "-" #ifdef HAVE_LCD_BITMAP @@ -1425,7 +1425,7 @@ const struct settings_list settings[] = { OFFON_SETTING(F_BANFROMQS, audioscrobbler, LANG_AUDIOSCROBBLER, false, "Last.fm Logging", NULL), #if CONFIG_TUNER - TEXT_SETTING(0, fmr_file, "fmr", "", + TEXT_SETTING(0, fmr_file, "fmr", "-", FMPRESET_PATH "/", ".fmr"), #endif #ifdef HAVE_LCD_BITMAP @@ -1434,7 +1434,7 @@ const struct settings_list settings[] = { #endif #ifdef HAVE_REMOTE_LCD TEXT_SETTING(F_THEMESETTING, remote_font_file, "remote font", - "", FONT_DIR "/", ".fnt"), + "-", FONT_DIR "/", ".fnt"), #endif TEXT_SETTING(F_THEMESETTING,wps_file, "wps", DEFAULT_WPSNAME, WPS_DIR "/", ".wps"), @@ -1448,13 +1448,13 @@ const struct settings_list settings[] = { TEXT_SETTING(F_THEMESETTING,rsbs_file, "rsbs", DEFAULT_WPSNAME, SBS_DIR "/", ".rsbs"), #endif - TEXT_SETTING(0,lang_file,"lang","",LANG_DIR "/",".lng"), + TEXT_SETTING(0,lang_file,"lang","-",LANG_DIR "/",".lng"), #if LCD_DEPTH > 1 TEXT_SETTING(F_THEMESETTING,backdrop_file,"backdrop", DEFAULT_BACKDROP, BACKDROP_DIR "/", ".bmp"), #endif #ifdef HAVE_LCD_BITMAP - TEXT_SETTING(0,kbd_file,"kbd","",ROCKBOX_DIR "/",".kbd"), + TEXT_SETTING(0,kbd_file,"kbd","-",ROCKBOX_DIR "/",".kbd"), #endif #ifdef HAVE_USB_CHARGING_ENABLE OFFON_SETTING(0,usb_charging,LANG_USB_CHARGING,false,"usb charging",NULL), @@ -1527,10 +1527,10 @@ const struct settings_list settings[] = { ICON_DIR "/", ".bmp"), #endif #ifdef HAVE_REMOTE_LCD - TEXT_SETTING(F_THEMESETTING, remote_icon_file, "remote iconset", "", + TEXT_SETTING(F_THEMESETTING, remote_icon_file, "remote iconset", "-", ICON_DIR "/", ".bmp"), TEXT_SETTING(F_THEMESETTING, remote_viewers_icon_file, - "remote viewers iconset", "", + "remote viewers iconset", "-", ICON_DIR "/", ".bmp"), #endif /* HAVE_REMOTE_LCD */ #ifdef HAVE_LCD_COLOR