Fix css reload not updating notification event_box

This commit is contained in:
Erik Reider
2021-12-23 18:16:56 +01:00
parent 1424a988c5
commit afefe58cba
3 changed files with 17 additions and 2 deletions

View File

@@ -6,7 +6,7 @@ namespace SwayNotificatonCenter {
public CcDaemon (NotiDaemon notiDaemon) { public CcDaemon (NotiDaemon notiDaemon) {
this.notiDaemon = notiDaemon; this.notiDaemon = notiDaemon;
this.controlCenter = new ControlCenter(this); this.controlCenter = new ControlCenter (this);
notiDaemon.on_dnd_toggle.connect ((dnd) => { notiDaemon.on_dnd_toggle.connect ((dnd) => {
this.controlCenter.set_switch_dnd_state (dnd); this.controlCenter.set_switch_dnd_state (dnd);
@@ -24,7 +24,9 @@ namespace SwayNotificatonCenter {
public signal void subscribe (uint count, bool dnd); public signal void subscribe (uint count, bool dnd);
public bool reload_css () throws Error { 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 { public void reload_config () throws Error {

View File

@@ -297,5 +297,13 @@ namespace SwayNotificatonCenter {
public bool get_visibility () { public bool get_visibility () {
return this.visible; 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 ();
}
}
} }
} }

View File

@@ -383,5 +383,10 @@ namespace SwayNotificatonCenter {
timeout_id = 0; timeout_id = 0;
} }
} }
/** Forces the EventBox to reload its style_context #27 */
public void reload_style_context () {
event_box.get_style_context ().changed ();
}
} }
} }