[vala] girwriter: Add fullname GIR attribute, and set fullname of GObject.Type



commit 323a13a36856faa694313d1465d625384422f7a3
Author: Yu Feng <rainwoodman gmail com>
Date:   Sat Dec 3 17:43:06 2016 -0800

    girwriter: Add fullname GIR attribute, and set fullname of GObject.Type
    
    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 |    9 +++++++++
 vala/valausedattr.vala     |    2 +-
 vapi/gobject-2.0.vapi      |    1 +
 3 files changed, 11 insertions(+), 1 deletions(-)
---
diff --git a/codegen/valagirwriter.vala b/codegen/valagirwriter.vala
index 302f8ae..c252b2d 100644
--- a/codegen/valagirwriter.vala
+++ b/codegen/valagirwriter.vala
@@ -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 {
diff --git a/vala/valausedattr.vala b/vala/valausedattr.vala
index 2e5840d..63b7104 100644
--- a/vala/valausedattr.vala
+++ b/vala/valausedattr.vala
@@ -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", ""
 
        };
        
diff --git a/vapi/gobject-2.0.vapi b/vapi/gobject-2.0.vapi
index b998d8b..1aa4296 100644
--- a/vapi/gobject-2.0.vapi
+++ b/vapi/gobject-2.0.vapi
@@ -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;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]