diff options
author | Simon McVittie <simon.mcvittie@collabora.co.uk> | 2010-11-16 17:26:24 +0000 |
---|---|---|
committer | Simon McVittie <simon.mcvittie@collabora.co.uk> | 2010-11-17 10:14:08 +0000 |
commit | cd0be1aa95b41cc66f6a5bf4f95733fa91fa8dc9 (patch) | |
tree | f50e4b13c8ae379835a66ecedb3ba7907600df30 /tools | |
parent | cfba7302281f1fbb39a0c5864bcc038bab2ed55b (diff) | |
download | telepathy-glib-cd0be1aa95b41cc66f6a5bf4f95733fa91fa8dc9.tar.gz |
gobject-foo.py: generate interface boilerplate correctly
In the test, use the interface-names-are-adjectives pattern, and update
the expected output.
Reviewed-by: Guillaume Desmottes <guillaume.desmottes@collabora.co.uk>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/gobject-foo.py | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/tools/gobject-foo.py b/tools/gobject-foo.py index 5921cab8a..002a290ba 100644 --- a/tools/gobject-foo.py +++ b/tools/gobject-foo.py @@ -5,7 +5,7 @@ # The master copy of this program is in the telepathy-glib repository - # please make any changes there. # -# Copyright (C) 2007 Collabora Ltd. <http://www.collabora.co.uk/> +# Copyright (C) 2007-2010 Collabora Ltd. <http://www.collabora.co.uk/> # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public @@ -33,8 +33,13 @@ def gobject_header(head, tail, as_interface=False): gtype = head.upper() + '_TYPE_' + tail.upper() o("typedef struct _%s %s;" % (MixedCase, MixedCase)) - o("typedef struct _%sClass %sClass;" % (MixedCase, MixedCase)) - o("typedef struct _%sPrivate %sPrivate;" % (MixedCase, MixedCase)) + + if as_interface: + o("typedef struct _%sInterface %sInterface;" % (MixedCase, MixedCase)) + else: + o("typedef struct _%sClass %sClass;" % (MixedCase, MixedCase)) + o("typedef struct _%sPrivate %sPrivate;" % (MixedCase, MixedCase)) + o("") o("GType %s_get_type (void);" % lower_case) o("") @@ -54,13 +59,17 @@ def gobject_header(head, tail, as_interface=False): o("#define %s_IS_%s(obj) \\" % (head.upper(), tail.upper())) o(" (G_TYPE_CHECK_INSTANCE_TYPE ((obj), %s))" % gtype) - if not as_interface: + if as_interface: + o("#define %s_GET_IFACE(obj) \\" % UPPER_CASE) + o(" (G_TYPE_INSTANCE_GET_INTERFACE ((obj), %s, \\" % gtype) + o(" %sInterface))" % MixedCase) + else: o("#define %s_IS_%s_CLASS(klass) \\" % (head.upper(), tail.upper())) o(" (G_TYPE_CHECK_CLASS_TYPE ((klass), %s))" % gtype) - o("#define %s_GET_CLASS(obj) \\" % UPPER_CASE) - o(" (G_TYPE_INSTANCE_GET_CLASS ((obj), %s, \\" % gtype) - o(" %sClass))" % MixedCase) + o("#define %s_GET_CLASS(obj) \\" % UPPER_CASE) + o(" (G_TYPE_INSTANCE_GET_CLASS ((obj), %s, \\" % gtype) + o(" %sClass))" % MixedCase) return out |