Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions daemon/CommonBackend.vala
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/*
* Copyright 2021-2026 elementary, Inc. (https://elementary.io)
* SPDX-License-Identifier: GPL-3.0-or-later
*/

[DBus (name = "io.elementary.InstallerDaemon")]
public class InstallerDaemon.CommonBackend : GLib.Object {
public void set_demo_mode_locale (string locale) throws GLib.Error {
GLib.FileUtils.set_contents ("/etc/default/locale", "LANG=" + locale);
}

public void trigger_demo_mode () throws GLib.Error {
var demo_mode_file = GLib.File.new_for_path ("/var/lib/lightdm/demo-mode");
try {
demo_mode_file.create (GLib.FileCreateFlags.NONE);
} catch (GLib.Error e) {
if (!(e is GLib.IOError.EXISTS)) {
throw e;
}
}
}
}
1 change: 1 addition & 0 deletions daemon/Daemon.vala
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ public class InstallerDaemon.Application : GLib.Application {
base.dbus_register (connection, object_path);

try {
connection.register_object ("/io/elementary/InstallerDaemon", new InstallerDaemon.CommonBackend ());
#if DISTINST_BACKEND
connection.register_object ("/io/elementary/InstallerDaemon", new InstallerDaemon.DistinstBackend ());
#endif
Expand Down
15 changes: 0 additions & 15 deletions daemon/DistinstBackend.vala
Original file line number Diff line number Diff line change
Expand Up @@ -219,21 +219,6 @@ public class InstallerDaemon.DistinstBackend : GLib.Object {
});
}

public void set_demo_mode_locale (string locale) throws GLib.Error {
GLib.FileUtils.set_contents ("/etc/default/locale", "LANG=" + locale);
}

public void trigger_demo_mode () throws GLib.Error {
var demo_mode_file = GLib.File.new_for_path ("/var/lib/lightdm/demo-mode");
try {
demo_mode_file.create (GLib.FileCreateFlags.NONE);
} catch (GLib.Error e) {
if (!(e is GLib.IOError.EXISTS)) {
throw e;
}
}
}

private string casper_dir () {
const string CDROM = "/cdrom";

Expand Down
1 change: 1 addition & 0 deletions daemon/meson.build
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
vala_files = [
'CommonBackend.vala',
Comment thread
danirabbit marked this conversation as resolved.
'Daemon.vala',
common_files
]
Expand Down
Loading