summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--apps/gui/skin_engine/skin_parser.c3
-rw-r--r--apps/gui/skin_engine/skin_tokens.c7
-rw-r--r--apps/gui/statusbar-skinned.c82
-rw-r--r--apps/gui/statusbar-skinned.h3
4 files changed, 34 insertions, 61 deletions
diff --git a/apps/gui/skin_engine/skin_parser.c b/apps/gui/skin_engine/skin_parser.c
index 2534bf9104..117a926fa3 100644
--- a/apps/gui/skin_engine/skin_parser.c
+++ b/apps/gui/skin_engine/skin_parser.c
@@ -1372,6 +1372,9 @@ static int skin_element_callback(struct skin_element* element, void* data)
1372 case SKIN_TOKEN_DRAW_INBUILTBAR: 1372 case SKIN_TOKEN_DRAW_INBUILTBAR:
1373 function = parse_statusbar_tags; 1373 function = parse_statusbar_tags;
1374 break; 1374 break;
1375 case SKIN_TOKEN_LIST_TITLE_TEXT:
1376 sb_skin_has_title(curr_screen);
1377 break;
1375#endif 1378#endif
1376 case SKIN_TOKEN_FILE_DIRECTORY: 1379 case SKIN_TOKEN_FILE_DIRECTORY:
1377 token->value.i = element->params[0].data.number; 1380 token->value.i = element->params[0].data.number;
diff --git a/apps/gui/skin_engine/skin_tokens.c b/apps/gui/skin_engine/skin_tokens.c
index c3f803e4a3..b5c32584b1 100644
--- a/apps/gui/skin_engine/skin_tokens.c
+++ b/apps/gui/skin_engine/skin_tokens.c
@@ -57,6 +57,7 @@
57 57
58#include "wps_internals.h" 58#include "wps_internals.h"
59#include "skin_engine.h" 59#include "skin_engine.h"
60#include "statusbar-skinned.h"
60#include "root_menu.h" 61#include "root_menu.h"
61#ifdef HAVE_RECORDING 62#ifdef HAVE_RECORDING
62#include "recording.h" 63#include "recording.h"
@@ -706,11 +707,11 @@ const char *get_token_value(struct gui_wps *gwps,
706 return buf; 707 return buf;
707 708
708 case SKIN_TOKEN_LIST_TITLE_TEXT: 709 case SKIN_TOKEN_LIST_TITLE_TEXT:
709 return (char*)token->value.data; 710 return sb_get_title(gwps->display->screen_type);
710 case SKIN_TOKEN_LIST_TITLE_ICON: 711 case SKIN_TOKEN_LIST_TITLE_ICON:
711 if (intval) 712 if (intval)
712 *intval = token->value.i; 713 *intval = sb_get_icon(gwps->display->screen_type);
713 snprintf(buf, buf_size, "%d", token->value.i); 714 snprintf(buf, buf_size, "%d",sb_get_icon(gwps->display->screen_type));
714 return buf; 715 return buf;
715 716
716 case SKIN_TOKEN_PLAYLIST_NAME: 717 case SKIN_TOKEN_PLAYLIST_NAME:
diff --git a/apps/gui/statusbar-skinned.c b/apps/gui/statusbar-skinned.c
index 2139bd698a..a5c751b804 100644
--- a/apps/gui/statusbar-skinned.c
+++ b/apps/gui/statusbar-skinned.c
@@ -42,73 +42,39 @@
42 42
43/* initial setup of wps_data */ 43/* initial setup of wps_data */
44static int update_delay = DEFAULT_UPDATE_DELAY; 44static int update_delay = DEFAULT_UPDATE_DELAY;
45static int set_title_worker(char* title, enum themable_icons icon, 45
46 struct wps_data *data, struct skin_element *root) 46static bool sbs_has_title[NB_SCREENS];
47static char* sbs_title[NB_SCREENS];
48static enum themable_icons sbs_icon[NB_SCREENS];
49
50bool sb_set_title_text(char* title, enum themable_icons icon, enum screen_type screen)
47{ 51{
48 int retval = 0; 52 sbs_title[screen] = title;
49 struct skin_element *element = root; 53 /* Icon_NOICON == -1 which the skin engine wants at position 1, so + 2 */
50 while (element) 54 sbs_icon[screen] = icon + 2;
51 { 55 return sbs_has_title[screen];
52 struct wps_token *token = NULL;
53 if (element->type == CONDITIONAL)
54 {
55 struct conditional *cond = (struct conditional *)element->data;
56 token = cond->token;
57 }
58 else if (element->type == TAG)
59 {
60 token = (struct wps_token *)element->data;
61 }
62 if (token)
63 {
64 if (token->type == SKIN_TOKEN_LIST_TITLE_TEXT)
65 {
66 token->value.data = title;
67 retval = 1;
68 }
69 else if (token->type == SKIN_TOKEN_LIST_TITLE_ICON)
70 {
71 /* Icon_NOICON == -1 which the skin engine wants at position 1, so + 2 */
72 token->value.i = icon+2;
73 }
74 else if (element->params_count)
75 {
76 int i;
77 for (i=0; i<element->params_count; i++)
78 {
79 if (element->params[i].type == CODE)
80 retval |= set_title_worker(title, icon, data,
81 element->params[i].data.code);
82 }
83 }
84 }
85 if (element->children_count)
86 {
87 int i;
88 for (i=0; i<element->children_count; i++)
89 retval |= set_title_worker(title, icon, data, element->children[i]);
90 }
91 element = element->next;
92 }
93 return retval;
94} 56}
95 57
96bool sb_set_title_text(char* title, enum themable_icons icon, enum screen_type screen) 58void sb_skin_has_title(enum screen_type screen)
97{ 59{
98 struct wps_data *data = skin_get_gwps(CUSTOM_STATUSBAR, screen)->data; 60 sbs_has_title[screen] = true;
99 bool retval = data->wps_loaded && 61}
100 set_title_worker(title, icon, data, data->tree) > 0; 62
101 return retval; 63const char* sb_get_title(enum screen_type screen)
64{
65 return sbs_has_title[screen] ? sbs_title[screen] : NULL;
66}
67enum themable_icons sb_get_icon(enum screen_type screen)
68{
69 return sbs_has_title[screen] ? sbs_icon[screen] : Icon_NOICON + 2;
102} 70}
103 71
104int sb_preproccess(enum screen_type screen, struct wps_data *data) 72int sb_preproccess(enum screen_type screen, struct wps_data *data)
105{ 73{
106 (void)data; 74 (void)data;
107 /* We need to disable the theme here or else viewport_set_defaults() 75 int i;
108 * (which is called in the viewport tag parser) will crash because 76 FOR_NB_SCREENS(i)
109 * the theme is enabled but sb_set_info_vp() isnt set untill after the sbs 77 sbs_has_title[i] = false;
110 * is parsed. This only affects the default viewport which is ignored
111 * int he sbs anyway */
112 viewportmanager_theme_enable(screen, false, NULL); 78 viewportmanager_theme_enable(screen, false, NULL);
113 return 1; 79 return 1;
114} 80}
diff --git a/apps/gui/statusbar-skinned.h b/apps/gui/statusbar-skinned.h
index a6e79a2246..bfd8193110 100644
--- a/apps/gui/statusbar-skinned.h
+++ b/apps/gui/statusbar-skinned.h
@@ -42,6 +42,9 @@ void sb_skin_update(enum screen_type screen, bool force);
42 42
43void sb_skin_set_update_delay(int delay); 43void sb_skin_set_update_delay(int delay);
44bool sb_set_title_text(char* title, enum themable_icons icon, enum screen_type screen); 44bool sb_set_title_text(char* title, enum themable_icons icon, enum screen_type screen);
45void sb_skin_has_title(enum screen_type screen);
46const char* sb_get_title(enum screen_type screen);
47enum themable_icons sb_get_icon(enum screen_type screen);
45 48
46#ifdef HAVE_TOUCHSCREEN 49#ifdef HAVE_TOUCHSCREEN
47void sb_bypass_touchregions(bool enable); 50void sb_bypass_touchregions(bool enable);