From 3f183927e158cc730eafff3abf1cb636ae8a8ad2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Danielle=20For=C3=A9?= Date: Thu, 3 Sep 2026 14:03:53 -0700 Subject: [PATCH] AppEntry: make properties settable --- src/Widgets/AppEntry.vala | 28 ++++++++++++++++------------ src/Widgets/NotificationsList.vala | 5 ++++- 2 files changed, 20 insertions(+), 13 deletions(-) diff --git a/src/Widgets/AppEntry.vala b/src/Widgets/AppEntry.vala index cfd89d8b..5476b56d 100644 --- a/src/Widgets/AppEntry.vala +++ b/src/Widgets/AppEntry.vala @@ -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; @@ -28,13 +41,6 @@ public class Notifications.AppEntry : Gtk.ListBoxRow { headers = (HashTable) 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"); @@ -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; diff --git a/src/Widgets/NotificationsList.vala b/src/Widgets/NotificationsList.vala index c614c5d4..d422e4c0 100644 --- a/src/Widgets/NotificationsList.vala +++ b/src/Widgets/NotificationsList.vala @@ -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;