misc: Eliminate redundant yes/no dialog functions

Change-Id: I28bc4531cdfe6e28a1677b1a0ebb461e48188fd8
This commit is contained in:
Christian Soffke 2025-01-09 03:23:54 +01:00
parent ad4113a7e9
commit ca459a9d09
5 changed files with 4 additions and 19 deletions

View file

@ -510,7 +510,7 @@ int copy_move_fileobject(const char *src_path, const char *dst_path, unsigned in
int rc; int rc;
if (file_exists(dst.path)) { if (file_exists(dst.path)) {
/* If user chooses not to overwrite, cancel */ /* If user chooses not to overwrite, cancel */
if (confirm_overwrite_yesno() == YESNO_NO) { if (!yesno_pop(ID2P(LANG_REALLY_OVERWRITE))) {
return FORC_NOOVERWRT; return FORC_NOOVERWRT;
} }

View file

@ -1274,20 +1274,6 @@ int confirm_delete_yesno(const char *name)
return gui_syncyesno_run(&message, &yes_message, NULL); return gui_syncyesno_run(&message, &yes_message, NULL);
} }
int confirm_overwrite_yesno(void)
{
static const char *lines[] = { ID2P(LANG_REALLY_OVERWRITE) };
static const struct text_message message = { lines, 1 };
return gui_syncyesno_run(&message, NULL, NULL);
}
int confirm_remove_queued_yesno(void)
{
static const char *lines[] = { ID2P(LANG_REMOVE_QUEUED_TRACKS) };
static const struct text_message message = { lines, 1 };
return gui_syncyesno_run(&message, NULL, NULL);
}
/* time_split_units() /* time_split_units()
split time values depending on base unit split time values depending on base unit
unit_idx: UNIT_HOUR, UNIT_MIN, UNIT_SEC, UNIT_MS unit_idx: UNIT_HOUR, UNIT_MIN, UNIT_SEC, UNIT_MS

View file

@ -175,8 +175,6 @@ int hex_to_rgb(const char* hex, int* color);
#endif #endif
int confirm_delete_yesno(const char *name); int confirm_delete_yesno(const char *name);
int confirm_overwrite_yesno(void);
int confirm_remove_queued_yesno(void);
char* strrsplt(char* str, int c); char* strrsplt(char* str, int c);
char* skip_whitespace(char* const str); char* skip_whitespace(char* const str);

View file

@ -4096,7 +4096,8 @@ int playlist_save(struct playlist_info* playlist, char *filename)
for (int i = playlist->amount - 1; i >= 0; i--) for (int i = playlist->amount - 1; i >= 0; i--)
if (playlist->indices[i] & PLAYLIST_QUEUED) if (playlist->indices[i] & PLAYLIST_QUEUED)
{ {
if (reload_tracks || (reload_tracks = (confirm_remove_queued_yesno() == YESNO_YES))) if (reload_tracks || (reload_tracks =
(yesno_pop(ID2P(LANG_REMOVE_QUEUED_TRACKS)))))
remove_track_unlocked(playlist, i, false); remove_track_unlocked(playlist, i, false);
else else
break; break;

View file

@ -423,7 +423,7 @@ bool catalog_pick_new_playlist_name(char *pl_name, size_t buf_size,
if (!curr_pl_name || strcmp(curr_pl_name, pl_name)) if (!curr_pl_name || strcmp(curr_pl_name, pl_name))
{ {
if (file_exists(pl_name)) if (file_exists(pl_name))
do_save = confirm_overwrite_yesno() == YESNO_YES; do_save = yesno_pop(ID2P(LANG_REALLY_OVERWRITE));
if (do_save) /* delete bookmark file unrelated to new playlist */ if (do_save) /* delete bookmark file unrelated to new playlist */
{ {