X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/afbf46a31740bb05af12a8ba0069345a2c9aba46..5bac960d404f6fc82f6d7c4c697dd018657d24ab:/src/gtk/notifmsg.cpp diff --git a/src/gtk/notifmsg.cpp b/src/gtk/notifmsg.cpp index 8b4b75c076..20bc1884ba 100644 --- a/src/gtk/notifmsg.cpp +++ b/src/gtk/notifmsg.cpp @@ -3,7 +3,6 @@ // Purpose: wxNotificationMessage for wxGTK using libnotify. // Author: Vadim Zeitlin // Created: 2012-07-25 -// RCS-ID: $Id$ // Copyright: (c) 2012 Vadim Zeitlin // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -23,13 +22,14 @@ #pragma hdrstop #endif -#if wxUSE_NOTIFICATION_MESSAGE +#if wxUSE_NOTIFICATION_MESSAGE && wxUSE_LIBNOTIFY + +#include "wx/notifmsg.h" #ifndef WX_PRECOMP + #include "wx/app.h" #endif // WX_PRECOMP -#include "wx/notifmsg.h" - #include #include "wx/module.h" @@ -82,6 +82,13 @@ wxIMPLEMENT_DYNAMIC_CLASS(wxLibnotifyModule, wxModule); // wxNotificationMessage implementation // ============================================================================ +bool wxNotificationMessage::GTKSetIconName(const wxString& name) +{ + m_iconName = name; + + return true; +} + bool wxNotificationMessage::Show(int timeout) { if ( !wxLibnotifyModule::Initialize() ) @@ -113,6 +120,15 @@ bool wxNotificationMessage::Show(int timeout) return false; } + // Explicitly specified icon name overrides the implicit one determined by + // the flags. + wxScopedCharBuffer buf; + if ( !m_iconName.empty() ) + { + buf = m_iconName.utf8_str(); + icon = buf; + } + // Create the notification or update an existing one if we had already been // shown before. if ( !m_notification ) @@ -122,6 +138,13 @@ bool wxNotificationMessage::Show(int timeout) GetTitle().utf8_str(), GetMessage().utf8_str(), icon +#if !wxUSE_LIBNOTIFY_0_7 + // There used to be an "associated window" + // parameter in this function but it has + // disappeared by 0.7, so use it for previous + // versions only. + , 0 +#endif // libnotify < 0.7 ); if ( !m_notification ) { @@ -191,4 +214,4 @@ wxNotificationMessage::~wxNotificationMessage() g_object_unref(m_notification); } -#endif // wxUSE_NOTIFICATION_MESSAGE +#endif // wxUSE_NOTIFICATION_MESSAGE && wxUSE_LIBNOTIFY