fix(agsV2): deal with dupe notif properly
All checks were successful
Discord / discord commits (push) Has been skipped

This commit is contained in:
matt1432 2024-11-12 15:47:21 -05:00
parent 04003d26ee
commit c20ec51142

View file

@ -123,7 +123,7 @@ export class NotifGestureWrapper extends Widget.EventBox {
)); ));
} }
public slideAway(side: 'Left' | 'Right'): void { public slideAway(side: 'Left' | 'Right', duplicate = false): void {
if (!this.sensitive || this._sliding_away) { if (!this.sensitive || this._sliding_away) {
return; return;
} }
@ -156,6 +156,7 @@ export class NotifGestureWrapper extends Widget.EventBox {
rev.revealChild = false; rev.revealChild = false;
timeout(ANIM_DURATION, () => { timeout(ANIM_DURATION, () => {
if (!duplicate) {
// Kill notif if specified // Kill notif if specified
if (!this.is_popup) { if (!this.is_popup) {
Notifications.get_notification(this.id)?.dismiss(); Notifications.get_notification(this.id)?.dismiss();
@ -167,6 +168,7 @@ export class NotifGestureWrapper extends Widget.EventBox {
// Make sure we cleanup any references to this instance // Make sure we cleanup any references to this instance
NotifGestureWrapper.popups.delete(this.id); NotifGestureWrapper.popups.delete(this.id);
} }
}
// Get rid of disappeared widget // Get rid of disappeared widget
this.destroy(); this.destroy();
@ -232,6 +234,12 @@ export class NotifGestureWrapper extends Widget.EventBox {
}); });
} }
this.hook(Notifications, 'notified', (_, notifId) => {
if (notifId === this.id) {
this.slideAway(this.is_popup ? 'Left' : 'Right', true);
}
});
const gesture = Gtk.GestureDrag.new(this); const gesture = Gtk.GestureDrag.new(this);
this.add( this.add(