]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
dbusgen: Added support for org.gtk.GDBus.DocString
authorJCWasmx86 <JCWasmx86@t-online.de>
Tue, 26 Apr 2022 12:01:34 +0000 (14:01 +0200)
committerRico Tzschichholz <ricotz@ubuntu.com>
Sat, 29 Apr 2023 19:00:17 +0000 (21:00 +0200)
dbusgen/tests/test-codegen.xml.vala-expected
dbusgen/valadbusparser.vala

index 83c46ea4500174cc9eab7de8b571961a84fdfc04..e2b8dc89454e4530b7a2c91a757a6733154efbb8 100644 (file)
@@ -1,5 +1,7 @@
+/*The org.project.Bar interface is very complicated.*/
 [DBus (name = "org.project.Bar", timeout = 120000)]
 public interface OrgProjectBar : GLib.Object {
+       /*Method <emphasis>documentation</emphasis> blablablabla.*/
        [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;
@@ -8,6 +10,7 @@ public interface OrgProjectBar : GLib.Object {
        public abstract void request_multi_property_mods () throws GLib.DBusError, GLib.IOError;
        public abstract void unimplemented_method () throws GLib.DBusError, GLib.IOError;
        public abstract void property_cancellation () throws GLib.DBusError, GLib.IOError;
+       /*<para>Property docs, yah...</para><para>Second paragraph.</para>*/
        [DBus (name = "y")]
        public abstract char y { get; set; }
        [DBus (name = "b")]
@@ -71,6 +74,7 @@ public interface OrgProjectBar : GLib.Object {
        public abstract string[] unset_ag { owned get; set; }
        [DBus (name = "unset_struct", signature = "(idsogayasaoag)")]
        public abstract GLib.Variant unset_struct { owned get; set; }
+       /*Signal documentation.*/
        public signal void test_signal (int32 val_int32, string[] array_of_strings, string[] array_of_bytestrings, [DBus (signature = "a{s(ii)}")] GLib.Variant dict_s_to_pairs);
        public signal void another_signal (string word);
 }
index 5c3a05a0d77b817a8696d79ec57c4ba6d9540ec7..25d362b8d08ca92245409b68ec4ef780a9414bd7 100644 (file)
@@ -229,7 +229,7 @@ public class Vala.DBusParser : CodeVisitor {
                                // This annotation is intended to be used by code generators to implement client-side caching of property values.
                                // For all properties for which the annotation is set to const, invalidates or true the client may unconditionally
                                // cache the values as the properties don't change or notifications are generated for them if they do.
-                               if (val == "false" || val == "const") {
+                               if (val != null && (val == "false" || val == "const")) {
                                        // const is technically wrong, but if you can't change the value, notify will never be triggered
                                        current_node.set_attribute_bool ("CCode", "notify", false);
                                }
@@ -281,6 +281,10 @@ public class Vala.DBusParser : CodeVisitor {
                        case "org.gtk.GDBus.DocString":
                                // A string with Docbook content for documentation. This annotation can be used on <interface>, <method>, <signal>,
                                // <property> and <arg> elements.
+                               if (val != null) {
+                                       ((Symbol) current_node).comment = new Vala.Comment (val, get_current_src ());
+                               }
+                               break;
                        case "org.gtk.GDBus.DocString.Short":
                                // A string with Docbook content for short/brief documentation. This annotation can only be used on <interface>
                                // elements.