summaryrefslogtreecommitdiff
path: root/tools/glib-client-gen.py
diff options
context:
space:
mode:
Diffstat (limited to 'tools/glib-client-gen.py')
-rw-r--r--tools/glib-client-gen.py22
1 files changed, 10 insertions, 12 deletions
diff --git a/tools/glib-client-gen.py b/tools/glib-client-gen.py
index 6b2b97f..e68e1a5 100644
--- a/tools/glib-client-gen.py
+++ b/tools/glib-client-gen.py
@@ -27,8 +27,8 @@ import os.path
import xml.dom.minidom
from getopt import gnu_getopt
-from libtpcodegen import file_set_contents
-from libglibcodegen import Signature, type_to_gtype, cmp_by_name, \
+from libtpcodegen import file_set_contents, key_by_name, u
+from libglibcodegen import Signature, type_to_gtype, \
get_docstring, xml_escape, get_deprecated
@@ -74,18 +74,12 @@ class Generator(object):
self.guard = opts.get('--guard', None)
def h(self, s):
- if isinstance(s, unicode):
- s = s.encode('utf-8')
self.__header.append(s)
def b(self, s):
- if isinstance(s, unicode):
- s = s.encode('utf-8')
self.__body.append(s)
def d(self, s):
- if isinstance(s, unicode):
- s = s.encode('utf-8')
self.__docs.append(s)
def get_iface_quark(self):
@@ -783,9 +777,11 @@ class Generator(object):
self.b(' g_return_val_if_fail (callback != NULL || '
'weak_object == NULL, NULL);')
self.b('')
+ self.b(' G_GNUC_BEGIN_IGNORE_DEPRECATIONS')
self.b(' iface = tp_proxy_borrow_interface_by_id (')
self.b(' (TpProxy *) proxy,')
self.b(' interface, &error);')
+ self.b(' G_GNUC_END_IGNORE_DEPRECATIONS')
self.b('')
self.b(' if (iface == NULL)')
self.b(' {')
@@ -1064,8 +1060,10 @@ class Generator(object):
self.b(' g_return_val_if_fail (%s (proxy), FALSE);'
% self.proxy_assert)
self.b('')
+ self.b(' G_GNUC_BEGIN_IGNORE_DEPRECATIONS')
self.b(' iface = tp_proxy_borrow_interface_by_id')
self.b(' ((TpProxy *) proxy, interface, error);')
+ self.b(' G_GNUC_END_IGNORE_DEPRECATIONS')
self.b('')
self.b(' if (iface == NULL)')
self.b(' return FALSE;')
@@ -1187,7 +1185,7 @@ class Generator(object):
self.b('')
nodes = self.dom.getElementsByTagName('node')
- nodes.sort(cmp_by_name)
+ nodes.sort(key=key_by_name)
for node in nodes:
self.do_interface(node)
@@ -1240,9 +1238,9 @@ class Generator(object):
self.h('#endif /* defined (%s) */' % self.guard)
self.h('')
- file_set_contents(self.basename + '.h', '\n'.join(self.__header))
- file_set_contents(self.basename + '-body.h', '\n'.join(self.__body))
- file_set_contents(self.basename + '-gtk-doc.h', '\n'.join(self.__docs))
+ file_set_contents(self.basename + '.h', u('\n').join(self.__header).encode('utf-8'))
+ file_set_contents(self.basename + '-body.h', u('\n').join(self.__body).encode('utf-8'))
+ file_set_contents(self.basename + '-gtk-doc.h', u('\n').join(self.__docs).encode('utf-8'))
def types_to_gtypes(types):
return [type_to_gtype(t)[1] for t in types]