Move handling of "rockbox_default.[r]wps" into wps.c, out of the skin engine (which should be as generic as possible).

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@22438 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Thomas Martitz 2009-08-20 14:29:03 +00:00
parent b944901354
commit e510de1b35
2 changed files with 29 additions and 24 deletions

View file

@ -55,9 +55,6 @@
#include "backdrop.h"
#define WPS_DEFAULTCFG WPS_DIR "/rockbox_default.wps"
#define RWPS_DEFAULTCFG WPS_DIR "/rockbox_default.rwps"
#define WPS_ERROR_INVALID_PARAM -1
/* level of current conditional.
@ -1691,27 +1688,6 @@ bool skin_data_load(struct wps_data *wps_data,
}
else
{
/*
* Hardcode loading WPS_DEFAULTCFG to cause a reset ideally this
* wants to be a virtual file. Feel free to modify dirbrowse()
* if you're feeling brave.
*/
#ifndef __PCTOOL__
if (! strcmp(buf, WPS_DEFAULTCFG) )
{
global_settings.wps_file[0] = 0;
return false;
}
#ifdef HAVE_REMOTE_LCD
if (! strcmp(buf, RWPS_DEFAULTCFG) )
{
global_settings.rwps_file[0] = 0;
return false;
}
#endif
#endif /* __PCTOOL__ */
int fd = open_utf8(buf, O_RDONLY);
if (fd < 0)

View file

@ -90,12 +90,41 @@ static void track_changed_callback(void *param);
static void nextid3available_callback(void* param);
#define WPS_DEFAULTCFG WPS_DIR "/rockbox_default.wps"
#ifdef HAVE_REMOTE_LCD
#define RWPS_DEFAULTCFG WPS_DIR "/rockbox_default.rwps"
#define DEFAULT_WPS(screen) ((screen) == SCREEN_MAIN ? \
WPS_DEFAULTCFG:RWPS_DEFAULTCFG)
#else
#define DEFAULT_WPS(screen) (WPS_DEFAULTCFG)
#endif
void wps_data_load(enum screen_type screen, const char *buf, bool isfile)
{
bool loaded_ok;
screens[screen].backdrop_unload(BACKDROP_SKIN_WPS);
#ifndef __PCTOOL__
/*
* Hardcode loading WPS_DEFAULTCFG to cause a reset ideally this
* wants to be a virtual file. Feel free to modify dirbrowse()
* if you're feeling brave.
*/
if (! strcmp(buf, DEFAULT_WPS(screen)) )
{
#ifdef HAVE_REMOTE_LCD
if (screen == SCREEN_REMOTE)
global_settings.rwps_file[0] = '\0';
else
#endif
global_settings.wps_file[0] = '\0';
buf = NULL;
}
#endif /* __PCTOOL__ */
loaded_ok = buf && skin_data_load(gui_wps[screen].data,
&screens[screen], buf, isfile);
if (!loaded_ok) /* load the hardcoded default */