[gnome-boxes/show-recomended-resources: 8/8] size-property: Use 64MB for all size properties



commit 7722ed37e209efa339ecc71f9cdd4422e8e3da93
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date:   Wed Feb 6 00:24:06 2013 +0200

    size-property: Use 64MB for all size properties
    
    The 1MB step we use for RAM is too small and 1GB step we use for storage
    is too big. 64MB seems to me like a nice step value for both properties.
    
    This also implies that minimum RAM is now 64MB.

 src/i-properties-provider.vala      |   11 ++++++-----
 src/libvirt-machine-properties.vala |    8 +++-----
 2 files changed, 9 insertions(+), 10 deletions(-)
---
diff --git a/src/i-properties-provider.vala b/src/i-properties-provider.vala
index 8efd122..5584f99 100644
--- a/src/i-properties-provider.vala
+++ b/src/i-properties-provider.vala
@@ -51,13 +51,15 @@ private class Boxes.Property: GLib.Object {
 }
 
 private class Boxes.SizeProperty : Boxes.Property {
+    public const uint64 STEP = 64 * Osinfo.MEBIBYTES;
+
     public signal void changed (uint64 value);
 
-    public SizeProperty (string name, uint64 size, uint64 min, uint64 max, uint64 step) {
+    public SizeProperty (string name, uint64 size, uint64 min, uint64 max) {
         var label = new Gtk.Label (format_size ((uint64) size, FormatSizeFlags.IEC_UNITS));
         label.halign = Gtk.Align.CENTER;
 
-        var scale = new Gtk.Scale.with_range (Gtk.Orientation.HORIZONTAL, min, max, step);
+        var scale = new Gtk.Scale.with_range (Gtk.Orientation.HORIZONTAL, min, max, STEP);
 
         scale.add_mark (min, Gtk.PositionType.BOTTOM, format_size (min, FormatSizeFlags.IEC_UNITS));
         scale.add_mark (max, Gtk.PositionType.BOTTOM,
@@ -137,9 +139,8 @@ private interface Boxes.IPropertiesProvider: GLib.Object {
                                                     string                   name,
                                                     uint64                   size,
                                                     uint64                   min,
-                                                    uint64                   max,
-                                                    uint64                   step) {
-        var property = new SizeProperty (name, size, min, max, step);
+                                                    uint64                   max) {
+        var property = new SizeProperty (name, size, min, max);
         list.append (property);
 
         return property;
diff --git a/src/libvirt-machine-properties.vala b/src/libvirt-machine-properties.vala
index 0b9e378..bf27dd1 100644
--- a/src/libvirt-machine-properties.vala
+++ b/src/libvirt-machine-properties.vala
@@ -391,9 +391,8 @@ private abstract class Boxes.LibvirtMachineProperties: Boxes.Machine {
             var property = add_size_property (ref list,
                                               _("Memory"),
                                               domain_config.memory,
-                                              Osinfo.MEBIBYTES,
-                                              max_ram * Osinfo.KIBIBYTES,
-                                              Osinfo.MEBIBYTES);
+                                              SizeProperty.STEP,
+                                              max_ram * Osinfo.KIBIBYTES);
             property.changed.connect (on_ram_changed);
 
             this.notify["state"].connect (() => {
@@ -498,8 +497,7 @@ private abstract class Boxes.LibvirtMachineProperties: Boxes.Machine {
                                               _("Maximum Disk Size"),
                                               volume_info.capacity,
                                               volume_info.capacity,
-                                              max_storage,
-                                              Osinfo.GIBIBYTES);
+                                              max_storage);
             property.changed.connect (on_storage_changed);
         } catch (GLib.Error error) {
             warning ("Failed to get information on volume '%s' or it's parent pool: %s",



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]