From f6dd52e3aee595ddb6b6079253db51dd00a710b4 Mon Sep 17 00:00:00 2001 From: enen92 <92enen@gmail.com> Date: Mon, 8 Jan 2024 12:38:32 +0000 Subject: [guilib][utils] Set IsPlayable false on add items --- xbmc/music/MusicUtils.cpp | 6 +++--- xbmc/video/VideoUtils.cpp | 6 +++--- xbmc/windows/GUIMediaWindow.cpp | 1 + xbmc/windows/GUIWindowFileManager.cpp | 1 + 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/xbmc/music/MusicUtils.cpp b/xbmc/music/MusicUtils.cpp index 0b0d13e556..ff68f9b274 100644 --- a/xbmc/music/MusicUtils.cpp +++ b/xbmc/music/MusicUtils.cpp @@ -930,10 +930,10 @@ bool IsItemPlayable(const CFileItem& item) return true; else if (item.m_bIsFolder) { - // Not a music-specific folder (just file:// or nfs://). Allow play if context is Music window. - if (CServiceBroker::GetGUI()->GetWindowManager().GetActiveWindow() == WINDOW_MUSIC_NAV && - item.GetPath() != "add") // Exclude "Add music source" item + if (!item.HasProperty("IsPlayable") || item.GetProperty("IsPlayable").asBoolean()) + { return true; + } } return false; } diff --git a/xbmc/video/VideoUtils.cpp b/xbmc/video/VideoUtils.cpp index 4122347d17..055f54e205 100644 --- a/xbmc/video/VideoUtils.cpp +++ b/xbmc/video/VideoUtils.cpp @@ -606,10 +606,10 @@ bool IsItemPlayable(const CFileItem& item) } else if (item.m_bIsFolder) { - // Not a video-specific folder (like file:// or nfs://). Allow play if context is Video window. - if (CServiceBroker::GetGUI()->GetWindowManager().GetActiveWindow() == WINDOW_VIDEO_NAV && - item.GetPath() != "add") // Exclude "Add video source" item + if (!item.HasProperty("IsPlayable") || item.GetProperty("IsPlayable").asBoolean()) + { return true; + } } return false; diff --git a/xbmc/windows/GUIMediaWindow.cpp b/xbmc/windows/GUIMediaWindow.cpp index 5dacf417a1..a261ecd702 100644 --- a/xbmc/windows/GUIMediaWindow.cpp +++ b/xbmc/windows/GUIMediaWindow.cpp @@ -907,6 +907,7 @@ bool CGUIMediaWindow::Update(const std::string &strDirectory, bool updateFilterP const std::string& strLabel = g_localizeStrings.Get(showLabel); CFileItemPtr pItem(new CFileItem(strLabel)); pItem->SetPath("add"); + pItem->SetProperty("IsPlayable", false); pItem->SetArt("icon", "DefaultAddSource.png"); pItem->SetLabel(strLabel); pItem->SetLabelPreformatted(true); diff --git a/xbmc/windows/GUIWindowFileManager.cpp b/xbmc/windows/GUIWindowFileManager.cpp index 966fd74fb0..59ba24245f 100644 --- a/xbmc/windows/GUIWindowFileManager.cpp +++ b/xbmc/windows/GUIWindowFileManager.cpp @@ -493,6 +493,7 @@ bool CGUIWindowFileManager::Update(int iList, const std::string &strDirectory) const std::string& strLabel = g_localizeStrings.Get(1026); CFileItemPtr pItem(new CFileItem(strLabel)); pItem->SetPath("add"); + pItem->SetProperty("IsPlayable", false); pItem->SetArt("icon", "DefaultAddSource.png"); pItem->SetLabel(strLabel); pItem->SetLabelPreformatted(true); -- cgit v1.2.3