Use list with all notifications
This commit is contained in:
parent
5f2e636868
commit
96f96ead7e
|
@ -9,8 +9,8 @@ namespace Dino.Plugins.WindowsNotification {
|
||||||
|
|
||||||
private StreamInteractor stream_interactor;
|
private StreamInteractor stream_interactor;
|
||||||
private Dino.Application app;
|
private Dino.Application app;
|
||||||
private GLib.Queue<int64?> notifications_to_be_removed;
|
private Gee.List<int64?> notifications_to_be_removed;
|
||||||
private HashMap<Conversation, int64?> content_notifications;
|
private Gee.List<int64?> content_notifications;
|
||||||
private HashMap<Conversation, Gee.List<int64?>> conversation_notifications;
|
private HashMap<Conversation, Gee.List<int64?>> conversation_notifications;
|
||||||
|
|
||||||
private class Notification {
|
private class Notification {
|
||||||
|
@ -20,8 +20,8 @@ namespace Dino.Plugins.WindowsNotification {
|
||||||
private WindowsNotificationProvider(Dino.Application app) {
|
private WindowsNotificationProvider(Dino.Application app) {
|
||||||
this.stream_interactor = app.stream_interactor;
|
this.stream_interactor = app.stream_interactor;
|
||||||
this.app = app;
|
this.app = app;
|
||||||
this.notifications_to_be_removed = new GLib.Queue<int64?>();
|
this.notifications_to_be_removed = new Gee.ArrayList<int64?>();
|
||||||
this.content_notifications = new HashMap<Conversation, int64?>(Conversation.hash_func, Conversation.equals_func);
|
this.content_notifications = new Gee.ArrayList<int64?>();
|
||||||
this.conversation_notifications = new HashMap<Conversation, Gee.List<int64?>>(Conversation.hash_func, Conversation.equals_func);
|
this.conversation_notifications = new HashMap<Conversation, Gee.List<int64?>>(Conversation.hash_func, Conversation.equals_func);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -228,7 +228,7 @@ namespace Dino.Plugins.WindowsNotification {
|
||||||
}
|
}
|
||||||
|
|
||||||
public async void retract_content_item_notifications() {
|
public async void retract_content_item_notifications() {
|
||||||
foreach (int64 id in content_notifications.values) {
|
foreach (int64 id in content_notifications) {
|
||||||
RemoveNotification(id);
|
RemoveNotification(id);
|
||||||
}
|
}
|
||||||
content_notifications.clear();
|
content_notifications.clear();
|
||||||
|
@ -278,7 +278,7 @@ namespace Dino.Plugins.WindowsNotification {
|
||||||
if (notification.id == -1) {
|
if (notification.id == -1) {
|
||||||
warning("Failed showing content item notification");
|
warning("Failed showing content item notification");
|
||||||
} else {
|
} else {
|
||||||
content_notifications[conversation] = notification.id;
|
content_notifications.add(notification.id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -288,15 +288,15 @@ namespace Dino.Plugins.WindowsNotification {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void clear_queue() {
|
private void clear_queue() {
|
||||||
int64? id = null;
|
foreach (var id in notifications_to_be_removed) {
|
||||||
while ((id = notifications_to_be_removed.pop_head()) != null) {
|
|
||||||
RemoveNotification(id);
|
RemoveNotification(id);
|
||||||
}
|
}
|
||||||
|
notifications_to_be_removed.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void add_to_removal_queue(int64? id) {
|
private void add_to_removal_queue(int64? id) {
|
||||||
if (id != null && id != -1 && id != 1 && id != 0) {
|
if (id != null && id != -1 && id != 1 && id != 0) {
|
||||||
notifications_to_be_removed.push_head(id);
|
notifications_to_be_removed.add(id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue