Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 6 additions & 34 deletions src/AbstractBubble.vala
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,17 @@
*/

public class Notifications.AbstractBubble : Gtk.Window {
public signal void closed (uint32 reason);
public signal void closed (uint32 reason) {
close ();
}

public uint32 timeout { get; set; }

protected Gtk.Stack content_area;

private Gtk.Revealer close_revealer;
private Gtk.Revealer revealer;
private Gtk.Box draw_area;

private Gtk.EventControllerMotion motion_controller;
private uint timeout_id;

construct {
Expand Down Expand Up @@ -64,25 +64,14 @@ public class Notifications.AbstractBubble : Gtk.Window {
};
overlay.add_overlay (close_revealer);

revealer = new Gtk.Revealer () {
reveal_child = true,
transition_duration = 195,
transition_type = Gtk.RevealerTransitionType.CROSSFADE,
child = overlay
};

var carousel = new Adw.Carousel () {
allow_mouse_drag = true,
interactive = true,
halign = Gtk.Align.END,
hexpand = true
};
carousel.append (new Gtk.Grid ());
carousel.append (revealer);
carousel.scroll_to (revealer, false);
carousel.append (overlay);
carousel.scroll_to (overlay, false);

child = carousel;
default_height = 0;
default_width = 332;
resizable = false;
add_css_class ("notification");
Expand All @@ -96,28 +85,11 @@ public class Notifications.AbstractBubble : Gtk.Window {
}
});
close_button.clicked.connect (() => closed (Notifications.Server.CloseReason.DISMISSED));
closed.connect (close);

motion_controller = new Gtk.EventControllerMotion () {
propagation_phase = TARGET
};
var motion_controller = new Gtk.EventControllerMotion ();
motion_controller.enter.connect (pointer_enter);
motion_controller.leave.connect (pointer_leave);

carousel.add_controller (motion_controller);

close_request.connect (on_close);
}

private bool on_close (Gtk.Window window) {
revealer.reveal_child = false;

Timeout.add (revealer.transition_duration, () => {
destroy ();
return Source.REMOVE;
});

return Gdk.EVENT_PROPAGATE;
}

public new void present () {
Expand Down
4 changes: 2 additions & 2 deletions src/DBus.vala
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ public class Notifications.Server : Object {
bubbles[id].insert_action_group ("fdo", action_group);
bubbles[id].close_request.connect (() => {
bubbles[id] = null;
return Gdk.EVENT_STOP;
return Gdk.EVENT_PROPAGATE;
});
bubbles[id].closed.connect ((res) => {
if (res == CloseReason.EXPIRED && app_settings.get_boolean ("remember")) {
Expand Down Expand Up @@ -209,7 +209,7 @@ public class Notifications.Server : Object {
);
confirmation.close_request.connect (() => {
confirmation = null;
return Gdk.EVENT_STOP;
return Gdk.EVENT_PROPAGATE;
});
} else {
confirmation.icon_name = icon_name;
Expand Down