[vala] gtk+-3.0: make IconInfo a compact class instead of a GObject



commit fd7ed30beaf863e011196edacef6e894712332f5
Author: Evan Nemerson <evan coeus-group com>
Date:   Wed Mar 27 02:08:23 2013 -0700

    gtk+-3.0: make IconInfo a compact class instead of a GObject
    
    Fixes bug 695831.

 vapi/gtk+-3.0.vapi                       |    5 +++--
 vapi/packages/gtk+-3.0/gtk+-3.0.metadata |    1 +
 vapigen/valagidlparser.vala              |   18 ++++++++++++++++--
 3 files changed, 20 insertions(+), 4 deletions(-)
---
diff --git a/vapi/gtk+-3.0.vapi b/vapi/gtk+-3.0.vapi
index 7b10f26..0b19cc6 100644
--- a/vapi/gtk+-3.0.vapi
+++ b/vapi/gtk+-3.0.vapi
@@ -2298,8 +2298,9 @@ namespace Gtk {
                public static unowned Gtk.IconSet lookup_default (string stock_id);
                public void remove_default ();
        }
-       [CCode (cheader_filename = "gtk/gtk.h")]
-       public class IconInfo : GLib.Object {
+       [CCode (cheader_filename = "gtk/gtk.h", copy_function = "gtk_icon_info_copy", free_function = 
"gtk_icon_info_free")]
+       [Compact]
+       public class IconInfo {
                [CCode (has_construct_function = false)]
                protected IconInfo ();
                public Gtk.IconInfo copy ();
diff --git a/vapi/packages/gtk+-3.0/gtk+-3.0.metadata b/vapi/packages/gtk+-3.0/gtk+-3.0.metadata
index 6bbc7f8..535061c 100644
--- a/vapi/packages/gtk+-3.0/gtk+-3.0.metadata
+++ b/vapi/packages/gtk+-3.0/gtk+-3.0.metadata
@@ -328,6 +328,7 @@ gtk_hsv_get_*.* is_out="1"
 gtk_hsv_to_rgb.r is_out="1"
 gtk_hsv_to_rgb.g is_out="1"
 gtk_hsv_to_rgb.b is_out="1"
+GtkIconInfo compact="1" copy_function="gtk_icon_info_copy" free_function="gtk_icon_info_free"
 gtk_icon_info_copy transfer_ownership="1"
 gtk_icon_info_get_embedded_rect.rectangle is_out="1"
 gtk_icon_info_load_icon transfer_ownership="1"
diff --git a/vapigen/valagidlparser.vala b/vapigen/valagidlparser.vala
index c707d9f..a5fc598 100644
--- a/vapigen/valagidlparser.vala
+++ b/vapigen/valagidlparser.vala
@@ -1524,6 +1524,18 @@ public class Vala.GIdlParser : CodeVisitor {
                                                if (eval (nv[1]) == "1") {
                                                        cl.set_attribute ("Experimental", true);
                                                }
+                                       } else if (nv[0] == "compact") {
+                                               if (eval (nv[1]) == "1") {
+                                                       cl.is_compact = true;
+                                               }
+                                       } else if (nv[0] == "ref_function") {
+                                               cl.set_attribute_string ("CCode", "ref_function", eval 
(nv[1]));
+                                       } else if (nv[0] == "unref_function") {
+                                               cl.set_attribute_string ("CCode", "unref_function", eval 
(nv[1]));
+                                       } else if (nv[0] == "copy_function") {
+                                               cl.set_attribute_string ("CCode", "copy_function", eval 
(nv[1]));
+                                       } else if (nv[0] == "free_function") {
+                                               cl.set_attribute_string ("CCode", "free_function", eval 
(nv[1]));
                                        }
                                }
                        }
@@ -1536,8 +1548,10 @@ public class Vala.GIdlParser : CodeVisitor {
                        var parent = parse_type_string (base_class);
                        cl.add_base_type (parent);
                } else if (node.parent != null) {
-                       var parent = parse_type_string (node.parent);
-                       cl.add_base_type (parent);
+                       if (!cl.is_compact) {
+                               var parent = parse_type_string (node.parent);
+                               cl.add_base_type (parent);
+                       }
                } else {
                        var gobject_symbol = new UnresolvedSymbol (new UnresolvedSymbol (null, "GLib"), 
"Object");
                        cl.add_base_type (new UnresolvedType.from_symbol (gobject_symbol));


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