aboutsummaryrefslogtreecommitdiff
path: root/xbmc/GUIMediaWindow.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'xbmc/GUIMediaWindow.cpp')
-rw-r--r--xbmc/GUIMediaWindow.cpp36
1 files changed, 34 insertions, 2 deletions
diff --git a/xbmc/GUIMediaWindow.cpp b/xbmc/GUIMediaWindow.cpp
index 1a07774dca..0de84f5547 100644
--- a/xbmc/GUIMediaWindow.cpp
+++ b/xbmc/GUIMediaWindow.cpp
@@ -152,7 +152,7 @@ bool CGUIMediaWindow::OnAction(const CAction &action)
{
if (action.GetID() == ACTION_PARENT_DIR)
{
- if (m_vecItems->IsVirtualDirectoryRoot() && g_advancedSettings.m_bUseEvilB)
+ if ((m_vecItems->IsVirtualDirectoryRoot() || m_vecItems->m_strPath == m_startDirectory) && g_advancedSettings.m_bUseEvilB)
g_windowManager.PreviousWindow();
else
GoParentFolder();
@@ -451,7 +451,32 @@ bool CGUIMediaWindow::OnMessage(CGUIMessage& message)
m_guiState->SetNextSortOrder();
UpdateFileList();
return true;
- }
+ }
+ break;
+ case GUI_MSG_WINDOW_INIT:
+ {
+ CStdString dir = message.GetStringParam(0);
+ const CStdString &ret = message.GetStringParam(1);
+ bool returning = ret.CompareNoCase("return") == 0;
+ if (!dir.IsEmpty())
+ {
+ m_history.ClearPathHistory();
+ // ensure our directory is valid
+ dir = GetStartFolder(dir);
+ if (!returning || m_vecItems->m_strPath.Left(dir.GetLength()) != dir)
+ { // we're not returning to the same path, so set our directory to the requested path
+ m_vecItems->m_strPath = dir;
+ }
+ // check for network up
+ if (CUtil::IsRemote(m_vecItems->m_strPath) && !WaitForNetwork())
+ m_vecItems->m_strPath.Empty();
+ SetHistoryForPath(m_vecItems->m_strPath);
+ }
+ if (message.GetParam1() != WINDOW_INVALID)
+ { // first time to this window - make sure we set the root path
+ m_startDirectory = returning ? dir : "";
+ }
+ }
break;
}
@@ -1488,3 +1513,10 @@ void CGUIMediaWindow::GetFilteredItems(const CStdString &filter, CFileItemList &
items.Add(item);
}
}
+
+CStdString CGUIMediaWindow::GetStartFolder(const CStdString &dir)
+{
+ if (dir.Equals("$ROOT") || dir.Equals("Root"))
+ return "";
+ return dir;
+}