summaryrefslogtreecommitdiff
path: root/src/notificationmonitor.cpp
diff options
context:
space:
mode:
authorJavier S. Pedro <dev.git@javispedro.com>2014-09-14 20:56:29 +0200
committerJavier S. Pedro <dev.git@javispedro.com>2014-09-14 20:56:29 +0200
commit6a581ace4f14c30f1c66daf28064d7aefde546fc (patch)
tree9b777dc1669832a6bc785b313edf88bf19c36425 /src/notificationmonitor.cpp
parent4bc56bff80046b74926289be8825726296f39791 (diff)
downloadsalmeta-6a581ace4f14c30f1c66daf28064d7aefde546fc.tar.gz
salmeta-6a581ace4f14c30f1c66daf28064d7aefde546fc.zip
simplify notification monitoring for now
Diffstat (limited to 'src/notificationmonitor.cpp')
-rw-r--r--src/notificationmonitor.cpp27
1 files changed, 7 insertions, 20 deletions
diff --git a/src/notificationmonitor.cpp b/src/notificationmonitor.cpp
index 50f7b91..50b2e3e 100644
--- a/src/notificationmonitor.cpp
+++ b/src/notificationmonitor.cpp
@@ -1,33 +1,25 @@
#include <QtCore/QDebug>
#include <QtDBus/QDBusConnection>
#include <QtDBus/QDBusConnectionInterface>
-
#include "notificationmonitor.h"
static NotificationMonitor *global_monitor = 0;
-namespace
-{
-
-}
-
NotificationMonitor::NotificationMonitor(QObject *parent) :
QObject(parent)
{
QDBusConnection bus = QDBusConnection::sessionBus();
-
- _watcher = new QDBusServiceWatcher("org.freedesktop.Notifications", bus,
- QDBusServiceWatcher::WatchForOwnerChange,
- this);
- connect(_watcher, &QDBusServiceWatcher::serviceOwnerChanged,
- this, &NotificationMonitor::handleServiceOwnerChanged);
-
- bus.interface()->call("AddMatch",
- "interface='org.freedesktop.Notifications',member='Notify',type='method_call',eavesdrop='true'");
+ QDBusConnectionInterface *dbus = bus.interface();
+ dbus->call("AddMatch",
+ "interface='org.freedesktop.Notifications',member='Notify',type='method_call',eavesdrop='true'");
}
NotificationMonitor::~NotificationMonitor()
{
+ QDBusConnection bus = QDBusConnection::sessionBus();
+ QDBusConnectionInterface *dbus = bus.interface();
+ dbus->call("RemoveMatch",
+ "interface='org.freedesktop.Notifications',member='Notify',type='method_call',eavesdrop='true'");
}
NotificationMonitor *NotificationMonitor::instance()
@@ -37,8 +29,3 @@ NotificationMonitor *NotificationMonitor::instance()
}
return global_monitor;
}
-
-void NotificationMonitor::handleServiceOwnerChanged(const QString &serviceName, const QString &oldOwner, const QString &newOwner)
-{
- qDebug() << "Service owner changed" << serviceName << oldOwner << newOwner;
-}