From 332c772fbefc1c27a5021e18a58f333b802bdaaf Mon Sep 17 00:00:00 2001 From: fiaxh Date: Wed, 7 Apr 2021 21:27:50 +0200 Subject: Let freedesktop notifications expire fixes #1026 --- main/src/ui/notifier_freedesktop.vala | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/main/src/ui/notifier_freedesktop.vala b/main/src/ui/notifier_freedesktop.vala index 00ba0d06..ecb5dc66 100644 --- a/main/src/ui/notifier_freedesktop.vala +++ b/main/src/ui/notifier_freedesktop.vala @@ -96,9 +96,10 @@ public class Dino.Ui.FreeDesktopNotifier : NotificationProvider, Object { uint32 replace_id = content_notifications.has_key(conversation) ? content_notifications[conversation] : 0; HashTable hash_table = new HashTable(null, null); hash_table["image-data"] = yield get_conversation_icon(conversation); + hash_table["desktop-entry"] = new Variant.string(Dino.Application.get_default().get_application_id()); string[] actions = new string[] {"default", "Open conversation"}; try { - uint32 notification_id = dbus_notifications.notify("Dino", replace_id, "", conversation_display_name, body, actions, hash_table, 0); + uint32 notification_id = dbus_notifications.notify("Dino", replace_id, "", conversation_display_name, body, actions, hash_table, -1); content_notifications[conversation] = notification_id; add_action_listener(notification_id, "default", () => { @@ -115,9 +116,10 @@ public class Dino.Ui.FreeDesktopNotifier : NotificationProvider, Object { HashTable hash_table = new HashTable(null, null); hash_table["image-data"] = yield get_conversation_icon(conversation); + hash_table["desktop-entry"] = new Variant.string(Dino.Application.get_default().get_application_id()); string[] actions = new string[] {"default", "Open conversation", "accept", _("Accept"), "deny", _("Deny")}; try { - uint32 notification_id = dbus_notifications.notify("Dino", 0, "", summary, body, actions, hash_table, 0); + uint32 notification_id = dbus_notifications.notify("Dino", 0, "", summary, body, actions, hash_table, -1); if (!conversation_notifications.has_key(conversation)) { conversation_notifications[conversation] = new ArrayList(); @@ -151,8 +153,9 @@ public class Dino.Ui.FreeDesktopNotifier : NotificationProvider, Object { } HashTable hash_table = new HashTable(null, null); + hash_table["desktop-entry"] = new Variant.string(Dino.Application.get_default().get_application_id()); try { - dbus_notifications.notify("Dino", 0, "im.dino.Dino", summary, body, new string[]{}, hash_table, 0); + dbus_notifications.notify("Dino", 0, "im.dino.Dino", summary, body, new string[]{}, hash_table, -1); } catch (Error e) { warning("Failed showing connection error notification: %s", e.message); } @@ -170,10 +173,11 @@ public class Dino.Ui.FreeDesktopNotifier : NotificationProvider, Object { HashTable hash_table = new HashTable(null, null); hash_table["image-data"] = yield get_conversation_icon(direct_conversation); + hash_table["desktop-entry"] = new Variant.string(Dino.Application.get_default().get_application_id()); string[] actions = new string[] {"default", "", "reject", _("Reject"), "accept", _("Accept")}; try { - uint32 notification_id = dbus_notifications.notify("Dino", 0, "", summary, body, actions, hash_table, 0); + uint32 notification_id = dbus_notifications.notify("Dino", 0, "", summary, body, actions, hash_table, -1); Conversation group_conversation = stream_interactor.get_module(ConversationManager.IDENTITY).create_conversation(room_jid, account, Conversation.Type.GROUPCHAT); add_action_listener(notification_id, "default", () => { @@ -202,10 +206,11 @@ public class Dino.Ui.FreeDesktopNotifier : NotificationProvider, Object { HashTable hash_table = new HashTable(null, null); hash_table["image-data"] = yield get_conversation_icon(conversation); + hash_table["desktop-entry"] = new Variant.string(Dino.Application.get_default().get_application_id()); string[] actions = new string[] {"deny", _("Deny"), "accept", _("Accept")}; try { - uint32 notification_id = dbus_notifications.notify("Dino", 0, "", summary, body, actions, hash_table, 0); + uint32 notification_id = dbus_notifications.notify("Dino", 0, "", summary, body, actions, hash_table, -1); add_action_listener(notification_id, "accept", () => { GLib.Application.get_default().activate_action("accept-voice-request", new Variant.int32(conversation.id)); -- cgit v1.2.3-70-g09d2