FIRE-6868: Implemented GrowlNotifierWin::isUsable and fixed Growl initialization on Windows (only subscribe for events if Growl is available)

master
Ansariel 2013-04-26 22:40:12 +02:00
parent da57595d86
commit 7532d4f953
2 changed files with 29 additions and 5 deletions

View File

@ -80,6 +80,24 @@ GrowlManager::GrowlManager() : LLEventTimer(GROWL_THROTTLE_CLEANUP_PERIOD)
LL_INFOS("GrowlManagerInit") << "Created generic GrowlNotifier." << LL_ENDL;
#endif
#ifdef LL_WINDOWS
if (mNotifier)
{
// Need to call loadConfig for Windows first before we know if
// Growl is usable -Ansariel
loadConfig();
if (!mNotifier->isUsable())
{
LL_WARNS("GrowlManagerInit") << "Growl is unusable; bailing out." << LL_ENDL;
return;
}
}
else
{
LL_WARNS("GrowlManagerInit") << "Growl is unusable; bailing out." << LL_ENDL;
return;
}
#else
// Don't do anything more if Growl isn't usable.
if( !mNotifier || !mNotifier->isUsable())
{
@ -87,6 +105,9 @@ GrowlManager::GrowlManager() : LLEventTimer(GROWL_THROTTLE_CLEANUP_PERIOD)
return;
}
loadConfig();
#endif
// Hook into LLNotifications...
// We hook into all of them, even though (at the time of writing) nothing uses "alert", so more notifications can be added easily.
LLNotificationChannel::buildChannel("GrowlNotifications", "Visible", &filterOldNotifications);
@ -97,8 +118,6 @@ GrowlManager::GrowlManager() : LLEventTimer(GROWL_THROTTLE_CLEANUP_PERIOD)
// Hook into script dialogs
LLScriptFloaterManager::instance().addNewObjectCallback(&GrowlManager::onScriptDialog);
this->loadConfig();
}
void GrowlManager::loadConfig()

View File

@ -37,7 +37,9 @@
#include "growlnotifierwin.h"
#include "llviewercontrol.h"
GrowlNotifierWin::GrowlNotifierWin():applicationName("")
GrowlNotifierWin::GrowlNotifierWin() :
applicationName(""),
growl(NULL)
{
LL_INFOS("GrowlNotifierWin") << "Windows growl notifications initialised." << LL_ENDL;
@ -67,10 +69,13 @@ void GrowlNotifierWin::showNotification(const std::string& notification_title, c
const std::string& notification_type)
{
//LL_INFOS("GrowlNotifierWin") << std::string(gDirUtilp->getDefaultSkinDir()+gDirUtilp->getDirDelimiter()+"textures"+gDirUtilp->getDirDelimiter()+"phoenixicon.ico").c_str() << LL_ENDL;
growl->Notify(notification_type.c_str(),notification_title.c_str(),notification_message.c_str());
if (growl)
{
growl->Notify(notification_type.c_str(),notification_title.c_str(),notification_message.c_str());
}
}
bool GrowlNotifierWin::isUsable()
{
return true;
return (growl && growl->isConnected());
}