don't allow navigation to containers with no items. Closes #11482
authorJonathan Marshall <jmarshall@never.you.mind>
Wed, 18 May 2011 23:06:57 +0000 (11:06 +1200)
committerJonathan Marshall <jmarshall@never.you.mind>
Wed, 18 May 2011 23:06:57 +0000 (11:06 +1200)
xbmc/GUIViewControl.cpp
xbmc/guilib/GUIBaseContainer.cpp
xbmc/guilib/GUIBaseContainer.h

index 42843e9..28b3fc1 100644 (file)
@@ -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());
 }
index c15a38d..bea730d 100644 (file)
@@ -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());
+}
index c3b6c41..77a2c3b 100644 (file)
@@ -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();