Skip to content

Commit

Permalink
CheckView: remove minimum space check (#670)
Browse files Browse the repository at this point in the history
* CheckView: remove minimum space check

* Update CheckView.vala
  • Loading branch information
danirabbit authored Dec 2, 2022
1 parent 33486bc commit b4aca6c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 44 deletions.
9 changes: 7 additions & 2 deletions src/MainWindow.vala
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ public interface UPower : GLib.Object {
}

public class Installer.MainWindow : Hdy.Window {
// 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 Gtk.Label infobar_label;
private Gtk.Stack stack;

Expand Down Expand Up @@ -189,7 +194,7 @@ public class Installer.MainWindow : Hdy.Window {
disk_view.previous_view = try_install_view;
stack.add (disk_view);
stack.visible_child = disk_view;
disk_view.load.begin (CheckView.MINIMUM_SPACE);
disk_view.load.begin (MINIMUM_SPACE);

load_check_view ();

Expand All @@ -205,7 +210,7 @@ public class Installer.MainWindow : Hdy.Window {
partitioning_view.destroy ();
}

partitioning_view = new PartitioningView (CheckView.MINIMUM_SPACE);
partitioning_view = new PartitioningView (MINIMUM_SPACE);
partitioning_view.previous_view = try_install_view;
stack.add (partitioning_view);
stack.visible_child = partitioning_view;
Expand Down
42 changes: 0 additions & 42 deletions src/Views/CheckView.vala
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@
public class Installer.CheckView : AbstractInstallerView {
// 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;
// Minimum 15 GB
public const uint64 MINIMUM_SPACE = 15 * ONE_GB;
// Minimum 1.2 GHz
public const int MINIMUM_FREQUENCY = 1200 * 1000;
// Minimum 1GB
Expand Down Expand Up @@ -59,12 +57,6 @@ public class Installer.CheckView : AbstractInstallerView {
"applications-development"
);

var space_view = new CheckView (
_("Not Enough Space"),
_("%s of storage or more is required to install %s.").printf (GLib.format_size (MINIMUM_SPACE), Utils.get_pretty_name ()),
"drive-harddisk"
);

var vm_view = new CheckView (
_("Virtual Machine"),
_("Some parts of %s may run slowly, freeze, or not function properly.").printf (Utils.get_pretty_name ()),
Expand Down Expand Up @@ -119,11 +111,6 @@ public class Installer.CheckView : AbstractInstallerView {
critical ("Couldn't read apt sources: %s", e.message);
}

if (!get_has_enough_space ()) {
message_box.add (space_view);
ignore_button.sensitive = false;
}

if (get_vm ()) {
message_box.add (vm_view);
}
Expand All @@ -135,35 +122,6 @@ public class Installer.CheckView : AbstractInstallerView {
show_all ();
}

private static bool get_has_enough_space () {
var loop = new MainLoop ();
InstallerDaemon.DiskInfo? disks = null;

Daemon.get_default ().get_disks.begin (false, (obj, res) => {
try {
disks = ((Daemon)obj).get_disks.end (res);
} catch (Error e) {
critical ("Unable to get disks list: %s", e.message);
} finally {
loop.quit ();
}
});

loop.run ();

if (disks == null) {
return false;
}

foreach (unowned InstallerDaemon.Disk disk in disks.physical_disks) {
uint64 size = disk.sectors * disk.sector_size;
if (size > MINIMUM_SPACE) {
return true;
}
}
return false;
}

private int get_frequency () {
var max_freq_file = GLib.File.new_for_path ("/sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq");
try {
Expand Down

0 comments on commit b4aca6c

Please sign in to comment.