[gnome-boxes/take-manual-input-for-memory-widget: 1/2] preferences: Use IEC (base 1024) units with "GiB"-style suffixes
- From: Felipe Borges <felipeborges src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-boxes/take-manual-input-for-memory-widget: 1/2] preferences: Use IEC (base 1024) units with "GiB"-style suffixes
- Date: Tue, 1 Mar 2022 12:16:50 +0000 (UTC)
commit e15c5aef02aeeeb5eab1699bfea5872ff246e1d5
Author: Felipe Borges <felipeborges gnome org>
Date: Tue Mar 1 13:07:33 2022 +0100
preferences: Use IEC (base 1024) units with "GiB"-style suffixes
src/preferences/memory-row.vala | 3 ++-
src/preferences/resources-page.vala | 6 ++++--
src/preferences/storage-row.vala | 2 +-
3 files changed, 7 insertions(+), 4 deletions(-)
---
diff --git a/src/preferences/memory-row.vala b/src/preferences/memory-row.vala
index de3872e5..9e568df5 100644
--- a/src/preferences/memory-row.vala
+++ b/src/preferences/memory-row.vala
@@ -29,7 +29,8 @@ private int on_spin_button_input (Gtk.SpinButton spin_button, out double new_val
private bool on_spin_button_output (Gtk.SpinButton spin_button) {
uint64 current_value = (uint64)spin_button.get_value ();
- spin_button.text = GLib.format_size (current_value);
+ spin_button.text = GLib.format_size (current_value,
+ GLib.FormatSizeFlags.IEC_UNITS);
return true;
}
diff --git a/src/preferences/resources-page.vala b/src/preferences/resources-page.vala
index 6dd8ac90..fbd9f3d2 100644
--- a/src/preferences/resources-page.vala
+++ b/src/preferences/resources-page.vala
@@ -80,9 +80,11 @@ private async void mark_recommended_resources () {
// Translators: %s is a recommended value for RAM/storage limit. For example "Recommended 4 GB."
var row_subtitle = _("Recommended %s.");
- ram_row.set_subtitle (row_subtitle.printf (GLib.format_size (recommended_resources.ram)));
+ ram_row.set_subtitle (row_subtitle.printf (GLib.format_size (recommended_resources.ram,
+ GLib.FormatSizeFlags.IEC_UNITS)));
if (machine.storage_volume != null)
- storage_row.set_subtitle (row_subtitle.printf (GLib.format_size
(recommended_resources.storage)));
+ storage_row.set_subtitle (row_subtitle.printf (GLib.format_size
(recommended_resources.storage,
+
GLib.FormatSizeFlags.IEC_UNITS)));
}
}
diff --git a/src/preferences/storage-row.vala b/src/preferences/storage-row.vala
index 585d15dd..87b0baf6 100644
--- a/src/preferences/storage-row.vala
+++ b/src/preferences/storage-row.vala
@@ -74,7 +74,7 @@ private void setup_external_storage () {
null, (obj, res) => {
try {
FileInfo info = disk.query_info_async.end (res);
- used_label.label = _("Used %s").printf (GLib.format_size (info.get_size ()));
+ used_label.label = _("Used %s").printf (GLib.format_size (info.get_size (),
GLib.FormatSizeFlags.IEC_UNITS));
} catch (GLib.Error error) {
message ("Failed to calculate disk size for '%s': %s", disk.get_path (),
error.message);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]