From 48ffe8dac3935b7e2b2e73be0d6ec47d8a506b50 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Thu, 5 Mar 2020 15:33:18 +0100 Subject: [PATCH] Do not rely on settings->arrays.menu_driver anymore to check which menu driver is active --- runtime_file.c | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/runtime_file.c b/runtime_file.c index 9cddd6f6e6..f8e6a3a3f2 100644 --- a/runtime_file.c +++ b/runtime_file.c @@ -40,6 +40,10 @@ #include "verbosity.h" #include "msg_hash.h" +#if defined(HAVE_MENU) +#include "menu/menu_driver.h" +#endif + #include "runtime_file.h" #define LOG_FILE_RUNTIME_FORMAT_STR "%u:%02u:%02u" @@ -946,11 +950,15 @@ void runtime_update_playlist(playlist_t *playlist, size_t idx) char runtime_str[64]; char last_played_str[64]; enum playlist_sublabel_last_played_style_type - timedate_style = PLAYLIST_LAST_PLAYED_STYLE_YMD_HMS; - settings_t *settings = config_get_ptr(); - runtime_log_t *runtime_log = NULL; - const struct playlist_entry *entry = NULL; - struct playlist_entry update_entry = {0}; + timedate_style = PLAYLIST_LAST_PLAYED_STYLE_YMD_HMS; + runtime_log_t *runtime_log = NULL; + const struct playlist_entry *entry = NULL; + struct playlist_entry update_entry = {0}; + settings_t *settings = config_get_ptr(); + unsigned pl_sublabel_last_played_style = settings ? settings->uints.playlist_sublabel_last_played_style : 0; +#ifdef HAVE_MENU + const char *menu_ident = menu_driver_ident(); +#endif /* Sanity check */ if (!playlist || !settings) @@ -963,11 +971,10 @@ void runtime_update_playlist(playlist_t *playlist, size_t idx) * (saves 'if' checks later...) */ update_entry.runtime_status = PLAYLIST_RUNTIME_MISSING; +#ifdef HAVE_MENU /* Get current last played formatting type * > Have to include a 'HAVE_MENU' check here... */ -#ifdef HAVE_MENU - timedate_style = (enum playlist_sublabel_last_played_style_type) - settings->uints.playlist_sublabel_last_played_style; + timedate_style = (enum playlist_sublabel_last_played_style_type)pl_sublabel_last_played_style; #endif /* 'Attach' runtime/last played strings */ @@ -1016,9 +1023,7 @@ void runtime_update_playlist(playlist_t *playlist, size_t idx) #if defined(HAVE_MENU) && defined(HAVE_OZONE) /* Ozone requires runtime/last played strings to be * populated even when no runtime is recorded */ - /* TODO/FIXME - we shouldn't rely here on the settings - * struct - not safe */ - if (string_is_equal(settings->arrays.menu_driver, "ozone")) + if (string_is_equal(menu_ident, "ozone")) { if (update_entry.runtime_status != PLAYLIST_RUNTIME_VALID) {