Skip to content
Merged
Show file tree
Hide file tree
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
28 changes: 16 additions & 12 deletions src/Widgets/AppEntry.vala
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,21 @@
public class Notifications.AppEntry : Gtk.ListBoxRow {
public signal void clear ();

public string app_id { get; construct; }
public string app_name { get; construct; }
private string _app_id = "";
public string app_id {
get {
return _app_id;
}
set {
_app_id = value;

if (value in headers) {
expander.active = headers[value];
}
}
}

public string app_name { get; set; default = ""; }

private static Gtk.CssProvider provider;
private static Settings settings;
Expand All @@ -28,13 +41,6 @@ public class Notifications.AppEntry : Gtk.ListBoxRow {
headers = (HashTable<string, bool>) settings.get_value ("headers");
}

public AppEntry (string app_id, string app_name) {
Object (
app_id: app_id,
app_name: app_name
);
}

construct {
var image = new Gtk.Image.from_icon_name ("pan-end-symbolic");

Expand Down Expand Up @@ -75,9 +81,7 @@ public class Notifications.AppEntry : Gtk.ListBoxRow {
can_focus = false;
child = box;

if (app_id in headers) {
expander.active = headers[app_id];
}
bind_property ("app-name", label, "label");

expander.toggled.connect (() => {
headers[app_id] = expander.active;
Expand Down
5 changes: 4 additions & 1 deletion src/Widgets/NotificationsList.vala
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,10 @@ public class Notifications.NotificationsList : Granite.Bin {

var app_entry = app_entries[row_app_id];
if (app_entry == null) {
app_entry = new AppEntry (row_app_id, row_entry.notification.app_name);
app_entry = new AppEntry () {
app_name = row_entry.notification.app_name,
app_id = row_app_id
};
app_entry.clear.connect (clear_app_entry);

app_entries[row_app_id] = app_entry;
Expand Down
Loading