summaryrefslogtreecommitdiff
path: root/tools/glib-ginterface-gen.py
diff options
context:
space:
mode:
authorRoss Burton <ross@linux.intel.com>2008-11-19 15:20:25 +0000
committerSimon McVittie <simon.mcvittie@collabora.co.uk>2008-11-28 10:36:12 +0000
commit2ec7565c049d157cc36e6b37d137dc82b47f0e54 (patch)
tree4781045325ae6d3667a1cb7548c25c4d5c2da909 /tools/glib-ginterface-gen.py
parent912c7816115dbbbe1f65f2d3371c7378deee175e (diff)
downloadtelepathy-glib-2ec7565c049d157cc36e6b37d137dc82b47f0e54.tar.gz
Only include properties mixin if required
Check if there are any properties in the nodes, if there are none then don't include the properties mixin header because it won't be used. This means if properties are not used the GInterface is standalone.
Diffstat (limited to 'tools/glib-ginterface-gen.py')
-rw-r--r--tools/glib-ginterface-gen.py16
1 files changed, 12 insertions, 4 deletions
diff --git a/tools/glib-ginterface-gen.py b/tools/glib-ginterface-gen.py
index 1b1715562..fd7ad41c8 100644
--- a/tools/glib-ginterface-gen.py
+++ b/tools/glib-ginterface-gen.py
@@ -619,10 +619,21 @@ class Generator(object):
return in_base_init
+ def have_properties(self, nodes):
+ for node in nodes:
+ interface = node.getElementsByTagName('interface')[0]
+ if interface.getElementsByTagName('property'):
+ return True
+ return False
+
def __call__(self):
+ nodes = self.dom.getElementsByTagName('node')
+ nodes.sort(cmp_by_name)
+
self.h('#include <glib-object.h>')
self.h('#include <dbus/dbus-glib.h>')
- self.h('#include <telepathy-glib/dbus-properties-mixin.h>')
+ if (self.have_properties (nodes)):
+ self.h('#include <telepathy-glib/dbus-properties-mixin.h>')
self.h('')
self.h('G_BEGIN_DECLS')
self.h('')
@@ -633,9 +644,6 @@ class Generator(object):
self.b('#include %s' % header)
self.b('')
- nodes = self.dom.getElementsByTagName('node')
- nodes.sort(cmp_by_name)
-
for node in nodes:
self.do_node(node)