Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/Indicator.vala
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,14 @@ public class Notifications.Indicator : Wingpanel.Indicator {
sort_list_model.section_sorter.changed (DIFFERENT);
}

// Create value if it doesn't exist and set true
var settings = new Settings ("io.elementary.panel.notifications");
var headers = (HashTable<string, bool>) settings.get_value ("headers");
if (!headers.contains (notification.desktop_id)) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

headers can be null here I think, so we should check for nullability ?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably it doesn't unless we give a key that doesn't exist?

https://valadoc.org/gio-2.0/GLib.Settings.get_value.html

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (!headers.contains (notification.desktop_id)) {
if (!(notification.desktop_id in headers)) {

I don't force this but leaving a comment that we can use a syntax sugar here if we want.

headers[notification.desktop_id] = true;
settings.set_value ("headers", headers);
}

list_store.append (notification);
}

Expand Down
Loading