]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
girwriter: Add fullname GIR attribute, and set fullname of GObject.Type
authorYu Feng <rainwoodman@gmail.com>
Sun, 4 Dec 2016 01:43:06 +0000 (17:43 -0800)
committerRico Tzschichholz <ricotz@ubuntu.com>
Mon, 5 Dec 2016 08:02:36 +0000 (09:02 +0100)
In gir files generated by Vala, members of type GType is referenced
with name "GObject.Type", but GObject-introspection expect it to be
"GType".

While there was no way to override the fully qualified GIR name of a
member, this patch adds [GIR (fullname = "GType")] to fix the mismatch
for GObject.Type.

https://bugzilla.gnome.org/show_bug.cgi?id=775591

codegen/valagirwriter.vala
vala/valausedattr.vala
vapi/gobject-2.0.vapi

index 302f8aee6834e63b90241a0e77ba3f1759fceee5..c252b2d32b2c589cf75b4741a85825d105da98ea 100644 (file)
@@ -1380,6 +1380,11 @@ public class Vala.GIRWriter : CodeVisitor {
        }
 
        private string? get_full_gir_name (Symbol sym) {
+               string? gir_fullname = sym.get_attribute_string ("GIR", "fullname");
+               if (gir_fullname != null) {
+                       return gir_fullname;
+               }
+
                string? gir_name = sym.get_attribute_string ("GIR", "name");
 
                if (gir_name == null && sym is Namespace) {
@@ -1421,6 +1426,10 @@ public class Vala.GIRWriter : CodeVisitor {
                                        if (!externals.contains (external)) {
                                                externals.add (external);
                                        }
+                                       string? gir_fullname = type_symbol.get_attribute_string ("GIR", "fullname");
+                                       if (gir_fullname != null) {
+                                               return gir_fullname;
+                                       }
                                        var type_name = type_symbol.get_attribute_string ("GIR", "name") ?? type_symbol.name;
                                        return "%s.%s".printf (type_symbol.source_reference.file.gir_namespace, type_name);
                                } else {
index 2e5840d556ca730ad81ca0d1c9fd93330d046ee3..63b71043246be3c70e7b4285ebbb0813f382a4fd 100644 (file)
@@ -76,7 +76,7 @@ public class Vala.UsedAttr : CodeVisitor {
 
                "DBus", "name", "no_reply", "result", "use_string_marshalling", "value", "signature", "visible", "timeout", "",
 
-               "GIR", "name", ""
+               "GIR", "fullname", "name", ""
 
        };
        
index b998d8b2f4d768ac2e841f6399456f9bb3f239f1..1aa4296ad4c63082ad4f6082dddb8a626217e3a8 100644 (file)
@@ -423,6 +423,7 @@ namespace GLib {
                public weak GLib.Type[] param_types;
        }
        [CCode (get_value_function = "g_value_get_gtype", marshaller_type_name = "GTYPE", set_value_function = "g_value_set_gtype", type_id = "G_TYPE_GTYPE")]
+       [GIR (fullname = "GType")]
        public struct Type : ulong {
                public const GLib.Type BOXED;
                public const GLib.Type ENUM;