[dconf] dconf-editor: Correct type text for floating point keys



commit 936beb6ce07ceda9269cb02e1b92eb3dc57c3f14
Author: Gergely Polonkai <gergely polonkai eu>
Date:   Wed Jul 23 09:18:03 2014 +1200

    dconf-editor: Correct type text for floating point keys
    
    We were previously showing the range for double keys as integers - correct to using double.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=733557

 editor/dconf-editor.vala |   14 +++++++++++++-
 editor/dconf-view.vala   |    4 ++++
 2 files changed, 17 insertions(+), 1 deletions(-)
---
diff --git a/editor/dconf-editor.vala b/editor/dconf-editor.vala
index 671b9b5..8174218 100644
--- a/editor/dconf-editor.vala
+++ b/editor/dconf-editor.vala
@@ -171,7 +171,6 @@ class ConfigurationEditor : Gtk.Application
         case "u":
         case "x":
         case "t":
-        case "d":
             Variant min, max;
             if (key.schema.range != null)
             {
@@ -184,6 +183,19 @@ class ConfigurationEditor : Gtk.Application
                 max = key.get_max();
             }
             return _("Integer [%s..%s]").printf(min.print(false), max.print(false));
+        case "d":
+            Variant min, max;
+            if (key.schema.range != null)
+            {
+                min = key.schema.range.min;
+                max = key.schema.range.max;
+            }
+            else
+            {
+                min = key.get_min();
+                max = key.get_max();
+            }
+            return _("Double [%s..%s]").printf(min.print(false), max.print(false));
         case "b":
             return _("Boolean");
         case "s":
diff --git a/editor/dconf-view.vala b/editor/dconf-view.vala
index f4d07d4..ac5303b 100644
--- a/editor/dconf-view.vala
+++ b/editor/dconf-view.vala
@@ -67,6 +67,10 @@ private class KeyValueRenderer: Gtk.CellRenderer
                 }
                 spin_renderer.adjustment = new Gtk.Adjustment(v, min, max, 1, 0, 0);
                 spin_renderer.digits = 0;
+                if (key.type_string == "d")
+                {
+                    spin_renderer.digits = 20;
+                }
                 mode = Gtk.CellRendererMode.EDITABLE;
                 break;
             default:


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