make sure we initialize buttons in the video info dialog before we init the window...
authorJonathan Marshall <jmarshall@never.you.mind>
Sat, 3 Nov 2012 06:00:47 +0000 (19:00 +1300)
committerJonathan Marshall <jmarshall@never.you.mind>
Sat, 3 Nov 2012 06:00:47 +0000 (19:00 +1300)
xbmc/video/dialogs/GUIDialogVideoInfo.cpp
xbmc/video/dialogs/GUIDialogVideoInfo.h

index 3ea42b1..415a1c1 100644 (file)
@@ -90,39 +90,6 @@ bool CGUIDialogVideoInfo::OnMessage(CGUIMessage& message)
     }
     break;
 
-  case GUI_MSG_WINDOW_INIT:
-    {
-      m_bRefresh = false;
-      m_bRefreshAll = true;
-      m_hasUpdatedThumb = false;
-
-      CGUIDialog::OnMessage(message);
-      m_bViewReview = true;
-
-      CVideoDatabase database;
-      ADDON::ScraperPtr scraper;
-
-      if(database.Open())
-      {
-        scraper = database.GetScraperForPath(m_movieItem->GetVideoInfoTag()->GetPath());
-        database.Close();
-      }
-
-      CONTROL_ENABLE_ON_CONDITION(CONTROL_BTN_REFRESH, (g_settings.GetCurrentProfile().canWriteDatabases() || g_passwordManager.bMasterUser) && !m_movieItem->GetVideoInfoTag()->m_strIMDBNumber.Left(2).Equals("xx") && scraper);
-      CONTROL_ENABLE_ON_CONDITION(CONTROL_BTN_GET_THUMB, (g_settings.GetCurrentProfile().canWriteDatabases() || g_passwordManager.bMasterUser) && !m_movieItem->GetVideoInfoTag()->m_strIMDBNumber.Mid(2).Equals("plugin"));
-
-      VIDEODB_CONTENT_TYPE type = (VIDEODB_CONTENT_TYPE)m_movieItem->GetVideoContentType();
-      if (type == VIDEODB_CONTENT_TVSHOWS || type == VIDEODB_CONTENT_MOVIES)
-        CONTROL_ENABLE_ON_CONDITION(CONTROL_BTN_GET_FANART, (g_settings.GetCurrentProfile().canWriteDatabases() || g_passwordManager.bMasterUser) && !m_movieItem->GetVideoInfoTag()->m_strIMDBNumber.Mid(2).Equals("plugin"));
-      else
-        CONTROL_DISABLE(CONTROL_BTN_GET_FANART);
-
-      Update();
-      return true;
-    }
-    break;
-
-
   case GUI_MSG_CLICKED:
     {
       int iControl = message.GetSenderId();
@@ -222,6 +189,36 @@ bool CGUIDialogVideoInfo::OnMessage(CGUIMessage& message)
   return CGUIDialog::OnMessage(message);
 }
 
+void CGUIDialogVideoInfo::OnInitWindow()
+{
+  m_bRefresh = false;
+  m_bRefreshAll = true;
+  m_hasUpdatedThumb = false;
+  m_bViewReview = true;
+
+  CVideoDatabase database;
+  ADDON::ScraperPtr scraper;
+
+  if(database.Open())
+  {
+    scraper = database.GetScraperForPath(m_movieItem->GetVideoInfoTag()->GetPath());
+    database.Close();
+  }
+
+  CONTROL_ENABLE_ON_CONDITION(CONTROL_BTN_REFRESH, (g_settings.GetCurrentProfile().canWriteDatabases() || g_passwordManager.bMasterUser) && !m_movieItem->GetVideoInfoTag()->m_strIMDBNumber.Left(2).Equals("xx") && scraper);
+  CONTROL_ENABLE_ON_CONDITION(CONTROL_BTN_GET_THUMB, (g_settings.GetCurrentProfile().canWriteDatabases() || g_passwordManager.bMasterUser) && !m_movieItem->GetVideoInfoTag()->m_strIMDBNumber.Mid(2).Equals("plugin"));
+
+  VIDEODB_CONTENT_TYPE type = (VIDEODB_CONTENT_TYPE)m_movieItem->GetVideoContentType();
+  if (type == VIDEODB_CONTENT_TVSHOWS || type == VIDEODB_CONTENT_MOVIES)
+    CONTROL_ENABLE_ON_CONDITION(CONTROL_BTN_GET_FANART, (g_settings.GetCurrentProfile().canWriteDatabases() || g_passwordManager.bMasterUser) && !m_movieItem->GetVideoInfoTag()->m_strIMDBNumber.Mid(2).Equals("plugin"));
+  else
+    CONTROL_DISABLE(CONTROL_BTN_GET_FANART);
+
+  Update();
+
+  CGUIDialog::OnInitWindow();
+}
+
 bool CGUIDialogVideoInfo::OnAction(const CAction &action)
 {
   if (action.GetID() == ACTION_SHOW_INFO)
index dd34b5a..8c27850 100644 (file)
@@ -43,6 +43,7 @@ public:
 
   static std::string ChooseArtType(const CFileItem &item, std::map<std::string, std::string> &currentArt);
 protected:
+  virtual void OnInitWindow();
   void Update();
   void SetLabel(int iControl, const CStdString& strLabel);