From 96f96ead7ea4a2f45ce4098734484d745edc26ff Mon Sep 17 00:00:00 2001 From: LAGonauta Date: Thu, 26 Nov 2020 21:06:41 -0300 Subject: [PATCH] Use list with all notifications --- .../src/win_notification_provider.vala | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/plugins/windows-notification/src/win_notification_provider.vala b/plugins/windows-notification/src/win_notification_provider.vala index 3673f07b..81fe0e89 100644 --- a/plugins/windows-notification/src/win_notification_provider.vala +++ b/plugins/windows-notification/src/win_notification_provider.vala @@ -9,8 +9,8 @@ namespace Dino.Plugins.WindowsNotification { private StreamInteractor stream_interactor; private Dino.Application app; - private GLib.Queue notifications_to_be_removed; - private HashMap content_notifications; + private Gee.List notifications_to_be_removed; + private Gee.List content_notifications; private HashMap> conversation_notifications; private class Notification { @@ -20,8 +20,8 @@ namespace Dino.Plugins.WindowsNotification { private WindowsNotificationProvider(Dino.Application app) { this.stream_interactor = app.stream_interactor; this.app = app; - this.notifications_to_be_removed = new GLib.Queue(); - this.content_notifications = new HashMap(Conversation.hash_func, Conversation.equals_func); + this.notifications_to_be_removed = new Gee.ArrayList(); + this.content_notifications = new Gee.ArrayList(); this.conversation_notifications = new HashMap>(Conversation.hash_func, Conversation.equals_func); } @@ -228,7 +228,7 @@ namespace Dino.Plugins.WindowsNotification { } public async void retract_content_item_notifications() { - foreach (int64 id in content_notifications.values) { + foreach (int64 id in content_notifications) { RemoveNotification(id); } content_notifications.clear(); @@ -278,7 +278,7 @@ namespace Dino.Plugins.WindowsNotification { if (notification.id == -1) { warning("Failed showing content item notification"); } else { - content_notifications[conversation] = notification.id; + content_notifications.add(notification.id); } } @@ -288,15 +288,15 @@ namespace Dino.Plugins.WindowsNotification { } private void clear_queue() { - int64? id = null; - while ((id = notifications_to_be_removed.pop_head()) != null) { + foreach (var id in notifications_to_be_removed) { RemoveNotification(id); } + notifications_to_be_removed.clear(); } private void add_to_removal_queue(int64? id) { if (id != null && id != -1 && id != 1 && id != 0) { - notifications_to_be_removed.push_head(id); + notifications_to_be_removed.add(id); } } }