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
3 changes: 3 additions & 0 deletions daemon/Daemon.vala
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
*/

public class InstallerDaemon.Application : GLib.Application {
// We have to do it step by step because the vala compiler has overflows with big numbers.
public const uint64 ONE_GB = 1000 * 1000 * 1000;

public Application () {
Object (
application_id: "io.elementary.InstallerDaemon",
Expand Down
4 changes: 4 additions & 0 deletions daemon/DistinstBackend.vala
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ public class InstallerDaemon.DistinstBackend : GLib.Object {
return to_common_usage_bootloader (Distinst.bootloader_detect ());
}

public uint64 get_minimum_disk_size () throws GLib.Error {
return 15 * Application.ONE_GB;
}

public DiskInfo get_disks (bool get_partitions = false) throws GLib.Error {
disks = Distinst.Disks.probe ();

Expand Down
9 changes: 9 additions & 0 deletions src/Helpers/InstallerDaemon.vala
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ public class Installer.Daemon {
public abstract InstallerDaemon.PartitionTable bootloader_detect () throws GLib.Error;

public async abstract InstallerDaemon.DiskInfo get_disks (bool get_partitions = false) throws GLib.Error;
public async abstract uint64 get_minimum_disk_size () throws GLib.Error;
public async abstract int decrypt_partition (string path, string pv, string password) throws GLib.Error;
public async abstract InstallerDaemon.Disk get_logical_device (string pv) throws GLib.Error;
public async abstract void install_with_default_disk_layout (InstallerDaemon.InstallConfig config, string disk, bool encrypt, string encryption_password) throws GLib.Error;
Expand Down Expand Up @@ -104,6 +105,14 @@ public class Installer.Daemon {
return yield daemon.get_logical_device (pv);
}

public async uint64 get_minimum_disk_size () throws GLib.Error {
if (daemon == null) {
throw new GLib.IOError.FAILED ("Not connected to installer daemon");
}

return yield daemon.get_minimum_disk_size ();
}

public async void install_with_default_disk_layout (InstallerDaemon.InstallConfig config, string disk, bool encrypt, string encryption_password) throws GLib.Error {
if (daemon == null) {
throw new GLib.IOError.FAILED ("Not connected to installer daemon");
Expand Down
8 changes: 1 addition & 7 deletions src/MainWindow.vala
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,6 @@ public interface UPower : GLib.Object {
}

public class Installer.MainWindow : Gtk.ApplicationWindow, PantheonWayland.ExtendedBehavior {
// We have to do it step by step because the vala compiler has overflows with big numbers.
private const uint64 ONE_GB = 1000 * 1000 * 1000;
// Minimum 15 GB
private const uint64 MINIMUM_SPACE = 15 * ONE_GB;

private Adw.NavigationView navigation_view;
private LanguageView language_view;
private TryInstallView try_install_view;
Expand Down Expand Up @@ -155,7 +150,6 @@ public class Installer.MainWindow : Gtk.ApplicationWindow, PantheonWayland.Exten
var disk_view = new DiskView ();
navigation_view.push (disk_view);

disk_view.load.begin (MINIMUM_SPACE);
disk_view.next_step.connect (() => load_encrypt_view ());
}

Expand Down Expand Up @@ -186,7 +180,7 @@ public class Installer.MainWindow : Gtk.ApplicationWindow, PantheonWayland.Exten
}

private void load_partitioning_view () {
var partitioning_view = new PartitioningView (MINIMUM_SPACE);
var partitioning_view = new PartitioningView ();
navigation_view.push (partitioning_view);

partitioning_view.next_step.connect (() => {
Expand Down
4 changes: 3 additions & 1 deletion src/Views/DiskView.vala
Original file line number Diff line number Diff line change
Expand Up @@ -103,13 +103,15 @@ public class Installer.DiskView : AbstractInstallerView {
action_box_end.append (next_button);
}

public async void load (uint64 minimum_disk_size) {
public async void load () {
uint64 minimum_disk_size;
DiskButton[] enabled_buttons = {};
DiskButton[] disabled_buttons = {};

InstallerDaemon.DiskInfo? disks;
try {
disks = yield Daemon.get_default ().get_disks ();
minimum_disk_size = yield Daemon.get_default ().get_minimum_disk_size ();
} catch (Error e) {
critical ("Unable to get disks list: %s", e.message);
load_stack.set_visible_child_name ("disk");
Expand Down
5 changes: 1 addition & 4 deletions src/Views/PartitioningView.vala
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,7 @@ public class Installer.PartitioningView : AbstractInstallerView {
public Gee.ArrayList<Installer.Mount> mounts;
public Gee.ArrayList<InstallerDaemon.LuksCredentials?> luks;

public static uint64 minimum_disk_size;

public PartitioningView (uint64 size) {
minimum_disk_size = size;
public PartitioningView () {
Object (cancellable: false);
}

Expand Down
Loading