Index: apps/gui/skin_engine/skin_parser.c
===================================================================
--- apps/gui/skin_engine/skin_parser.c (revision 24861)
+++ apps/gui/skin_engine/skin_parser.c (working copy)
@@ -27,6 +27,7 @@
#include "misc.h"
#include "plugin.h"
#include "viewport.h"
+#include "pebble.h"

#ifdef __PCTOOL__
#ifdef WPSEDITOR
@@ -143,6 +144,8 @@
return 0;
}

+static int parse_pebble(const char *wps_bufptr,
+ struct wps_token *token, struct wps_data *wps_data);
#ifdef HAVE_LCD_BITMAP
static int parse_viewport_display(const char *wps_bufptr,
struct wps_token *token, struct wps_data *wps_data);
@@ -379,6 +382,8 @@
{ WPS_TOKEN_TRANSLATEDSTRING, "Sx", WPS_REFRESH_STATIC,
parse_setting_and_lang },
{ WPS_TOKEN_LANG_IS_RTL , "Sr", WPS_REFRESH_STATIC, NULL },
+
+ { WPS_TOKEN_PEBBLE , "P", WPS_REFRESH_DYNAMIC, parse_pebble },

{ WPS_TOKEN_LASTTOUCH, "Tl", WPS_REFRESH_DYNAMIC, parse_timeout },
{ WPS_TOKEN_CURRENT_SCREEN, "cs", WPS_REFRESH_DYNAMIC, NULL },
@@ -531,6 +536,36 @@
return true;
}

+static int parse_pebble(const char *wps_bufptr,
+ struct wps_token *token,
+ struct wps_data *wps_data)
+{
+ (void)wps_data;
+ const char *ptr = wps_bufptr;
+ const char *end;
+ char temp[64];
+ char filename[MAX_PATH];
+
+ /* Find the setting's cfg_name */
+ if (*ptr != '|')
+ return WPS_ERROR_INVALID_PARAM;
+ ptr++;
+ end = strchr(ptr,'|');
+ if (!end)
+ return WPS_ERROR_INVALID_PARAM;
+ strlcpy(temp, ptr,end-ptr+1);
+ snprintf(filename,MAX_PATH, ROCKBOX_DIR "/pebbles/%s.pebble",temp);
+
+ short index=pebble_load(filename);
+ if(index<0)
+ return false;
+
+ pebble_init(index,token,&(curr_vp->vp));
+
+ token->value.i = index;
+ return skip_end_of_line(wps_bufptr);
+}
+
#ifdef HAVE_LCD_BITMAP

static int parse_statusbar_enable(const char *wps_bufptr,
@@ -1942,6 +1977,7 @@
**/
static void skin_data_reset(struct wps_data *wps_data)
{
+ pebbles_reset();
#ifdef HAVE_LCD_BITMAP
wps_data->images = NULL;
wps_data->progressbars = NULL;