Skip to content
This repository

home.xml existence testing #1094

Merged
merged 2 commits into from almost 2 years ago

2 participants

Michal Piechowiak jmarshallnz
Michal Piechowiak
Collaborator
pieh commented June 20, 2012

This fixes issue described in http://forum.xbmc.org/showthread.php?tid=132641

Currently when we load skin, we test if loading Home.xml window is ok: https://github.com/xbmc/xbmc/blob/master....cpp#L1815 . This can actually cause several issues:
a) window will stay in memory and next time we will show it we won't resolve our includes as window is already loaded
b) it will trigger home's window actions (which technically is correct as we load that window, but I doubt anyone want that)

Fix:
Instead of loading home.xml we just test if it exists. I also moved this test before loading any includes, etc. as we don't need them to test file existence.
In addition I notify user that something is wrong with skin and that's why we load default skin instead.

added some commits June 20, 2012
Michal Piechowiak instead of loading home.xml just test if it exist on skin loading
fixes conditional includes in home.xml not being resolved on window activation first time we enter home.xml after skin loading
ad5e04d
Michal Piechowiak add error notification for user when missing home.xml 40bb7a5
jmarshallnz
Owner

Looks good - assigned to July.

Michal Piechowiak pieh merged commit 5096f9c into from July 02, 2012
Michal Piechowiak pieh closed this July 02, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Showing 2 unique commits by 1 author.

Jun 21, 2012
Michal Piechowiak instead of loading home.xml just test if it exist on skin loading
fixes conditional includes in home.xml not being resolved on window activation first time we enter home.xml after skin loading
ad5e04d
Michal Piechowiak add error notification for user when missing home.xml 40bb7a5
This page is out of date. Refresh to see the latest.
10  language/English/strings.po
@@ -8725,7 +8725,15 @@ msgctxt "#24101"
8725 8725
 msgid "Would you like to download this Add-on?"
8726 8726
 msgstr ""
8727 8727
 
8728  
-#empty strings from id 24102 to 24999
  8728
+msgctxt "#24102"
  8729
+msgid "Unable to load skin"
  8730
+msgstr ""
  8731
+
  8732
+msgctxt "#24103"
  8733
+msgid "Skin is missing some files"
  8734
+msgstr ""
  8735
+
  8736
+#empty strings from id 24104 to 24999
8729 8737
 
8730 8738
 msgctxt "#25000"
8731 8739
 msgid "Notifications"
27  xbmc/Application.cpp
@@ -1746,6 +1746,20 @@ void CApplication::LoadSkin(const SkinPtr& skin)
1746 1746
     return ;
1747 1747
   }
1748 1748
 
  1749
+  if (!skin->HasSkinFile("Home.xml"))
  1750
+  {
  1751
+    // failed to find home.xml
  1752
+    // fallback to default skin
  1753
+    if (strcmpi(skin->ID().c_str(), DEFAULT_SKIN) != 0)
  1754
+    {
  1755
+      CLog::Log(LOGERROR, "home.xml doesn't exist in skin: %s, fallback to \"%s\" skin", skin->ID().c_str(), DEFAULT_SKIN);
  1756
+      g_guiSettings.SetString("lookandfeel.skin", DEFAULT_SKIN);
  1757
+      LoadSkin(DEFAULT_SKIN);
  1758
+      CGUIDialogKaiToast::QueueNotification(CGUIDialogKaiToast::Error, g_localizeStrings.Get(24102), g_localizeStrings.Get(24103));
  1759
+      return ;
  1760
+    }
  1761
+  }
  1762
+
1749 1763
   bool bPreviousPlayingState=false;
1750 1764
   bool bPreviousRenderingState=false;
1751 1765
   if (g_application.m_pPlayer && g_application.IsPlayingVideo())
@@ -1811,19 +1825,6 @@ void CApplication::LoadSkin(const SkinPtr& skin)
1811 1825
   start = CurrentHostCounter();
1812 1826
 
1813 1827
   CLog::Log(LOGINFO, "  load new skin...");
1814  
-  CGUIWindowHome *pHome = (CGUIWindowHome *)g_windowManager.GetWindow(WINDOW_HOME);
1815  
-  if (!pHome || !pHome->Load("Home.xml"))
1816  
-  {
1817  
-    // failed to load home.xml
1818  
-    // fallback to default skin
1819  
-    if ( strcmpi(skin->ID().c_str(), DEFAULT_SKIN) != 0)
1820  
-    {
1821  
-      CLog::Log(LOGERROR, "failed to load home.xml for skin: %s, fallback to \"%s\" skin", skin->ID().c_str(), DEFAULT_SKIN);
1822  
-      g_guiSettings.SetString("lookandfeel.skin", DEFAULT_SKIN);
1823  
-      LoadSkin(DEFAULT_SKIN);
1824  
-      return ;
1825  
-    }
1826  
-  }
1827 1828
 
1828 1829
   // Load the user windows
1829 1830
   LoadUserWindows();
Commit_comment_tip

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.