Skip to content
This repository
Browse code

Merge pull request #3137 from jmbreuer/upstream-sortby

Differentiate between "unsorted" and "unsortable"
  • Loading branch information...
commit 6db5a2cb6f2a6aa6f0a976b104a092abb149f961 2 parents 4dfbc05 + a29abf1
jmarshallnz authored September 27, 2013
7  xbmc/view/GUIViewState.cpp
@@ -220,6 +220,11 @@ SortDescription CGUIViewState::GetSortMethod() const
220 220
   return sorting;
221 221
 }
222 222
 
  223
+bool CGUIViewState::HasMultipleSortMethods() const
  224
+{
  225
+  return m_sortMethods.size() > 1;
  226
+}
  227
+
223 228
 int CGUIViewState::GetSortMethodLabel() const
224 229
 {
225 230
   if (m_currentSortMethod>=0 && m_currentSortMethod<(int)m_sortMethods.size())
@@ -293,6 +298,7 @@ void CGUIViewState::SetSortMethod(SortBy sortBy, SortAttribute sortAttributes /*
293 298
       break;
294 299
     }
295 300
   }
  301
+  SetSortOrder(m_sortOrder);
296 302
 }
297 303
 
298 304
 void CGUIViewState::SetSortMethod(SortDescription sortDescription)
@@ -308,6 +314,7 @@ SortDescription CGUIViewState::SetNextSortMethod(int direction /* = 1 */)
308 314
     m_currentSortMethod = 0;
309 315
   if (m_currentSortMethod < 0)
310 316
     m_currentSortMethod = m_sortMethods.size() ? (int)m_sortMethods.size() - 1 : 0;
  317
+  SetSortOrder(m_sortOrder);
311 318
 
312 319
   SaveViewState();
313 320
 
1  xbmc/view/GUIViewState.h
@@ -40,6 +40,7 @@ class CGUIViewState
40 40
   SortDescription SetNextSortMethod(int direction = 1);
41 41
   void SetCurrentSortMethod(int method);
42 42
   SortDescription GetSortMethod() const;
  43
+  bool HasMultipleSortMethods() const;
43 44
   int GetSortMethodLabel() const;
44 45
   void GetSortMethodLabelMasks(LABEL_MASKS& masks) const;
45 46
 
2  xbmc/windows/GUIMediaWindow.cpp
@@ -544,7 +544,7 @@ void CGUIMediaWindow::UpdateButtons()
544 544
     m_viewControl.SetCurrentView(m_guiState->GetViewAsControl());
545 545
 
546 546
     // Update sort by button
547  
-    if (m_guiState->GetSortMethod().sortBy == SortByNone)
  547
+    if (!m_guiState->HasMultipleSortMethods())
548 548
       CONTROL_DISABLE(CONTROL_BTNSORTBY);
549 549
     else
550 550
       CONTROL_ENABLE(CONTROL_BTNSORTBY);

0 notes on commit 6db5a2c

Please sign in to comment.
Something went wrong with that request. Please try again.