aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Marshall <jmarshall@never.you.mind>2011-05-19 11:06:57 +1200
committerJonathan Marshall <jmarshall@never.you.mind>2011-05-19 11:06:57 +1200
commitfd0447c7357a201242266f5f2c596a8637c687cc (patch)
treef4761f1771f6eee7d9fa91eaf6091f7fc890cafa
parent0f04d6f4a11a302c7e8ed5b5331c3b6d33925551 (diff)
don't allow navigation to containers with no items. Closes #11482
-rw-r--r--xbmc/GUIViewControl.cpp6
-rw-r--r--xbmc/guilib/GUIBaseContainer.cpp5
-rw-r--r--xbmc/guilib/GUIBaseContainer.h1
3 files changed, 9 insertions, 3 deletions
diff --git a/xbmc/GUIViewControl.cpp b/xbmc/GUIViewControl.cpp
index 42843e91e4..28b3fc125c 100644
--- a/xbmc/GUIViewControl.cpp
+++ b/xbmc/GUIViewControl.cpp
@@ -112,6 +112,9 @@ void CGUIViewControl::SetCurrentView(int viewMode)
previousView->OnMessage(msg);
}
+ // Update it with the contents
+ UpdateContents(pNewView, item);
+
// and focus if necessary
if (hasFocus)
{
@@ -119,9 +122,6 @@ void CGUIViewControl::SetCurrentView(int viewMode)
g_windowManager.SendMessage(msg);
}
- // Update it with the contents
- UpdateContents(pNewView, item);
-
// Update our view control
UpdateViewAsControl(((CGUIBaseContainer *)pNewView)->GetLabel());
}
diff --git a/xbmc/guilib/GUIBaseContainer.cpp b/xbmc/guilib/GUIBaseContainer.cpp
index c15a38d167..bea730def2 100644
--- a/xbmc/guilib/GUIBaseContainer.cpp
+++ b/xbmc/guilib/GUIBaseContainer.cpp
@@ -1109,3 +1109,8 @@ void CGUIBaseContainer::GetCacheOffsets(int &cacheBefore, int &cacheAfter)
cacheAfter = m_cacheItems / 2;
}
}
+
+bool CGUIBaseContainer::CanFocus() const
+{
+ return (!m_items.empty() && CGUIControl::CanFocus());
+}
diff --git a/xbmc/guilib/GUIBaseContainer.h b/xbmc/guilib/GUIBaseContainer.h
index c3b6c415ef..77a2c3bd0f 100644
--- a/xbmc/guilib/GUIBaseContainer.h
+++ b/xbmc/guilib/GUIBaseContainer.h
@@ -50,6 +50,7 @@ public:
virtual void OnLeft();
virtual void OnRight();
virtual bool OnMouseOver(const CPoint &point);
+ virtual bool CanFocus() const;
virtual bool OnMessage(CGUIMessage& message);
virtual void SetFocus(bool bOnOff);
virtual void AllocResources();