Skip to content

Commit 30b42eb

Browse files
authored
Move Settings object into Application class (#267)
1 parent bbacc52 commit 30b42eb

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

src/Application.vala

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
*/
2020

2121
public class Notifications.Application : Gtk.Application {
22+
public static Settings settings = new Settings ("io.elementary.notifications");
23+
2224
public Application () {
2325
Object (
2426
application_id: "io.elementary.notifications",
@@ -30,7 +32,7 @@ public class Notifications.Application : Gtk.Application {
3032
try {
3133
new Notifications.Server (connection);
3234
} catch (Error e) {
33-
Error.prefix_literal (out e, "Registring notification server failed: ");
35+
Error.prefix_literal (out e, "Registering notification server failed: ");
3436
throw e;
3537
}
3638

@@ -62,7 +64,7 @@ public class Notifications.Application : Gtk.Application {
6264
dbus_flags,
6365
() => hold (),
6466
(conn, name) => {
65-
critical ("Could not aquire bus: %s", name);
67+
critical ("Could not acquire bus: %s", name);
6668
name_lost ();
6769
}
6870
);

src/DBus.vala

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,10 @@ public class Notifications.Server : Object {
2525
private Gee.Map<uint32, Bubble?> bubbles;
2626
private Confirmation? confirmation;
2727

28-
private Settings settings;
29-
3028
private uint action_group_id;
3129
private uint server_id;
3230

3331
public Server (DBusConnection connection) throws Error {
34-
settings = new Settings ("io.elementary.notifications");
3532
bubbles = new Gee.HashMap<uint32, Bubble?> ();
3633
action_group = new Fdo.ActionGroup (this);
3734

@@ -144,10 +141,10 @@ public class Notifications.Server : Object {
144141
notification.buttons.add ({ label, action_name });
145142
}
146143

147-
if (!settings.get_boolean ("do-not-disturb") || notification.priority == GLib.NotificationPriority.URGENT) {
144+
if (!Application.settings.get_boolean ("do-not-disturb") || notification.priority == GLib.NotificationPriority.URGENT) {
148145
var app_settings = new Settings.with_path (
149146
"io.elementary.notifications.applications",
150-
settings.path.concat ("applications", "/", notification.app_id, "/")
147+
Application.settings.path.concat ("applications", "/", notification.app_id, "/")
151148
);
152149

153150
if (app_settings.get_boolean ("bubbles")) {

0 commit comments

Comments
 (0)