Skip to content

Commit 8100ec7

Browse files
authored
Merge branch 'main' into lenemter/move-close-reason
2 parents febdc1d + 432aa45 commit 8100ec7

File tree

2 files changed

+26
-29
lines changed

2 files changed

+26
-29
lines changed

src/AbstractBubble.vala

Lines changed: 25 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ public class Notifications.AbstractBubble : Gtk.Window {
4141

4242
private Gtk.Revealer close_revealer;
4343
private Gtk.Box draw_area;
44+
private Gtk.Overlay overlay;
4445

4546
private uint timeout_id;
4647

@@ -82,7 +83,7 @@ public class Notifications.AbstractBubble : Gtk.Window {
8283
overflow = VISIBLE
8384
};
8485

85-
var overlay = new Gtk.Overlay () {
86+
overlay = new Gtk.Overlay () {
8687
child = draw_area
8788
};
8889
overlay.add_overlay (close_revealer);
@@ -102,11 +103,7 @@ public class Notifications.AbstractBubble : Gtk.Window {
102103
can_focus = false;
103104
set_titlebar (new Gtk.Grid ());
104105

105-
carousel.page_changed.connect ((index) => {
106-
if (index == 0) {
107-
closed (CloseReason.DISMISSED);
108-
}
109-
});
106+
carousel.page_changed.connect (on_page_changed);
110107
close_button.clicked.connect (() => closed (CloseReason.DISMISSED));
111108

112109
var motion_controller = new Gtk.EventControllerMotion ();
@@ -124,18 +121,7 @@ public class Notifications.AbstractBubble : Gtk.Window {
124121
}
125122
});
126123

127-
carousel.notify["position"].connect (() => {
128-
current_swipe_progress = carousel.position;
129-
130-
if (desktop_panel != null) {
131-
int left, right;
132-
get_blur_margins (out left, out right);
133-
134-
desktop_panel.add_blur (left, right, 16, 16, 9);
135-
} else if (Gdk.Display.get_default () is Gdk.X11.Display) {
136-
x11_update_mutter_hints ();
137-
}
138-
});
124+
carousel.notify["position"].connect (update_swipe_progress);
139125

140126
transparency_settings.changed["use-transparency"].connect (update_transparency);
141127
update_transparency ();
@@ -149,6 +135,27 @@ public class Notifications.AbstractBubble : Gtk.Window {
149135
}
150136
}
151137

138+
private void on_page_changed (Adw.Carousel carousel, uint index) {
139+
if (carousel.get_nth_page (index) != overlay) {
140+
closed (CloseReason.DISMISSED);
141+
}
142+
}
143+
144+
private void update_swipe_progress (Object obj, ParamSpec pspec) {
145+
var carousel = (Adw.Carousel) obj;
146+
147+
current_swipe_progress = carousel.position;
148+
149+
if (desktop_panel != null) {
150+
int left, right;
151+
get_blur_margins (out left, out right);
152+
153+
desktop_panel.add_blur (left, right, 16, 16, 9);
154+
} else if (Gdk.Display.get_default () is Gdk.X11.Display) {
155+
x11_update_mutter_hints ();
156+
}
157+
}
158+
152159
public new void present () {
153160
if (timeout_id != 0) {
154161
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)