~unity-api-team/unity-notifications/trunk

« back to all changes in this revision

Viewing changes to src/NotificationPlugin.cpp

  • Committer: CI Train Bot
  • Author(s): Pete Woods
  • Date: 2015-06-23 15:50:11 UTC
  • mfrom: (224.1.8 add-dbus-tests)
  • Revision ID: ci-train-bot@canonical.com-20150623155011-bnt9ubw5elnay015
Add end to end DBus tests and use XML introspection data
Approved by: Charles Kerr

Show diffs side-by-side

added added

removed removed

Lines of Context:
26
26
 
27
27
#include <qqml.h>
28
28
 
29
 
#include <QtDBus>
 
29
#include <QDBusConnection>
30
30
#include <QQmlEngine>
31
31
#include <QQmlContext>
32
32
 
52
52
 
53
53
void NotificationPlugin::initializeEngine(QQmlEngine *engine, const char *uri) {
54
54
    m = new NotificationModel();
55
 
    s = new NotificationServer(*m, engine);
56
 
 
57
 
    QDBusConnectionInterface *iface = QDBusConnection::sessionBus().interface();
58
 
    auto reply = iface->registerService(DBUS_SERVICE_NAME, QDBusConnectionInterface::ReplaceExistingService,
59
 
                                        QDBusConnectionInterface::DontAllowReplacement);
60
 
    if(!reply.isValid() || reply.value() != QDBusConnectionInterface::ServiceRegistered) {
61
 
        fprintf(stderr, "Service name already taken.\n");
62
 
    }
63
 
    if(!QDBusConnection::sessionBus().registerObject(DBUS_PATH, engine)) {
64
 
        fprintf(stderr, "Could not register to DBus session.\n");
65
 
    }
 
55
    s = new NotificationServer(QDBusConnection::sessionBus(), *m, engine);
66
56
}