Updating a skin should work now even if the current version is missing. This should solve the issue 121.

The default tray icon is shown if custom tray measure cannot be created.
This commit is contained in:
Kimmo Pekkola 2009-10-30 19:10:55 +00:00
parent fd9cac7add
commit 46570b6025
3 changed files with 47 additions and 35 deletions

View File

@ -994,6 +994,11 @@ void CRainmeter::CheckSkinVersions()
// Compare the version files // Compare the version files
if (CompareVersions(strVersionNew, strVersionInIni) == 1 && if (CompareVersions(strVersionNew, strVersionInIni) == 1 &&
CompareVersions(strVersionNew, strVersionCurrent) == 1) CompareVersions(strVersionNew, strVersionCurrent) == 1)
{
// Check if the old skin exists at all
struct _stat64i32 s;
std::wstring strSkinPath = m_SkinPath + menu[i].name;
if (_wstat(strSkinPath.c_str(), &s) == 0)
{ {
std::wstring strMessage = L"The config called \"" + menu[i].name + L"\" is newer\nthan the one you are currently using.\n\n"; std::wstring strMessage = L"The config called \"" + menu[i].name + L"\" is newer\nthan the one you are currently using.\n\n";
strMessage += L"New config: " + (strVersionNew.empty() ? L"Unknown" : strVersionNew) + L"\n"; strMessage += L"New config: " + (strVersionNew.empty() ? L"Unknown" : strVersionNew) + L"\n";
@ -1038,6 +1043,16 @@ void CRainmeter::CheckSkinVersions()
MessageBox(NULL, strMessage.c_str(), APPNAME, MB_OK | MB_ICONERROR); MessageBox(NULL, strMessage.c_str(), APPNAME, MB_OK | MB_ICONERROR);
} }
} }
}
else
{
std::wstring strMessage = L"A new version of config called \"" + menu[i].name + L"\" is available\n";
strMessage += L"Do you want to add it to your skin library?";
if (IDYES == MessageBox(NULL, strMessage.c_str(), APPNAME, MB_YESNO | MB_ICONQUESTION))
{
CopyFiles(strMainSkinsPath + menu[i].name, m_SkinPath);
}
}
// Even if the user doesn't want to upgrade mark it to the Rainmeter.ini so we don't ask the upgrade question again // Even if the user doesn't want to upgrade mark it to the Rainmeter.ini so we don't ask the upgrade question again
WritePrivateProfileString(menu[i].name.c_str(), L"Version", strVersionNew.c_str(), m_IniFile.c_str()); WritePrivateProfileString(menu[i].name.c_str(), L"Version", strVersionNew.c_str(), m_IniFile.c_str());

View File

@ -195,11 +195,7 @@ BOOL CTrayWindow::ShowBalloonHelp()
HICON CTrayWindow::CreateTrayIcon(double value) HICON CTrayWindow::CreateTrayIcon(double value)
{ {
if (m_Measure == NULL) if (m_Measure != NULL)
{
return LoadIcon(m_Instance, MAKEINTRESOURCE(IDI_TRAY));
}
else
{ {
if (m_MeterType == TRAY_METER_TYPE_HISTOGRAM) if (m_MeterType == TRAY_METER_TYPE_HISTOGRAM)
{ {
@ -290,7 +286,8 @@ HICON CTrayWindow::CreateTrayIcon(double value)
} }
} }
return NULL; // Return the default icon if there is no valid measure
return LoadIcon(m_Instance, MAKEINTRESOURCE(IDI_TRAY));
} }
void CTrayWindow::ReadConfig(CConfigParser& parser) void CTrayWindow::ReadConfig(CConfigParser& parser)

View File

@ -1,2 +1,2 @@
#pragma once #pragma once
const int revision_number = 291; const int revision_number = 292;