diff options
Diffstat (limited to 'apps')
-rw-r--r-- | apps/plugins/lib/playback_control.c | 41 | ||||
-rw-r--r-- | apps/plugins/lib/playback_control.h | 6 |
2 files changed, 29 insertions, 18 deletions
diff --git a/apps/plugins/lib/playback_control.c b/apps/plugins/lib/playback_control.c index 8a1381a1e7..672d275bcc 100644 --- a/apps/plugins/lib/playback_control.c +++ b/apps/plugins/lib/playback_control.c | |||
@@ -98,26 +98,31 @@ static bool repeat_mode(void) | |||
98 | 98 | ||
99 | return result; | 99 | return result; |
100 | } | 100 | } |
101 | MENUITEM_FUNCTION(prevtrack_item, 0, "Previous Track", | ||
102 | prevtrack, NULL, NULL, Icon_NOICON); | ||
103 | MENUITEM_FUNCTION(playpause_item, 0, "Pause / Play", | ||
104 | play, NULL, NULL, Icon_NOICON); | ||
105 | MENUITEM_FUNCTION(stop_item, 0, "Stop Playback", | ||
106 | stop, NULL, NULL, Icon_NOICON); | ||
107 | MENUITEM_FUNCTION(nexttrack_item, 0, "Next Track", | ||
108 | nexttrack, NULL, NULL, Icon_NOICON); | ||
109 | MENUITEM_FUNCTION(volume_item, 0, "Change Volume", | ||
110 | volume, NULL, NULL, Icon_NOICON); | ||
111 | MENUITEM_FUNCTION(shuffle_item, 0, "Enable/Disable Shuffle", | ||
112 | shuffle, NULL, NULL, Icon_NOICON); | ||
113 | MENUITEM_FUNCTION(repeat_mode_item, 0, "Change Repeat Mode", | ||
114 | repeat_mode, NULL, NULL, Icon_NOICON); | ||
115 | MAKE_MENU(playback_control_menu, "Playback Control", NULL, Icon_NOICON, | ||
116 | &prevtrack_item, &playpause_item, &stop_item, &nexttrack_item, | ||
117 | &volume_item, &shuffle_item, &repeat_mode_item); | ||
101 | 118 | ||
102 | bool playback_control(struct plugin_api* newapi) | 119 | void playback_control_init(struct plugin_api* newapi) |
103 | { | 120 | { |
104 | int m; | ||
105 | api = newapi; | 121 | api = newapi; |
106 | bool result; | 122 | } |
107 | |||
108 | static struct menu_item items[] = { | ||
109 | { "Previous Track", prevtrack }, | ||
110 | { "Pause / Play", play }, | ||
111 | { "Stop Playback", stop }, | ||
112 | { "Next Track", nexttrack }, | ||
113 | { "Change Volume", volume }, | ||
114 | { "Enable/Disable Shuffle", shuffle }, | ||
115 | { "Change Repeat Mode", repeat_mode }, | ||
116 | }; | ||
117 | 123 | ||
118 | m=api->menu_init( items, sizeof(items) / sizeof(*items), NULL, | 124 | bool playback_control(struct plugin_api* newapi) |
119 | NULL, NULL, NULL); | 125 | { |
120 | result = api->menu_run(m); | 126 | api = newapi; |
121 | api->menu_exit(m); | 127 | return api->do_menu(&playback_control_menu, NULL) == SYS_USB_CONNECTED; |
122 | return result; | ||
123 | } | 128 | } |
diff --git a/apps/plugins/lib/playback_control.h b/apps/plugins/lib/playback_control.h index a259fc9194..679a89000f 100644 --- a/apps/plugins/lib/playback_control.h +++ b/apps/plugins/lib/playback_control.h | |||
@@ -19,6 +19,12 @@ | |||
19 | #ifndef __PLAYBACK_CONTROL_H__ | 19 | #ifndef __PLAYBACK_CONTROL_H__ |
20 | #define __PLAYBACK_CONTROL_H__ | 20 | #define __PLAYBACK_CONTROL_H__ |
21 | 21 | ||
22 | /* Use these if your menu uses the new menu api. | ||
23 | REMEBER to call playback_control_init(rb) before rb->do_menu()... */ | ||
24 | extern const struct menu_item_ex *playback_control_menu; | ||
25 | void playback_control_init(struct plugin_api* newapi); | ||
26 | |||
27 | /* Use this if your menu still uses the old menu api */ | ||
22 | bool playback_control(struct plugin_api* api); | 28 | bool playback_control(struct plugin_api* api); |
23 | 29 | ||
24 | #endif /* __PLAYBACK_CONTROL_H__ */ | 30 | #endif /* __PLAYBACK_CONTROL_H__ */ |