diff --git a/src/AbstractBubble.vala b/src/AbstractBubble.vala index 32d6b0e..711deb7 100644 --- a/src/AbstractBubble.vala +++ b/src/AbstractBubble.vala @@ -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 (); } @@ -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); @@ -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); } } @@ -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; diff --git a/src/Bubble.vala b/src/Bubble.vala index 4570f6b..88b068e 100644 --- a/src/Bubble.vala +++ b/src/Bubble.vala @@ -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 */ @@ -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); } diff --git a/src/DBus.vala b/src/DBus.vala index ce6434b..1ec31f4 100644 --- a/src/DBus.vala +++ b/src/DBus.vala @@ -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); diff --git a/src/FdoActionGroup.vala b/src/FdoActionGroup.vala index 29af9ec..53d35c0 100644 --- a/src/FdoActionGroup.vala +++ b/src/FdoActionGroup.vala @@ -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 @@ -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; @@ -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) actions;