aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormontellese <montellese@xbmc.org>2012-10-18 11:43:34 +0200
committermontellese <montellese@xbmc.org>2012-10-18 11:43:34 +0200
commite530bbb8e367f44841704b6563e55c8e3dac8812 (patch)
treecf657edd8b9b9b7221b656193916868615e3b27c
parentbb6d1c74774635636cd5e60b20dd2eef06333c2e (diff)
media library: only do a list refresh when the items have been loaded before
Without this additional logic/check the call to Refresh from CGUIMediaWindow::OnInitWindow() causes to only perform a refresh (i.e. only using the list of items from the latest GetDirectory() call and ignoring any member variables) because the path has already been set in m_vecItems. Therefore we only add the retrieved lsit of items to m_vecItems and ignore member variables like m_content, m_mapProperties etc. That resulted in bad behaviour (e.g. watched state didn't work anymore) for logic relying on m_vecItems->GetContent().
-rw-r--r--xbmc/windows/GUIMediaWindow.cpp8
-rw-r--r--xbmc/windows/GUIMediaWindow.h1
2 files changed, 7 insertions, 2 deletions
diff --git a/xbmc/windows/GUIMediaWindow.cpp b/xbmc/windows/GUIMediaWindow.cpp
index 913069de8b..293f47d746 100644
--- a/xbmc/windows/GUIMediaWindow.cpp
+++ b/xbmc/windows/GUIMediaWindow.cpp
@@ -90,6 +90,7 @@ CGUIMediaWindow::CGUIMediaWindow(int id, const char *xmlFile)
m_iLastControl = -1;
m_iSelectedItem = -1;
m_canFilterAdvanced = false;
+ m_itemsLoaded = false;
m_guiState.reset(CGUIViewState::GetViewState(GetID(), *m_vecItems));
}
@@ -243,6 +244,7 @@ bool CGUIMediaWindow::OnMessage(CGUIMessage& message)
// Call ClearFileItems() after our window has finished doing any WindowClose
// animations
ClearFileItems();
+ m_itemsLoaded = false;
return true;
}
break;
@@ -727,12 +729,12 @@ bool CGUIMediaWindow::Update(const CStdString &strDirectory)
GetDirectoryHistoryString(pItem.get(), strSelectedItem);
}
}
-
- bool refresh = strDirectory == m_vecItems->GetPath();
CStdString strCurrentDirectory = m_vecItems->GetPath();
m_history.SetSelectedItem(strSelectedItem, strCurrentDirectory);
+ bool refresh = (strDirectory == strCurrentDirectory && m_itemsLoaded);
+
CFileItemList items;
if (!GetDirectory(strDirectory, items))
{
@@ -760,6 +762,8 @@ bool CGUIMediaWindow::Update(const CStdString &strDirectory)
m_vecItems->Append(items);
else
m_vecItems->Copy(items);
+
+ m_itemsLoaded = true;
// if we're getting the root source listing
// make sure the path history is clean
diff --git a/xbmc/windows/GUIMediaWindow.h b/xbmc/windows/GUIMediaWindow.h
index 765a48fc43..7dd1abb1e9 100644
--- a/xbmc/windows/GUIMediaWindow.h
+++ b/xbmc/windows/GUIMediaWindow.h
@@ -145,4 +145,5 @@ protected:
CSmartPlaylist m_filter;
bool m_canFilterAdvanced;
+ bool m_itemsLoaded;
};