mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-13 03:28:19 +00:00
b7d452d2a0
Add libnotify support for linux client Also unify notification management Make libnotify mandatory for the client. It is installed on 100% of Arch Linux systems and on 70% of Debian systems. I'd guess the remaining Debian systems are servers. Detect dependent libraries of `libnotify` using `pkg-config`. Remove library-specific code from the game module. Decrement refcount for libnotify notification object before leaving the function.
36 lines
699 B
C++
36 lines
699 B
C++
#include "notifications.h"
|
|
|
|
#include <base/detect.h>
|
|
|
|
#if defined(CONF_PLATFORM_MACOSX)
|
|
// Code is in src/osx/notification.mm.
|
|
#elif defined(CONF_FAMILY_UNIX)
|
|
#include <libnotify/notify.h>
|
|
void NotificationsInit()
|
|
{
|
|
notify_init("DDNet Client");
|
|
}
|
|
void NotificationsUninit()
|
|
{
|
|
notify_uninit();
|
|
}
|
|
void NotificationsNotify(const char *pTitle, const char *pMessage)
|
|
{
|
|
NotifyNotification *pNotif = notify_notification_new(pTitle, pMessage, NULL);
|
|
notify_notification_show(pNotif, NULL);
|
|
g_object_unref(G_OBJECT(pNotif));
|
|
}
|
|
#else
|
|
void NotificationsInit()
|
|
{
|
|
}
|
|
void NotificationsUninit()
|
|
{
|
|
}
|
|
void NotificationsNotify(const char *pTitle, const char *pMessage)
|
|
{
|
|
(void)pTitle;
|
|
(void)pMessage;
|
|
}
|
|
#endif
|