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
This commit is contained in:
Thomas Martitz 2010-02-21 20:34:27 +00:00
parent 3d6faa08bf
commit ec0ca10ddf
3 changed files with 21 additions and 12 deletions

View file

@ -47,7 +47,8 @@
*/ */
static int clear_main_backdrop(void) 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); sb_set_backdrop(SCREEN_MAIN, NULL);
viewportmanager_theme_enable(SCREEN_MAIN, false, NULL); viewportmanager_theme_enable(SCREEN_MAIN, false, NULL);
viewportmanager_theme_undo(SCREEN_MAIN, true); viewportmanager_theme_undo(SCREEN_MAIN, true);

View file

@ -464,12 +464,20 @@ bool cfg_to_string(int i/*setting_id*/, char* buf, int buf_len)
case F_T_UCHARPTR: case F_T_UCHARPTR:
if (((char*)settings[i].setting)[0] if (((char*)settings[i].setting)[0]
&& settings[i].filename_setting->prefix) && settings[i].filename_setting->prefix)
{
if (((char*)settings[i].setting)[0] == '-')
{
buf[0] = '-';
buf[1] = '\0';
}
else
{ {
snprintf(buf,buf_len,"%s%s%s", snprintf(buf,buf_len,"%s%s%s",
settings[i].filename_setting->prefix, settings[i].filename_setting->prefix,
(char*)settings[i].setting, (char*)settings[i].setting,
settings[i].filename_setting->suffix); settings[i].filename_setting->suffix);
} }
}
else strlcpy(buf,(char*)settings[i].setting, else strlcpy(buf,(char*)settings[i].setting,
settings[i].filename_setting->max_len); settings[i].filename_setting->max_len);
break; break;

View file

@ -199,7 +199,7 @@ static const char graphic_numeric[] = "graphic,numeric";
/* Default theme settings */ /* Default theme settings */
#define DEFAULT_WPSNAME "cabbiev2" #define DEFAULT_WPSNAME "cabbiev2"
#define DEFAULT_SBS_NAME DEFAULT_WPSNAME #define DEFAULT_SBS_NAME "-"
#ifdef HAVE_LCD_BITMAP #ifdef HAVE_LCD_BITMAP
@ -1425,7 +1425,7 @@ const struct settings_list settings[] = {
OFFON_SETTING(F_BANFROMQS, audioscrobbler, LANG_AUDIOSCROBBLER, false, OFFON_SETTING(F_BANFROMQS, audioscrobbler, LANG_AUDIOSCROBBLER, false,
"Last.fm Logging", NULL), "Last.fm Logging", NULL),
#if CONFIG_TUNER #if CONFIG_TUNER
TEXT_SETTING(0, fmr_file, "fmr", "", TEXT_SETTING(0, fmr_file, "fmr", "-",
FMPRESET_PATH "/", ".fmr"), FMPRESET_PATH "/", ".fmr"),
#endif #endif
#ifdef HAVE_LCD_BITMAP #ifdef HAVE_LCD_BITMAP
@ -1434,7 +1434,7 @@ const struct settings_list settings[] = {
#endif #endif
#ifdef HAVE_REMOTE_LCD #ifdef HAVE_REMOTE_LCD
TEXT_SETTING(F_THEMESETTING, remote_font_file, "remote font", TEXT_SETTING(F_THEMESETTING, remote_font_file, "remote font",
"", FONT_DIR "/", ".fnt"), "-", FONT_DIR "/", ".fnt"),
#endif #endif
TEXT_SETTING(F_THEMESETTING,wps_file, "wps", TEXT_SETTING(F_THEMESETTING,wps_file, "wps",
DEFAULT_WPSNAME, WPS_DIR "/", ".wps"), DEFAULT_WPSNAME, WPS_DIR "/", ".wps"),
@ -1448,13 +1448,13 @@ const struct settings_list settings[] = {
TEXT_SETTING(F_THEMESETTING,rsbs_file, "rsbs", TEXT_SETTING(F_THEMESETTING,rsbs_file, "rsbs",
DEFAULT_WPSNAME, SBS_DIR "/", ".rsbs"), DEFAULT_WPSNAME, SBS_DIR "/", ".rsbs"),
#endif #endif
TEXT_SETTING(0,lang_file,"lang","",LANG_DIR "/",".lng"), TEXT_SETTING(0,lang_file,"lang","-",LANG_DIR "/",".lng"),
#if LCD_DEPTH > 1 #if LCD_DEPTH > 1
TEXT_SETTING(F_THEMESETTING,backdrop_file,"backdrop", TEXT_SETTING(F_THEMESETTING,backdrop_file,"backdrop",
DEFAULT_BACKDROP, BACKDROP_DIR "/", ".bmp"), DEFAULT_BACKDROP, BACKDROP_DIR "/", ".bmp"),
#endif #endif
#ifdef HAVE_LCD_BITMAP #ifdef HAVE_LCD_BITMAP
TEXT_SETTING(0,kbd_file,"kbd","",ROCKBOX_DIR "/",".kbd"), TEXT_SETTING(0,kbd_file,"kbd","-",ROCKBOX_DIR "/",".kbd"),
#endif #endif
#ifdef HAVE_USB_CHARGING_ENABLE #ifdef HAVE_USB_CHARGING_ENABLE
OFFON_SETTING(0,usb_charging,LANG_USB_CHARGING,false,"usb charging",NULL), OFFON_SETTING(0,usb_charging,LANG_USB_CHARGING,false,"usb charging",NULL),
@ -1527,10 +1527,10 @@ const struct settings_list settings[] = {
ICON_DIR "/", ".bmp"), ICON_DIR "/", ".bmp"),
#endif #endif
#ifdef HAVE_REMOTE_LCD #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"), ICON_DIR "/", ".bmp"),
TEXT_SETTING(F_THEMESETTING, remote_viewers_icon_file, TEXT_SETTING(F_THEMESETTING, remote_viewers_icon_file,
"remote viewers iconset", "", "remote viewers iconset", "-",
ICON_DIR "/", ".bmp"), ICON_DIR "/", ".bmp"),
#endif /* HAVE_REMOTE_LCD */ #endif /* HAVE_REMOTE_LCD */
#ifdef HAVE_LCD_COLOR #ifdef HAVE_LCD_COLOR