Skip to content

Commit

Permalink
Merge pull request #3137 from jmbreuer/upstream-sortby
Browse files Browse the repository at this point in the history
Differentiate between "unsorted" and "unsortable"
  • Loading branch information
jmarshallnz committed Sep 27, 2013
2 parents 4dfbc05 + a29abf1 commit 6db5a2c
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
7 changes: 7 additions & 0 deletions xbmc/view/GUIViewState.cpp
Expand Up @@ -220,6 +220,11 @@ SortDescription CGUIViewState::GetSortMethod() const
return sorting;
}

bool CGUIViewState::HasMultipleSortMethods() const
{
return m_sortMethods.size() > 1;
}

int CGUIViewState::GetSortMethodLabel() const
{
if (m_currentSortMethod>=0 && m_currentSortMethod<(int)m_sortMethods.size())
Expand Down Expand Up @@ -293,6 +298,7 @@ void CGUIViewState::SetSortMethod(SortBy sortBy, SortAttribute sortAttributes /*
break;
}
}
SetSortOrder(m_sortOrder);
}

void CGUIViewState::SetSortMethod(SortDescription sortDescription)
Expand All @@ -308,6 +314,7 @@ SortDescription CGUIViewState::SetNextSortMethod(int direction /* = 1 */)
m_currentSortMethod = 0;
if (m_currentSortMethod < 0)
m_currentSortMethod = m_sortMethods.size() ? (int)m_sortMethods.size() - 1 : 0;
SetSortOrder(m_sortOrder);

SaveViewState();

Expand Down
1 change: 1 addition & 0 deletions xbmc/view/GUIViewState.h
Expand Up @@ -40,6 +40,7 @@ class CGUIViewState
SortDescription SetNextSortMethod(int direction = 1);
void SetCurrentSortMethod(int method);
SortDescription GetSortMethod() const;
bool HasMultipleSortMethods() const;
int GetSortMethodLabel() const;
void GetSortMethodLabelMasks(LABEL_MASKS& masks) const;

Expand Down
2 changes: 1 addition & 1 deletion xbmc/windows/GUIMediaWindow.cpp
Expand Up @@ -544,7 +544,7 @@ void CGUIMediaWindow::UpdateButtons()
m_viewControl.SetCurrentView(m_guiState->GetViewAsControl());

// Update sort by button
if (m_guiState->GetSortMethod().sortBy == SortByNone)
if (!m_guiState->HasMultipleSortMethods())
CONTROL_DISABLE(CONTROL_BTNSORTBY);
else
CONTROL_ENABLE(CONTROL_BTNSORTBY);
Expand Down

0 comments on commit 6db5a2c

Please sign in to comment.