[dconf] editor: Use int.parse() and double.parse() instead of to_int() and to_double()



commit 9d24a54cb775837cd78d13ebf5c2758292a61448
Author: Robert Ancell <robert ancell canonical com>
Date:   Thu Mar 10 16:32:19 2011 +1100

    editor: Use int.parse() and double.parse() instead of to_int() and to_double()

 editor/dconf-schema.vala |    2 +-
 editor/dconf-view.vala   |   16 ++++++++--------
 2 files changed, 9 insertions(+), 9 deletions(-)
---
diff --git a/editor/dconf-schema.vala b/editor/dconf-schema.vala
index 3520d60..8f3a70d 100644
--- a/editor/dconf-schema.vala
+++ b/editor/dconf-schema.vala
@@ -222,7 +222,7 @@ public class SchemaEnum
                 for (var prop = child->properties; prop != null; prop = prop->next)
                 {
                     if (prop->name == "value")
-                        value = prop->children->content.to_int();
+                        value = int.parse(prop->children->content);
                     else if (prop->name == "nick")
                         nick = prop->children->content;
                     else
diff --git a/editor/dconf-view.vala b/editor/dconf-view.vala
index a71f129..184f9bb 100644
--- a/editor/dconf-view.vala
+++ b/editor/dconf-view.vala
@@ -238,28 +238,28 @@ private class KeyValueRenderer: Gtk.CellRenderer
         switch (key.type_string)
         {
         case "y":
-            key.value = new Variant.byte((uchar)text.to_int());
+            key.value = new Variant.byte((uchar)int.parse(text));
             break;
         case "n":
-            key.value = new Variant.int16((int16)text.to_int());
+            key.value = new Variant.int16((int16)int.parse(text));
             break;
         case "q":
-            key.value = new Variant.uint16((uint16)text.to_int());
+            key.value = new Variant.uint16((uint16)int.parse(text));
             break;
         case "i":
-            key.value = new Variant.int32(text.to_int());
+            key.value = new Variant.int32(int.parse(text));
             break;
         case "u":
-            key.value = new Variant.uint32(text.to_int());
+            key.value = new Variant.uint32(int.parse(text));
             break;
         case "x":
-            key.value = new Variant.int64(text.to_int());
+            key.value = new Variant.int64(int.parse(text));
             break;
         case "t":
-            key.value = new Variant.uint64(text.to_int());
+            key.value = new Variant.uint64(int.parse(text));
             break;
         case "d":
-            key.value = new Variant.double(text.to_double());
+            key.value = new Variant.double(double.parse(text));
             break;
         }
     }



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