Skip to content

Commit

Permalink
Merge pull request xbmc#2007 from jmarshallnz/dot_dot_dot
Browse files Browse the repository at this point in the history
Show '..' items as we're supposed to in empty lists
  • Loading branch information
jmarshallnz committed Dec 30, 2012
2 parents 8d822b5 + ede31b2 commit a1d90c1
Showing 1 changed file with 13 additions and 26 deletions.
39 changes: 13 additions & 26 deletions xbmc/windows/GUIMediaWindow.cpp
Expand Up @@ -873,18 +873,6 @@ bool CGUIMediaWindow::Update(const CStdString &strDirectory, bool updateFilterPa
// filtering on the items, setting thumbs.
OnPrepareFileItems(*m_vecItems);

// The idea here is to ensure we have something to focus if our file list
// is empty. As such, this check MUST be last and ignore the hide parent
// fileitems settings.
if (m_vecItems->IsEmpty())
{
CFileItemPtr pItem(new CFileItem(".."));
pItem->SetPath(m_history.GetParentPath());
pItem->m_bIsFolder = true;
pItem->m_bIsShareOrDrive = false;
m_vecItems->AddFront(pItem, 0);
}

m_vecItems->FillInDefaultIcons();

m_guiState.reset(CGUIViewState::GetViewState(GetID(), *m_vecItems));
Expand Down Expand Up @@ -946,22 +934,9 @@ bool CGUIMediaWindow::Refresh(bool clearCache /* = false */)
m_vecItems->RemoveDiscCache(GetID());

// get the original number of items
int oldCount = m_filter.IsEmpty() ? m_vecItems->Size() : m_unfilteredItems->Size();
if (!Update(strCurrentDirectory, false))
return false;

// check if we previously had at least 1 item
// in the list and whether it now went down to 0
// if there are no more items to show after the update
// we go one level up in the hierachry to not show an
// empty list
if (oldCount > 0 &&
(m_filter.IsEmpty() ? m_vecItems->Size() : m_unfilteredItems->Size()) <= 0)
{
CGUIDialogKaiToast::QueueNotification(CGUIDialogKaiToast::Info, g_localizeStrings.Get(2080), g_localizeStrings.Get(2081));
GoParentFolder();
}

return true;
}

Expand Down Expand Up @@ -1775,7 +1750,19 @@ void CGUIMediaWindow::OnFilterItems(const CStdString &filter)
}
}
}


// The idea here is to ensure we have something to focus if our file list
// is empty. As such, this check MUST be last and ignore the hide parent
// fileitems settings.
if (m_vecItems->IsEmpty())
{
CFileItemPtr pItem(new CFileItem(".."));
pItem->SetPath(m_history.GetParentPath());
pItem->m_bIsFolder = true;
pItem->m_bIsShareOrDrive = false;
m_vecItems->AddFront(pItem, 0);
}

// and update our view control + buttons
m_viewControl.SetItems(*m_vecItems);
m_viewControl.SetSelectedItem(currentItemPath);
Expand Down

0 comments on commit a1d90c1

Please sign in to comment.