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



commit 6140441b7b41ed223fc9e81f26ecb0f1bf6373b8
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 9329628..9ab6d13 100644
--- a/codegen/valagirwriter.vala
+++ b/codegen/valagirwriter.vala
@@ -1376,6 +1376,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) {
@@ -1417,6 +1422,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 14cdd97..495ff1a 100644
--- a/vala/valausedattr.vala
+++ b/vala/valausedattr.vala
@@ -74,7 +74,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 f562bb3..ac3ccab 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]