Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

home.xml existence testing #1094

Merged
merged 2 commits into from

2 participants

Michal Piechowiak jmarshallnz
Michal Piechowiak
Collaborator

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.

pieh added some commits
Michal Piechowiak pieh 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 pieh add error notification for user when missing home.xml 40bb7a5
jmarshallnz
Owner

Looks good - assigned to July.

Michal Piechowiak pieh was assigned
Michal Piechowiak pieh merged commit 5096f9c into from
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jun 21, 2012
  1. Michal Piechowiak

    instead of loading home.xml just test if it exist on skin loading

    pieh authored
    fixes conditional includes in home.xml not being resolved on window activation first time we enter home.xml after skin loading
  2. Michal Piechowiak
This page is out of date. Refresh to see the latest.
Showing with 23 additions and 14 deletions.
  1. +9 −1 language/English/strings.po
  2. +14 −13 xbmc/Application.cpp
10 language/English/strings.po
View
@@ -8725,7 +8725,15 @@ msgctxt "#24101"
msgid "Would you like to download this Add-on?"
msgstr ""
-#empty strings from id 24102 to 24999
+msgctxt "#24102"
+msgid "Unable to load skin"
+msgstr ""
+
+msgctxt "#24103"
+msgid "Skin is missing some files"
+msgstr ""
+
+#empty strings from id 24104 to 24999
msgctxt "#25000"
msgid "Notifications"
27 xbmc/Application.cpp
View
@@ -1746,6 +1746,20 @@ void CApplication::LoadSkin(const SkinPtr& skin)
return ;
}
+ if (!skin->HasSkinFile("Home.xml"))
+ {
+ // failed to find home.xml
+ // fallback to default skin
+ if (strcmpi(skin->ID().c_str(), DEFAULT_SKIN) != 0)
+ {
+ CLog::Log(LOGERROR, "home.xml doesn't exist in skin: %s, fallback to \"%s\" skin", skin->ID().c_str(), DEFAULT_SKIN);
+ g_guiSettings.SetString("lookandfeel.skin", DEFAULT_SKIN);
+ LoadSkin(DEFAULT_SKIN);
+ CGUIDialogKaiToast::QueueNotification(CGUIDialogKaiToast::Error, g_localizeStrings.Get(24102), g_localizeStrings.Get(24103));
+ return ;
+ }
+ }
+
bool bPreviousPlayingState=false;
bool bPreviousRenderingState=false;
if (g_application.m_pPlayer && g_application.IsPlayingVideo())
@@ -1811,19 +1825,6 @@ void CApplication::LoadSkin(const SkinPtr& skin)
start = CurrentHostCounter();
CLog::Log(LOGINFO, " load new skin...");
- CGUIWindowHome *pHome = (CGUIWindowHome *)g_windowManager.GetWindow(WINDOW_HOME);
- if (!pHome || !pHome->Load("Home.xml"))
- {
- // failed to load home.xml
- // fallback to default skin
- if ( strcmpi(skin->ID().c_str(), DEFAULT_SKIN) != 0)
- {
- CLog::Log(LOGERROR, "failed to load home.xml for skin: %s, fallback to \"%s\" skin", skin->ID().c_str(), DEFAULT_SKIN);
- g_guiSettings.SetString("lookandfeel.skin", DEFAULT_SKIN);
- LoadSkin(DEFAULT_SKIN);
- return ;
- }
- }
// Load the user windows
LoadUserWindows();
Something went wrong with that request. Please try again.