From fa6a6846303817feb9bbd3f6aa136852c10cd072 Mon Sep 17 00:00:00 2001 From: David Zeuthen Date: Wed, 3 Oct 2012 11:07:57 -0400 Subject: [PATCH] gdbus-codegen: make members of an interface inherit the "Since" annotation This is the expected (and sane) behavior - without this bug-fix you'd have to add "Since" to every member of a newly added D-Bus interface. Also show-case this in the codegen example. Signed-off-by: David Zeuthen --- .../gdbus-object-manager-example-sections.txt | 6 ++++++ gio/gdbus-2.0/codegen/dbustypes.py | 18 ++++++++++++------ .../gdbus-example-objectmanager.xml | 13 +++++++++++++ 3 files changed, 31 insertions(+), 6 deletions(-) diff --git a/docs/reference/gio/gdbus-object-manager-example/gdbus-object-manager-example-sections.txt b/docs/reference/gio/gdbus-object-manager-example/gdbus-object-manager-example-sections.txt index a5594aec5..1e3b8b814 100644 --- a/docs/reference/gio/gdbus-object-manager-example/gdbus-object-manager-example-sections.txt +++ b/docs/reference/gio/gdbus-object-manager-example/gdbus-object-manager-example-sections.txt @@ -11,8 +11,14 @@ example_animal_call_poke_sync example_animal_complete_poke example_animal_emit_jumped example_animal_get_mood +example_animal_get_foo +example_animal_get_bar example_animal_dup_mood +example_animal_dup_foo +example_animal_dup_bar example_animal_set_mood +example_animal_set_foo +example_animal_set_bar ExampleAnimalProxy ExampleAnimalProxyClass example_animal_proxy_new diff --git a/gio/gdbus-2.0/codegen/dbustypes.py b/gio/gdbus-2.0/codegen/dbustypes.py index 5fdb9a169..38eb0c46f 100644 --- a/gio/gdbus-2.0/codegen/dbustypes.py +++ b/gio/gdbus-2.0/codegen/dbustypes.py @@ -235,11 +235,13 @@ class Method: self.since = '' self.deprecated = False - def post_process(self, interface_prefix, cns, cns_upper, cns_lower): + def post_process(self, interface_prefix, cns, cns_upper, cns_lower, containing_iface): if len(self.doc_string) == 0: self.doc_string = utils.lookup_docs(self.annotations) if len(self.since) == 0: self.since = utils.lookup_since(self.annotations) + if len(self.since) == 0: + self.since = containing_iface.since name = self.name overridden_name = utils.lookup_annotation(self.annotations, 'org.gtk.GDBus.C.Name') @@ -272,11 +274,13 @@ class Signal: self.since = '' self.deprecated = False - def post_process(self, interface_prefix, cns, cns_upper, cns_lower): + def post_process(self, interface_prefix, cns, cns_upper, cns_lower, containing_iface): if len(self.doc_string) == 0: self.doc_string = utils.lookup_docs(self.annotations) if len(self.since) == 0: self.since = utils.lookup_since(self.annotations) + if len(self.since) == 0: + self.since = containing_iface.since name = self.name overridden_name = utils.lookup_annotation(self.annotations, 'org.gtk.GDBus.C.Name') @@ -319,11 +323,13 @@ class Property: self.since = '' self.deprecated = False - def post_process(self, interface_prefix, cns, cns_upper, cns_lower): + def post_process(self, interface_prefix, cns, cns_upper, cns_lower, containing_iface): if len(self.doc_string) == 0: self.doc_string = utils.lookup_docs(self.annotations) if len(self.since) == 0: self.since = utils.lookup_since(self.annotations) + if len(self.since) == 0: + self.since = containing_iface.since name = self.name overridden_name = utils.lookup_annotation(self.annotations, 'org.gtk.GDBus.C.Name') @@ -411,10 +417,10 @@ class Interface: self.deprecated = True for m in self.methods: - m.post_process(interface_prefix, cns, cns_upper, cns_lower) + m.post_process(interface_prefix, cns, cns_upper, cns_lower, self) for s in self.signals: - s.post_process(interface_prefix, cns, cns_upper, cns_lower) + s.post_process(interface_prefix, cns, cns_upper, cns_lower, self) for p in self.properties: - p.post_process(interface_prefix, cns, cns_upper, cns_lower) + p.post_process(interface_prefix, cns, cns_upper, cns_lower, self) diff --git a/gio/tests/gdbus-object-manager-example/gdbus-example-objectmanager.xml b/gio/tests/gdbus-object-manager-example/gdbus-example-objectmanager.xml index 1036b7a97..472b2571e 100644 --- a/gio/tests/gdbus-object-manager-example/gdbus-example-objectmanager.xml +++ b/gio/tests/gdbus-object-manager-example/gdbus-example-objectmanager.xml @@ -45,6 +45,19 @@ + + + + + +