From 712a2fcc1da9a90e174e24ff76b8f8308ef84cc6 Mon Sep 17 00:00:00 2001
From: Ryunam <ryunam@gmail.com>
Date: Tue, 17 Apr 2018 17:53:24 +0200
Subject: [PATCH] Add toggle to show/hide Playlist tabs

---
 config.def.h                 |  1 +
 configuration.c              |  1 +
 configuration.h              |  1 +
 intl/msg_hash_ar.h           |  4 ++++
 intl/msg_hash_chs.h          |  2 ++
 intl/msg_hash_cht.h          |  2 ++
 intl/msg_hash_eo.h           |  2 ++
 intl/msg_hash_fr.h           |  2 ++
 intl/msg_hash_it.h           |  2 ++
 intl/msg_hash_lbl.h          |  2 ++
 intl/msg_hash_nl.h           |  2 ++
 intl/msg_hash_us.h           |  4 ++++
 intl/msg_hash_vn.h           |  4 ++++
 menu/cbs/menu_cbs_sublabel.c |  4 ++++
 menu/drivers/xmb.c           |  2 +-
 menu/menu_displaylist.c      |  3 +++
 menu/menu_setting.c          | 15 +++++++++++++++
 msg_hash.h                   |  1 +
 18 files changed, 53 insertions(+), 1 deletion(-)

diff --git a/config.def.h b/config.def.h
index 26c8425972..3d4a6ab152 100644
--- a/config.def.h
+++ b/config.def.h
@@ -297,6 +297,7 @@ static bool content_show_history     = true;
 #ifdef HAVE_LIBRETRODB
 static bool content_show_add     	 = true;
 #endif
+static bool content_show_playlists   = true;
 
 #ifdef HAVE_XMB
 static unsigned xmb_scale_factor = 100;
diff --git a/configuration.c b/configuration.c
index 5d72273a96..b98fd08d47 100644
--- a/configuration.c
+++ b/configuration.c
@@ -1312,6 +1312,7 @@ static struct config_bool_setting *populate_settings_bool(settings_t *settings,
 #ifdef HAVE_LIBRETRODB
    SETTING_BOOL("content_show_add",              &settings->bools.menu_content_show_add, true, content_show_add, false);
 #endif
+   SETTING_BOOL("content_show_playlists",        &settings->bools.menu_content_show_playlists, true, content_show_playlists, false);
    SETTING_BOOL("menu_show_load_core",           &settings->bools.menu_show_load_core, true, menu_show_load_core, false);
    SETTING_BOOL("menu_show_load_content",        &settings->bools.menu_show_load_content, true, menu_show_load_content, false);
    SETTING_BOOL("menu_show_information",         &settings->bools.menu_show_information, true, menu_show_information, false);
diff --git a/configuration.h b/configuration.h
index 22afea73b4..d4aeaa9f6d 100644
--- a/configuration.h
+++ b/configuration.h
@@ -158,6 +158,7 @@ typedef struct settings
       bool menu_content_show_netplay;
       bool menu_content_show_history;
       bool menu_content_show_add;
+      bool menu_content_show_playlists;
       bool menu_unified_controls;
       bool quick_menu_show_take_screenshot;
       bool quick_menu_show_save_load_state;
diff --git a/intl/msg_hash_ar.h b/intl/msg_hash_ar.h
index 38ad7fe49d..ee7de26592 100644
--- a/intl/msg_hash_ar.h
+++ b/intl/msg_hash_ar.h
@@ -1879,6 +1879,8 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_CONTENT_SHOW_HISTORY,
       "Show History Tab")
 MSG_HASH(MENU_ENUM_LABEL_VALUE_CONTENT_SHOW_ADD,
       "Show Import content Tab")
+MSG_HASH(MENU_ENUM_LABEL_VALUE_CONTENT_SHOW_PLAYLISTS,
+      "Show Playlist Tabs")
 MSG_HASH(MENU_ENUM_LABEL_VALUE_CONTENT_SHOW_FAVORITES,
       "Show Favorites Tab")
 MSG_HASH(MENU_ENUM_LABEL_VALUE_CONTENT_SHOW_IMAGES,
@@ -3081,6 +3083,8 @@ MSG_HASH(MENU_ENUM_SUBLABEL_CONTENT_SHOW_HISTORY,
       "Show the recent history tab inside the main menu.")
 MSG_HASH(MENU_ENUM_SUBLABEL_CONTENT_SHOW_ADD,
       "Show the import content tab inside the main menu.")
+MSG_HASH(MENU_ENUM_SUBLABEL_CONTENT_SHOW_PLAYLISTS,
+      "Show playlist tabs inside the main menu.")
 MSG_HASH(MENU_ENUM_SUBLABEL_RGUI_SHOW_START_SCREEN,
       "Show startup screen in menu. This is automatically set to false after the program starts for the first time.")
 MSG_HASH(MENU_ENUM_SUBLABEL_MATERIALUI_MENU_HEADER_OPACITY,
diff --git a/intl/msg_hash_chs.h b/intl/msg_hash_chs.h
index 2359b5ffd5..ef35928e1c 100644
--- a/intl/msg_hash_chs.h
+++ b/intl/msg_hash_chs.h
@@ -2909,6 +2909,8 @@ MSG_HASH(MENU_ENUM_SUBLABEL_CONTENT_SHOW_HISTORY,
       "Show the recent history tab inside the main menu.")
 MSG_HASH(MENU_ENUM_SUBLABEL_CONTENT_SHOW_ADD,
       "Show the import content tab inside the main menu.")
+MSG_HASH(MENU_ENUM_SUBLABEL_CONTENT_SHOW_PLAYLISTS,
+      "Show playlist tabs inside the main menu.")
 MSG_HASH(MENU_ENUM_SUBLABEL_RGUI_SHOW_START_SCREEN,
       "Show startup screen in menu. This is automatically set to false after the program starts for the first time.")
 MSG_HASH(MENU_ENUM_SUBLABEL_MATERIALUI_MENU_HEADER_OPACITY,
diff --git a/intl/msg_hash_cht.h b/intl/msg_hash_cht.h
index ee0585c832..7f9945dabd 100644
--- a/intl/msg_hash_cht.h
+++ b/intl/msg_hash_cht.h
@@ -2901,6 +2901,8 @@ MSG_HASH(MENU_ENUM_SUBLABEL_CONTENT_SHOW_HISTORY,
       "Show the recent history tab inside the main menu.")
 MSG_HASH(MENU_ENUM_SUBLABEL_CONTENT_SHOW_ADD,
       "Show the import content tab inside the main menu.")
+MSG_HASH(MENU_ENUM_SUBLABEL_CONTENT_SHOW_PLAYLISTS,
+      "Show playlist tabs inside the main menu.")
 MSG_HASH(MENU_ENUM_SUBLABEL_RGUI_SHOW_START_SCREEN,
       "Show startup screen in menu. This is automatically set to false after the program starts for the first time.")
 MSG_HASH(MENU_ENUM_SUBLABEL_MATERIALUI_MENU_HEADER_OPACITY,
diff --git a/intl/msg_hash_eo.h b/intl/msg_hash_eo.h
index 2a3d41b3d4..ed258bbce0 100644
--- a/intl/msg_hash_eo.h
+++ b/intl/msg_hash_eo.h
@@ -2774,6 +2774,8 @@ MSG_HASH(MENU_ENUM_SUBLABEL_CONTENT_SHOW_HISTORY,
       "Show the recent history tab inside the main menu.")
 MSG_HASH(MENU_ENUM_SUBLABEL_CONTENT_SHOW_ADD,
       "Show the import content tab inside the main menu.")
+MSG_HASH(MENU_ENUM_SUBLABEL_CONTENT_SHOW_PLAYLISTS,
+      "Show playlist tabs inside the main menu.")
 MSG_HASH(MENU_ENUM_SUBLABEL_RGUI_SHOW_START_SCREEN,
       "Show startup screen in menu. This is automatically set to false after the program starts for the first time.")
 MSG_HASH(MENU_ENUM_SUBLABEL_MATERIALUI_MENU_HEADER_OPACITY,
diff --git a/intl/msg_hash_fr.h b/intl/msg_hash_fr.h
index 0b24993d02..0133bdec20 100644
--- a/intl/msg_hash_fr.h
+++ b/intl/msg_hash_fr.h
@@ -2939,6 +2939,8 @@ MSG_HASH(MENU_ENUM_SUBLABEL_CONTENT_SHOW_HISTORY,
       "Affiche l'onglet de l'historique dans le menu principal.")
 MSG_HASH(MENU_ENUM_SUBLABEL_CONTENT_SHOW_ADD,
       "Show the import content tab inside the main menu.")
+MSG_HASH(MENU_ENUM_SUBLABEL_CONTENT_SHOW_PLAYLISTS,
+      "Show playlist tabs inside the main menu.")
 MSG_HASH(MENU_ENUM_SUBLABEL_RGUI_SHOW_START_SCREEN,
       "Show startup screen in menu. This is automatically set to false after the program starts for the first time.")
 MSG_HASH(MENU_ENUM_SUBLABEL_MATERIALUI_MENU_HEADER_OPACITY,
diff --git a/intl/msg_hash_it.h b/intl/msg_hash_it.h
index 99f7321f26..d441d6b7e3 100644
--- a/intl/msg_hash_it.h
+++ b/intl/msg_hash_it.h
@@ -2991,6 +2991,8 @@ MSG_HASH(MENU_ENUM_SUBLABEL_CONTENT_SHOW_HISTORY,
       "Mostra la colonna cronologia all'interno del menu principale.")
 MSG_HASH(MENU_ENUM_SUBLABEL_CONTENT_SHOW_ADD,
       "Mostra la colonna importa contenuto all'interno del menu principale.")
+MSG_HASH(MENU_ENUM_SUBLABEL_CONTENT_SHOW_PLAYLISTS,
+      "Mostra le colonne delle playlist all'interno del menu principale")
 MSG_HASH(MENU_ENUM_SUBLABEL_RGUI_SHOW_START_SCREEN,
       "Mostra la schermata di avvio nel menu. Questo viene automaticamente impostato su off dopo l'avvio del programma per la prima volta.")
 MSG_HASH(MENU_ENUM_SUBLABEL_MATERIALUI_MENU_HEADER_OPACITY,
diff --git a/intl/msg_hash_lbl.h b/intl/msg_hash_lbl.h
index 8f138c19d2..7942fd7b3e 100644
--- a/intl/msg_hash_lbl.h
+++ b/intl/msg_hash_lbl.h
@@ -1253,6 +1253,8 @@ MSG_HASH(MENU_ENUM_LABEL_CONTENT_SHOW_HISTORY,
       "content_show_history")
 MSG_HASH(MENU_ENUM_LABEL_CONTENT_SHOW_ADD,
       "content_show_add")
+MSG_HASH(MENU_ENUM_LABEL_CONTENT_SHOW_PLAYLISTS,
+      "content_show_playlists")
 MSG_HASH(MENU_ENUM_LABEL_CONTENT_SHOW_FAVORITES,
       "content_show_favorites")
 MSG_HASH(MENU_ENUM_LABEL_CONTENT_SHOW_IMAGES,
diff --git a/intl/msg_hash_nl.h b/intl/msg_hash_nl.h
index 6f7ec9d529..c6e4047d9c 100644
--- a/intl/msg_hash_nl.h
+++ b/intl/msg_hash_nl.h
@@ -2776,6 +2776,8 @@ MSG_HASH(MENU_ENUM_SUBLABEL_CONTENT_SHOW_HISTORY,
       "Show the recent history tab inside the main menu.")
 MSG_HASH(MENU_ENUM_SUBLABEL_CONTENT_SHOW_ADD,
       "Show the import content tab inside the main menu.")
+MSG_HASH(MENU_ENUM_SUBLABEL_CONTENT_SHOW_PLAYLISTS,
+      "Show playlist tabs inside the main menu.")
 MSG_HASH(MENU_ENUM_SUBLABEL_RGUI_SHOW_START_SCREEN,
       "Show startup screen in menu. This is automatically set to false after the program starts for the first time.")
 MSG_HASH(MENU_ENUM_SUBLABEL_MATERIALUI_MENU_HEADER_OPACITY,
diff --git a/intl/msg_hash_us.h b/intl/msg_hash_us.h
index 90d8a2c09b..d0752f8240 100644
--- a/intl/msg_hash_us.h
+++ b/intl/msg_hash_us.h
@@ -1897,6 +1897,8 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_CONTENT_SHOW_HISTORY,
       "Show History Tab")
 MSG_HASH(MENU_ENUM_LABEL_VALUE_CONTENT_SHOW_ADD,
       "Show Import content Tab")
+MSG_HASH(MENU_ENUM_LABEL_VALUE_CONTENT_SHOW_PLAYLISTS,
+      "Show Playlist Tabs")
 MSG_HASH(MENU_ENUM_LABEL_VALUE_CONTENT_SHOW_FAVORITES,
       "Show Favorites Tab")
 MSG_HASH(MENU_ENUM_LABEL_VALUE_CONTENT_SHOW_IMAGES,
@@ -3126,6 +3128,8 @@ MSG_HASH(MENU_ENUM_SUBLABEL_CONTENT_SHOW_HISTORY,
       "Show the recent history tab inside the main menu.")
 MSG_HASH(MENU_ENUM_SUBLABEL_CONTENT_SHOW_ADD,
       "Show the import content tab inside the main menu.")
+MSG_HASH(MENU_ENUM_SUBLABEL_CONTENT_SHOW_PLAYLISTS,
+      "Show playlist tabs inside the main menu.")
 MSG_HASH(MENU_ENUM_SUBLABEL_RGUI_SHOW_START_SCREEN,
       "Show startup screen in menu. This is automatically set to false after the program starts for the first time.")
 MSG_HASH(MENU_ENUM_SUBLABEL_MATERIALUI_MENU_HEADER_OPACITY,
diff --git a/intl/msg_hash_vn.h b/intl/msg_hash_vn.h
index efc435f26a..285acf1900 100644
--- a/intl/msg_hash_vn.h
+++ b/intl/msg_hash_vn.h
@@ -1761,6 +1761,8 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_CONTENT_SHOW_HISTORY,
       "Display History Tab")
 MSG_HASH(MENU_ENUM_LABEL_VALUE_CONTENT_SHOW_ADD,
       "Display Import content Tab")
+MSG_HASH(MENU_ENUM_LABEL_VALUE_CONTENT_SHOW_PLAYLISTS,
+      "Display Playlist Tabs")
 MSG_HASH(MENU_ENUM_LABEL_VALUE_CONTENT_SHOW_IMAGES,
       "Display Image Tab")
 MSG_HASH(MENU_ENUM_LABEL_VALUE_CONTENT_SHOW_MUSIC,
@@ -2935,6 +2937,8 @@ MSG_HASH(MENU_ENUM_SUBLABEL_CONTENT_SHOW_HISTORY,
       "Show the recent history tab inside the main menu.")
 MSG_HASH(MENU_ENUM_SUBLABEL_CONTENT_SHOW_ADD,
       "Show the import content tab inside the main menu.")
+MSG_HASH(MENU_ENUM_SUBLABEL_CONTENT_SHOW_PLAYLISTS,
+      "Show playlist tabs inside the main menu.")
 MSG_HASH(MENU_ENUM_SUBLABEL_RGUI_SHOW_START_SCREEN,
       "Show startup screen in menu. This is automatically set to false after the program starts for the first time.")
 MSG_HASH(MENU_ENUM_SUBLABEL_MATERIALUI_MENU_HEADER_OPACITY,
diff --git a/menu/cbs/menu_cbs_sublabel.c b/menu/cbs/menu_cbs_sublabel.c
index d9841a6294..7be57bf835 100644
--- a/menu/cbs/menu_cbs_sublabel.c
+++ b/menu/cbs/menu_cbs_sublabel.c
@@ -338,6 +338,7 @@ default_sublabel_macro(action_bind_sublabel_menu_settings_tab,
 default_sublabel_macro(action_bind_sublabel_menu_settings_tab_enable_password,     MENU_ENUM_SUBLABEL_CONTENT_SHOW_SETTINGS_PASSWORD)
 default_sublabel_macro(action_bind_sublabel_menu_history_tab,                      MENU_ENUM_SUBLABEL_CONTENT_SHOW_HISTORY)
 default_sublabel_macro(action_bind_sublabel_menu_import_content_tab,               MENU_ENUM_SUBLABEL_CONTENT_SHOW_ADD)
+default_sublabel_macro(action_bind_sublabel_menu_playlist_tabs,                    MENU_ENUM_SUBLABEL_CONTENT_SHOW_PLAYLISTS)
 default_sublabel_macro(action_bind_sublabel_main_menu_enable_settings,             MENU_ENUM_SUBLABEL_XMB_MAIN_MENU_ENABLE_SETTINGS)
 default_sublabel_macro(action_bind_sublabel_rgui_show_start_screen,                MENU_ENUM_SUBLABEL_RGUI_SHOW_START_SCREEN)
 default_sublabel_macro(action_bind_sublabel_menu_header_opacity,                   MENU_ENUM_SUBLABEL_MATERIALUI_MENU_HEADER_OPACITY)
@@ -699,6 +700,9 @@ int menu_cbs_init_bind_sublabel(menu_file_list_cbs_t *cbs,
          case MENU_ENUM_LABEL_CONTENT_SHOW_ADD:
             BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_menu_import_content_tab);
             break;
+         case MENU_ENUM_LABEL_CONTENT_SHOW_PLAYLISTS:
+            BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_menu_playlist_tabs);
+            break;
          case MENU_ENUM_LABEL_XMB_MAIN_MENU_ENABLE_SETTINGS:
             BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_main_menu_enable_settings);
             break;
diff --git a/menu/drivers/xmb.c b/menu/drivers/xmb.c
index 53ca07b3d7..cf61dfa30e 100755
--- a/menu/drivers/xmb.c
+++ b/menu/drivers/xmb.c
@@ -1990,7 +1990,7 @@ static void xmb_init_horizontal_list(xmb_handle_t *xmb)
    info.type_default            = FILE_TYPE_PLAIN;
    info.enum_idx                = MENU_ENUM_LABEL_CONTENT_COLLECTION_LIST;
 
-   if (!string_is_empty(info.path))
+   if (settings->bools.menu_content_show_playlists && !string_is_empty(info.path))
    {
       if (menu_displaylist_ctl(DISPLAYLIST_DATABASE_PLAYLISTS_HORIZONTAL, &info))
       {
diff --git a/menu/menu_displaylist.c b/menu/menu_displaylist.c
index 16da491e9c..f0d7940b66 100644
--- a/menu/menu_displaylist.c
+++ b/menu/menu_displaylist.c
@@ -5216,6 +5216,9 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, void *data)
                MENU_ENUM_LABEL_CONTENT_SHOW_ADD,
                PARSE_ONLY_BOOL, false);
 #endif
+         menu_displaylist_parse_settings_enum(menu, info,
+               MENU_ENUM_LABEL_CONTENT_SHOW_PLAYLISTS,
+               PARSE_ONLY_BOOL, false);
          menu_displaylist_parse_settings_enum(menu, info,
                MENU_ENUM_LABEL_TIMEDATE_ENABLE,
                PARSE_ONLY_BOOL, false);
diff --git a/menu/menu_setting.c b/menu/menu_setting.c
index 4f8b30e6ad..219bed435d 100644
--- a/menu/menu_setting.c
+++ b/menu/menu_setting.c
@@ -5724,6 +5724,21 @@ static bool setting_append_list(
             settings_data_list_current_add_flags(list, list_info, SD_FLAG_LAKKA_ADVANCED);
 #endif
 
+            CONFIG_BOOL(
+                  list, list_info,
+                  &settings->bools.menu_content_show_playlists,
+                  MENU_ENUM_LABEL_CONTENT_SHOW_PLAYLISTS,
+                  MENU_ENUM_LABEL_VALUE_CONTENT_SHOW_PLAYLISTS,
+                  content_show_playlists,
+                  MENU_ENUM_LABEL_VALUE_OFF,
+                  MENU_ENUM_LABEL_VALUE_ON,
+                  &group_info,
+                  &subgroup_info,
+                  parent_group,
+                  general_write_handler,
+                  general_read_handler,
+                  SD_FLAG_NONE);
+
 #ifdef HAVE_MATERIALUI
          if (string_is_equal(settings->arrays.menu_driver, "glui"))
          {
diff --git a/msg_hash.h b/msg_hash.h
index 1ebe02b5a7..f55e29f338 100644
--- a/msg_hash.h
+++ b/msg_hash.h
@@ -774,6 +774,7 @@ enum msg_hash_enums
    MENU_LABEL(CONTENT_SHOW_NETPLAY),
    MENU_LABEL(CONTENT_SHOW_HISTORY),
    MENU_LABEL(CONTENT_SHOW_ADD),
+   MENU_LABEL(CONTENT_SHOW_PLAYLISTS),
    MENU_LABEL(XMB_RIBBON_ENABLE),
    MENU_LABEL(THUMBNAILS),
    MENU_LABEL(LEFT_THUMBNAILS),