From e510de1b351de2e5784088bfa9db5573bb921450 Mon Sep 17 00:00:00 2001 From: Thomas Martitz Date: Thu, 20 Aug 2009 14:29:03 +0000 Subject: 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 --- apps/gui/skin_engine/skin_parser.c | 24 ------------------------ apps/gui/wps.c | 29 +++++++++++++++++++++++++++++ 2 files changed, 29 insertions(+), 24 deletions(-) diff --git a/apps/gui/skin_engine/skin_parser.c b/apps/gui/skin_engine/skin_parser.c index 892bb3d933..639c81ed17 100644 --- a/apps/gui/skin_engine/skin_parser.c +++ b/apps/gui/skin_engine/skin_parser.c @@ -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) diff --git a/apps/gui/wps.c b/apps/gui/wps.c index 79f35c61eb..ed3bf5f6b3 100644 --- a/apps/gui/wps.c +++ b/apps/gui/wps.c @@ -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 */ -- cgit v1.2.3