Implemented "CloseNotification" function
This commit is contained in:
@@ -122,7 +122,7 @@ namespace SwayNotificatonCenter {
|
||||
}
|
||||
|
||||
public void CloseNotification (uint32 id) throws DBusError, IOError {
|
||||
print ("yeet");
|
||||
notiWin.close_notification (id);
|
||||
}
|
||||
|
||||
public void GetServerInformation (out string name,
|
||||
|
@@ -12,10 +12,16 @@ namespace SwayNotificatonCenter {
|
||||
GtkLayerShell.set_anchor (this, GtkLayerShell.Edge.RIGHT, true);
|
||||
}
|
||||
|
||||
private void removeWidget (Gtk.Widget widget) {
|
||||
uint len = box.get_children ().length () - 1;
|
||||
box.remove (widget);
|
||||
if (len <= 0) box.set_visible (false);
|
||||
}
|
||||
|
||||
public void replace_notification (NotifyParams param) {
|
||||
foreach (var w in box.get_children ()) {
|
||||
if (((Notification) w).param.applied_id == param.replaces_id) {
|
||||
box.remove (w);
|
||||
removeWidget (w);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -31,5 +37,14 @@ namespace SwayNotificatonCenter {
|
||||
});
|
||||
this.show_all ();
|
||||
}
|
||||
|
||||
public void close_notification (uint32 id) {
|
||||
foreach (var w in box.get_children ()) {
|
||||
if (((Notification) w).param.applied_id == id) {
|
||||
removeWidget (w);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user