summary refs log tree commit diff
diff options
context:
space:
mode:
authorLoren Burkholder <computersemiexpert@outlook.com>2021-02-15 16:52:19 -0500
committerNicolas Werner <nicolas.werner@hotmail.de>2021-03-17 19:17:13 +0100
commitae7468a7161b4726c02e6e76d819a27f0e8bb4ea (patch)
tree5045f9e4fef0c247907bf53517904f0c57b3d7ea
parentUse plaintext for Windows notifications (diff)
downloadnheko-ae7468a7161b4726c02e6e76d819a27f0e8bb4ea.tar.xz
Use the class D-Bus member
-rw-r--r--src/notifications/ManagerLinux.cpp12
1 files changed, 3 insertions, 9 deletions
diff --git a/src/notifications/ManagerLinux.cpp b/src/notifications/ManagerLinux.cpp
index 44dbb196..e81500a0 100644
--- a/src/notifications/ManagerLinux.cpp
+++ b/src/notifications/ManagerLinux.cpp
@@ -62,10 +62,7 @@ NotificationsManager::postNotification(const mtx::responses::Notification &notif
         const auto text = utils::event_body(notification.event);
         auto formattedText = utils::markdownToHtml(text);
 
-        static QDBusInterface notifyApp("org.freedesktop.Notifications",
-                                        "/org/freedesktop/Notifications",
-                                        "org.freedesktop.Notifications");
-        auto capabilites = notifyApp.call("GetCapabilites");
+        auto capabilites = dbus.call("GetCapabilites");
         if (!capabilites.arguments().contains("body-markup"))
                 formattedText = QTextDocumentFragment::fromHtml(formattedText).toPlainText();
 
@@ -94,7 +91,7 @@ NotificationsManager::postNotification(const mtx::responses::Notification &notif
         argumentList << hints;                          // hints
         argumentList << (int)-1;                        // timeout in ms
 
-        QDBusPendingCall call = notifyApp.asyncCallWithArgumentList("Notify", argumentList);
+        QDBusPendingCall call = dbus.asyncCallWithArgumentList("Notify", argumentList);
         auto watcher          = new QDBusPendingCallWatcher{call, this};
         connect(
           watcher, &QDBusPendingCallWatcher::finished, this, [watcher, this, room_id, event_id]() {
@@ -110,10 +107,7 @@ NotificationsManager::postNotification(const mtx::responses::Notification &notif
 void
 NotificationsManager::closeNotification(uint id)
 {
-        static QDBusInterface closeCall("org.freedesktop.Notifications",
-                                        "/org/freedesktop/Notifications",
-                                        "org.freedesktop.Notifications");
-        auto call    = closeCall.asyncCall("CloseNotification", (uint)id); // replace_id
+        auto call    = dbus.asyncCall("CloseNotification", (uint)id); // replace_id
         auto watcher = new QDBusPendingCallWatcher{call, this};
         connect(watcher, &QDBusPendingCallWatcher::finished, this, [watcher]() {
                 if (watcher->reply().type() == QDBusMessage::ErrorMessage) {