[caribou] setting_types: avoid using GVariant



commit 4ee4055a9a77e7cf0ebba636f569e3181e8d7697
Author: Dan Winship <danw gnome org>
Date:   Thu Aug 4 10:23:16 2011 -0400

    setting_types: avoid using GVariant
    
    pygobject 2.28's GLib.Variant doesn't work with glib master (bug
    654859), and pygobject 3.x is not yet ready for general use. So just
    avoid using variants for now.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=655976

 caribou/settings/setting_types.py |   11 +++++++++--
 tools/make_schema.py              |    3 +--
 2 files changed, 10 insertions(+), 4 deletions(-)
---
diff --git a/caribou/settings/setting_types.py b/caribou/settings/setting_types.py
index efa438c..66fb0f0 100644
--- a/caribou/settings/setting_types.py
+++ b/caribou/settings/setting_types.py
@@ -108,8 +108,8 @@ class ValueSetting(Setting):
         return bool(self.value)
 
     @property
-    def gvariant(self):
-        return GLib.Variant(self.variant_type, self.value)
+    def default_value(self):
+        return "%r" % self.value
 
 class BooleanSetting(ValueSetting):
     variant_type = 'b'
@@ -118,6 +118,13 @@ class BooleanSetting(ValueSetting):
         # Almost anything could be a boolean.
         return bool(val)
 
+    @property
+    def default_value(self):
+        if self.value:
+            return "true"
+        else:
+            return "false"
+
 class IntegerSetting(ValueSetting):
     variant_type = 'i'
     entry_type = ENTRY_SPIN
diff --git a/tools/make_schema.py b/tools/make_schema.py
index a6d070f..8a6303e 100755
--- a/tools/make_schema.py
+++ b/tools/make_schema.py
@@ -57,8 +57,7 @@ class SchemasMaker:
             key.setAttribute('type', setting.variant_type)
             schemalist.appendChild(key)
             self._append_children_element_value_pairs(
-                doc, key, [('default',
-                            getattr(setting.gvariant, "print")(False)),
+                doc, key, [('default', setting.default_value),
                            ('_summary', setting.short_desc),
                            ('_description', setting.long_desc)])
 



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