]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
Fix naming of properties
authorJCWasmx86 <JCWasmx86@t-online.de>
Mon, 6 Jun 2022 13:23:20 +0000 (15:23 +0200)
committerRico Tzschichholz <ricotz@ubuntu.com>
Sat, 29 Apr 2023 19:00:17 +0000 (21:00 +0200)
dbusgen/tests/test-codegen.xml
dbusgen/tests/test-codegen.xml.vala-expected
dbusgen/valadbusparser.vala

index bd7b77be6ad89f26d9d065e4f3351cca39f13354..35ccd9be63fa2c5587bd988ec8bd240a92d4cbc6 100644 (file)
       </variablelist>
     -->
     <property name="FancyProperty" type="s" access="read"/>
+
+    <property name="foo-bar-property" type="s" access="read"/>
   </interface>
 
   <interface name="ChangingInterfaceV1">
index 8d151142fe942d11715280cf6c47894646263a59..ec034cc842b33ec9951941efecef33648643c68b 100644 (file)
@@ -5,7 +5,7 @@ public interface OrgProjectBar : GLib.Object {
        [Version (since = "0.58")]
        public abstract void hello_world (string greeting, out string response) throws GLib.DBusError, GLib.IOError;
        public abstract void test_primitive_types (char val_byte, bool val_boolean, int16 val_int16, uint16 val_uint16, int32 val_int32, uint32 val_uint32, int64 val_int64, uint64 val_uint64, double val_double, string val_string, GLib.ObjectPath val_objpath, string val_signature, string val_bytestring, out char ret_byte, out bool ret_boolean, out int16 ret_int16, out uint16 ret_uint16, out int32 ret_int32, out uint32 ret_uint32, out int64 ret_int64, out uint64 ret_uint64, out double ret_double, out string ret_string, out GLib.ObjectPath ret_objpath, out string ret_signature, out string ret_bytestring) throws GLib.DBusError, GLib.IOError;
-       public abstract void test_non_primitive_types (GLib.HashTable<string,string> dict_s_to_s, [DBus (signature = "a{s(ii)}")] GLib.Variant dict_s_to_pairs, [DBus (signature = "(iss)")] GLib.Variant a_struct, string[] array_of_strings, out string[] ret_array_of_strings, GLib.ObjectPath[] array_of_objpaths, out GLib.ObjectPath[] ret_array_of_objpaths, string[] array_of_signatures, out string[] ret_array_of_signatures, string[] array_of_bytestrings, out string[] ret_array_of_bytestrings, out string result) throws GLib.DBusError, GLib.IOError;
+       public abstract void test_non_primitive_types (GLib.HashTable<string,string> dict_s_to_s, [DBus (signature = "a{s(ii)}")] GLib.Variant dict_s_to_pairs, DBusProxyStruct_1iss1_ a_struct, string[] array_of_strings, out string[] ret_array_of_strings, GLib.ObjectPath[] array_of_objpaths, out GLib.ObjectPath[] ret_array_of_objpaths, string[] array_of_signatures, out string[] ret_array_of_signatures, string[] array_of_bytestrings, out string[] ret_array_of_bytestrings, out string result) throws GLib.DBusError, GLib.IOError;
        public abstract void test_generic_array ([DBus (signature = "a{sas}")] GLib.Variant dict_array_value) throws GLib.DBusError, GLib.IOError;
        public abstract void test_generic_primitive ([DBus (signature = "a{ts}")] GLib.Variant dict_primitive_key, [DBus (signature = "a{st}")] GLib.Variant dict_primitive_value) throws GLib.DBusError, GLib.IOError;
        public abstract void test_duplicate_argname (string arg, out string arg0) throws GLib.DBusError, GLib.IOError;
@@ -75,8 +75,8 @@ public interface OrgProjectBar : GLib.Object {
        public abstract GLib.ObjectPath[] unset_ao { owned get; set; }
        [DBus (name = "unset_ag")]
        public abstract string[] unset_ag { owned get; set; }
-       [DBus (name = "unset_struct", signature = "(idsogayasaoag)")]
-       public abstract GLib.Variant unset_struct { owned get; set; }
+       [DBus (name = "unset_struct")]
+       public abstract DBusProxyStruct_1idsogayasaoag1_ unset_struct { owned get; set; }
        [DBus (name = "HelloWorld")]
        public signal void hello_world0 (string greeting);
        /*Signal documentation.*/
@@ -105,8 +105,7 @@ public interface ComAcmeRocket : GLib.Object {
        public abstract void ignite () throws GLib.DBusError, GLib.IOError;
        [CCode (cname = "speed-xyz")]
        public abstract double speed { get; }
-       [DBus (signature = "(ddd)")]
-       public abstract GLib.Variant direction { owned get; }
+       public abstract DBusProxyStruct_1ddd1_ direction { owned get; }
        public abstract string type { owned get; }
        [CCode (cname = "exploded-xyz")]
        public signal void exploded ();
@@ -144,6 +143,8 @@ public interface OrgProjectInlineDocs : GLib.Object {
        public abstract string property4 { owned get; }
        public abstract string property5 { owned get; }
        public abstract string fancy_property { owned get; }
+    [DBus (name = "foo-bar-property")]
+    public abstract string foo_bar_property { owned get; }
        public signal void bar_signal (string blah, string boo);
 }
 [DBus (name = "ChangingInterfaceV1", timeout = 120000)]
@@ -216,3 +217,31 @@ public interface Naming : GLib.Object {
 public interface OrgFreedesktopDBusIntrospectable : GLib.Object {
        public abstract void introspect (out string xml_data) throws GLib.DBusError, GLib.IOError;
 }
+public struct DBusProxyStruct_1ii1_2_ {
+       public int32 arg0;
+       public int32 arg1;
+}
+public struct DBusProxyStruct_1iss1_ {
+       public int32 arg0;
+       public string arg1;
+       public string arg2;
+}
+public struct DBusProxyStruct_1idsogayasaoag1_ {
+       public int32 arg0;
+       public double arg1;
+       public string arg2;
+       public GLib.ObjectPath arg3;
+       public string arg4;
+       public string arg5;
+       public string[] arg6;
+       public GLib.ObjectPath[] arg7;
+       public string[] arg8;
+}
+public struct DBusProxyStruct_1ddd1_ {
+       public double arg0;
+       public double arg1;
+       public double arg2;
+}
+public struct DBusProxyStruct_1i1_ {
+       public int32 arg0;
+}
index a05df00e83f77d8f2a5644eddb77df1a1883c572..52bea752ce3848bbe65fd2129391fff3234a5ead 100644 (file)
@@ -424,10 +424,10 @@ public class Vala.DBusParser : CodeVisitor {
                        name = "%s%u".printf (name, duplicate_counter++);
                }
 
-               current_node = current_property = new Property (name, data_type, null, null, get_current_src ());
+               current_node = current_property = new Property (name.replace ("-", "_"), data_type, null, null, get_current_src ());
                current_property.is_abstract = true;
                current_property.access = SymbolAccessibility.PUBLIC;
-               member_names.add (name);
+               member_names.add (name.replace ("-", "_"));
 
                if (needs_name) {
                        current_node.set_attribute_string ("DBus", "name", name);