Commit 9339e454 authored by Erik Reider's avatar Erik Reider

Fixed do not disturb widget not properly reflecting the state. Fixes: #419

parent 55b599c5
...@@ -30,13 +30,13 @@ namespace SwayNotificationCenter.Widgets { ...@@ -30,13 +30,13 @@ namespace SwayNotificationCenter.Widgets {
// Dnd button // Dnd button
dnd_button = new Gtk.Switch () { dnd_button = new Gtk.Switch () {
state = noti_daemon.dnd, active = noti_daemon.dnd,
}; };
dnd_button.state_set.connect (state_set); dnd_button.notify["active"].connect (switch_active_changed_cb);
noti_daemon.on_dnd_toggle.connect ((dnd) => { noti_daemon.on_dnd_toggle.connect ((dnd) => {
dnd_button.state_set.disconnect (state_set); dnd_button.notify["active"].disconnect (switch_active_changed_cb);
dnd_button.set_active (dnd); dnd_button.set_active (dnd);
dnd_button.state_set.connect (state_set); dnd_button.notify["active"].connect (switch_active_changed_cb);
}); });
dnd_button.set_can_focus (false); dnd_button.set_can_focus (false);
...@@ -46,9 +46,8 @@ namespace SwayNotificationCenter.Widgets { ...@@ -46,9 +46,8 @@ namespace SwayNotificationCenter.Widgets {
append (dnd_button); append (dnd_button);
} }
private bool state_set (Gtk.Widget widget, bool state) { private void switch_active_changed_cb () {
noti_daemon.dnd = state; noti_daemon.dnd = dnd_button.active;
return false;
} }
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment