~renatofilho/sync-monitor/remove-addressbook

« back to all changes in this revision

Viewing changes to src/notify-message-notify.cpp

  • Committer: Renato Araujo Oliveira Filho
  • Date: 2014-04-09 19:49:30 UTC
  • Revision ID: renato.filho@canonical.com-20140409194930-oy2z258gijrlkfvv
*Make sure that the first online account created is set as default account
*After removing a online account ask the user if he wants to keep the contacts or remove it.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 * Copyright 2014 Canonical Ltd.
3
 
 *
4
 
 * This file is part of sync-monitor.
5
 
 *
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.
9
 
 *
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.
14
 
 *
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/>.
17
 
 */
18
 
 
19
 
#include "notify-message.h"
20
 
 
21
 
#include <QtCore/QCoreApplication>
22
 
#include <QtCore/QDebug>
23
 
#include <libnotify/notify.h>
24
 
 
25
 
static void notificationClosed(NotifyNotification *notification, gpointer data);
26
 
 
27
 
NotifyMessage::NotifyMessage()
28
 
{
29
 
    qDebug() << "Notify init";
30
 
    notify_init(QCoreApplication::instance()->applicationName().toUtf8());
31
 
}
32
 
 
33
 
NotifyMessage::~NotifyMessage()
34
 
{
35
 
    notify_uninit();
36
 
}
37
 
 
38
 
void NotifyMessage::show(const QString &title, const QString &msg, const QString &iconName)
39
 
{
40
 
    NotifyNotification *notify = notify_notification_new(title.toUtf8().data(),
41
 
                                                         msg.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,
46
 
                           "closed",
47
 
                           (GCallback)notificationClosed,
48
 
                           0);
49
 
}
50
 
 
51
 
void notificationClosed(NotifyNotification *notification, gpointer data)
52
 
{
53
 
    g_object_unref(notification);
54
 
}