From f27f8bdf2b729844fb97e8eb4a0558c3a0b79139 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Danielle=20For=C3=A9?= Date: Thu, 3 Sep 2026 10:28:33 -0700 Subject: [PATCH 1/3] NotificationsList: remove app entries hashmap --- src/Indicator.vala | 12 +++++++++--- src/Widgets/NotificationsList.vala | 26 ++++---------------------- 2 files changed, 13 insertions(+), 25 deletions(-) diff --git a/src/Indicator.vala b/src/Indicator.vala index b69cf308..61a30bc0 100644 --- a/src/Indicator.vala +++ b/src/Indicator.vala @@ -50,7 +50,13 @@ public class Notifications.Indicator : Wingpanel.Indicator { }; nlist = new NotificationsList (); - nlist.items_changed.connect (set_display_icon_name); + nlist.items_changed.connect (() => { + set_display_icon_name (); + + if (nlist.notification_items.get_n_items () == 0) { + Session.get_instance ().clear (); + } + }); monitor.notification_received.connect (on_notification_received); monitor.notification_closed.connect (on_notification_closed); @@ -171,7 +177,7 @@ public class Notifications.Indicator : Wingpanel.Indicator { } private void update_clear_all_sensitivity () { - clear_all_btn.sensitive = nlist.app_entries.size > 0; + clear_all_btn.sensitive = nlist.notification_items.get_n_items () > 0; } private void on_notification_closed (uint32 id, Notification.CloseReason reason) { @@ -187,7 +193,7 @@ public class Notifications.Indicator : Wingpanel.Indicator { private void set_display_icon_name () { if (notify_settings.get_boolean ("do-not-disturb")) { dynamic_icon.state = NotificationsIndicator.SymbolState.DISABLED; - } else if (nlist != null && nlist.app_entries.size > 0) { + } else if (nlist != null && nlist.notification_items.get_n_items () > 0) { dynamic_icon.state = NotificationsIndicator.SymbolState.ACTIVE; } else { dynamic_icon.state = NotificationsIndicator.SymbolState.NORMAL; diff --git a/src/Widgets/NotificationsList.vala b/src/Widgets/NotificationsList.vala index c4ef2696..66e44027 100644 --- a/src/Widgets/NotificationsList.vala +++ b/src/Widgets/NotificationsList.vala @@ -92,15 +92,10 @@ public class Notifications.NotificationsList : Granite.Bin { return; } - var app_entry = app_entries[row_app_id]; - if (app_entry == null) { - app_entry = new AppEntry (row_entry.notification.app_info); - app_entry.clear.connect (clear_app_entry); + var app_entry = new AppEntry (row_entry.notification.app_info); + app_entry.clear.connect (clear_app_entry); - app_entries[row_app_id] = app_entry; - } - - row.set_header (app_entries[row_app_id]); + row.set_header (app_entry); } public async void add_entry (Notification notification) { @@ -119,20 +114,13 @@ public class Notifications.NotificationsList : Granite.Bin { } public void clear_all () { - var iter = app_entries.map_iterator (); - while (iter.next ()) { - var entry = iter.get_value (); - iter.unset (); - clear_app_entry (entry); - } - + Session.get_instance ().clear (); list_store.remove_all (); close_popover (); } private void clear_app_entry (AppEntry app_entry) { app_entry.clear.disconnect (clear_app_entry); - app_entries.unset (app_entry.app_id); Notification[] to_remove = {}; for (int i = 0; i < list_store.n_items; i++) { @@ -144,10 +132,6 @@ public class Notifications.NotificationsList : Granite.Bin { } Session.get_instance ().remove_notifications (to_remove); - - if (app_entries.size == 0) { - Session.get_instance ().clear (); - } } private void remove_notification (NotificationEntry notification_entry) { @@ -166,8 +150,6 @@ public class Notifications.NotificationsList : Granite.Bin { ); if (items_for_appid.n_items == 0) { - clear_app_entry (app_entries[app_id]); - var settings = new Settings ("io.elementary.panel.notifications"); var headers = (HashTable) settings.get_value ("headers"); if (headers.remove (app_id)) { From b120adf4d10c3cf35a844c8e46d52cb1b9878544 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Danielle=20For=C3=A9?= Date: Thu, 3 Sep 2026 13:55:23 -0700 Subject: [PATCH 2/3] better merge --- src/Indicator.vala | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/src/Indicator.vala b/src/Indicator.vala index 7304d0e2..647a437e 100644 --- a/src/Indicator.vala +++ b/src/Indicator.vala @@ -50,13 +50,7 @@ public class Notifications.Indicator : Wingpanel.Indicator { }; nlist = new NotificationsList (); - nlist.items_changed.connect (() => { - set_display_icon_name (); - - if (nlist.notification_items.get_n_items () == 0) { - Session.get_instance ().clear (); - } - }); + nlist.items_changed.connect (set_display_icon_name); monitor.notification_received.connect (on_notification_received); monitor.notification_closed.connect (on_notification_closed); From 47f61bb4c428bc2f6babc0ee58450789d4425ce2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Danielle=20For=C3=A9?= Date: Thu, 3 Sep 2026 14:30:56 -0700 Subject: [PATCH 3/3] Actually remove --- src/Widgets/NotificationsList.vala | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/Widgets/NotificationsList.vala b/src/Widgets/NotificationsList.vala index af826344..d47b7c0b 100644 --- a/src/Widgets/NotificationsList.vala +++ b/src/Widgets/NotificationsList.vala @@ -11,7 +11,6 @@ public class Notifications.NotificationsList : Granite.Bin { public const string ACTION_PREFIX = ACTION_GROUP_PREFIX + "."; private static GLib.HashTable app_datetime; - private Gee.HashMap app_entries; private ListStore list_store; public ListModel notification_items { @@ -21,7 +20,6 @@ public class Notifications.NotificationsList : Granite.Bin { } construct { - app_entries = new Gee.HashMap (); app_datetime = new GLib.HashTable (str_hash, str_equal); var placeholder = new Gtk.Label (_("No Notifications")) {