From 86445e3008a17a3486dba4b95ca130cffcea9fcf Mon Sep 17 00:00:00 2001 From: Juerg Billeter Date: Fri, 31 Aug 2007 10:08:59 +0000 Subject: [PATCH] support base_class attribute 2007-08-31 Juerg Billeter * vapigen/valagidlparser.vala: support base_class attribute * vapi/packages/gdk-2.0/gdk-2.0.metadata, vapi/gdk-2.0.vala: set base_class of GdkPixmap, fixes bug 463816 svn path=/trunk/; revision=551 --- ChangeLog | 7 +++++++ vapi/gdk-2.0.vala | 4 ++-- vapi/packages/gdk-2.0/gdk-2.0.metadata | 2 ++ vapigen/valagidlparser.vala | 10 +++++++++- 4 files changed, 20 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index f61bc8f..ecc73b4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,12 @@ 2007-08-31 Jürg Billeter + * vapigen/valagidlparser.vala: support base_class attribute + + * vapi/packages/gdk-2.0/gdk-2.0.metadata, vapi/gdk-2.0.vala: set + base_class of GdkPixmap, fixes bug 463816 + +2007-08-31 Jürg Billeter + * vala/valaclass.vala, vala/valastruct.vala: use G_TYPE_POINTER for not registered classes, add has_type_id attribute diff --git a/vapi/gdk-2.0.vala b/vapi/gdk-2.0.vala index 97131c7..5fa6c53 100644 --- a/vapi/gdk-2.0.vala +++ b/vapi/gdk-2.0.vala @@ -956,7 +956,7 @@ namespace Gdk { public PixbufSimpleAnim (int width, int height, float rate); } [CCode (cheader_filename = "gdk/gdk.h")] - public class Pixmap : GLib.Object { + public class Pixmap : Gdk.Drawable { public static weak Gdk.Pixmap colormap_create_from_xpm (Gdk.Drawable drawable, Gdk.Colormap colormap, Gdk.Bitmap mask, out Gdk.Color transparent_color, string filename); public static weak Gdk.Pixmap colormap_create_from_xpm_d (Gdk.Drawable drawable, Gdk.Colormap colormap, Gdk.Bitmap mask, out Gdk.Color transparent_color, string data); public static weak Gdk.Pixmap create_from_data (Gdk.Drawable drawable, string data, int width, int height, int depth, out Gdk.Color fg, out Gdk.Color bg); @@ -1627,7 +1627,7 @@ namespace Gdk { } [CCode (cheader_filename = "gdk/gdk.h")] public class Cairo { - public static weak Cairo.Context create (Gdk.Drawable drawable); + public static Cairo.Context create (Gdk.Drawable drawable); public static void rectangle (Cairo.Context cr, out Gdk.Rectangle rectangle); public static void region (Cairo.Context cr, Gdk.Region region); public static void set_source_color (Cairo.Context cr, out Gdk.Color color); diff --git a/vapi/packages/gdk-2.0/gdk-2.0.metadata b/vapi/packages/gdk-2.0/gdk-2.0.metadata index cfc50e7..3b92e66 100644 --- a/vapi/packages/gdk-2.0/gdk-2.0.metadata +++ b/vapi/packages/gdk-2.0/gdk-2.0.metadata @@ -1,5 +1,6 @@ Gdk cheader_filename="gdk/gdk.h" GdkAtom is_value_type="1" +gdk_cairo_create transfer_ownership="1" GdkColor is_value_type="1" GdkCursor is_value_type="0" gdk_pixbuf_new_from_xpm_data.data is_array="1" @@ -7,6 +8,7 @@ gdk_pixbuf_save_to_bufferv.option_keys is_array="1" gdk_pixbuf_save_to_bufferv.option_values is_array="1" gdk_pixbuf_save_to_callbackv.option_keys is_array="1" gdk_pixbuf_save_to_callbackv.option_values is_array="1" +GdkPixmap base_class="GdkDrawable" GdkRectangle is_value_type="1" GdkWindowAttr is_value_type="1" diff --git a/vapigen/valagidlparser.vala b/vapigen/valagidlparser.vala index 08eff31..1c85f41 100644 --- a/vapigen/valagidlparser.vala +++ b/vapigen/valagidlparser.vala @@ -543,6 +543,8 @@ public class Vala.GIdlParser : CodeVisitor { private void parse_object (IdlNodeInterface! node, Namespace! ns, IdlModule! module) { string name = fix_type_name (node.gtype_name, module); + string base_class = null; + var cl = ns.scope.lookup (name) as Class; if (cl == null) { cl = new Class (name, current_source_reference); @@ -554,6 +556,8 @@ public class Vala.GIdlParser : CodeVisitor { var nv = attr.split ("=", 2); if (nv[0] == "cheader_filename") { cl.add_cheader_filename (eval (nv[1])); + } else if (nv[0] == "base_class") { + base_class = eval (nv[1]); } else if (nv[0] == "hidden") { if (eval (nv[1]) == "1") { return; @@ -566,7 +570,11 @@ public class Vala.GIdlParser : CodeVisitor { current_source_file.add_node (cl); } - if (node.parent != null) { + if (base_class != null) { + var parent = new TypeReference (); + parse_type_string (parent, base_class); + cl.add_base_type (parent); + } else if (node.parent != null) { var parent = new TypeReference (); parse_type_string (parent, node.parent); cl.add_base_type (parent); -- 2.7.4