mirror of
https://github.com/Rockbox/rockbox.git
synced 2026-01-22 01:30:35 -05:00
Use SBS title in delete confirmation screens
When deleting files or directories, you will now see the path's basename in the previously empty title of an SBS, making it a bit easier to immediately know whether you've selected the correct item. Matching titles were also added everywhere else that confirm_delete_yesno is used. The full path of the item is still displayed below, and continues to scroll, so that themes without a title, such as the default cabbiev2, will look the same. Change-Id: I32422cfbbf6e680f58456237380176617789cac3
This commit is contained in:
parent
d1c3e3b08b
commit
399230e9ec
10 changed files with 52 additions and 15 deletions
|
|
@ -1083,7 +1083,7 @@ static int select_bookmark(const char* bookmark_file_name,
|
|||
case ACTION_BMS_DELETE:
|
||||
if (item >= 0)
|
||||
{
|
||||
if (confirm_delete_yesno("") == YESNO_YES)
|
||||
if (confirm_delete_yesno("", str(LANG_BOOKMARK_CONTEXT_MENU)) == YESNO_YES)
|
||||
{
|
||||
delete_bookmark(bookmark_file_name, item);
|
||||
bookmarks->reload = true;
|
||||
|
|
|
|||
|
|
@ -582,9 +582,8 @@ int delete_fileobject(const char *selected_file)
|
|||
|
||||
/* Note: delete_fileobject() will happily delete whatever
|
||||
* path is passed (after confirmation) */
|
||||
if (confirm_delete_yesno(param.path) != YESNO_YES) {
|
||||
if (confirm_delete_yesno(param.path, param.toplevel_name) != YESNO_YES)
|
||||
return FORC_CANCELLED;
|
||||
}
|
||||
|
||||
if (param.is_dir) {
|
||||
int rc = check_count_fileobjects(¶m);
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@
|
|||
#include "appevents.h"
|
||||
#include "splash.h"
|
||||
#include "backlight.h"
|
||||
#include "statusbar-skinned.h"
|
||||
|
||||
struct gui_yesno
|
||||
{
|
||||
|
|
@ -216,6 +217,7 @@ static void gui_yesno_ui_update(unsigned short id, void *event_data, void *user_
|
|||
* no_message - displayed when YESNO_NO is choosen
|
||||
*/
|
||||
enum yesno_res gui_syncyesno_run_w_tmo(int ticks, enum yesno_res tmo_default_res,
|
||||
const char * title,
|
||||
const struct text_message * main_message,
|
||||
const struct text_message * yes_message,
|
||||
const struct text_message * no_message)
|
||||
|
|
@ -242,6 +244,9 @@ enum yesno_res gui_syncyesno_run_w_tmo(int ticks, enum yesno_res tmo_default_res
|
|||
yn[i].display=&screens[i];
|
||||
screens[i].scroll_stop();
|
||||
viewportmanager_theme_enable(i, true, &(yn[i].vp));
|
||||
if (sb_set_title_text(title, Icon_NOICON, i))
|
||||
send_event(GUI_EVENT_ACTIONUPDATE, (void*)1);
|
||||
|
||||
yn[i].vp_lines = viewport_get_nb_lines(&(yn[i].vp));
|
||||
}
|
||||
|
||||
|
|
@ -363,8 +368,18 @@ enum yesno_res gui_syncyesno_run(const struct text_message * main_message,
|
|||
const struct text_message * yes_message,
|
||||
const struct text_message * no_message)
|
||||
{
|
||||
return gui_syncyesno_run_w_tmo(TIMEOUT_BLOCK, YESNO_TMO,
|
||||
main_message, yes_message, no_message);
|
||||
return gui_syncyesno_run_w_tmo(TIMEOUT_BLOCK, YESNO_TMO, NULL,
|
||||
main_message, yes_message, no_message);
|
||||
}
|
||||
|
||||
extern enum yesno_res gui_syncyesno_run_w_title(
|
||||
const char * title,
|
||||
const struct text_message * main_message,
|
||||
const struct text_message * yes_message,
|
||||
const struct text_message * no_message)
|
||||
{
|
||||
return gui_syncyesno_run_w_tmo(TIMEOUT_BLOCK, YESNO_TMO, title,
|
||||
main_message, yes_message, no_message);
|
||||
}
|
||||
|
||||
static bool yesno_pop_lines(const char *lines[], int line_cnt)
|
||||
|
|
|
|||
|
|
@ -50,11 +50,19 @@ extern enum yesno_res gui_syncyesno_run(
|
|||
const struct text_message * yes_message,
|
||||
const struct text_message * no_message);
|
||||
|
||||
/* Sets SBS title for the screen. Title may be NULL. */
|
||||
extern enum yesno_res gui_syncyesno_run_w_title(
|
||||
const char *title,
|
||||
const struct text_message * main_message,
|
||||
const struct text_message * yes_message,
|
||||
const struct text_message * no_message);
|
||||
|
||||
extern enum yesno_res gui_syncyesno_run_w_tmo(
|
||||
int ticks, enum yesno_res tmo_default_res,
|
||||
const struct text_message * main_message,
|
||||
const struct text_message * yes_message,
|
||||
const struct text_message * no_message);
|
||||
int ticks, enum yesno_res tmo_default_res,
|
||||
const char *title,
|
||||
const struct text_message * main_message,
|
||||
const struct text_message * yes_message,
|
||||
const struct text_message * no_message);
|
||||
|
||||
bool yesno_pop(const char* text);
|
||||
bool yesno_pop_confirm(const char* text);
|
||||
|
|
|
|||
|
|
@ -119,6 +119,7 @@ enum yesno_res gui_syncyesno_run(const struct text_message * main_message,
|
|||
}
|
||||
|
||||
enum yesno_res gui_syncyesno_run_w_tmo(int ticks, enum yesno_res tmo_default_res,
|
||||
const char *title,
|
||||
const struct text_message * main_message,
|
||||
const struct text_message * yes_message,
|
||||
const struct text_message * no_message)
|
||||
|
|
@ -126,6 +127,16 @@ enum yesno_res gui_syncyesno_run_w_tmo(int ticks, enum yesno_res tmo_default_res
|
|||
/* FIXME: create a prompt with timeout for android */
|
||||
(void)ticks;
|
||||
(void)tmo_default_res;
|
||||
(void)title; /* Note: title ignored on Android */
|
||||
return gui_syncyesno_run(main_message, yes_message, no_message);
|
||||
}
|
||||
|
||||
enum yesno_res gui_syncyesno_run_w_title(const char *title,
|
||||
const struct text_message * main_message,
|
||||
const struct text_message * yes_message,
|
||||
const struct text_message * no_message)
|
||||
{
|
||||
(void)title; /* Note: title ignored on Android */
|
||||
return gui_syncyesno_run(main_message, yes_message, no_message);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1277,13 +1277,13 @@ char* skip_whitespace(char* const str)
|
|||
|
||||
#if !defined(CHECKWPS) && !defined(DBTOOL)
|
||||
|
||||
int confirm_delete_yesno(const char *name)
|
||||
int confirm_delete_yesno(const char *name, const char *title)
|
||||
{
|
||||
const char *lines[] = { ID2P(LANG_REALLY_DELETE), name };
|
||||
const char *yes_lines[] = { ID2P(LANG_DELETING), name };
|
||||
const struct text_message message = { lines, 2 };
|
||||
const struct text_message yes_message = { yes_lines, 2 };
|
||||
return gui_syncyesno_run(&message, &yes_message, NULL);
|
||||
return gui_syncyesno_run_w_title(title, &message, &yes_message, NULL);
|
||||
}
|
||||
|
||||
/* time_split_units()
|
||||
|
|
|
|||
|
|
@ -174,7 +174,9 @@ void adjust_volume_ex(int steps, enum volume_adjust_mode mode);
|
|||
int hex_to_rgb(const char* hex, int* color);
|
||||
#endif
|
||||
|
||||
int confirm_delete_yesno(const char *name);
|
||||
/* Note: Don't rely on title being visible. It is not
|
||||
displayed on Android, or if SBS has no title. */
|
||||
int confirm_delete_yesno(const char *name, const char *title);
|
||||
|
||||
char* strrsplt(char* str, int c);
|
||||
char* skip_whitespace(char* const str);
|
||||
|
|
|
|||
|
|
@ -646,7 +646,8 @@ static void close_playlist_viewer(void)
|
|||
if (viewer.num_tracks && yesno_pop(ID2P(LANG_SAVE_CHANGES)))
|
||||
save_playlist_screen(viewer.playlist);
|
||||
else if (!viewer.num_tracks &&
|
||||
confirm_delete_yesno(viewer.playlist->filename) == YESNO_YES)
|
||||
confirm_delete_yesno(viewer.playlist->filename,
|
||||
viewer.title) == YESNO_YES)
|
||||
{
|
||||
remove(viewer.playlist->filename);
|
||||
reload_directory();
|
||||
|
|
|
|||
|
|
@ -633,7 +633,7 @@ static int shortcut_menu_get_action(int action, struct gui_synclist *lists)
|
|||
{
|
||||
int selection = gui_synclist_get_sel_pos(lists);
|
||||
|
||||
if (confirm_delete_yesno("") != YESNO_YES)
|
||||
if (confirm_delete_yesno("", str(LANG_SHORTCUTS)) != YESNO_YES)
|
||||
{
|
||||
gui_synclist_set_title(lists, lists->title, lists->title_icon);
|
||||
if (global_settings.talk_menu)
|
||||
|
|
|
|||
|
|
@ -5253,7 +5253,8 @@ static void tagcache_thread(void)
|
|||
ID2P(LANG_TAGCACHE_UPDATE)};
|
||||
static const struct text_message message = {lines, 2};
|
||||
|
||||
if (gui_syncyesno_run_w_tmo(HZ * 5, YESNO_YES, &message, NULL, NULL) == YESNO_YES)
|
||||
if (gui_syncyesno_run_w_tmo(HZ * 5, YESNO_YES, str(LANG_TAGCACHE),
|
||||
&message, NULL, NULL) == YESNO_YES)
|
||||
#endif
|
||||
{
|
||||
allocate_tempbuf();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue