From 4e971c8da419931fb88e79be1124e6e2c9b0ed18 Mon Sep 17 00:00:00 2001 From: lenemter Date: Mon, 6 Oct 2025 11:24:58 +0300 Subject: [PATCH 1/2] Move CloseReason to AbstractBubble --- src/AbstractBubble.vala | 20 +++++++++++++++----- src/Bubble.vala | 4 ++-- src/DBus.vala | 9 +-------- src/FdoActionGroup.vala | 6 +++--- 4 files changed, 21 insertions(+), 18 deletions(-) diff --git a/src/AbstractBubble.vala b/src/AbstractBubble.vala index f0076bc9..742dca5f 100644 --- a/src/AbstractBubble.vala +++ b/src/AbstractBubble.vala @@ -1,5 +1,5 @@ /* -* Copyright 2020 elementary, Inc. (https://elementary.io) +* Copyright 2020-2025 elementary, Inc. (https://elementary.io) * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public @@ -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,10 +104,10 @@ public class Notifications.AbstractBubble : Gtk.Window { carousel.page_changed.connect ((index) => { if (index == 0) { - closed (Notifications.Server.CloseReason.DISMISSED); + closed (CloseReason.DISMISSED); } }); - 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); @@ -170,7 +180,7 @@ public class Notifications.AbstractBubble : Gtk.Window { } private bool timeout_expired () { - closed (Notifications.Server.CloseReason.EXPIRED); + closed (CloseReason.EXPIRED); return Source.REMOVE; } diff --git a/src/Bubble.vala b/src/Bubble.vala index 4570f6ba..88b068ec 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 e0d0a540..dc2c8308 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 29af9ec7..53d35c0c 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; From febdc1d8ac56ada40f3a630f1ccfa31e38210f2f Mon Sep 17 00:00:00 2001 From: lenemter Date: Mon, 6 Oct 2025 14:26:46 +0300 Subject: [PATCH 2/2] A --- src/AbstractBubble.vala | 1 - 1 file changed, 1 deletion(-) diff --git a/src/AbstractBubble.vala b/src/AbstractBubble.vala index 742dca5f..efd3f1ac 100644 --- a/src/AbstractBubble.vala +++ b/src/AbstractBubble.vala @@ -184,7 +184,6 @@ public class Notifications.AbstractBubble : Gtk.Window { 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;