Index: xbmc/utils/GUIInfoManager.cpp =================================================================== --- xbmc/utils/GUIInfoManager.cpp (revision 30779) +++ xbmc/utils/GUIInfoManager.cpp (working copy) @@ -1033,7 +1033,6 @@ { case WEATHER_CONDITIONS: strLabel = g_weatherManager.GetInfo(WEATHER_LABEL_CURRENT_COND); - strLabel = strLabel.Trim(); break; case WEATHER_TEMPERATURE: strLabel.Format("%s%s", g_weatherManager.GetInfo(WEATHER_LABEL_CURRENT_TEMP), g_langInfo.GetTempUnitString().c_str()); @@ -1042,8 +1041,7 @@ strLabel = g_weatherManager.GetInfo(WEATHER_LABEL_LOCATION); break; case WEATHER_FANART_CODE: - strLabel = CUtil::GetFileName(g_weatherManager.GetInfo(WEATHER_IMAGE_CURRENT_ICON)); - CUtil::RemoveExtension(strLabel); + strLabel = g_weatherManager.GetInfo(WEATHER_LABEL_FANART_CODE); break; case WEATHER_PLUGIN: strLabel = g_guiSettings.GetString("weather.plugin"); @@ -2648,7 +2646,9 @@ return GetMultiInfoLabel(m_multiInfo[info - MULTI_INFO_START], contextWindow); } else if (info == WEATHER_CONDITIONS) + { return g_weatherManager.GetInfo(WEATHER_IMAGE_CURRENT_ICON); + } else if (info == SYSTEM_PROFILETHUMB) { CStdString thumb = g_settings.m_vecProfiles[g_settings.m_iLastLoadedProfileIndex].getThumb(); Index: xbmc/utils/Weather.cpp =================================================================== --- xbmc/utils/Weather.cpp (revision 30779) +++ xbmc/utils/Weather.cpp (working copy) @@ -25,7 +25,6 @@ #include "GUIWindowManager.h" #include "GUIMediaWindow.h" #include "ScriptSettings.h" -#include "GUIDialogPluginSettings.h" using namespace std; @@ -42,12 +41,24 @@ { } -const char *CWeather::TranslateInfo(int info) +CStdString CWeather::TranslateInfo(int info) const { - if (info == WEATHER_LABEL_CURRENT_COND) return m_szCurrentConditions; - else if (info == WEATHER_IMAGE_CURRENT_ICON) return m_szCurrentIcon; - else if (info == WEATHER_LABEL_CURRENT_TEMP) return m_szCurrentTemperature; - else if (info == WEATHER_LABEL_LOCATION) return m_szCurrentLocation; + CGUIWindow *window = g_windowManager.GetWindow(WINDOW_WEATHER); + if (window) + { + if (info == WEATHER_LABEL_CURRENT_COND) + return window->GetProperty("Current.Condition"); + else if (info == WEATHER_IMAGE_CURRENT_ICON) + return window->GetProperty("Current.ConditionIcon"); + else if (info == WEATHER_LABEL_CURRENT_TEMP) + return window->GetProperty("Current.Temperature"); + else if (info == WEATHER_LABEL_LOCATION) + return window->GetProperty("Location"); + else if (info == WEATHER_ISFETCHED) + return window->GetProperty("Weather.IsFetched"); + else if (info == WEATHER_LABEL_FANART_CODE) + return window->GetProperty("Current.FanartCode"); + } return ""; } @@ -86,12 +97,6 @@ void CWeather::Reset() { - strcpy(m_szLastUpdateTime, "false"); - strcpy(m_szCurrentIcon,""); - strcpy(m_szCurrentConditions, ""); - strcpy(m_szCurrentTemperature, ""); - strcpy(m_szCurrentLocation, ""); - for (int i = 0; i < MAX_LOCATION; i++) { strcpy(m_szLocation[i], ""); @@ -103,23 +108,5 @@ { // call GetInfo() to make sure that we actually start up GetInfo(0); - SetInfo(); - return (strcmp(m_szLastUpdateTime, "true") == 0); + return TranslateInfo(WEATHER_ISFETCHED).Equals("true"); } - -void CWeather::SetInfo() -{ - if (strcmp(m_szLastUpdateTime, "false") == 0 || strcmp(m_szLastUpdateTime, "") == 0) - { - CGUIWindow *window = g_windowManager.GetWindow(WINDOW_WEATHER); - if (window) - { - // set these so existing weather infolabels don't break - strcpy(m_szLastUpdateTime, ((CGUIMediaWindow*)window)->GetProperty("Weather.IsFetched").c_str()); - strcpy(m_szCurrentIcon, ((CGUIMediaWindow*)window)->GetProperty("Current.ConditionIcon").c_str()); - strcpy(m_szCurrentConditions, ((CGUIMediaWindow*)window)->GetProperty("Current.Condition").c_str()); - strcpy(m_szCurrentTemperature, ((CGUIMediaWindow*)window)->GetProperty("Current.Condition").c_str()); - strcpy(m_szCurrentLocation, ((CGUIMediaWindow*)window)->GetProperty("Location").c_str()); - } - } -} Index: xbmc/utils/Weather.h =================================================================== --- xbmc/utils/Weather.h (revision 30779) +++ xbmc/utils/Weather.h (working copy) @@ -22,11 +22,14 @@ */ #include "InfoLoader.h" +#include "StdString.h" #define WEATHER_LABEL_LOCATION 10 #define WEATHER_IMAGE_CURRENT_ICON 21 #define WEATHER_LABEL_CURRENT_COND 22 #define WEATHER_LABEL_CURRENT_TEMP 23 +#define WEATHER_ISFETCHED 24 +#define WEATHER_LABEL_FANART_CODE 25 class CBackgroundWeatherLoader : public CBackgroundLoader @@ -47,22 +50,13 @@ void SetArea(int iArea) { m_iCurWeather = iArea; }; unsigned int GetMaxLocations(); - void SetInfo(); protected: - virtual const char *TranslateInfo(int info); + virtual CStdString TranslateInfo(int info) const; virtual DWORD TimeToNextRefreshInMs(); char m_szLocation[10][100]; - // Last updated - char m_szLastUpdateTime[256]; - // Now weather - char m_szCurrentIcon[256]; - char m_szCurrentConditions[256]; - char m_szCurrentTemperature[10]; - char m_szCurrentLocation[256]; - unsigned int m_iCurWeather; int m_MaxLocations;