summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Soffke <christian.soffke@gmail.com>2021-11-21 11:31:11 +0100
committerSolomon Peachy <pizza@shaftnet.org>2021-12-02 17:37:15 -0500
commit0da0390b85edf0e27b8c79cd436881d959b1574e (patch)
treee471d284154daba2bf43793314f46e821053143e
parent2512ed1c56a7c415f5a13ac2f38f72278e3ac660 (diff)
downloadrockbox-0da0390b85edf0e27b8c79cd436881d959b1574e.tar.gz
rockbox-0da0390b85edf0e27b8c79cd436881d959b1574e.zip
PictureFlow: Warn Before Erasing Playlist
Respect system-wide setting, in consistence with browser behavior Change-Id: I7df90554a466ed5ca1b99da179cc7d95360499b6
-rw-r--r--apps/plugin.c2
-rw-r--r--apps/plugin.h3
-rw-r--r--apps/plugins/pictureflow/pictureflow.c25
3 files changed, 25 insertions, 5 deletions
diff --git a/apps/plugin.c b/apps/plugin.c
index a19b3ee226..0225491d85 100644
--- a/apps/plugin.c
+++ b/apps/plugin.c
@@ -802,7 +802,7 @@ static const struct plugin_api rockbox_api = {
plugin_get_current_filename,
/* new stuff at the end, sort into place next time
the API gets incompatible */
-
+ warn_on_pl_erase,
};
static int plugin_buffer_handle;
diff --git a/apps/plugin.h b/apps/plugin.h
index e1b7c69f96..6ad495b5a6 100644
--- a/apps/plugin.h
+++ b/apps/plugin.h
@@ -155,7 +155,7 @@ int plugin_open(const char *plugin, const char *parameter);
#define PLUGIN_MAGIC 0x526F634B /* RocK */
/* increase this every time the api struct changes */
-#define PLUGIN_API_VERSION 245
+#define PLUGIN_API_VERSION 246
/* update this to latest version if a change to the api struct breaks
backwards compatibility (and please take the opportunity to sort in any
@@ -928,6 +928,7 @@ struct plugin_api {
char* (*plugin_get_current_filename)(void);
/* new stuff at the end, sort into place next time
the API gets incompatible */
+ bool (*warn_on_pl_erase)(void);
};
diff --git a/apps/plugins/pictureflow/pictureflow.c b/apps/plugins/pictureflow/pictureflow.c
index 07403083f0..aebbc9aa6d 100644
--- a/apps/plugins/pictureflow/pictureflow.c
+++ b/apps/plugins/pictureflow/pictureflow.c
@@ -3227,7 +3227,7 @@ static int main_menu(void)
return -2;
#if PF_PLAYBACK_CAPABLE
case PF_MENU_CLEAR_PLAYLIST:
- if(rb->playlist_remove_all_tracks(NULL) == 0) {
+ if(rb->warn_on_pl_erase() && rb->playlist_remove_all_tracks(NULL) == 0) {
rb->playlist_create(NULL, NULL);
rb->splash(HZ*2, ID2P(LANG_PLAYLIST_CLEARED));
}
@@ -3484,6 +3484,19 @@ static void select_prev_track(void)
}
#if PF_PLAYBACK_CAPABLE
+
+static bool pf_warn_on_pl_erase(void)
+{
+#ifdef USEGSLIB
+ grey_show(false);
+#endif
+ bool ret = rb->warn_on_pl_erase();
+#ifdef USEGSLIB
+ grey_show(true);
+#endif
+ return ret;
+}
+
/*
* Puts the current tracklist into a newly created playlist and starts playling
*/
@@ -3523,7 +3536,11 @@ play:
* if shuffle, we can't predict the playing track easily, and for either
* case the track list doesn't get auto scrolled*/
if(!append)
+ {
rb->playlist_start(position, 0, 0);
+ /* make warn on playlist erase work */
+ rb->playlist_get_current()->num_inserted_tracks = 0;
+ }
old_playlist = center_slide.slide_index;
old_shuffle = shuffle;
}
@@ -3956,6 +3973,8 @@ static int pictureflow_main(void)
set_current_slide(target);
#if PF_PLAYBACK_CAPABLE
if(pf_cfg.auto_wps == 1) {
+ if (!pf_warn_on_pl_erase())
+ break;
create_track_index(center_slide.slide_index);
reset_track_list();
start_playback(false);
@@ -3970,15 +3989,15 @@ static int pictureflow_main(void)
revert_cover_out_animation();
else if (pf_state == pf_cover_in)
interrupt_cover_in_animation();
- else if ( pf_state == pf_show_tracks ) {
#if PF_PLAYBACK_CAPABLE
+ else if (pf_state == pf_show_tracks && pf_warn_on_pl_erase()) {
start_playback(false);
if(pf_cfg.auto_wps != 0) {
pf_cfg.last_album = center_index;
return PLUGIN_GOTO_WPS;
}
-#endif
}
+#endif
break;
default:
exit_on_usb(button);