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
19 changes: 14 additions & 5 deletions src/AbstractBubble.vala
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,18 @@
*
*/

public enum Notifications.CloseReason {
EXPIRED = 1,
DISMISSED = 2,
/**
* This value is unique for org.freedesktop.Notifications server interface and must not be used elsewhere.
*/
CLOSE_NOTIFICATION_CALL = 3,
UNDEFINED = 4
}

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

Expand Down Expand Up @@ -94,7 +104,7 @@ public class Notifications.AbstractBubble : Gtk.Window {
set_titlebar (new Gtk.Grid ());

carousel.page_changed.connect (on_page_changed);
close_button.clicked.connect (() => closed (Notifications.Server.CloseReason.DISMISSED));
close_button.clicked.connect (() => closed (CloseReason.DISMISSED));

var motion_controller = new Gtk.EventControllerMotion ();
motion_controller.enter.connect (pointer_enter);
Expand Down Expand Up @@ -127,7 +137,7 @@ public class Notifications.AbstractBubble : Gtk.Window {

private void on_page_changed (Adw.Carousel carousel, uint index) {
if (carousel.get_nth_page (index) != overlay) {
closed (Notifications.Server.CloseReason.DISMISSED);
closed (CloseReason.DISMISSED);
}
}

Expand Down Expand Up @@ -177,11 +187,10 @@ public class Notifications.AbstractBubble : Gtk.Window {
}

private bool timeout_expired () {
closed (Notifications.Server.CloseReason.EXPIRED);
closed (CloseReason.EXPIRED);
return Source.REMOVE;
}


private void get_blur_margins (out int left, out int right) {
var width = get_width ();
var distance = (1 - current_swipe_progress) * width;
Expand Down
4 changes: 2 additions & 2 deletions src/Bubble.vala
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2019-2023 elementary, Inc. (https://elementary.io)
* Copyright 2019-2025 elementary, Inc. (https://elementary.io)
* SPDX-License-Identifier: GPL-3.0-or-later
*/

Expand Down Expand Up @@ -56,7 +56,7 @@ public class Notifications.Bubble : AbstractBubble {
notification.app_info.launch_uris_async.begin (null, null, null, (obj, res) => {
try {
((AppInfo) obj).launch_uris_async.end (res);
closed (Server.CloseReason.UNDEFINED);
closed (CloseReason.UNDEFINED);
} catch (Error e) {
warning ("Unable to launch app: %s", e.message);
}
Expand Down
9 changes: 1 addition & 8 deletions src/DBus.vala
Original file line number Diff line number Diff line change
@@ -1,17 +1,10 @@
/*
* Copyright 2019-2023 elementary, Inc. (https://elementary.io)
* Copyright 2019-2025 elementary, Inc. (https://elementary.io)
* SPDX-License-Identifier: GPL-3.0-or-later
*/

[DBus (name = "org.freedesktop.Notifications")]
public class Notifications.Server : Object {
public enum CloseReason {
EXPIRED = 1,
DISMISSED = 2,
CLOSE_NOTIFICATION_CALL = 3,
UNDEFINED = 4
}

public signal void action_invoked (uint32 id, string action_key);
public signal void notification_closed (uint32 id, uint32 reason);

Expand Down
6 changes: 3 additions & 3 deletions src/FdoActionGroup.vala
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2023 elementary, Inc. (https://elementary.io)
* Copyright 2023-2025 elementary, Inc. (https://elementary.io)
* SPDX-License-Identifier: GPL-3.0-or-later
*
* Author: Gustavo Marques <[email protected]>
Expand Down Expand Up @@ -95,7 +95,7 @@ public sealed class Notifications.Fdo.ActionGroup : Object, GLib.ActionGroup {
uint32 id;

while (iter.next ("u", out id)) {
server.notification_closed (id, Server.CloseReason.DISMISSED);
server.notification_closed (id, CloseReason.DISMISSED);
}

return;
Expand All @@ -120,7 +120,7 @@ public sealed class Notifications.Fdo.ActionGroup : Object, GLib.ActionGroup {
/* GLib says that we are only meant to override list_actions and query_actions,
* however, the gio bindings only have query_action marked as virtual.
*
* FIXME: remove everthing below when we have valac 0.58 as minimal version.
* FIXME: remove everything below when we have valac 0.58 as minimal version.
*/
public bool has_action (string action_name) {
return action_name in (Gee.Collection<string>) actions;
Expand Down