Skip to content

Commit 3301d76

Browse files
committed
Clean up Housekeeping class
Remove unnecessary GLib prefixes in Housekeeping.vala in accordance with elementary code style guide.
1 parent 82777a3 commit 3301d76

File tree

1 file changed

+17
-17
lines changed

1 file changed

+17
-17
lines changed

src/Backends/Housekeeping.vala

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -19,18 +19,18 @@
1919
*/
2020

2121
[DBus (name = "org.freedesktop.systemd1.Manager")]
22-
public interface SystemdManager : GLib.Object {
23-
public abstract async string get_unit_file_state (string unit_file) throws GLib.Error;
24-
public abstract async void enable_unit_files (string[] unit_files, bool runtime, bool replace) throws GLib.Error;
25-
public abstract async void start_unit (string name, string mode) throws GLib.Error;
22+
public interface SystemdManager : Object {
23+
public abstract async string get_unit_file_state (string unit_file) throws Error;
24+
public abstract async void enable_unit_files (string[] unit_files, bool runtime, bool replace) throws Error;
25+
public abstract async void start_unit (string name, string mode) throws Error;
2626
}
2727

28-
public class SettingsDaemon.Backends.Housekeeping : GLib.Object {
29-
private GLib.Settings housekeeping_settings;
28+
public class SettingsDaemon.Backends.Housekeeping : Object {
29+
private Settings housekeeping_settings;
3030
private SystemdManager? systemd;
3131

3232
construct {
33-
housekeeping_settings = new GLib.Settings ("io.elementary.settings-daemon.housekeeping");
33+
housekeeping_settings = new Settings ("io.elementary.settings-daemon.housekeeping");
3434
housekeeping_settings.changed.connect (() => {
3535
enable_systemd_tmpfiles.begin ();
3636
write_systemd_tmpfiles_config.begin ();
@@ -48,8 +48,8 @@ public class SettingsDaemon.Backends.Housekeeping : GLib.Object {
4848
private async void enable_systemd_tmpfiles () {
4949
if (systemd == null) {
5050
try {
51-
systemd = yield GLib.Bus.get_proxy (
52-
GLib.BusType.SESSION,
51+
systemd = yield Bus.get_proxy (
52+
BusType.SESSION,
5353
"org.freedesktop.systemd1",
5454
"/org/freedesktop/systemd1"
5555
);
@@ -75,15 +75,15 @@ public class SettingsDaemon.Backends.Housekeeping : GLib.Object {
7575
// Write (or delete) a config file in ~/.config/user-tmpfiles.d to configure the systemd timer for cleaning up the user's
7676
// downloads folder based on the configured age in GSettings
7777
private async void write_systemd_tmpfiles_config () {
78-
var config_path = GLib.Path.build_filename (
79-
GLib.Environment.get_user_config_dir (),
78+
var config_path = Path.build_filename (
79+
Environment.get_user_config_dir (),
8080
"user-tmpfiles.d",
8181
"io.elementary.settings-daemon.downloads-folder.conf"
8282
);
8383

8484
var downloads_cleanup_enabled = housekeeping_settings.get_boolean ("cleanup-downloads-folder");
8585

86-
var config_file = GLib.File.new_for_path (config_path);
86+
var config_file = File.new_for_path (config_path);
8787
if (!config_file.get_parent ().query_exists ()) {
8888
if (!downloads_cleanup_enabled) {
8989
// No point continuing if cleanup isn't enabled
@@ -100,11 +100,11 @@ public class SettingsDaemon.Backends.Housekeeping : GLib.Object {
100100

101101
int downloads_cleanup_days = housekeeping_settings.get_int ("old-files-age");
102102

103-
var downloads_folder = GLib.Environment.get_user_special_dir (
104-
GLib.UserDirectory.DOWNLOAD
103+
var downloads_folder = Environment.get_user_special_dir (
104+
UserDirectory.DOWNLOAD
105105
);
106106

107-
var home_folder = GLib.Environment.get_home_dir ();
107+
var home_folder = Environment.get_home_dir ();
108108
if (File.new_for_path (home_folder).equal (File.new_for_path (downloads_folder))) {
109109
// TODO: Possibly throw a notification as a warning here? This will currently just silently fail
110110
// and no downloads will be cleaned up, despite the setting being enabled
@@ -117,7 +117,7 @@ public class SettingsDaemon.Backends.Housekeeping : GLib.Object {
117117
try {
118118
yield config_file.delete_async ();
119119
} catch (Error e) {
120-
if (!(e is GLib.IOError.NOT_FOUND)) {
120+
if (!(e is IOError.NOT_FOUND)) {
121121
warning ("Unable to delete systemd-tmpfiles config: %s", e.message);
122122
}
123123
}
@@ -140,7 +140,7 @@ public class SettingsDaemon.Backends.Housekeeping : GLib.Object {
140140

141141
FileOutputStream os = config_stream.output_stream as FileOutputStream;
142142
try {
143-
yield os.write_all_async (config.data, GLib.Priority.DEFAULT, null, null);
143+
yield os.write_all_async (config.data, Priority.DEFAULT, null, null);
144144
} catch (Error e) {
145145
warning ("Unable to write systemd-tmpfiles config: %s", e.message);
146146
}

0 commit comments

Comments
 (0)