From f026cc4e176fb80e8d592b95d7a012b7565dd6cc Mon Sep 17 00:00:00 2001 From: Aidan MacDonald Date: Wed, 1 Jun 2022 02:00:30 +0100 Subject: tagcache: Add menu entry for customizing the DB path Allow the database path to be set from the file browser's "Set As" context menu, so it can be changed without editing the .cfg file by hand. Change-Id: Ie1a84bcb2084ee3b1a0a18cc51f564238515f164 --- apps/onplay.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'apps/onplay.c') diff --git a/apps/onplay.c b/apps/onplay.c index ccebee402e..a85284c7d0 100644 --- a/apps/onplay.c +++ b/apps/onplay.c @@ -1390,9 +1390,27 @@ static bool set_catalogdir(void) MENUITEM_FUNCTION(set_catalogdir_item, 0, ID2P(LANG_PLAYLIST_DIR), set_catalogdir, clipboard_callback, Icon_Playlist); +static bool set_databasedir(void) +{ + path_append(global_settings.tagcache_db_path, selected_file, + PA_SEP_SOFT, sizeof(global_settings.tagcache_db_path)); + + struct tagcache_stat *tc_stat = tagcache_get_stat(); + if (strcasecmp(global_settings.tagcache_db_path, tc_stat->db_path)) + { + splashf(HZ, ID2P(LANG_PLEASE_REBOOT)); + } + + settings_save(); + return false; +} +MENUITEM_FUNCTION(set_databasedir_item, 0, ID2P(LANG_DATABASE_DIR), + set_databasedir, clipboard_callback, Icon_Audio); + MAKE_ONPLAYMENU(set_as_dir_menu, ID2P(LANG_SET_AS), clipboard_callback, Icon_NOICON, &set_catalogdir_item, + &set_databasedir_item, #ifdef HAVE_RECORDING &set_recdir_item, #endif @@ -1454,6 +1472,7 @@ static int clipboard_callback(int action, if (this_item == &delete_dir_item || this_item == &set_startdir_item || this_item == &set_catalogdir_item || + this_item == &set_databasedir_item || this_item == &set_as_dir_menu #ifdef HAVE_RECORDING || this_item == &set_recdir_item -- cgit v1.2.3