From afefe58cba7fcf3324c1b456fa73ec17027f55d5 Mon Sep 17 00:00:00 2001 From: Erik Reider Date: Thu, 23 Dec 2021 18:16:56 +0100 Subject: [PATCH] Fix css reload not updating notification event_box --- src/ccDaemon/ccDaemon.vala | 6 ++++-- src/controlCenter/controlCenter.vala | 8 ++++++++ src/notification/notification.vala | 5 +++++ 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/src/ccDaemon/ccDaemon.vala b/src/ccDaemon/ccDaemon.vala index 2e8b1ae..0656f79 100644 --- a/src/ccDaemon/ccDaemon.vala +++ b/src/ccDaemon/ccDaemon.vala @@ -6,7 +6,7 @@ namespace SwayNotificatonCenter { public CcDaemon (NotiDaemon notiDaemon) { this.notiDaemon = notiDaemon; - this.controlCenter = new ControlCenter(this); + this.controlCenter = new ControlCenter (this); notiDaemon.on_dnd_toggle.connect ((dnd) => { this.controlCenter.set_switch_dnd_state (dnd); @@ -24,7 +24,9 @@ namespace SwayNotificatonCenter { public signal void subscribe (uint count, bool dnd); public bool reload_css () throws Error { - return Functions.load_css (style_path); + bool result = Functions.load_css (style_path); + if (result) controlCenter.reload_notifications_style (); + return result; } public void reload_config () throws Error { diff --git a/src/controlCenter/controlCenter.vala b/src/controlCenter/controlCenter.vala index 39af097..c7ed21d 100644 --- a/src/controlCenter/controlCenter.vala +++ b/src/controlCenter/controlCenter.vala @@ -297,5 +297,13 @@ namespace SwayNotificatonCenter { public bool get_visibility () { return this.visible; } + + /** Forces each notification EventBox to reload its style_context #27 */ + public void reload_notifications_style () { + foreach (var c in list_box.get_children ()) { + Notification noti = (Notification) c; + if (noti != null) noti.reload_style_context (); + } + } } } diff --git a/src/notification/notification.vala b/src/notification/notification.vala index 476046e..bd112c9 100644 --- a/src/notification/notification.vala +++ b/src/notification/notification.vala @@ -383,5 +383,10 @@ namespace SwayNotificatonCenter { timeout_id = 0; } } + + /** Forces the EventBox to reload its style_context #27 */ + public void reload_style_context () { + event_box.get_style_context ().changed (); + } } }