diff --git a/src/infoplugins/generic/snorenotify/SnoreNotifyPlugin.cpp b/src/infoplugins/generic/snorenotify/SnoreNotifyPlugin.cpp index 607a92373..bb9263b77 100644 --- a/src/infoplugins/generic/snorenotify/SnoreNotifyPlugin.cpp +++ b/src/infoplugins/generic/snorenotify/SnoreNotifyPlugin.cpp @@ -1,6 +1,6 @@ /* === This file is part of Tomahawk Player - <http://tomahawk-player.org> === * - * Copyright 2013 , Patrick von Reth <vonreth@kde.org> + * Copyright 2013-2014, Patrick von Reth <vonreth@kde.org> * Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org> * Copyright 2010-2012, Jeff Mitchell <jeff@tomahawk-player.org> * @@ -59,14 +59,16 @@ SnoreNotifyPlugin::SnoreNotifyPlugin() } else { - m_snore->setPrimaryNotificationBackend( backend ); + if(!m_snore->setPrimaryNotificationBackend( backend )) + { + tDebug( LOGVERBOSE ) << Q_FUNC_INFO << "Ivalid or unavailible Snore backend: " << backend << " availible backens: " << m_snore->notificationBackends(); + m_snore->setPrimaryNotificationBackend(); + } } tDebug( LOGVERBOSE ) << Q_FUNC_INFO << m_snore->primaryNotificationBackend(); m_application = new Snore::Application( qApp->applicationName(), m_defaultIcon ); - m_snore->addApplication( m_application ); - m_snore->applicationIsInitialized( m_application ); addAlert( InfoNotifyUser, tr( "Notify User" ) ); addAlert( InfoNowPlaying, tr( "Now Playing" ) ); @@ -74,6 +76,9 @@ SnoreNotifyPlugin::SnoreNotifyPlugin() addAlert( InfoNowStopped, tr( "Playback Stopped" ) ); addAlert( InfoInboxReceived, tr( "You received a Song recomondation" ) ); + m_snore->addApplication( m_application ); + m_snore->applicationIsInitialized( m_application ); + connect( m_snore, SIGNAL( actionInvoked( Snore::Notification ) ), this, SLOT( slotActionInvoked( Snore::Notification ) ) ); } @@ -81,13 +86,14 @@ SnoreNotifyPlugin::SnoreNotifyPlugin() SnoreNotifyPlugin::~SnoreNotifyPlugin() { tDebug( LOGVERBOSE ) << Q_FUNC_INFO; - m_snore->deleteLater(); - m_application->deleteLater(); + m_snore->removeApplication(m_application->name()); foreach( Snore::Alert* alert, m_alerts ) { alert->deleteLater(); } + m_snore->deleteLater(); + m_application->deleteLater(); } void diff --git a/src/infoplugins/generic/snorenotify/SnoreNotifyPlugin.h b/src/infoplugins/generic/snorenotify/SnoreNotifyPlugin.h index 1c6b046ff..1240e25ed 100644 --- a/src/infoplugins/generic/snorenotify/SnoreNotifyPlugin.h +++ b/src/infoplugins/generic/snorenotify/SnoreNotifyPlugin.h @@ -1,6 +1,6 @@ /* === This file is part of Tomahawk Player - <http://tomahawk-player.org> === * - * Copyright 2013 , Patrick von Reth <vonreth@kde.org> + * Copyright 2013-2014, Patrick von Reth <vonreth@kde.org> * Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org> * Copyright 2010-2011, Jeff Mitchell <jeff@tomahawk-player.org> * @@ -26,8 +26,6 @@ #include "infosystem/InfoSystem.h" #include <snore/core/snore.h> -class QDBusPendingCallWatcher; - namespace Tomahawk {