]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
dbusgen: Set DBus.name on symbols as needed
authorRico Tzschichholz <ricotz@ubuntu.com>
Tue, 26 Mar 2019 16:45:05 +0000 (17:45 +0100)
committerRico Tzschichholz <ricotz@ubuntu.com>
Sat, 29 Apr 2023 19:00:17 +0000 (21:00 +0200)
dbusgen/valadbusparser.vala

index ae44ba280f3c54f043db18edf96ac957632b120b..816913fbe0b43cc5f286d6d875dd2edc6d25c8de 100644 (file)
@@ -299,16 +299,24 @@ public class Vala.DBusParser : CodeVisitor {
                        return;
                }
 
+               var needs_name = false;
                var vala_name = Vala.Symbol.camel_case_to_lower_case (name);
                if (name == Vala.Symbol.lower_case_to_camel_case (vala_name)) {
                        name = vala_name;
+               } else {
+                       needs_name = true;
                }
+
                current_node = current_method = new Method (name, dbus_module.void_type.copy (), get_current_src ());
                ((Method)current_method).is_abstract = true;
                ((Method)current_method).access = SymbolAccessibility.PUBLIC;
                ((Method)current_method).add_error_type (dbus_module.gio_error_type);
                ((Method)current_method).add_error_type (dbus_module.gdbus_error_type);
 
+               if (needs_name) {
+                       current_node.set_attribute_string ("DBus", "name", name);
+               }
+
                next ();
 
                parse_method_body ();
@@ -363,14 +371,22 @@ public class Vala.DBusParser : CodeVisitor {
                        needs_signature = true;
                }
 
+               var needs_name = false;
                var vala_name = Vala.Symbol.camel_case_to_lower_case (name);
                if (name == Vala.Symbol.lower_case_to_camel_case (vala_name)) {
                        name = vala_name;
+               } else {
+                       needs_name = true;
                }
+
                current_node = current_property = new Property (name, data_type, null, null, get_current_src ());
                current_property.is_abstract = true;
                current_property.access = SymbolAccessibility.PUBLIC;
 
+               if (needs_name) {
+                       current_node.set_attribute_string ("DBus", "name", name);
+               }
+
                next ();
 
                while (current_token == MarkupTokenType.START_ELEMENT) {
@@ -509,13 +525,21 @@ public class Vala.DBusParser : CodeVisitor {
                        return;
                }
 
+               var needs_name = false;
                var vala_name = Vala.Symbol.camel_case_to_lower_case (name);
                if (name == Vala.Symbol.lower_case_to_camel_case (vala_name)) {
                        name = vala_name;
+               } else {
+                       needs_name = true;
                }
+
                current_node = current_method = new Signal (name, dbus_module.void_type.copy ());
                ((Signal)current_node).access = SymbolAccessibility.PUBLIC;
 
+               if (needs_name) {
+                       current_node.set_attribute_string ("DBus", "name", name);
+               }
+
                next ();
 
                parse_method_body ();