summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--apps/gui/gwps-common.c7
-rw-r--r--apps/gui/gwps.c82
-rw-r--r--apps/gui/gwps.h3
-rw-r--r--apps/root_menu.c4
-rw-r--r--apps/tree.c2
5 files changed, 8 insertions, 90 deletions
diff --git a/apps/gui/gwps-common.c b/apps/gui/gwps-common.c
index e218c123f3..d50069eac1 100644
--- a/apps/gui/gwps-common.c
+++ b/apps/gui/gwps-common.c
@@ -451,13 +451,6 @@ bool update(struct gui_wps *gwps)
451 else{ 451 else{
452 gui_wps_refresh(gwps, 0, WPS_REFRESH_ALL); 452 gui_wps_refresh(gwps, 0, WPS_REFRESH_ALL);
453 } 453 }
454
455 if (gwps->state->id3)
456 {
457 strncpy(gwps->state->current_track_path, gwps->state->id3->path,
458 sizeof(gwps->state->current_track_path));
459 gwps->state->current_track_path[sizeof(gwps->state->current_track_path)-1] = '\0';
460 }
461 } 454 }
462 455
463 if (gwps->state->id3) 456 if (gwps->state->id3)
diff --git a/apps/gui/gwps.c b/apps/gui/gwps.c
index c1e7606634..d586a9a9e2 100644
--- a/apps/gui/gwps.c
+++ b/apps/gui/gwps.c
@@ -64,23 +64,13 @@
64#include "appevents.h" 64#include "appevents.h"
65#include "viewport.h" 65#include "viewport.h"
66 66
67/* currently only on wps_state is needed */ 67/* currently only one wps_state is needed */
68struct wps_state wps_state; 68struct wps_state wps_state;
69struct gui_wps gui_wps[NB_SCREENS]; 69struct gui_wps gui_wps[NB_SCREENS];
70static struct wps_data wps_datas[NB_SCREENS]; 70static struct wps_data wps_datas[NB_SCREENS];
71 71
72/* change the path to the current played track */
73static void wps_state_update_ctp(const char *path);
74/* initial setup of wps_data */ 72/* initial setup of wps_data */
75static void wps_state_init(void); 73static void wps_state_init(void);
76/* initial setup of a wps */
77static void gui_wps_init(struct gui_wps *gui_wps);
78/* connects a wps with a format-description of the displayed content */
79static void gui_wps_set_data(struct gui_wps *gui_wps, struct wps_data *data);
80/* connects a wps with a screen */
81static void gui_wps_set_disp(struct gui_wps *gui_wps, struct screen *display);
82/* connects a wps with a statusbar*/
83static void gui_wps_set_statusbar(struct gui_wps *gui_wps, struct gui_statusbar *statusbar);
84 74
85static void prev_track(unsigned skip_thresh) 75static void prev_track(unsigned skip_thresh)
86{ 76{
@@ -167,7 +157,6 @@ long gui_wps_show(void)
167 return 0; 157 return 0;
168 FOR_NB_SCREENS(i) 158 FOR_NB_SCREENS(i)
169 gui_wps_refresh(&gui_wps[i], 0, WPS_REFRESH_ALL); 159 gui_wps_refresh(&gui_wps[i], 0, WPS_REFRESH_ALL);
170 wps_state_update_ctp(wps_state.id3->path);
171 } 160 }
172 161
173 restore = true; 162 restore = true;
@@ -738,71 +727,10 @@ static void wps_state_init(void)
738 wps_state.paused = false; 727 wps_state.paused = false;
739 wps_state.id3 = NULL; 728 wps_state.id3 = NULL;
740 wps_state.nid3 = NULL; 729 wps_state.nid3 = NULL;
741 wps_state.current_track_path[0] = '\0';
742} 730}
743 731
744#if 0
745/* these are obviously not used? */
746
747void wps_state_update_ff_rew(bool ff_rew)
748{
749 wps_state.ff_rewind = ff_rew;
750}
751
752void wps_state_update_paused(bool paused)
753{
754 wps_state.paused = paused;
755}
756void wps_state_update_id3_nid3(struct mp3entry *id3, struct mp3entry *nid3)
757{
758 wps_state.id3 = id3;
759 wps_state.nid3 = nid3;
760}
761#endif
762
763static void wps_state_update_ctp(const char *path)
764{
765 strncpy(wps_state.current_track_path, path,
766 sizeof(wps_state.current_track_path));
767 wps_state.current_track_path[sizeof(wps_state.current_track_path)-1] = '\0';
768}
769/* wps_state end*/ 732/* wps_state end*/
770 733
771/* initial setup of a wps */
772static void gui_wps_init(struct gui_wps *gui_wps)
773{
774 gui_wps->data = NULL;
775 gui_wps->display = NULL;
776 gui_wps->statusbar = NULL;
777 /* Currently no seperate wps_state needed/possible
778 so use the only aviable ( "global" ) one */
779 gui_wps->state = &wps_state;
780}
781
782/* connects a wps with a format-description of the displayed content */
783static void gui_wps_set_data(struct gui_wps *gui_wps, struct wps_data *data)
784{
785 gui_wps->data = data;
786}
787
788/* connects a wps with a screen */
789static void gui_wps_set_disp(struct gui_wps *gui_wps, struct screen *display)
790{
791 gui_wps->display = display;
792}
793
794static void gui_wps_set_statusbar(struct gui_wps *gui_wps, struct gui_statusbar *statusbar)
795{
796 gui_wps->statusbar = statusbar;
797}
798/* gui_wps end */
799
800void gui_sync_wps_screen_init(void)
801{
802 int i;
803 FOR_NB_SCREENS(i)
804 gui_wps_set_disp(&gui_wps[i], &screens[i]);
805}
806#ifdef HAVE_LCD_BITMAP 734#ifdef HAVE_LCD_BITMAP
807static void statusbar_toggle_handler(void *data) 735static void statusbar_toggle_handler(void *data)
808{ 736{
@@ -841,9 +769,11 @@ void gui_sync_wps_init(void)
841#ifdef HAVE_REMOTE_LCD 769#ifdef HAVE_REMOTE_LCD
842 wps_datas[i].remote_wps = (i != 0); 770 wps_datas[i].remote_wps = (i != 0);
843#endif 771#endif
844 gui_wps_init(&gui_wps[i]); 772 gui_wps[i].data = &wps_datas[i];
845 gui_wps_set_data(&gui_wps[i], &wps_datas[i]); 773 gui_wps[i].display = &screens[i];
846 gui_wps_set_statusbar(&gui_wps[i], &statusbars.statusbars[i]); 774 /* Currently no seperate wps_state needed/possible
775 so use the only aviable ( "global" ) one */
776 gui_wps[i].state = &wps_state;
847 } 777 }
848#ifdef HAVE_LCD_BITMAP 778#ifdef HAVE_LCD_BITMAP
849 add_event(GUI_EVENT_STATUSBAR_TOGGLE, false, statusbar_toggle_handler); 779 add_event(GUI_EVENT_STATUSBAR_TOGGLE, false, statusbar_toggle_handler);
diff --git a/apps/gui/gwps.h b/apps/gui/gwps.h
index 6311bc058b..3836d9291b 100644
--- a/apps/gui/gwps.h
+++ b/apps/gui/gwps.h
@@ -469,7 +469,6 @@ struct wps_state
469 bool wps_time_countup; 469 bool wps_time_countup;
470 struct mp3entry* id3; 470 struct mp3entry* id3;
471 struct mp3entry* nid3; 471 struct mp3entry* nid3;
472 char current_track_path[MAX_PATH];
473}; 472};
474 473
475 474
@@ -491,7 +490,6 @@ struct gui_wps
491 struct screen *display; 490 struct screen *display;
492 struct wps_data *data; 491 struct wps_data *data;
493 struct wps_state *state; 492 struct wps_state *state;
494 struct gui_statusbar *statusbar;
495}; 493};
496 494
497/* gui_wps end */ 495/* gui_wps end */
@@ -503,7 +501,6 @@ extern struct wps_state wps_state;
503extern struct gui_wps gui_wps[NB_SCREENS]; 501extern struct gui_wps gui_wps[NB_SCREENS];
504 502
505void gui_sync_wps_init(void); 503void gui_sync_wps_init(void);
506void gui_sync_wps_screen_init(void);
507 504
508#ifdef HAVE_ALBUMART 505#ifdef HAVE_ALBUMART
509/* gives back if WPS contains an albumart tag */ 506/* gives back if WPS contains an albumart tag */
diff --git a/apps/root_menu.c b/apps/root_menu.c
index 3b0907f00a..418ea01cff 100644
--- a/apps/root_menu.c
+++ b/apps/root_menu.c
@@ -96,9 +96,9 @@ static int browser(void* param)
96 filter = global_settings.dirfilter; 96 filter = global_settings.dirfilter;
97 if (global_settings.browse_current && 97 if (global_settings.browse_current &&
98 last_screen == GO_TO_WPS && 98 last_screen == GO_TO_WPS &&
99 wps_state.current_track_path[0] != '\0') 99 wps_state.id3)
100 { 100 {
101 strcpy(folder, wps_state.current_track_path); 101 strcpy(folder, wps_state.id3->path);
102 } 102 }
103#ifdef HAVE_HOTSWAP /* quick hack to stop crashing if you try entering 103#ifdef HAVE_HOTSWAP /* quick hack to stop crashing if you try entering
104 the browser from the menu when you were in the card 104 the browser from the menu when you were in the card
diff --git a/apps/tree.c b/apps/tree.c
index 3c3189f85a..37078d4ebd 100644
--- a/apps/tree.c
+++ b/apps/tree.c
@@ -285,8 +285,6 @@ bool check_rockboxdir(void)
285/* do this really late in the init sequence */ 285/* do this really late in the init sequence */
286void tree_gui_init(void) 286void tree_gui_init(void)
287{ 287{
288 gui_sync_wps_screen_init();
289
290 check_rockboxdir(); 288 check_rockboxdir();
291 289
292 strcpy(tc.currdir, "/"); 290 strcpy(tc.currdir, "/");