Skip to content

Commit 59e77f8

Browse files
authored
Merge branch 'main' into lenemter/move-send-sound
2 parents fca6f87 + 432aa45 commit 59e77f8

File tree

2 files changed

+27
-30
lines changed

2 files changed

+27
-30
lines changed

src/AbstractBubble.vala

Lines changed: 26 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2020 elementary, Inc. (https://elementary.io)
2+
* Copyright 2020-2025 elementary, Inc. (https://elementary.io)
33
*
44
* This program is free software; you can redistribute it and/or
55
* modify it under the terms of the GNU General Public
@@ -31,6 +31,7 @@ public class Notifications.AbstractBubble : Gtk.Window {
3131

3232
private Gtk.Revealer close_revealer;
3333
private Gtk.Box draw_area;
34+
private Gtk.Overlay overlay;
3435

3536
private uint timeout_id;
3637

@@ -72,7 +73,7 @@ public class Notifications.AbstractBubble : Gtk.Window {
7273
overflow = VISIBLE
7374
};
7475

75-
var overlay = new Gtk.Overlay () {
76+
overlay = new Gtk.Overlay () {
7677
child = draw_area
7778
};
7879
overlay.add_overlay (close_revealer);
@@ -92,11 +93,7 @@ public class Notifications.AbstractBubble : Gtk.Window {
9293
can_focus = false;
9394
set_titlebar (new Gtk.Grid ());
9495

95-
carousel.page_changed.connect ((index) => {
96-
if (index == 0) {
97-
closed (Notifications.Server.CloseReason.DISMISSED);
98-
}
99-
});
96+
carousel.page_changed.connect (on_page_changed);
10097
close_button.clicked.connect (() => closed (Notifications.Server.CloseReason.DISMISSED));
10198

10299
var motion_controller = new Gtk.EventControllerMotion ();
@@ -114,18 +111,7 @@ public class Notifications.AbstractBubble : Gtk.Window {
114111
}
115112
});
116113

117-
carousel.notify["position"].connect (() => {
118-
current_swipe_progress = carousel.position;
119-
120-
if (desktop_panel != null) {
121-
int left, right;
122-
get_blur_margins (out left, out right);
123-
124-
desktop_panel.add_blur (left, right, 16, 16, 9);
125-
} else if (Gdk.Display.get_default () is Gdk.X11.Display) {
126-
x11_update_mutter_hints ();
127-
}
128-
});
114+
carousel.notify["position"].connect (update_swipe_progress);
129115

130116
transparency_settings.changed["use-transparency"].connect (update_transparency);
131117
update_transparency ();
@@ -139,6 +125,27 @@ public class Notifications.AbstractBubble : Gtk.Window {
139125
}
140126
}
141127

128+
private void on_page_changed (Adw.Carousel carousel, uint index) {
129+
if (carousel.get_nth_page (index) != overlay) {
130+
closed (Notifications.Server.CloseReason.DISMISSED);
131+
}
132+
}
133+
134+
private void update_swipe_progress (Object obj, ParamSpec pspec) {
135+
var carousel = (Adw.Carousel) obj;
136+
137+
current_swipe_progress = carousel.position;
138+
139+
if (desktop_panel != null) {
140+
int left, right;
141+
get_blur_margins (out left, out right);
142+
143+
desktop_panel.add_blur (left, right, 16, 16, 9);
144+
} else if (Gdk.Display.get_default () is Gdk.X11.Display) {
145+
x11_update_mutter_hints ();
146+
}
147+
}
148+
142149
public new void present () {
143150
if (timeout_id != 0) {
144151
Source.remove (timeout_id);

src/Application.vala

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2019-2023 elementary, Inc. (https://elementary.io)
2+
* Copyright 2019-2025 elementary, Inc. (https://elementary.io)
33
*
44
* This program is free software; you can redistribute it and/or
55
* modify it under the terms of the GNU General Public
@@ -19,9 +19,6 @@
1919
*/
2020

2121
public class Notifications.Application : Gtk.Application {
22-
private static Granite.Settings granite_settings;
23-
private static Gtk.Settings gtk_settings;
24-
2522
public Application () {
2623
Object (
2724
application_id: "io.elementary.notifications",
@@ -45,13 +42,6 @@ public class Notifications.Application : Gtk.Application {
4542

4643
Granite.init ();
4744

48-
granite_settings = Granite.Settings.get_default ();
49-
gtk_settings = Gtk.Settings.get_default ();
50-
gtk_settings.gtk_application_prefer_dark_theme = granite_settings.prefers_color_scheme == Granite.Settings.ColorScheme.DARK;
51-
granite_settings.notify["prefers-color-scheme"].connect (() => {
52-
gtk_settings.gtk_application_prefer_dark_theme = granite_settings.prefers_color_scheme == Granite.Settings.ColorScheme.DARK;
53-
});
54-
5545
unowned var context = CanberraGtk4.context_get ();
5646
context.change_props (
5747
Canberra.PROP_APPLICATION_NAME, "Notifications",

0 commit comments

Comments
 (0)