Skip to content

Commit 4c36884

Browse files
committed
Move Settings object into Application class
1 parent a3e59f5 commit 4c36884

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
private static Granite.Settings granite_settings;
2325
private static Gtk.Settings gtk_settings;
2426

@@ -33,7 +35,7 @@ public class Notifications.Application : Gtk.Application {
3335
try {
3436
new Notifications.Server (connection);
3537
} catch (Error e) {
36-
Error.prefix_literal (out e, "Registring notification server failed: ");
38+
Error.prefix_literal (out e, "Registering notification server failed: ");
3739
throw e;
3840
}
3941

@@ -72,7 +74,7 @@ public class Notifications.Application : Gtk.Application {
7274
dbus_flags,
7375
() => hold (),
7476
(conn, name) => {
75-
critical ("Could not aquire bus: %s", name);
77+
critical ("Could not acquire bus: %s", name);
7678
name_lost ();
7779
}
7880
);

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)