From ca459a9d09fa891d188f11f0f77154b87978ff9c Mon Sep 17 00:00:00 2001 From: Christian Soffke Date: Thu, 9 Jan 2025 03:23:54 +0100 Subject: [PATCH] misc: Eliminate redundant yes/no dialog functions Change-Id: I28bc4531cdfe6e28a1677b1a0ebb461e48188fd8 --- apps/fileop.c | 2 +- apps/misc.c | 14 -------------- apps/misc.h | 2 -- apps/playlist.c | 3 ++- apps/playlist_catalog.c | 2 +- 5 files changed, 4 insertions(+), 19 deletions(-) diff --git a/apps/fileop.c b/apps/fileop.c index 4463168ac1..5c123e2f99 100644 --- a/apps/fileop.c +++ b/apps/fileop.c @@ -510,7 +510,7 @@ int copy_move_fileobject(const char *src_path, const char *dst_path, unsigned in int rc; if (file_exists(dst.path)) { /* If user chooses not to overwrite, cancel */ - if (confirm_overwrite_yesno() == YESNO_NO) { + if (!yesno_pop(ID2P(LANG_REALLY_OVERWRITE))) { return FORC_NOOVERWRT; } diff --git a/apps/misc.c b/apps/misc.c index a3823cd5a3..03a673456d 100644 --- a/apps/misc.c +++ b/apps/misc.c @@ -1274,20 +1274,6 @@ int confirm_delete_yesno(const char *name) 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() split time values depending on base unit unit_idx: UNIT_HOUR, UNIT_MIN, UNIT_SEC, UNIT_MS diff --git a/apps/misc.h b/apps/misc.h index f3c23e9f78..e4204bab73 100644 --- a/apps/misc.h +++ b/apps/misc.h @@ -175,8 +175,6 @@ int hex_to_rgb(const char* hex, int* color); #endif 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* skip_whitespace(char* const str); diff --git a/apps/playlist.c b/apps/playlist.c index a33c19a1e4..dafb2e652a 100644 --- a/apps/playlist.c +++ b/apps/playlist.c @@ -4096,7 +4096,8 @@ int playlist_save(struct playlist_info* playlist, char *filename) for (int i = playlist->amount - 1; i >= 0; i--) 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); else break; diff --git a/apps/playlist_catalog.c b/apps/playlist_catalog.c index 43fcf3562a..cff8dd3f2a 100644 --- a/apps/playlist_catalog.c +++ b/apps/playlist_catalog.c @@ -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 (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 */ {