]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
use G_TYPE_POINTER for not registered classes, add has_type_id attribute
authorJuerg Billeter <j@bitron.ch>
Fri, 31 Aug 2007 09:44:28 +0000 (09:44 +0000)
committerJürg Billeter <juergbi@src.gnome.org>
Fri, 31 Aug 2007 09:44:28 +0000 (09:44 +0000)
2007-08-31  Juerg Billeter  <j@bitron.ch>

* vala/valaclass.vala, vala/valastruct.vala: use G_TYPE_POINTER for
  not registered classes, add has_type_id attribute

* vapigen/valagidlparser.vala: use GLib.Boxed as base type of boxed
  types

* vapi/glib-2.0.vala: use has_type_id attribute and GLib.Boxed

* vapi/gconf-2.0.vala, vapi/gdk-2.0.vala, vapi/gnome-desktop-2.0.vala,
  vapi/gnome-vfs-2.0.vala, vapi/gstreamer-0.10.vala, vapi/gtk+-2.0.vala,
  vapi/libglade-2.0.vala, vapi/libgnome-2.0.vala, vapi/libsoup-2.2.vala,
  vapi/pango.vala, vapi/poppler-glib.vala: regenerated

svn path=/trunk/; revision=550

16 files changed:
ChangeLog
vala/valaclass.vala
vala/valastruct.vala
vapi/gconf-2.0.vala
vapi/gdk-2.0.vala
vapi/glib-2.0.vala
vapi/gnome-desktop-2.0.vala
vapi/gnome-vfs-2.0.vala
vapi/gstreamer-0.10.vala
vapi/gtk+-2.0.vala
vapi/libglade-2.0.vala
vapi/libgnome-2.0.vala
vapi/libsoup-2.2.vala
vapi/pango.vala
vapi/poppler-glib.vala
vapigen/valagidlparser.vala

index 686f01ed77a7388e261d49856d44bc90b0dd4e4b..f61bc8fec7a9e55f5475d6171b58c995491cbb91 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,18 @@
+2007-08-31  Jürg Billeter  <j@bitron.ch>
+
+       * vala/valaclass.vala, vala/valastruct.vala: use G_TYPE_POINTER for
+         not registered classes, add has_type_id attribute
+
+       * vapigen/valagidlparser.vala: use GLib.Boxed as base type of boxed
+         types
+
+       * vapi/glib-2.0.vala: use has_type_id attribute and GLib.Boxed
+
+       * vapi/gconf-2.0.vala, vapi/gdk-2.0.vala, vapi/gnome-desktop-2.0.vala,
+         vapi/gnome-vfs-2.0.vala, vapi/gstreamer-0.10.vala, vapi/gtk+-2.0.vala,
+         vapi/libglade-2.0.vala, vapi/libgnome-2.0.vala, vapi/libsoup-2.2.vala,
+         vapi/pango.vala, vapi/poppler-glib.vala: regenerated
+
 2007-08-30  Mathias Hasselmann  <mathias.hasselmann@gmx.de>
 
        * vapi/packages/gtksourceview-2.0/gtksourceview-2.0.metadata:
index 1f128a82a2a045b25395dd540ab71de2501f91b9..627aebcd04b6cac4c66c478abb1273e1b8dff80f 100644 (file)
@@ -57,6 +57,7 @@ public class Vala.Class : DataType {
        private string const_cname;
        private string lower_case_cprefix;
        private string lower_case_csuffix;
+       private bool has_type_id;
        private string type_id;
        private string ref_function;
        private string unref_function;
@@ -397,6 +398,9 @@ public class Vala.Class : DataType {
                if (a.has_argument ("free_function")) {
                        set_free_function (a.get_string ("free_function"));
                }
+               if (a.has_argument ("has_type_id")) {
+                       has_type_id = a.get_bool ("has_type_id");
+               }
                if (a.has_argument ("type_id")) {
                        type_id = a.get_string ("type_id");
                }
@@ -441,9 +445,17 @@ public class Vala.Class : DataType {
                }
        }
 
+       private bool get_has_type_id () {
+               return has_type_id || (base_class != null && base_class.get_has_type_id ());
+       }
+
        public override string get_type_id () {
                if (type_id == null) {
-                       type_id = get_upper_case_cname ("TYPE_");
+                       if (get_has_type_id ()) {
+                               type_id = get_upper_case_cname ("TYPE_");
+                       } else {
+                               type_id = "G_TYPE_POINTER";
+                       }
                }
                
                return type_id;
index 7c9a85118c4a999e556b5a1fe271b2183a7506c7..b6458fc2623845cc6f6f18d74690d1ccb8e107f8 100644 (file)
@@ -291,11 +291,7 @@ public class Vala.Struct : DataType {
 
        public override string get_type_id () {
                if (type_id == null) {
-                       if (is_reference_type ()) {
-                               type_id = "G_TYPE_POINTER";
-                       } else {
-                               Report.error (source_reference, "The type `%s` doesn't declare a type id".printf (get_full_name ()));
-                       }
+                       Report.error (source_reference, "The type `%s` doesn't declare a type id".printf (get_full_name ()));
                }
                return type_id;
        }
index 5b1af22505f55bf808903bf3507170e51536f465..f1b392107b04eb3f5e08de60bad561e338d5db96 100644 (file)
@@ -121,7 +121,7 @@ namespace GConf {
                public ulong vtable_size;
        }
        [CCode (ref_function = "gconf_change_set_ref", unref_function = "gconf_change_set_unref", cheader_filename = "gconf/gconf.h")]
-       public class ChangeSet {
+       public class ChangeSet : GLib.Boxed {
                public bool check_value (string key, GConf.Value value_retloc);
                public void clear ();
                public void @foreach (GConf.ChangeSetForeachFunc func, pointer user_data);
@@ -247,7 +247,7 @@ namespace GConf {
                public void set_mod_user (string mod_user);
                public void set_schema (string schema_name);
        }
-       [CCode (cheader_filename = "gconf/gconf.h")]
+       [CCode (copy_function = "gconf_schema_copy", cheader_filename = "gconf/gconf.h")]
        public class Schema {
                public weak GConf.Schema copy ();
                public GConf.ValueType get_car_type ();
@@ -305,7 +305,7 @@ namespace GConf {
                public weak GConf.Sources modified_sources;
                public weak string key;
        }
-       [CCode (cheader_filename = "gconf/gconf.h")]
+       [CCode (copy_function = "gconf_value_copy", cheader_filename = "gconf/gconf.h")]
        public class Value {
                public GConf.ValueType type;
                public int compare (GConf.Value value_b);
index 671fcdd13df82b00e190411c83aca4216239aef1..97131c748ddb4d3cd707dad2cc5e37dc7b736d83 100644 (file)
@@ -1163,7 +1163,7 @@ namespace Gdk {
                public static weak Gdk.Bitmap create_from_data (Gdk.Drawable drawable, string data, int width, int height);
        }
        [CCode (ref_function = "gdk_cursor_ref", unref_function = "gdk_cursor_unref", cheader_filename = "gdk/gdk.h")]
-       public class Cursor {
+       public class Cursor : GLib.Boxed {
                public Gdk.CursorType type;
                public weak Gdk.Display get_display ();
                public weak Gdk.Pixbuf get_image ();
@@ -1391,7 +1391,7 @@ namespace Gdk {
                public Gdk.WindowState new_window_state;
        }
        [CCode (ref_function = "gdk_font_ref", unref_function = "gdk_font_unref", cheader_filename = "gdk/gdk.h")]
-       public class Font {
+       public class Font : GLib.Boxed {
                public Gdk.FontType type;
                public int ascent;
                public int descent;
@@ -1517,14 +1517,13 @@ namespace Gdk {
        [CCode (cheader_filename = "gdk/gdk.h")]
        public class PointerHooks {
        }
-       [CCode (cheader_filename = "gdk/gdk.h")]
+       [CCode (copy_function = "gdk_region_copy", free_function = "gdk_region_destroy", cheader_filename = "gdk/gdk.h")]
        public class Region {
                public long size;
                public long numRects;
                public weak Gdk.RegionBox rects;
                public weak Gdk.RegionBox extents;
                public weak Gdk.Region copy ();
-               public void destroy ();
                public bool empty ();
                public bool equal (Gdk.Region region2);
                public void get_clipbox (out Gdk.Rectangle rectangle);
@@ -1665,7 +1664,7 @@ namespace Gdk {
                public static int trap_pop ();
                public static void trap_push ();
        }
-       [CCode (cheader_filename = "gdk/gdk.h")]
+       [CCode (copy_function = "gdk_event_copy", cheader_filename = "gdk/gdk.h")]
        public class Event {
                public weak Gdk.Event copy ();
                public static weak Gdk.Event get ();
index b803eb587a3df51ff66e21dbe8f93094f8a74d9a..2d4a080988e2c29e1e43aebfc2a91236e896bddf 100644 (file)
@@ -575,6 +575,7 @@ namespace GLib {
                
        }
 
+       [CCode (has_type_id = true)]
        public class TypeInstance {
        }
 
@@ -652,9 +653,8 @@ namespace GLib {
        public class InitiallyUnowned : Object {
        }
 
-       public /* static */ interface Boxed<G> {
-               public abstract G copy ();
-               public abstract void free ();
+       [CCode (cname = "gpointer", has_type_id = true, type_id = "G_TYPE_BOXED", marshaller_type_name = "BOXED", get_value_function = "g_value_get_boxed", set_value_function = "g_value_set_boxed")]
+       public abstract class Boxed {
        }
 
        [CCode (free_function = "g_free", type_id = "G_TYPE_VALUE")]
@@ -739,8 +739,7 @@ namespace GLib {
 
        public static delegate void Callback ();
 
-       [CCode (type_id = "G_TYPE_CLOSURE")]
-       public class Closure {
+       public class Closure : Boxed {
        }
 
        public static delegate void ClosureNotify (pointer data, Closure closure);
@@ -1175,8 +1174,8 @@ namespace GLib {
        
        /* IO Channels */
        
-       [CCode (ref_function = "g_io_channel_ref", unref_function = "g_io_channel_unref", type_id = "G_TYPE_IO_CHANNEL")]
-       public class IOChannel {
+       [CCode (ref_function = "g_io_channel_ref", unref_function = "g_io_channel_unref")]
+       public class IOChannel : Boxed {
                public IOChannel.file (string! filename, string! mode) throws FileError;
                [CCode (cname = "g_io_channel_unix_new")]
                public IOChannel.unix_new (int fd);
@@ -1398,8 +1397,8 @@ namespace GLib {
                public bool valid (); 
        }
 
-       [CCode (free_function = "g_date_free", type_id = "G_TYPE_DATE")]
-       public class Date {
+       [CCode (free_function = "g_date_free")]
+       public class Date : Boxed {
                public Date ();
                public Date.dmy (DateDay day, DateMonth month, DateYear year);
                public Date.julian (uint julian_day);
@@ -1862,8 +1861,8 @@ namespace GLib {
                NEWLINE_ANY
        }
 
-       [CCode (ref_function = "g_regex_ref", unref_function = "g_regex_unref", type_id = "G_TYPE_REGEX")]
-       public class Regex {
+       [CCode (ref_function = "g_regex_ref", unref_function = "g_regex_unref")]
+       public class Regex : Boxed {
                public Regex (string! pattern, RegexCompileFlags compile_options = 0, RegexMatchFlags match_options = 0) throws RegexError;
                public string! get_pattern ();
                public int get_max_backref ();
@@ -2155,8 +2154,8 @@ namespace GLib {
        
        /* Hash Tables */
        
-       [CCode (ref_function = "g_hash_table_ref", unref_function = "g_hash_table_unref", type_id = "G_TYPE_HASH_TABLE")]
-       public class HashTable<K,V> {
+       [CCode (ref_function = "g_hash_table_ref", unref_function = "g_hash_table_unref")]
+       public class HashTable<K,V> : Boxed {
                public HashTable (HashFunc hash_func, EqualFunc key_equal_func);
                public HashTable.full (HashFunc hash_func, EqualFunc key_equal_func, DestroyNotify key_destroy_func, DestroyNotify value_destroy_func);
                public void insert (K# key, V# value);
@@ -2193,7 +2192,7 @@ namespace GLib {
        /* Strings */
        
        [CCode (free_function = "g_string_free", type_id = "G_TYPE_GSTRING")]
-       public class String {
+       public class String : Boxed {
                public String (string init = "");
                [CCode (cname = "g_string_sized_new")]
                public String.sized (ulong dfl_size);
index 05d747797d7adefdf1b71717e37eb4dd3768b2d6..b3344692cfa6a145a1b87d98bed41231493a0f74 100644 (file)
@@ -57,7 +57,7 @@ namespace Gnome {
        public class Hint : Gtk.Dialog {
        }
        [CCode (ref_function = "gnome_desktop_item_ref", unref_function = "gnome_desktop_item_unref", cheader_filename = "libgnome/gnome-desktop-item.h")]
-       public class DesktopItem {
+       public class DesktopItem : GLib.Boxed {
                public bool attr_exists (string attr);
                public void clear_localestring (string attr);
                public void clear_section (string section);
index dcc971f722946b806469bc7bd90bb9bda940d914..a1af708afe6c0669b0d3d4877e15d17a86033287 100644 (file)
@@ -466,7 +466,7 @@ namespace GnomeVFS {
                public signal void drive_disconnected (GnomeVFS.Drive drive);
        }
        [CCode (cheader_filename = "libgnomevfs/gnome-vfs.h")]
-       public class Address {
+       public class Address : GLib.Boxed {
                public weak GnomeVFS.Address dup ();
                public bool equal (GnomeVFS.Address b);
                public int get_family_type ();
@@ -480,12 +480,11 @@ namespace GnomeVFS {
        [CCode (cheader_filename = "libgnomevfs/gnome-vfs.h")]
        public class AsyncHandle {
        }
-       [CCode (cheader_filename = "libgnomevfs/gnome-vfs.h")]
+       [CCode (free_function = "gnome_vfs_cancellation_destroy", cheader_filename = "libgnomevfs/gnome-vfs.h")]
        public class Cancellation {
                public void ack ();
                public void cancel ();
                public bool check ();
-               public void destroy ();
                public int get_fd ();
                public Cancellation ();
        }
@@ -651,7 +650,6 @@ namespace GnomeVFS {
        public class InetConnection {
                public GnomeVFS.Result create (string host_name, uint host_port, GnomeVFS.Cancellation cancellation);
                public GnomeVFS.Result create_from_address (GnomeVFS.Address address, uint host_port, GnomeVFS.Cancellation cancellation);
-               public void destroy (GnomeVFS.Cancellation cancellation);
                public weak GnomeVFS.Address get_address ();
                public int get_fd ();
                public weak string get_ip ();
@@ -676,7 +674,7 @@ namespace GnomeVFS {
                public weak GLib.List list;
                public uint entries_read;
        }
-       [CCode (cheader_filename = "libgnomevfs/gnome-vfs.h")]
+       [CCode (copy_function = "gnome_vfs_mime_application_copy", cheader_filename = "libgnomevfs/gnome-vfs.h")]
        public class MimeApplication {
                public weak string id;
                public weak string name;
@@ -911,11 +909,10 @@ namespace GnomeVFS {
        [CCode (cheader_filename = "libgnomevfs/gnome-vfs.h")]
        public class ResolveHandle {
        }
-       [CCode (cheader_filename = "libgnomevfs/gnome-vfs.h")]
+       [CCode (free_function = "gnome_vfs_ssl_destroy", cheader_filename = "libgnomevfs/gnome-vfs.h")]
        public class SSL {
                public GnomeVFS.Result create (string host, uint port, GnomeVFS.Cancellation cancellation);
                public GnomeVFS.Result create_from_fd (int fd, GnomeVFS.Cancellation cancellation);
-               public void destroy (GnomeVFS.Cancellation cancellation);
                public static bool enabled ();
                public GnomeVFS.Result read (pointer buffer, GnomeVFS.FileSize bytes, out GnomeVFS.FileSize bytes_read, GnomeVFS.Cancellation cancellation);
                public GnomeVFS.Result set_timeout (out GLib.TimeVal timeout, GnomeVFS.Cancellation cancellation);
@@ -955,9 +952,8 @@ namespace GnomeVFS {
                public GnomeVFS.Result read (pointer buffer, GnomeVFS.FileSize bytes, out GnomeVFS.FileSize bytes_read, GnomeVFS.Cancellation cancellation);
                public GnomeVFS.Result write (pointer buffer, int bytes, out GnomeVFS.FileSize bytes_written, GnomeVFS.Cancellation cancellation);
        }
-       [CCode (cheader_filename = "libgnomevfs/gnome-vfs.h")]
+       [CCode (free_function = "gnome_vfs_socket_buffer_destroy", cheader_filename = "libgnomevfs/gnome-vfs.h")]
        public class SocketBuffer {
-               public GnomeVFS.Result destroy (bool close_socket, GnomeVFS.Cancellation cancellation);
                public GnomeVFS.Result flush (GnomeVFS.Cancellation cancellation);
                public SocketBuffer (GnomeVFS.Socket socket);
                public GnomeVFS.Result peekc (string character, GnomeVFS.Cancellation cancellation);
index 751afb932c6883e35d5db37119fcd6ced718d424..fdbe586527d4607870ba4a6db72707879831a8c2 100644 (file)
@@ -1209,7 +1209,7 @@ namespace Gst {
        public class BinaryTypeFindFactory {
        }
        [CCode (ref_function = "gst_caps_ref", unref_function = "gst_caps_unref", cheader_filename = "gst/gst.h")]
-       public class Caps {
+       public class Caps : GLib.Boxed {
                public GLib.Type type;
                public int refcount;
                public Gst.CapsFlags flags;
@@ -1286,8 +1286,8 @@ namespace Gst {
                public Gst.Format format;
                public int64 value;
        }
-       [CCode (cheader_filename = "gst/gst.h")]
-       public class IndexEntry {
+       [CCode (copy_function = "gst_index_entry_copy", cheader_filename = "gst/gst.h")]
+       public class IndexEntry : GLib.Boxed {
                public bool assoc_map (Gst.Format format, int64 value);
                public weak Gst.IndexEntry copy ();
                public static GLib.Type get_type ();
@@ -1336,7 +1336,7 @@ namespace Gst {
                public GLib.Quark quark;
        }
        [CCode (cheader_filename = "gst/gst.h")]
-       public class Segment {
+       public class Segment : GLib.Boxed {
                public double rate;
                public double abs_rate;
                public Gst.Format format;
@@ -1377,8 +1377,8 @@ namespace Gst {
                public weak Gst.Caps get_caps ();
                public static GLib.Type get_type ();
        }
-       [CCode (cheader_filename = "gst/gst.h")]
-       public class Structure {
+       [CCode (copy_function = "gst_structure_copy", cheader_filename = "gst/gst.h")]
+       public class Structure : GLib.Boxed {
                public GLib.Type type;
                public weak Gst.Structure copy ();
                public static weak Gst.Structure empty_new (string name);
@@ -1426,8 +1426,8 @@ namespace Gst {
                public void set_value (string fieldname, GLib.Value value);
                public weak string to_string ();
        }
-       [CCode (cheader_filename = "gst/gst.h")]
-       public class TagList {
+       [CCode (copy_function = "gst_tag_list_copy", cheader_filename = "gst/gst.h")]
+       public class TagList : GLib.Boxed {
                public GLib.Type type;
                public void add (Gst.TagMergeMode mode, string tag);
                public void add_valist (Gst.TagMergeMode mode, string tag, pointer var_args);
@@ -1475,9 +1475,8 @@ namespace Gst {
                public TagList ();
                public void remove_tag (string tag);
        }
-       [CCode (cheader_filename = "gst/gst.h")]
+       [CCode (free_function = "gst_trace_destroy", cheader_filename = "gst/gst.h")]
        public class Trace {
-               public void destroy ();
                public void flush ();
                public Trace (string filename, int size);
                public static void read_tsc (int64 dst);
index 43a9ba04f36cdce9cfbe26324fd1935a515b75a0..2a7464e125d9bfde348f67e57270fa3dc528c6ba 100644 (file)
@@ -5058,8 +5058,8 @@ namespace Gtk {
                public weak string domain_dirname;
                public weak string default_locales;
        }
-       [CCode (cheader_filename = "gtk/gtk.h")]
-       public class IconInfo {
+       [CCode (copy_function = "gtk_icon_info_copy", cheader_filename = "gtk/gtk.h")]
+       public class IconInfo : GLib.Boxed {
                public weak Gtk.IconInfo copy ();
                [NoArrayLength]
                public bool get_attach_points (Gdk.Point[] points, int n_points);
@@ -5073,7 +5073,7 @@ namespace Gtk {
                public void set_raw_coordinates (bool raw_coordinates);
        }
        [CCode (ref_function = "gtk_icon_set_ref", unref_function = "gtk_icon_set_unref", cheader_filename = "gtk/gtk.h")]
-       public class IconSet {
+       public class IconSet : GLib.Boxed {
                public void add_source (Gtk.IconSource source);
                public weak Gtk.IconSet copy ();
                [NoArrayLength]
@@ -5083,8 +5083,8 @@ namespace Gtk {
                public IconSet.from_pixbuf (Gdk.Pixbuf pixbuf);
                public weak Gdk.Pixbuf render_icon (Gtk.Style style, Gtk.TextDirection direction, Gtk.StateType state, Gtk.IconSize size, Gtk.Widget widget, string detail);
        }
-       [CCode (cheader_filename = "gtk/gtk.h")]
-       public class IconSource {
+       [CCode (copy_function = "gtk_icon_source_copy", cheader_filename = "gtk/gtk.h")]
+       public class IconSource : GLib.Boxed {
                public weak Gtk.IconSource copy ();
                public Gtk.TextDirection get_direction ();
                public bool get_direction_wildcarded ();
@@ -5165,8 +5165,8 @@ namespace Gtk {
                public int start;
                public int end;
        }
-       [CCode (cheader_filename = "gtk/gtk.h")]
-       public class PaperSize {
+       [CCode (copy_function = "gtk_paper_size_copy", cheader_filename = "gtk/gtk.h")]
+       public class PaperSize : GLib.Boxed {
                public weak Gtk.PaperSize copy ();
                public static weak string get_default ();
                public double get_default_bottom_margin (Gtk.Unit unit);
@@ -5241,7 +5241,7 @@ namespace Gtk {
                public int age;
        }
        [CCode (ref_function = "gtk_recent_info_ref", unref_function = "gtk_recent_info_unref", cheader_filename = "gtk/gtk.h")]
-       public class RecentInfo {
+       public class RecentInfo : GLib.Boxed {
                public bool exists ();
                public ulong get_added ();
                public int get_age ();
@@ -5273,8 +5273,8 @@ namespace Gtk {
                public double ruler_scale;
                public int subdivide;
        }
-       [CCode (cheader_filename = "gtk/gtk.h")]
-       public class SelectionData {
+       [CCode (copy_function = "gtk_selection_data_copy", cheader_filename = "gtk/gtk.h")]
+       public class SelectionData : GLib.Boxed {
                public Gdk.Atom selection;
                public Gdk.Atom target;
                public Gdk.Atom type;
@@ -5307,7 +5307,7 @@ namespace Gtk {
                public weak string origin;
                public weak GLib.Value value;
        }
-       [CCode (cheader_filename = "gtk/gtk.h")]
+       [CCode (copy_function = "gtk_stock_item_copy", cheader_filename = "gtk/gtk.h")]
        public class StockItem {
                public weak string stock_id;
                public weak string label;
@@ -5350,7 +5350,7 @@ namespace Gtk {
                public uint info;
        }
        [CCode (ref_function = "gtk_target_list_ref", unref_function = "gtk_target_list_unref", cheader_filename = "gtk/gtk.h")]
-       public class TargetList {
+       public class TargetList : GLib.Boxed {
                public weak GLib.List list;
                public uint ref_count;
                public void add (Gdk.Atom target, uint flags, uint info);
@@ -5384,7 +5384,7 @@ namespace Gtk {
                public uint is_text;
        }
        [CCode (ref_function = "gtk_text_attributes_ref", unref_function = "gtk_text_attributes_unref", cheader_filename = "gtk/gtk.h")]
-       public class TextAttributes {
+       public class TextAttributes : GLib.Boxed {
                public weak Gtk.TextAppearance appearance;
                public Gtk.Justification justification;
                public Gtk.TextDirection direction;
@@ -5423,8 +5423,8 @@ namespace Gtk {
        [CCode (cheader_filename = "gtk/gtk.h")]
        public class ThemeEngine {
        }
-       [CCode (cheader_filename = "gtk/gtk.h")]
-       public class TreePath {
+       [CCode (copy_function = "gtk_tree_path_copy", cheader_filename = "gtk/gtk.h")]
+       public class TreePath : GLib.Boxed {
                public void append_index (int index_);
                public int compare (Gtk.TreePath b);
                public weak Gtk.TreePath copy ();
@@ -5446,8 +5446,8 @@ namespace Gtk {
                public weak string to_string ();
                public bool up ();
        }
-       [CCode (cheader_filename = "gtk/gtk.h")]
-       public class TreeRowReference {
+       [CCode (copy_function = "gtk_tree_row_reference_copy", cheader_filename = "gtk/gtk.h")]
+       public class TreeRowReference : GLib.Boxed {
                public weak Gtk.TreeRowReference copy ();
                public static void deleted (GLib.Object proxy, Gtk.TreePath path);
                public weak Gtk.TreeModel get_model ();
index 2af98df3bf38df81ec8190317a5c90bf31afa282..265022818618372301643289ac70d5af23a9a791 100644 (file)
@@ -49,7 +49,7 @@ namespace Glade {
                public weak Glade.WidgetInfo child;
                public weak string internal_child;
        }
-       [CCode (cheader_filename = "glade/glade.h")]
+       [CCode (free_function = "glade_interface_destroy", cheader_filename = "glade/glade.h")]
        public class Interface {
                public weak string requires;
                public uint n_requires;
@@ -57,7 +57,6 @@ namespace Glade {
                public uint n_toplevels;
                public weak GLib.HashTable names;
                public weak GLib.HashTable strings;
-               public void destroy ();
                public void dump (string filename);
        }
        [CCode (cheader_filename = "glade/glade.h")]
index 836daef315e3da5a30299e6788568220b9dfff43..6e1418da209a04f5bc44a23b5004f0bcac2870ba 100644 (file)
@@ -96,7 +96,7 @@ namespace Gnome {
                public weak string espeaker { get; set; }
        }
        [CCode (cheader_filename = "libgnome/libgnome.h")]
-       public class ModuleInfo {
+       public class ModuleInfo : GLib.Boxed {
                public weak string name;
                public weak string version;
                public weak string description;
index 225c167b9ae71c35c7eeec53c2887f7881c5e3ba..f9f8db309b2a2eb0e3d6e0a5a0f21e1948dc6f98 100644 (file)
@@ -461,10 +461,9 @@ namespace Soup {
                public uchar @in;
                public bool doByteReverse;
        }
-       [CCode (cheader_filename = "libsoup/soup.h")]
+       [CCode (free_function = "soup_message_queue_destroy", cheader_filename = "libsoup/soup.h")]
        public class MessageQueue {
                public void append (Soup.Message msg);
-               public void destroy ();
                public weak Soup.Message first (Soup.MessageQueueIter iter);
                public void free_iter (Soup.MessageQueueIter iter);
                public MessageQueue ();
@@ -526,7 +525,7 @@ namespace Soup {
                public Soup.ServerUnregisterFn unregister;
                public pointer user_data;
        }
-       [CCode (cheader_filename = "libsoup/soup.h")]
+       [CCode (copy_function = "soup_uri_copy", cheader_filename = "libsoup/soup.h")]
        public class Uri {
                public GLib.Quark protocol;
                public weak string user;
index dbd2f34811cee7aeae08599e48588dd6779ae3db..16c461efd37496a590562ff7fdda3004bb1e6227 100644 (file)
@@ -212,7 +212,7 @@ namespace Pango {
                WORD_CHAR,
        }
        [CCode (cheader_filename = "pango/pango.h")]
-       public class Language {
+       public class Language : GLib.Boxed {
                public weak string! to_string ();
                public static weak Pango.Language from_string (string language);
                public static weak Pango.Language get_default ();
@@ -421,10 +421,9 @@ namespace Pango {
                public weak Pango.Attribute attr;
                public int value;
        }
-       [CCode (cheader_filename = "pango/pango.h")]
+       [CCode (copy_function = "pango_attr_iterator_copy", free_function = "pango_attr_iterator_destroy", cheader_filename = "pango/pango.h")]
        public class AttrIterator {
                public weak Pango.AttrIterator copy ();
-               public void destroy ();
                public weak Pango.Attribute get (Pango.AttrType type);
                public weak GLib.SList get_attrs ();
                public void get_font (Pango.FontDescription desc, Pango.Language language, GLib.SList extra_attrs);
@@ -438,7 +437,7 @@ namespace Pango {
                public AttrLanguage (Pango.Language language);
        }
        [CCode (ref_function = "pango_attr_list_ref", unref_function = "pango_attr_list_unref", cheader_filename = "pango/pango.h")]
-       public class AttrList {
+       public class AttrList : GLib.Boxed {
                public void change (Pango.Attribute attr);
                public weak Pango.AttrList copy ();
                public weak Pango.AttrList filter (Pango.AttrFilterFunc func, pointer data);
@@ -472,13 +471,12 @@ namespace Pango {
                public weak Pango.Attribute attr;
                public weak string value;
        }
-       [CCode (cheader_filename = "pango/pango.h")]
+       [CCode (copy_function = "pango_attribute_copy", free_function = "pango_attribute_destroy", cheader_filename = "pango/pango.h")]
        public class Attribute {
                public pointer klass;
                public uint start_index;
                public uint end_index;
                public weak Pango.Attribute copy ();
-               public void destroy ();
                public bool equal (Pango.Attribute attr2);
        }
        [CCode (ref_function = "pango_coverage_ref", unref_function = "pango_coverage_unref", cheader_filename = "pango/pango.h")]
@@ -499,8 +497,8 @@ namespace Pango {
        [CCode (cheader_filename = "pango/pango.h")]
        public class EngineShape {
        }
-       [CCode (cheader_filename = "pango/pango.h")]
-       public class FontDescription {
+       [CCode (copy_function = "pango_font_description_copy", cheader_filename = "pango/pango.h")]
+       public class FontDescription : GLib.Boxed {
                public bool better_match (Pango.FontDescription old_match, Pango.FontDescription new_match);
                public weak Pango.FontDescription copy ();
                public weak Pango.FontDescription copy_static ();
@@ -534,7 +532,7 @@ namespace Pango {
                public void unset_fields (Pango.FontMask to_unset);
        }
        [CCode (ref_function = "pango_font_metrics_ref", unref_function = "pango_font_metrics_unref", cheader_filename = "pango/pango.h")]
-       public class FontMetrics {
+       public class FontMetrics : GLib.Boxed {
                public int get_approximate_char_width ();
                public int get_approximate_digit_width ();
                public int get_ascent ();
@@ -565,8 +563,8 @@ namespace Pango {
                public void letter_space (string text, Pango.LogAttr log_attrs, int letter_spacing);
                public weak Pango.GlyphItem split (string text, int split_index);
        }
-       [CCode (cheader_filename = "pango/pango.h")]
-       public class GlyphString {
+       [CCode (copy_function = "pango_glyph_string_copy", cheader_filename = "pango/pango.h")]
+       public class GlyphString : GLib.Boxed {
                public int num_glyphs;
                public weak Pango.GlyphInfo glyphs;
                public int log_clusters;
@@ -585,8 +583,8 @@ namespace Pango {
        public class GlyphVisAttr {
                public uint is_cluster_start;
        }
-       [CCode (cheader_filename = "pango/pango.h")]
-       public class Item {
+       [CCode (copy_function = "pango_item_copy", cheader_filename = "pango/pango.h")]
+       public class Item : GLib.Boxed {
                public int offset;
                public int length;
                public int num_chars;
@@ -597,7 +595,7 @@ namespace Pango {
                public weak Pango.Item split (int split_index, int split_offset);
        }
        [CCode (cheader_filename = "pango/pango.h")]
-       public class LayoutIter {
+       public class LayoutIter : GLib.Boxed {
                public bool at_last_line ();
                public int get_baseline ();
                public void get_char_extents (out Pango.Rectangle logical_rect);
@@ -618,7 +616,7 @@ namespace Pango {
                public bool next_run ();
        }
        [CCode (ref_function = "pango_layout_line_ref", unref_function = "pango_layout_line_unref", cheader_filename = "pango/pango.h")]
-       public class LayoutLine {
+       public class LayoutLine : GLib.Boxed {
                public weak Pango.Layout layout;
                public int start_index;
                public int length;
@@ -659,8 +657,8 @@ namespace Pango {
                public ScriptIter (string text, int length);
                public bool next ();
        }
-       [CCode (cheader_filename = "pango/pango.h")]
-       public class TabArray {
+       [CCode (copy_function = "pango_tab_array_copy", cheader_filename = "pango/pango.h")]
+       public class TabArray : GLib.Boxed {
                public weak Pango.TabArray copy ();
                public bool get_positions_in_pixels ();
                public int get_size ();
index 802b136577eb3ec364a7507fc41e4ac99046c8ff..a811ad771d151c29d7d7f8aedf6aaadf0195ce06 100644 (file)
@@ -293,7 +293,7 @@ namespace Poppler {
                public weak string title;
                public weak string uri;
        }
-       [CCode (cheader_filename = "poppler.h")]
+       [CCode (copy_function = "poppler_dest_copy", cheader_filename = "poppler.h")]
        public class Dest {
                public Poppler.DestType type;
                public int page_num;
@@ -309,7 +309,7 @@ namespace Poppler {
                public weak Poppler.Dest copy ();
                public static GLib.Type get_type ();
        }
-       [CCode (cheader_filename = "poppler.h")]
+       [CCode (copy_function = "poppler_fonts_iter_copy", cheader_filename = "poppler.h")]
        public class FontsIter {
                public weak Poppler.FontsIter copy ();
                public weak string get_file_name ();
@@ -321,7 +321,7 @@ namespace Poppler {
                public bool is_subset ();
                public bool next ();
        }
-       [CCode (cheader_filename = "poppler.h")]
+       [CCode (copy_function = "poppler_form_field_mapping_copy", cheader_filename = "poppler.h")]
        public class FormFieldMapping {
                public weak Poppler.Rectangle area;
                public weak Poppler.FormField field;
@@ -329,7 +329,7 @@ namespace Poppler {
                public static GLib.Type get_type ();
                public FormFieldMapping ();
        }
-       [CCode (cheader_filename = "poppler.h")]
+       [CCode (copy_function = "poppler_image_mapping_copy", cheader_filename = "poppler.h")]
        public class ImageMapping {
                public weak Poppler.Rectangle area;
                public weak Gdk.Pixbuf image;
@@ -337,7 +337,7 @@ namespace Poppler {
                public static GLib.Type get_type ();
                public ImageMapping ();
        }
-       [CCode (cheader_filename = "poppler.h")]
+       [CCode (copy_function = "poppler_index_iter_copy", cheader_filename = "poppler.h")]
        public class IndexIter {
                public weak Poppler.IndexIter copy ();
                public weak Poppler.Action get_action ();
@@ -347,7 +347,7 @@ namespace Poppler {
                public IndexIter (Poppler.Document document);
                public bool next ();
        }
-       [CCode (cheader_filename = "poppler.h")]
+       [CCode (copy_function = "poppler_link_mapping_copy", cheader_filename = "poppler.h")]
        public class LinkMapping {
                public weak Poppler.Rectangle area;
                public weak Poppler.Action action;
@@ -355,7 +355,7 @@ namespace Poppler {
                public static GLib.Type get_type ();
                public LinkMapping ();
        }
-       [CCode (cheader_filename = "poppler.h")]
+       [CCode (copy_function = "poppler_page_transition_copy", cheader_filename = "poppler.h")]
        public class PageTransition {
                public Poppler.PageTransitionType type;
                public Poppler.PageTransitionAlignment alignment;
@@ -368,7 +368,7 @@ namespace Poppler {
                public static GLib.Type get_type ();
                public PageTransition ();
        }
-       [CCode (cheader_filename = "poppler.h")]
+       [CCode (copy_function = "poppler_rectangle_copy", cheader_filename = "poppler.h")]
        public class Rectangle {
                public double x1;
                public double y1;
index 5f68062bbcd09a88019ad68a97384212f1f9dcea..08eff31b0c244b58d467cb3ca4caae726fec429d 100644 (file)
@@ -342,6 +342,7 @@ public class Vala.GIdlParser : CodeVisitor {
 
                        string ref_function = null;
                        string unref_function = null;
+                       string copy_function = null;
                        string free_function = null;
 
                        foreach (weak IdlNode member in st_node.members) {
@@ -350,9 +351,12 @@ public class Vala.GIdlParser : CodeVisitor {
                                                ref_function = ((IdlNodeFunction) member).symbol;
                                        } else if (member.name == "unref") {
                                                unref_function = ((IdlNodeFunction) member).symbol;
-                                       } else if (member.name == "free") {
+                                       } else if (member.name == "free" || member.name == "destroy") {
                                                free_function = ((IdlNodeFunction) member).symbol;
                                        } else {
+                                               if (member.name == "copy") {
+                                                       copy_function = ((IdlNodeFunction) member).symbol;
+                                               }
                                                var m = parse_function ((IdlNodeFunction) member);
                                                if (m != null) {
                                                        cl.add_method (m);
@@ -369,6 +373,9 @@ public class Vala.GIdlParser : CodeVisitor {
                        if (ref_function != null) {
                                cl.set_ref_function (ref_function);
                        }
+                       if (copy_function != null) {
+                               cl.set_dup_function (copy_function);
+                       }
                        if (unref_function != null) {
                                cl.set_unref_function (unref_function);
                        } else if (free_function != null) {
@@ -442,11 +449,17 @@ public class Vala.GIdlParser : CodeVisitor {
                                cl.set_type_id (cl.get_upper_case_cname ("TYPE_"));
                                current_source_file.add_node (cl);
                        }
-               
+
+                       var parent = new TypeReference ();
+                       parent.namespace_name = "GLib";
+                       parent.type_name = "Boxed";
+                       cl.add_base_type (parent);
+
                        current_data_type = cl;
 
                        string ref_function = null;
                        string unref_function = null;
+                       string copy_function = null;
                        string free_function = null;
 
                        foreach (weak IdlNode member in boxed_node.members) {
@@ -455,9 +468,12 @@ public class Vala.GIdlParser : CodeVisitor {
                                                ref_function = ((IdlNodeFunction) member).symbol;
                                        } else if (member.name == "unref") {
                                                unref_function = ((IdlNodeFunction) member).symbol;
-                                       } else if (member.name == "free") {
+                                       } else if (member.name == "free" || member.name == "destroy") {
                                                free_function = ((IdlNodeFunction) member).symbol;
                                        } else {
+                                               if (member.name == "copy") {
+                                                       copy_function = ((IdlNodeFunction) member).symbol;
+                                               }
                                                var m = parse_function ((IdlNodeFunction) member);
                                                if (m != null) {
                                                        cl.add_method (m);
@@ -474,6 +490,9 @@ public class Vala.GIdlParser : CodeVisitor {
                        if (ref_function != null) {
                                cl.set_ref_function (ref_function);
                        }
+                       if (copy_function != null) {
+                               cl.set_dup_function (copy_function);
+                       }
                        if (unref_function != null) {
                                cl.set_unref_function (unref_function);
                        } else if (free_function != null) {