From bb6ca3e4ffe5fe24f467afcedf07f3ed45de5a5c Mon Sep 17 00:00:00 2001 From: twinaphex Date: Wed, 4 Oct 2017 08:26:41 +0200 Subject: [PATCH] Fix playlists in non-horizontal mode --- intl/msg_hash_lbl.h | 2 ++ menu/cbs/menu_cbs_deferred_push.c | 12 ++++++++++++ menu/cbs/menu_cbs_ok.c | 23 ++++++++++++----------- menu/menu_displaylist.c | 20 ++++++++++++++++++-- menu/menu_displaylist.h | 1 + msg_hash.h | 1 + 6 files changed, 46 insertions(+), 13 deletions(-) diff --git a/intl/msg_hash_lbl.h b/intl/msg_hash_lbl.h index 3a99b0ee54..4f68ded6b4 100644 --- a/intl/msg_hash_lbl.h +++ b/intl/msg_hash_lbl.h @@ -229,6 +229,8 @@ MSG_HASH(MENU_ENUM_LABEL_DATABASE_MANAGER, "database_manager") MSG_HASH(MENU_ENUM_LABEL_DATABASE_MANAGER_LIST, "database_manager_list") +MSG_HASH(MENU_ENUM_LABEL_DEFERRED_PLAYLIST_LIST, + "deferred_playlist_list") MSG_HASH(MENU_ENUM_LABEL_DEFERRED_FAVORITES_LIST, "deferred_favorites_list") MSG_HASH(MENU_ENUM_LABEL_DEFERRED_IMAGES_LIST, diff --git a/menu/cbs/menu_cbs_deferred_push.c b/menu/cbs/menu_cbs_deferred_push.c index 25e2f40314..05d86c322e 100644 --- a/menu/cbs/menu_cbs_deferred_push.c +++ b/menu/cbs/menu_cbs_deferred_push.c @@ -901,6 +901,12 @@ static int deferred_push_detect_core_list(menu_displaylist_info_t *info) DISPLAYLIST_CORES_DETECTED); } +static int deferred_playlist_list(menu_displaylist_info_t *info) +{ + menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list); + return general_push(info, PUSH_DEFAULT, DISPLAYLIST_PLAYLIST); +} + static int deferred_music_history_list(menu_displaylist_info_t *info) { menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list); @@ -1195,6 +1201,12 @@ static int menu_cbs_init_bind_deferred_push_compare_label( BIND_ACTION_DEFERRED_PUSH(cbs, deferred_music_history_list); return 0; } + else if ( + string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_PLAYLIST_LIST))) + { + BIND_ACTION_DEFERRED_PUSH(cbs, deferred_playlist_list); + return 0; + } else if ( string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_IMAGES_LIST))) { diff --git a/menu/cbs/menu_cbs_ok.c b/menu/cbs/menu_cbs_ok.c index 9c7f286693..f4ff0bf626 100644 --- a/menu/cbs/menu_cbs_ok.c +++ b/menu/cbs/menu_cbs_ok.c @@ -180,15 +180,6 @@ int generic_action_ok_displaylist_push(const char *path, info.enum_idx = MENU_ENUM_LABEL_DEFERRED_IMAGES_LIST; dl_type = DISPLAYLIST_GENERIC; break; - case ACTION_OK_DL_MUSIC_LIST: - info.type = type; - info.directory_ptr = idx; - info_path = label; - info_label = msg_hash_to_str( - MENU_ENUM_LABEL_DEFERRED_MUSIC_LIST); - info.enum_idx = MENU_ENUM_LABEL_DEFERRED_MUSIC_LIST; - dl_type = DISPLAYLIST_GENERIC; - break; case ACTION_OK_DL_VIDEO_LIST: info.type = type; info.directory_ptr = idx; @@ -381,13 +372,23 @@ int generic_action_ok_displaylist_push(const char *path, dl_type = DISPLAYLIST_FILE_BROWSER_SELECT_FILE; break; case ACTION_OK_DL_PLAYLIST_COLLECTION: - filebrowser_clear_type(); info.type = type; info.directory_ptr = idx; info_path = path; - info_label = label; + info_label = msg_hash_to_str( + MENU_ENUM_LABEL_DEFERRED_PLAYLIST_LIST); + info.enum_idx = MENU_ENUM_LABEL_DEFERRED_PLAYLIST_LIST; dl_type = DISPLAYLIST_GENERIC; break; + case ACTION_OK_DL_MUSIC_LIST: + info.type = type; + info.directory_ptr = idx; + info_path = label; + info_label = msg_hash_to_str( + MENU_ENUM_LABEL_DEFERRED_MUSIC_LIST); + info.enum_idx = MENU_ENUM_LABEL_DEFERRED_MUSIC_LIST; + dl_type = DISPLAYLIST_GENERIC; + break; case ACTION_OK_DL_CHEAT_FILE: filebrowser_clear_type(); info.type = type; diff --git a/menu/menu_displaylist.c b/menu/menu_displaylist.c index 08f1adb65a..3b0fe4b3ab 100644 --- a/menu/menu_displaylist.c +++ b/menu/menu_displaylist.c @@ -3628,8 +3628,11 @@ static int menu_displaylist_parse_playlists( file_type = FILE_TYPE_PLAYLIST_COLLECTION; - if (!string_is_empty(path)) - path = path_basename(path); + if (horizontal) + { + if (!string_is_empty(path)) + path = path_basename(path); + } items_found++; menu_entries_append_enum(info->list, path, label, @@ -6773,6 +6776,19 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, void *data) } use_filebrowser = true; break; + case DISPLAYLIST_PLAYLIST: + menu_displaylist_parse_playlist_generic(menu, info, + path_basename(info->path), + info->path, + &ret); + ret = 0; + + if (ret == 0) + { + info->need_refresh = true; + info->need_push = true; + } + break; case DISPLAYLIST_IMAGES_HISTORY: #ifdef HAVE_IMAGEVIEWER if (settings->bools.history_list_enable) diff --git a/menu/menu_displaylist.h b/menu/menu_displaylist.h index 2dd05054f3..630c0c3286 100644 --- a/menu/menu_displaylist.h +++ b/menu/menu_displaylist.h @@ -62,6 +62,7 @@ enum menu_displaylist_ctl_state DISPLAYLIST_HORIZONTAL_CONTENT_ACTIONS, DISPLAYLIST_HISTORY, DISPLAYLIST_FAVORITES, + DISPLAYLIST_PLAYLIST, DISPLAYLIST_VIDEO_HISTORY, DISPLAYLIST_MUSIC_HISTORY, DISPLAYLIST_IMAGES_HISTORY, diff --git a/msg_hash.h b/msg_hash.h index 4ee725abee..e2a9cb0be1 100644 --- a/msg_hash.h +++ b/msg_hash.h @@ -840,6 +840,7 @@ enum msg_hash_enums MENU_LABEL(BROWSE_START), /* Deferred */ MENU_ENUM_LABEL_DEFERRED_FAVORITES_LIST, + MENU_ENUM_LABEL_DEFERRED_PLAYLIST_LIST, MENU_ENUM_LABEL_DEFERRED_IMAGES_LIST, MENU_ENUM_LABEL_DEFERRED_MUSIC_LIST, MENU_ENUM_LABEL_DEFERRED_VIDEO_LIST,