diff options
author | Will Thompson <will.thompson@collabora.co.uk> | 2011-08-26 12:08:45 +0100 |
---|---|---|
committer | Will Thompson <will.thompson@collabora.co.uk> | 2011-09-06 15:35:27 +0100 |
commit | 0630ff688eb5eacce5a635068e0f4e9ca2b6427e (patch) | |
tree | c1cb7464341abb778c95d0ede9c74752d4189b5b /tools | |
parent | 423b08acd005876d0c8eb1e4905939d806980d12 (diff) | |
download | telepathy-glib-0630ff688eb5eacce5a635068e0f4e9ca2b6427e.tar.gz |
ginterface-gen: set PropertiesChanged annotation flags
This will be tested shortly.
Diffstat (limited to 'tools')
-rw-r--r-- | tools/glib-ginterface-gen.py | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/tools/glib-ginterface-gen.py b/tools/glib-ginterface-gen.py index 9dfdcc75d..e277b91f4 100644 --- a/tools/glib-ginterface-gen.py +++ b/tools/glib-ginterface-gen.py @@ -33,6 +33,16 @@ from libglibcodegen import Signature, type_to_gtype, cmp_by_name, \ NS_TP = "http://telepathy.freedesktop.org/wiki/DbusSpec#extensions-v0" +def get_emits_changed(node): + try: + return [ + annotation.getAttribute('value') + for annotation in node.getElementsByTagName('annotation') + if annotation.getAttribute('name') == 'org.freedesktop.DBus.Property.EmitsChangedSignal' + ][0] + except IndexError: + return None + class Generator(object): def __init__(self, dom, prefix, basename, signal_marshal_prefix, @@ -108,6 +118,8 @@ class Generator(object): if tmp and not self.allow_havoc: raise AssertionError('%s is %s' % (self.iface_name, tmp)) + iface_emits_changed = get_emits_changed(interface) + self.b('static const DBusGObjectInfo _%s%s_object_info;' % (self.prefix_, node_name_lc)) self.b('') @@ -270,6 +282,16 @@ class Generator(object): flags = ('TP_DBUS_PROPERTIES_MIXIN_FLAG_READ | ' 'TP_DBUS_PROPERTIES_MIXIN_FLAG_WRITE') + prop_emits_changed = get_emits_changed(m) + + if prop_emits_changed is None: + prop_emits_changed = iface_emits_changed + + if prop_emits_changed == 'true': + flags += ' | TP_DBUS_PROPERTIES_MIXIN_FLAG_EMITS_CHANGED' + elif prop_emits_changed == 'invalidates': + flags += ' | TP_DBUS_PROPERTIES_MIXIN_FLAG_EMITS_INVALIDATED' + self.b(' { 0, %s, "%s", 0, NULL, NULL }, /* %s */' % (flags, m.getAttribute('type'), m.getAttribute('name'))) |