[pygobject/pygobject-2-28] Revert "[gi] Removed hack to avoid using GLib.Variant.new_variant."
- From: Ignacio Casal Quinteiro <icq src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pygobject/pygobject-2-28] Revert "[gi] Removed hack to avoid using GLib.Variant.new_variant."
- Date: Wed, 8 Jun 2011 17:16:11 +0000 (UTC)
commit 1598047c0ddd6a1d04d41e59dd182f3c0524f3c4
Author: Ignacio Casal Quinteiro <icq gnome org>
Date: Wed Jun 8 19:18:23 2011 +0200
Revert "[gi] Removed hack to avoid using GLib.Variant.new_variant."
This reverts commit dfe95b9ec598b57deaabd98ab488ab054a44ec09.
gi/overrides/GLib.py | 14 +++++++++++++-
1 files changed, 13 insertions(+), 1 deletions(-)
---
diff --git a/gi/overrides/GLib.py b/gi/overrides/GLib.py
index ad9f235..2caf205 100644
--- a/gi/overrides/GLib.py
+++ b/gi/overrides/GLib.py
@@ -25,6 +25,17 @@ GLib = modules['GLib']._introspection_module
__all__ = []
+def _create_variant(value):
+ '''Create a variant containing the variant "value".
+
+ This is usually done with the GLib.Variant.new_variant() leaf
+ constructor, but this is currently broken, see GNOME#639952.
+ '''
+ builder = GLib.VariantBuilder()
+ builder.init(variant_type_from_string('v'))
+ builder.add_value(value)
+ return builder.end()
+
class _VariantCreator(object):
_LEAF_CONSTRUCTORS = {
@@ -41,7 +52,8 @@ class _VariantCreator(object):
's': GLib.Variant.new_string,
'o': GLib.Variant.new_object_path,
'g': GLib.Variant.new_signature,
- 'v': GLib.Variant.new_variant,
+ #'v': GLib.Variant.new_variant,
+ 'v': _create_variant,
}
def _create(self, format, args):
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]