2
* Copyright 2014 Canonical Ltd.
4
* This file is part of sync-monitor.
6
* sync-monitor is free software; you can redistribute it and/or modify
7
* it under the terms of the GNU General Public License as published by
8
* the Free Software Foundation; version 3.
10
* contact-service-app is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
* GNU General Public License for more details.
15
* You should have received a copy of the GNU General Public License
16
* along with this program. If not, see <http://www.gnu.org/licenses/>.
19
#include "notify-message.h"
21
#include <QtCore/QCoreApplication>
22
#include <QtCore/QDebug>
23
#include <libnotify/notify.h>
25
static void notificationClosed(NotifyNotification *notification, gpointer data);
27
NotifyMessage::NotifyMessage()
29
qDebug() << "Notify init";
30
notify_init(QCoreApplication::instance()->applicationName().toUtf8());
33
NotifyMessage::~NotifyMessage()
38
void NotifyMessage::show(const QString &title, const QString &msg, const QString &iconName)
40
NotifyNotification *notify = notify_notification_new(title.toUtf8().data(),
42
iconName.isEmpty() ? (const char*) 0 : iconName.toUtf8().constData());
43
notify_notification_set_timeout(notify, NOTIFY_EXPIRES_DEFAULT);
44
notify_notification_show(notify, 0);
45
g_signal_connect_after(notify,
47
(GCallback)notificationClosed,
51
void notificationClosed(NotifyNotification *notification, gpointer data)
53
g_object_unref(notification);