gwin32notificationbackend: Only warn once

Use a GOnce to make sure we only warn about notifications not being
supported on Windows once, rather than on each attempted notification.

Signed-off-by: Philip Withnall <withnall@endlessm.com>

Helps: https://gitlab.gnome.org/GNOME/glib/issues/1234
This commit is contained in:
Philip Withnall 2018-04-23 10:59:04 +01:00
parent fded2090e2
commit 39382c7889

View File

@ -59,12 +59,18 @@ g_win32_notification_backend_send_notification (GNotificationBackend *backend,
const gchar *id,
GNotification *notification)
{
static gsize warned = 0;
/* FIXME: See https://bugzilla.gnome.org/show_bug.cgi?id=776583. This backend
* exists purely to stop crashes when applications use g_notification*()
* on Windows, by providing a dummy backend implementation. (The alternative
* was to modify all of the backend call sites in g_notification*(), which
* seemed less scalable.) */
g_warning ("Notifications are not yet supported on Windows.");
if (g_once_init_enter (&warned))
{
g_warning ("Notifications are not yet supported on Windows.");
g_once_init_leave (&warned, 1);
}
}
static void