From: Juerg Billeter Date: Tue, 3 Jul 2007 21:42:08 +0000 (+0000) Subject: write cprefix and lower_case_cprefix of namespaces and write X-Git-Tag: VALA_0_1_0~7 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=af384685a2c0ae8d44af31eda1ad3bc628bb18fc;p=thirdparty%2Fvala.git write cprefix and lower_case_cprefix of namespaces and write 2007-07-03 Juerg Billeter * vala/valainterfacewriter.vala: write cprefix and lower_case_cprefix of namespaces and write cheader_filename of interfaces * vala/valanamespace.vala: make set_cprefix and set_lower_case_cprefix methods public * ccode/valaccodewriter.vala, vala/valainterfacewriter.vala, gobject/valaccodecompiler.vala, compiler/valacompiler.vala, vapi/glib-2.0.vala, vapigen/valagidlparser.vala, vapigen/valavapigen.vala: split GLib.File into GLib.FileStream and GLib.FileUtils to not conflict with GVFS * vala/valagidlparser.vala: improve support for GVFS * vapi/atk.vala, vapi/gdk-2.0.vala, vapi/gtk+-2.0.vala, vapi/pango.vala: regenerated * vapi/gio-standalone.vala, vapi/packages/gio-standalone/: add experimental VAPI for GVFS * vapi/Makefile.am: update svn path=/trunk/; revision=328 --- diff --git a/ChangeLog b/ChangeLog index 3934873c9..75fafd376 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,21 @@ +2007-07-03 Jürg Billeter + + * vala/valainterfacewriter.vala: write cprefix and lower_case_cprefix + of namespaces and write cheader_filename of interfaces + * vala/valanamespace.vala: make set_cprefix and set_lower_case_cprefix + methods public + * ccode/valaccodewriter.vala, vala/valainterfacewriter.vala, + gobject/valaccodecompiler.vala, compiler/valacompiler.vala, + vapi/glib-2.0.vala, vapigen/valagidlparser.vala, + vapigen/valavapigen.vala: split GLib.File into GLib.FileStream and + GLib.FileUtils to not conflict with GVFS + * vala/valagidlparser.vala: improve support for GVFS + * vapi/atk.vala, vapi/gdk-2.0.vala, vapi/gtk+-2.0.vala, vapi/pango.vala: + regenerated + * vapi/gio-standalone.vala, vapi/packages/gio-standalone/: add + experimental VAPI for GVFS + * vapi/Makefile.am: update + 2007-07-01 Jürg Billeter * vapi/glib-2.0.vala: add more string utility functions and GDate diff --git a/ccode/valaccodewriter.vala b/ccode/valaccodewriter.vala index 89b18cc4e..9972b988f 100644 --- a/ccode/valaccodewriter.vala +++ b/ccode/valaccodewriter.vala @@ -1,6 +1,6 @@ /* valaccodewriter.vala * - * Copyright (C) 2006 Jürg Billeter + * Copyright (C) 2006-2007 Jürg Billeter * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -35,12 +35,12 @@ public class Vala.CCodeWriter { } construct { _filename = value; - file_exists = File.test (_filename, FileTest.EXISTS); + file_exists = FileUtils.test (_filename, FileTest.EXISTS); if (file_exists) { temp_filename = "%s.valatmp".printf (_filename); - stream = File.open (temp_filename, "w"); + stream = FileStream.open (temp_filename, "w"); } else { - stream = File.open (_filename, "w"); + stream = FileStream.open (_filename, "w"); } } } @@ -58,7 +58,7 @@ public class Vala.CCodeWriter { private string temp_filename; private bool file_exists; - private File stream; + private FileStream stream; private int indent; @@ -90,9 +90,9 @@ public class Vala.CCodeWriter { new_file = null; if (changed) { - File.rename (temp_filename, _filename); + FileUtils.rename (temp_filename, _filename); } else { - File.unlink (temp_filename); + FileUtils.unlink (temp_filename); } } } diff --git a/compiler/valacompiler.vala b/compiler/valacompiler.vala index ee3a981f6..d211d87fe 100644 --- a/compiler/valacompiler.vala +++ b/compiler/valacompiler.vala @@ -78,24 +78,24 @@ class Vala.Compiler { if (vapi_directories != null) { foreach (string vapidir in vapi_directories) { var filename = Path.build_filename (vapidir, basename); - if (File.test (filename, FileTest.EXISTS)) { + if (FileUtils.test (filename, FileTest.EXISTS)) { return filename; } } } string filename = Path.build_filename (Config.PACKAGE_DATADIR, "vapi", basename); - if (File.test (filename, FileTest.EXISTS)) { + if (FileUtils.test (filename, FileTest.EXISTS)) { return filename; } filename = Path.build_filename ("/usr/local/share/vala/vapi", basename); - if (File.test (filename, FileTest.EXISTS)) { + if (FileUtils.test (filename, FileTest.EXISTS)) { return filename; } filename = Path.build_filename ("/usr/share/vala/vapi", basename); - if (File.test (filename, FileTest.EXISTS)) { + if (FileUtils.test (filename, FileTest.EXISTS)) { return filename; } @@ -119,9 +119,9 @@ class Vala.Compiler { context.add_source_file (new SourceFile (context, package_path, true)); var deps_filename = Path.build_filename (Path.get_dirname (package_path), "%s.deps".printf (pkg)); - if (File.test (deps_filename, FileTest.EXISTS)) { + if (FileUtils.test (deps_filename, FileTest.EXISTS)) { string deps_content; - File.get_contents (deps_filename, out deps_content, null, null); + FileUtils.get_contents (deps_filename, out deps_content, null, null); foreach (string dep in deps_content.split ("\n")) { if (dep != "") { if (!add_package (context, dep)) { @@ -172,7 +172,7 @@ class Vala.Compiler { } foreach (string source in sources) { - if (File.test (source, FileTest.EXISTS)) { + if (FileUtils.test (source, FileTest.EXISTS)) { context.add_source_file (new SourceFile (context, source)); } else { Report.error (null, "%s not found".printf (source)); diff --git a/gobject/valaccodecompiler.vala b/gobject/valaccodecompiler.vala index 97703e3cd..2d6b1725c 100644 --- a/gobject/valaccodecompiler.vala +++ b/gobject/valaccodecompiler.vala @@ -81,8 +81,8 @@ public class Vala.CCodeCompiler { /* remove generated C source and header files */ foreach (SourceFile file in source_files) { if (!file.pkg) { - File.unlink (file.get_csource_filename ()); - File.unlink (file.get_cheader_filename ()); + FileUtils.unlink (file.get_csource_filename ()); + FileUtils.unlink (file.get_cheader_filename ()); } } diff --git a/vala/valainterfacewriter.vala b/vala/valainterfacewriter.vala index 80a6ce1af..51412b44e 100644 --- a/vala/valainterfacewriter.vala +++ b/vala/valainterfacewriter.vala @@ -29,7 +29,7 @@ using GLib; public class Vala.InterfaceWriter : CodeVisitor { private CodeContext context; - File stream; + FileStream stream; int indent; /* at begin of line */ @@ -47,7 +47,7 @@ public class Vala.InterfaceWriter : CodeVisitor { public void write_file (CodeContext! context, string! filename) { this.context = context; - stream = File.open (filename, "w"); + stream = FileStream.open (filename, "w"); /* we're only interested in non-pkg source files */ foreach (SourceFile file in context.get_source_files ()) { @@ -72,7 +72,7 @@ public class Vala.InterfaceWriter : CodeVisitor { current_cheader_filename = ns.get_cheader_filename (); write_indent (); - write_string ("[CCode (cheader_filename = \"%s\")]".printf (current_cheader_filename)); + write_string ("[CCode (cprefix = \"%s\", lower_case_cprefix = \"%s\", cheader_filename = \"%s\")]".printf (ns.get_cprefix (), ns.get_lower_case_cprefix (), current_cheader_filename)); write_newline (); write_indent (); @@ -161,7 +161,22 @@ public class Vala.InterfaceWriter : CodeVisitor { if (iface.access == MemberAccessibility.PRIVATE) { return; } - + + write_indent (); + + var first = true; + string cheaders; + foreach (string cheader in iface.get_cheader_filenames ()) { + if (first) { + cheaders = cheader; + first = false; + } else { + cheaders = "%s, %s".printf (cheaders, cheader); + } + } + write_string ("[CCode (cheader_filename = \"%s\")]".printf (cheaders)); + write_newline (); + write_indent (); write_string ("public "); write_string ("interface "); diff --git a/vala/valanamespace.vala b/vala/valanamespace.vala index 5b6f7bdb6..67f027c76 100644 --- a/vala/valanamespace.vala +++ b/vala/valanamespace.vala @@ -282,11 +282,17 @@ public class Vala.Namespace : CodeNode { } return cprefix; } - - private void set_cprefix (string cprefix) { + + /** + * Sets the camel case string to be prepended to the name of members of + * this namespace when used in C code. + * + * @param cprefix the camel case prefix to be used in C code + */ + public void set_cprefix (string cprefix) { this.cprefix = cprefix; } - + /** * Returns the lower case string to be prepended to the name of members * of this namespace when used in C code. @@ -303,11 +309,17 @@ public class Vala.Namespace : CodeNode { } return lower_case_cprefix; } - - private void set_lower_case_cprefix (string cprefix) { + + /** + * Sets the lower case string to be prepended to the name of members of + * this namespace when used in C code. + * + * @param cprefix the lower case prefix to be used in C code + */ + public void set_lower_case_cprefix (string cprefix) { this.lower_case_cprefix = cprefix; } - + /** * Returns a list of C header filenames users of this namespace must * include. diff --git a/vapi/Makefile.am b/vapi/Makefile.am index c8a654b10..c021330cf 100644 --- a/vapi/Makefile.am +++ b/vapi/Makefile.am @@ -11,6 +11,7 @@ dist_vapi_DATA = \ glib-2.0.vala \ gdk-2.0.deps \ gdk-2.0.vala \ + gio-standalone.vala \ gtk+-2.0.deps \ gtk+-2.0.vala \ libxml-2.0.vala \ diff --git a/vapi/atk.vala b/vapi/atk.vala index 7f28b7329..ae9ce1145 100644 --- a/vapi/atk.vala +++ b/vapi/atk.vala @@ -1,4 +1,4 @@ -[CCode (cheader_filename = "atk/atk.h")] +[CCode (cprefix = "Atk", lower_case_cprefix = "atk_", cheader_filename = "atk/atk.h")] namespace Atk { [CCode (cprefix = "ATK_XY_")] public enum CoordType { @@ -397,6 +397,7 @@ namespace Atk { public class Util : GLib.Object { public static GLib.Type get_type (); } + [CCode (cheader_filename = "atk/atk.h")] public interface Action { public virtual bool do_action (int i); public virtual weak string get_description (int i); @@ -407,6 +408,7 @@ namespace Atk { public static GLib.Type get_type (); public virtual bool set_description (int i, string desc); } + [CCode (cheader_filename = "atk/atk.h")] public interface Component { public virtual uint add_focus_handler (Atk.FocusHandler handler); public virtual bool contains (int x, int y, Atk.CoordType coord_type); @@ -425,6 +427,7 @@ namespace Atk { public virtual bool set_size (int width, int height); public signal void bounds_changed (ref Atk.Rectangle bounds); } + [CCode (cheader_filename = "atk/atk.h")] public interface Document { public weak string get_attribute_value (string attribute_name); public weak GLib.SList get_attributes (); @@ -437,6 +440,7 @@ namespace Atk { public signal void reload (); public signal void load_stopped (); } + [CCode (cheader_filename = "atk/atk.h")] public interface EditableText { public virtual void copy_text (int start_pos, int end_pos); public virtual void cut_text (int start_pos, int end_pos); @@ -447,10 +451,12 @@ namespace Atk { public virtual bool set_run_attributes (GLib.SList attrib_set, int start_offset, int end_offset); public virtual void set_text_contents (string string); } + [CCode (cheader_filename = "atk/atk.h")] public interface HyperlinkImpl { public virtual weak Atk.Hyperlink get_hyperlink (); public static GLib.Type get_type (); } + [CCode (cheader_filename = "atk/atk.h")] public interface Hypertext { public virtual weak Atk.Hyperlink get_link (int link_index); public virtual int get_link_index (int char_index); @@ -458,6 +464,7 @@ namespace Atk { public static GLib.Type get_type (); public signal void link_selected (int link_index); } + [CCode (cheader_filename = "atk/atk.h")] public interface Image { public virtual weak string get_image_description (); public virtual weak string get_image_locale (); @@ -466,10 +473,12 @@ namespace Atk { public static GLib.Type get_type (); public virtual bool set_image_description (string description); } + [CCode (cheader_filename = "atk/atk.h")] public interface Implementor { public static GLib.Type get_type (); public virtual weak Atk.Object ref_accessible (); } + [CCode (cheader_filename = "atk/atk.h")] public interface Selection { public virtual bool add_selection (int i); public virtual bool clear_selection (); @@ -481,6 +490,7 @@ namespace Atk { public virtual bool select_all_selection (); public signal void selection_changed (); } + [CCode (cheader_filename = "atk/atk.h")] public interface StreamableContent { public virtual weak string get_mime_type (int i); public virtual int get_n_mime_types (); @@ -488,6 +498,7 @@ namespace Atk { public static GLib.Type get_type (); public virtual weak string get_uri (string mime_type); } + [CCode (cheader_filename = "atk/atk.h")] public interface Table { public virtual bool add_column_selection (int column); public virtual bool add_row_selection (int row); @@ -527,6 +538,7 @@ namespace Atk { public signal void column_reordered (); public signal void model_changed (); } + [CCode (cheader_filename = "atk/atk.h")] public interface Text { public virtual bool add_selection (int start_offset, int end_offset); public static Atk.TextAttribute attribute_for_name (string name); @@ -558,6 +570,7 @@ namespace Atk { public signal void text_selection_changed (); public signal void text_attributes_changed (); } + [CCode (cheader_filename = "atk/atk.h")] public interface Value { public virtual void get_current_value (GLib.Value value); public virtual void get_maximum_value (GLib.Value value); diff --git a/vapi/gdk-2.0.vala b/vapi/gdk-2.0.vala index 64c02e664..dfd62bcd2 100644 --- a/vapi/gdk-2.0.vala +++ b/vapi/gdk-2.0.vala @@ -1,4 +1,4 @@ -[CCode (cheader_filename = "gdk/gdk.h")] +[CCode (cprefix = "Gdk", lower_case_cprefix = "gdk_", cheader_filename = "gdk/gdk.h")] namespace Gdk { [CCode (cprefix = "GDK_AXIS_")] public enum AxisUse { diff --git a/vapi/gio-standalone.vala b/vapi/gio-standalone.vala new file mode 100644 index 000000000..22e41be90 --- /dev/null +++ b/vapi/gio-standalone.vala @@ -0,0 +1,648 @@ +[CCode (cprefix = "G", lower_case_cprefix = "g_", cheader_filename = "gio/gvfs.h")] +namespace GLib { + [CCode (cprefix = "G_DIRECTORY_MONITOR_EVENT_")] + public enum DirectoryMonitorEvent { + CHANGED, + DELETED, + CREATED, + ATTRIBUTE_CHANGED, + UNMOUNTED, + } + [CCode (cprefix = "G_FILE_ATTRIBUTE_TYPE_")] + public enum FileAttributeType { + INVALID, + STRING, + BYTE_STRING, + UINT32, + INT32, + UINT64, + INT64, + } + [CCode (cprefix = "G_FILE_COPY_")] + public enum FileCopyFlags { + OVERWRITE, + BACKUP, + } + [CCode (cprefix = "G_FILE_FLAG_")] + public enum FileFlags { + HIDDEN, + SYMLINK, + LOCAL, + VIRTUAL, + } + [CCode (cprefix = "G_FILE_GET_INFO_NOFOLLOW_")] + public enum FileGetInfoFlags { + SYMLINKS, + } + [CCode (cprefix = "G_FILE_MONITOR_EVENT_")] + public enum FileMonitorEvent { + CHANGED, + DELETED, + CREATED, + ATTRIBUTE_CHANGED, + UNMOUNTED, + } + [CCode (cprefix = "G_FILE_TYPE_")] + public enum FileType { + UNKNOWN, + REGULAR, + DIRECTORY, + SYMBOLIC_LINK, + SPECIAL, + SHORTCUT, + MOUNTABLE, + } + [CCode (cprefix = "G_IO_ERROR_")] + public enum IOErrorEnum { + FAILED, + NOT_FOUND, + EXISTS, + IS_DIRECTORY, + NOT_DIRECTORY, + NOT_EMPTY, + NOT_REGULAR_FILE, + NOT_SYMBOLIC_LINK, + NOT_MOUNTABLE, + FILENAME_TOO_LONG, + INVALID_FILENAME, + TOO_MANY_LINKS, + NO_SPACE, + INVALID_ARGUMENT, + PERMISSION_DENIED, + NOT_SUPPORTED, + NOT_MOUNTED, + ALREADY_MOUNTED, + CLOSED, + CANCELLED, + PENDING, + READ_ONLY, + CANT_CREATE_BACKUP, + WRONG_MTIME, + TIMED_OUT, + } + [CCode (cprefix = "G_PASSWORD_FLAGS_")] + public enum PasswordFlags { + NEED_PASSWORD, + NEED_USERNAME, + NEED_DOMAIN, + SAVING_SUPPORTED, + ANON_SUPPORTED, + } + [CCode (cprefix = "G_PASSWORD_SAVE_")] + public enum PasswordSave { + NEVER, + FOR_SESSION, + PERMANENTLY, + } + [CCode (cprefix = "G_UNIX_MOUNT_TYPE_")] + public enum UnixMountType { + UNKNOWN, + FLOPPY, + CDROM, + NFS, + ZIP, + JAZ, + MEMSTICK, + CF, + SM, + SDMMC, + IPOD, + CAMERA, + HD, + } + [CCode (cheader_filename = "gio/gvfs.h")] + public class BufferedInputStream : GLib.FilterInputStream { + public static GLib.Type get_type (); + public BufferedInputStream (GLib.InputStream base_stream); + public BufferedInputStream.sized (GLib.InputStream base_stream, uint size); + [NoAccessorMethod] + public weak uint buffer_size { get; construct; } + } + [CCode (cheader_filename = "gio/gvfs.h")] + public class BufferedOutputStream : GLib.FilterOutputStream { + public static GLib.Type get_type (); + public BufferedOutputStream (GLib.OutputStream base_stream); + public BufferedOutputStream.sized (GLib.OutputStream base_stream, uint size); + [NoAccessorMethod] + public weak uint buffer_size { get; construct; } + } + [CCode (cheader_filename = "gio/gvfs.h")] + public class Cancellable : GLib.Object { + public void cancel (); + public int get_fd (); + public static GLib.Type get_type (); + public bool is_cancelled (); + public Cancellable (); + public void reset (); + public signal void cancelled (); + } + [CCode (cheader_filename = "gio/gvfs.h")] + public class DesktopAppInfo : GLib.Object, GLib.AppInfo { + public static GLib.Type get_type (); + public DesktopAppInfo (string desktop_id); + } + [CCode (cheader_filename = "gio/gvfs.h")] + public class DirectoryMonitor : GLib.Object { + public virtual bool cancel (); + public void emit_event (GLib.File child, GLib.File other_file, GLib.DirectoryMonitorEvent event_type); + public static GLib.Type get_type (); + public void set_rate_limit (int limit_msecs); + public signal void changed (GLib.File child, GLib.File other_file, GLib.DirectoryMonitorEvent event_type); + } + [CCode (cheader_filename = "gio/gvfs.h")] + public class FileEnumerator : GLib.Object { + public static GLib.Type get_type (); + public bool has_pending (); + public bool is_stopped (); + public virtual weak GLib.FileInfo next_file (GLib.Cancellable cancellable, GLib.Error error); + public virtual void next_files_async (int num_files, int io_priority, GLib.AsyncNextFilesCallback @callback, pointer user_data, GLib.Cancellable cancellable); + public void set_pending (bool pending); + public virtual bool stop (GLib.Cancellable cancellable, GLib.Error error); + public virtual void stop_async (int io_priority, GLib.AsyncStopEnumeratingCallback @callback, pointer user_data, GLib.Cancellable cancellable); + } + [CCode (cheader_filename = "gio/gvfs.h")] + public class FileIcon : GLib.Object, GLib.Icon, GLib.LoadableIcon { + public weak GLib.File get_file (); + public static GLib.Type get_type (); + public FileIcon (GLib.File file); + } + [CCode (cheader_filename = "gio/gvfs.h")] + public class FileInfo : GLib.Object { + public weak GLib.FileInfo copy (); + public weak string get_attribute_as_string (string attribute); + public weak string get_attribute_byte_string (string attribute); + public int get_attribute_int32 (string attribute); + public int64 get_attribute_int64 (string attribute); + public weak string get_attribute_string (string attribute); + public GLib.FileAttributeType get_attribute_type (string attribute); + public uint get_attribute_uint32 (string attribute); + public uint64 get_attribute_uint64 (string attribute); + public weak string get_content_type (); + public weak string get_display_name (); + public weak string get_edit_name (); + public GLib.FileType get_file_type (); + public GLib.FileFlags get_flags (); + public weak string get_icon (); + public void get_modification_time (GLib.TimeVal result); + public weak string get_name (); + public int64 get_size (); + public weak string get_symlink_target (); + public static GLib.Type get_type (); + public bool has_attribute (string attribute); + public weak string list_attributes (string name_space); + public FileInfo (); + public void remove_attribute (string attribute); + public void set_attribute_byte_string (string attribute, string value); + public void set_attribute_int32 (string attribute, int value); + public void set_attribute_int64 (string attribute, int64 value); + public void set_attribute_string (string attribute, string value); + public void set_attribute_uint32 (string attribute, uint value); + public void set_attribute_uint64 (string attribute, uint64 value); + public void set_content_type (string content_type); + public void set_display_name (string display_name); + public void set_edit_name (string edit_name); + public void set_file_type (GLib.FileType type); + public void set_flags (GLib.FileFlags @flags); + public void set_icon (string icon); + public void set_modification_time (GLib.TimeVal mtime); + public void set_name (string name); + public void set_size (int64 size); + public void set_symlink_target (string symlink_target); + } + [CCode (cheader_filename = "gio/gvfs.h")] + public class FileInputStream : GLib.InputStream, GLib.Seekable { + public virtual weak GLib.FileInfo get_file_info (string attributes, GLib.Cancellable cancellable, GLib.Error error); + public static GLib.Type get_type (); + } + [CCode (cheader_filename = "gio/gvfs.h")] + public class FileMonitor : GLib.Object { + public virtual bool cancel (); + public static weak GLib.DirectoryMonitor directory (GLib.File file); + public void emit_event (GLib.File file, GLib.File other_file, GLib.FileMonitorEvent event_type); + public static weak GLib.FileMonitor file (GLib.File file); + public static GLib.Type get_type (); + public void set_rate_limit (int limit_msecs); + public signal void changed (GLib.File file, GLib.File other_file, GLib.FileMonitorEvent event_type); + } + [CCode (cheader_filename = "gio/gvfs.h")] + public class FileOutputStream : GLib.OutputStream { + public virtual weak GLib.FileInfo get_file_info (string attributes, GLib.Cancellable cancellable, GLib.Error error); + public void get_final_mtime (GLib.TimeVal mtime); + public bool get_should_get_final_mtime (); + public static GLib.Type get_type (); + public void set_final_mtime (GLib.TimeVal final_mtime); + public void set_should_get_final_mtime (bool get_final_mtime); + } + [CCode (cheader_filename = "gio/gvfs.h")] + public class FilterInputStream : GLib.InputStream { + public weak GLib.InputStream get_base_stream (); + public static GLib.Type get_type (); + [NoAccessorMethod] + public weak GLib.InputStream base_stream { get; construct; } + } + [CCode (cheader_filename = "gio/gvfs.h")] + public class FilterOutputStream : GLib.OutputStream { + public weak GLib.OutputStream get_base_stream (); + public static GLib.Type get_type (); + [NoAccessorMethod] + public weak GLib.OutputStream base_stream { get; construct; } + } + [CCode (cheader_filename = "gio/gvfs.h")] + public class InputStream : GLib.Object { + public virtual bool close (GLib.Cancellable cancellable, GLib.Error error); + public virtual void close_async (int io_priority, GLib.Cancellable cancellable, GLib.AsyncReadyCallback @callback, pointer user_data); + public virtual bool close_finish (GLib.AsyncResult result, GLib.Error error); + public static GLib.Type get_type (); + public bool has_pending (); + public bool is_closed (); + public virtual long read (pointer buffer, ulong count, GLib.Cancellable cancellable, GLib.Error error); + public bool read_all (pointer buffer, ulong count, ulong bytes_read, GLib.Cancellable cancellable, GLib.Error error); + public virtual void read_async (pointer buffer, ulong count, int io_priority, GLib.Cancellable cancellable, GLib.AsyncReadyCallback @callback, pointer user_data); + public virtual long read_finish (GLib.AsyncResult result, GLib.Error error); + public void set_pending (bool pending); + public virtual long skip (ulong count, GLib.Cancellable cancellable, GLib.Error error); + public virtual void skip_async (ulong count, int io_priority, GLib.Cancellable cancellable, GLib.AsyncReadyCallback @callback, pointer user_data); + public virtual long skip_finish (GLib.AsyncResult result, GLib.Error error); + } + [CCode (cheader_filename = "gio/gvfs.h")] + public class LocalDirectoryMonitor : GLib.DirectoryMonitor { + public static GLib.Type get_type (); + public static weak GLib.DirectoryMonitor start (string dirname); + } + [CCode (cheader_filename = "gio/gvfs.h")] + public class LocalFile : GLib.Object, GLib.File { + public static GLib.Type get_type (); + public static weak GLib.FileInfo info_get (string basename, string path, GLib.FileAttributeMatcher attribute_matcher, GLib.FileGetInfoFlags @flags, GLib.LocalParentFileInfo parent_info, GLib.Error error); + public static weak GLib.FileInfo info_get_from_fd (int fd, string attributes, GLib.Error error); + public static void info_get_parent_info (string dir, GLib.FileAttributeMatcher attribute_matcher, GLib.LocalParentFileInfo parent_info); + public LocalFile (string filename); + } + [CCode (cheader_filename = "gio/gvfs.h")] + public class LocalFileEnumerator : GLib.FileEnumerator { + public static GLib.Type get_type (); + public LocalFileEnumerator (string filename, string attributes, GLib.FileGetInfoFlags @flags, GLib.Cancellable cancellable, GLib.Error error); + } + [CCode (cheader_filename = "gio/gvfs.h")] + public class LocalFileInputStream : GLib.FileInputStream { + public static GLib.Type get_type (); + public LocalFileInputStream (int fd); + } + [CCode (cheader_filename = "gio/gvfs.h")] + public class LocalFileMonitor : GLib.FileMonitor { + public static GLib.Type get_type (); + public static weak GLib.FileMonitor start (string dirname); + } + [CCode (cheader_filename = "gio/gvfs.h")] + public class LocalFileOutputStream : GLib.FileOutputStream { + public static weak GLib.FileOutputStream append (string filename, GLib.Cancellable cancellable, GLib.Error error); + public static weak GLib.FileOutputStream create (string filename, GLib.Cancellable cancellable, GLib.Error error); + public static GLib.Type get_type (); + public static weak GLib.FileOutputStream replace (string filename, ulong mtime, bool make_backup, GLib.Cancellable cancellable, GLib.Error error); + } + [CCode (cheader_filename = "gio/gvfs.h")] + public class LocalVfs : GLib.Object, GLib.Vfs { + public static GLib.Type get_type (); + public LocalVfs (); + } + [CCode (cheader_filename = "gio/gvfs.h")] + public class MemoryInputStream : GLib.InputStream, GLib.Seekable { + public static weak GLib.InputStream from_data (pointer data, ulong len); + public static GLib.Type get_type (); + } + [CCode (cheader_filename = "gio/gvfs.h")] + public class MemoryOutputStream : GLib.OutputStream, GLib.Seekable { + public static GLib.Type get_type (); + public MemoryOutputStream (GLib.ByteArray data); + public void set_max_size (uint max_size); + [NoAccessorMethod] + public weak pointer data { get; set construct; } + [NoAccessorMethod] + public weak bool free_array { get; set; } + [NoAccessorMethod] + public weak uint size_limit { get; set; } + } + [CCode (cheader_filename = "gio/gvfs.h")] + public class MountOperation : GLib.Object { + public bool get_anonymous (); + public int get_choice (); + public weak string get_domain (); + public weak string get_password (); + public GLib.PasswordSave get_password_save (); + public static GLib.Type get_type (); + public weak string get_username (); + public MountOperation (); + public void set_anonymous (bool anonymous); + public void set_choice (int choice); + public void set_domain (string domain); + public void set_password (string password); + public void set_password_save (GLib.PasswordSave save); + public void set_username (string username); + public signal bool ask_password (string message, string default_user, string default_domain, GLib.PasswordFlags @flags); + public signal bool ask_question (string message, string[] choices); + [HasEmitter] + public signal void reply (bool abort); + } + [CCode (cheader_filename = "gio/gvfs.h")] + public class OutputStream : GLib.Object { + public virtual bool close (GLib.Cancellable cancellable, GLib.Error error); + public virtual void close_async (int io_priority, GLib.Cancellable cancellable, GLib.AsyncReadyCallback @callback, pointer user_data); + public virtual bool close_finish (GLib.AsyncResult result, GLib.Error error); + public virtual bool flush (GLib.Cancellable cancellable, GLib.Error error); + public virtual void flush_async (int io_priority, GLib.Cancellable cancellable, GLib.AsyncReadyCallback @callback, pointer user_data); + public virtual bool flush_finish (GLib.AsyncResult result, GLib.Error error); + public static GLib.Type get_type (); + public bool has_pending (); + public bool is_closed (); + public void set_pending (bool pending); + public virtual long write (pointer buffer, ulong count, GLib.Cancellable cancellable, GLib.Error error); + public bool write_all (pointer buffer, ulong count, ulong bytes_written, GLib.Cancellable cancellable, GLib.Error error); + public virtual void write_async (pointer buffer, ulong count, int io_priority, GLib.Cancellable cancellable, GLib.AsyncReadyCallback @callback, pointer user_data); + public virtual long write_finish (GLib.AsyncResult result, GLib.Error error); + } + [CCode (cheader_filename = "gio/gvfs.h")] + public class SimpleAsyncResult : GLib.Object, GLib.AsyncResult { + public void complete (); + public void complete_in_idle (); + public bool get_op_res_gboolean (); + public pointer get_op_res_gpointer (); + public long get_op_res_gssize (); + public pointer get_source_tag (); + public static GLib.Type get_type (); + public SimpleAsyncResult (GLib.Object source_object, GLib.AsyncReadyCallback @callback, pointer user_data, pointer source_tag); + public SimpleAsyncResult.error (GLib.Object source_object, GLib.AsyncReadyCallback @callback, pointer user_data, GLib.Quark domain, int code, string format); + public SimpleAsyncResult.from_error (GLib.Object source_object, GLib.AsyncReadyCallback @callback, pointer user_data, GLib.Error error); + public bool propagate_error (GLib.Error dest); + public void run_in_thread (GLib.SimpleAsyncThreadFunc func, int io_priority, GLib.Cancellable cancellable); + public void set_error (GLib.Quark domain, int code, string format); + public void set_error_va (GLib.Quark domain, int code, string format, pointer args); + public void set_from_error (GLib.Error error); + public void set_handle_cancellation (bool handle_cancellation); + public void set_op_res_gboolean (bool op_res); + public void set_op_res_gpointer (pointer op_res, GLib.DestroyNotify destroy_op_res); + public void set_op_res_gssize (long op_res); + } + [CCode (cheader_filename = "gio/gvfs.h")] + public class SocketInputStream : GLib.InputStream { + public static GLib.Type get_type (); + public SocketInputStream (int fd, bool close_fd_at_close); + } + [CCode (cheader_filename = "gio/gvfs.h")] + public class SocketOutputStream : GLib.OutputStream { + public static GLib.Type get_type (); + public SocketOutputStream (int fd, bool close_fd_at_close); + } + [CCode (cheader_filename = "gio/gvfs.h")] + public class ThemedIcon : GLib.Object, GLib.Icon { + public weak string get_names (); + public static GLib.Type get_type (); + public ThemedIcon (string iconname); + public ThemedIcon.from_names (string iconnames); + } + [CCode (cheader_filename = "gio/gvfs.h")] + public class UnionDrive : GLib.Object, GLib.Drive { + public bool child_is_for_monitor (GLib.VolumeMonitor child_monitor); + public static GLib.Type get_type (); + public bool is_for_child_drive (GLib.Drive child_drive); + public UnionDrive (GLib.VolumeMonitor union_monitor, GLib.Drive child_drive, GLib.VolumeMonitor child_monitor); + } + [CCode (cheader_filename = "gio/gvfs.h")] + public class UnionVolume : GLib.Object, GLib.Volume { + public void add_volume (GLib.Volume volume, GLib.VolumeMonitor monitor); + public weak GLib.Volume get_child_for_monitor (GLib.VolumeMonitor child_monitor); + public static GLib.Type get_type (); + public bool has_child_volume (GLib.Volume child_volume); + public bool is_last_child (GLib.Volume child_volume); + public UnionVolume (GLib.VolumeMonitor union_monitor, GLib.Volume volume, GLib.VolumeMonitor monitor); + public void remove_volume (GLib.Volume volume); + } + [CCode (cheader_filename = "gio/gvfs.h")] + public class UnionVolumeMonitor : GLib.VolumeMonitor { + public weak GLib.Drive convert_drive (GLib.Drive child_drive); + public weak GLib.List convert_volumes (GLib.List child_volumes); + public static GLib.Type get_type (); + } + [CCode (cheader_filename = "gio/gvfs.h")] + public class UnixDrive : GLib.Object, GLib.Drive { + public void disconnected (); + public static GLib.Type get_type (); + public bool has_mountpoint (string mountpoint); + public UnixDrive (GLib.VolumeMonitor volume_monitor, GLib.UnixMountPoint mountpoint); + public void set_volume (GLib.UnixVolume volume); + public void unset_volume (GLib.UnixVolume volume); + } + [CCode (cheader_filename = "gio/gvfs.h")] + public class UnixVolume : GLib.Object, GLib.Volume { + public static GLib.Type get_type (); + public bool has_mountpoint (string mountpoint); + public UnixVolume (GLib.VolumeMonitor volume_monitor, GLib.UnixMount mount); + public void unmounted (); + public void unset_drive (GLib.UnixDrive drive); + } + [CCode (cheader_filename = "gio/gvfs.h")] + public class UnixVolumeMonitor : GLib.VolumeMonitor { + public static GLib.Type get_type (); + public weak GLib.UnixDrive lookup_drive_for_mountpoint (string mountpoint); + public UnixVolumeMonitor (); + } + [CCode (cheader_filename = "gio/gvfs.h")] + public class VolumeMonitor : GLib.Object { + public virtual weak GLib.List get_connected_drives (); + public virtual weak GLib.List get_mounted_volumes (); + public static GLib.Type get_type (); + public signal void volume_mounted (GLib.Volume volume); + public signal void volume_pre_unmount (GLib.Volume volume); + public signal void volume_unmounted (GLib.Volume volume); + public signal void drive_connected (GLib.Drive drive); + public signal void drive_disconnected (GLib.Drive drive); + } + [CCode (cheader_filename = "gio/gvfs.h")] + public class Win32AppInfo : GLib.Object, GLib.AppInfo { + public static GLib.Type get_type (); + } + [CCode (cheader_filename = "gio/gvfs.h")] + public interface AppInfo { + public static weak GLib.AppInfo create_from_commandline (string commandline, string application_name, GLib.Error error); + public virtual weak GLib.AppInfo dup (); + public virtual bool equal (GLib.AppInfo appinfo2); + public virtual weak string get_description (); + public virtual weak string get_icon (); + public virtual weak string get_name (); + public static GLib.Type get_type (); + public virtual bool launch (GLib.List filenames, string envp, GLib.Error error); + public virtual bool launch_uris (GLib.List uris, string envp, GLib.Error error); + public virtual bool set_as_default_for_type (string content_type, GLib.Error error); + public virtual bool should_show (string desktop_env); + public virtual bool supports_uris (); + public virtual bool supports_xdg_startup_notify (); + } + [CCode (cheader_filename = "gio/gvfs.h")] + public interface AsyncResult { + public virtual weak GLib.Object get_source_object (); + public static GLib.Type get_type (); + public virtual pointer get_user_data (); + } + [CCode (cheader_filename = "gio/gvfs.h")] + public interface Drive { + public virtual bool can_eject (); + public virtual bool can_mount (); + public virtual void eject (GLib.AsyncReadyCallback @callback, pointer user_data); + public virtual bool eject_finish (GLib.AsyncResult result, GLib.Error error); + public virtual weak string get_icon (); + public virtual weak string get_name (); + public weak string get_platform_id (); + public static GLib.Type get_type (); + public virtual weak GLib.List get_volumes (); + public virtual bool is_automounted (); + public virtual void mount (GLib.MountOperation mount_operation, GLib.AsyncReadyCallback @callback, pointer user_data); + public virtual bool mount_finish (GLib.AsyncResult result, GLib.Error error); + public signal void changed (); + } + [CCode (cheader_filename = "gio/gfile.h")] + public interface File { + public virtual weak GLib.FileOutputStream append_to (GLib.Cancellable cancellable, GLib.Error error); + public virtual bool copy (GLib.File destination, GLib.FileCopyFlags @flags, GLib.Cancellable cancellable, GLib.FileProgressCallback progress_callback, pointer progress_callback_data, GLib.Error error); + public virtual weak GLib.FileOutputStream create (GLib.Cancellable cancellable, GLib.Error error); + public bool delete (GLib.Cancellable cancellable, GLib.Error error); + public virtual weak GLib.File dup (); + public virtual void eject_mountable (GLib.Cancellable cancellable, GLib.AsyncReadyCallback @callback, pointer user_data); + public virtual bool eject_mountable_finish (GLib.AsyncResult result, GLib.Error error); + public virtual weak GLib.FileEnumerator enumerate_children (string attributes, GLib.FileGetInfoFlags @flags, GLib.Cancellable cancellable, GLib.Error error); + public virtual bool equal (GLib.File file2); + public virtual weak string get_basename (); + public weak GLib.File get_child (string name); + public virtual weak GLib.File get_child_for_display_name (string display_name, GLib.Error error); + public void get_contents_async (GLib.Cancellable cancellable, GLib.AsyncReadyCallback @callback, pointer user_data); + public bool get_contents_finish (GLib.AsyncResult res, string contents, ulong length, GLib.Error error); + public virtual weak GLib.FileInfo get_filesystem_info (string attributes, GLib.Cancellable cancellable, GLib.Error error); + public static weak GLib.File get_for_commandline_arg (string arg); + public static weak GLib.File get_for_path (string path); + public static weak GLib.File get_for_uri (string uri); + public virtual weak GLib.FileInfo get_info (string attributes, GLib.FileGetInfoFlags @flags, GLib.Cancellable cancellable, GLib.Error error); + public virtual weak GLib.File get_parent (); + public virtual weak string get_parse_name (); + public virtual weak string get_path (); + public static GLib.Type get_type (); + public virtual weak string get_uri (); + public static uint hash (pointer file); + public virtual bool is_native (); + public virtual bool make_directory (GLib.Cancellable cancellable, GLib.Error error); + public virtual bool make_symbolic_link (string symlink_value, GLib.Cancellable cancellable, GLib.Error error); + public virtual void mount_mountable (GLib.MountOperation mount_operation, GLib.Cancellable cancellable, GLib.AsyncReadyCallback @callback, pointer user_data); + public virtual weak GLib.File mount_mountable_finish (GLib.AsyncResult result, GLib.Error error); + public virtual bool move (GLib.File destination, GLib.FileCopyFlags @flags, GLib.Cancellable cancellable, GLib.FileProgressCallback progress_callback, pointer progress_callback_data, GLib.Error error); + public static weak GLib.File parse_name (string parse_name); + public virtual weak GLib.FileInputStream read (GLib.Cancellable cancellable, GLib.Error error); + public virtual void read_async (int io_priority, GLib.Cancellable cancellable, GLib.AsyncReadyCallback @callback, pointer user_data); + public virtual weak GLib.FileInputStream read_finish (GLib.AsyncResult res, GLib.Error error); + public virtual weak GLib.FileOutputStream replace (ulong mtime, bool make_backup, GLib.Cancellable cancellable, GLib.Error error); + public virtual weak GLib.File resolve_relative (string relative_path); + public virtual bool set_attribute (string attribute, GLib.FileAttributeType type, pointer value, GLib.FileGetInfoFlags @flags, GLib.Cancellable cancellable, GLib.Error error); + public bool set_attribute_byte_string (string attribute, string value, GLib.FileGetInfoFlags @flags, GLib.Cancellable cancellable, GLib.Error error); + public bool set_attribute_int32 (string attribute, string value, GLib.FileGetInfoFlags @flags, GLib.Cancellable cancellable, GLib.Error error); + public bool set_attribute_int64 (string attribute, int64 value, GLib.FileGetInfoFlags @flags, GLib.Cancellable cancellable, GLib.Error error); + public bool set_attribute_string (string attribute, string value, GLib.FileGetInfoFlags @flags, GLib.Cancellable cancellable, GLib.Error error); + public bool set_attribute_uint32 (string attribute, uint value, GLib.FileGetInfoFlags @flags, GLib.Cancellable cancellable, GLib.Error error); + public bool set_attribute_uint64 (string attribute, uint64 value, GLib.FileGetInfoFlags @flags, GLib.Cancellable cancellable, GLib.Error error); + public virtual weak GLib.File set_display_name (string display_name, GLib.Cancellable cancellable, GLib.Error error); + public virtual bool trash (GLib.Cancellable cancellable, GLib.Error error); + public virtual void unmount_mountable (GLib.Cancellable cancellable, GLib.AsyncReadyCallback @callback, pointer user_data); + public virtual bool unmount_mountable_finish (GLib.AsyncResult result, GLib.Error error); + } + [CCode (cheader_filename = "gio/gvfs.h")] + public interface Icon { + public virtual bool equal (GLib.Icon icon2); + public static GLib.Type get_type (); + public static uint hash (pointer icon); + } + [CCode (cheader_filename = "gio/gvfs.h")] + public interface LoadableIcon { + public static GLib.Type get_type (); + public virtual weak GLib.InputStream load (int size, string type, GLib.Cancellable cancellable, GLib.Error error); + public virtual void load_async (int size, GLib.Cancellable cancellable, GLib.AsyncReadyCallback @callback, pointer user_data); + public virtual weak GLib.InputStream load_finish (GLib.AsyncResult res, string type, GLib.Error error); + } + [CCode (cheader_filename = "gio/gvfs.h")] + public interface Seekable { + public virtual bool can_seek (); + public virtual bool can_truncate (); + public static GLib.Type get_type (); + public virtual bool seek (int64 offset, GLib.SeekType type, GLib.Cancellable cancellable, GLib.Error err); + public virtual int64 tell (); + public virtual bool truncate (int64 offset, GLib.Cancellable cancellable, GLib.Error err); + } + [CCode (cheader_filename = "gio/gvfs.h")] + public interface Vfs { + public static weak GLib.Vfs get (); + public virtual weak GLib.File get_file_for_path (string path); + public virtual weak GLib.File get_file_for_uri (string uri); + public static GLib.Type get_type (); + public virtual weak GLib.File parse_name (string parse_name); + } + [CCode (cheader_filename = "gio/gvfs.h")] + public interface Volume { + public virtual bool can_eject (); + public virtual bool can_unmount (); + public virtual void eject (GLib.AsyncReadyCallback @callback, pointer user_data); + public virtual bool eject_finish (GLib.AsyncResult result, GLib.Error error); + public virtual weak GLib.Drive get_drive (); + public virtual weak string get_icon (); + public virtual weak string get_name (); + public virtual weak string get_platform_id (); + public virtual weak GLib.File get_root (); + public static GLib.Type get_type (); + public virtual void unmount (GLib.AsyncReadyCallback @callback, pointer user_data); + public virtual bool unmount_finish (GLib.AsyncResult result, GLib.Error error); + public signal void changed (); + } + [ReferenceType] + public struct AsyncResultData { + public pointer async_object; + public weak GLib.Error error; + public pointer user_data; + } + [ReferenceType] + public struct FileAttributeMatcher { + public bool enumerate_namespace (string @namespace); + public weak string enumerate_next (); + public void free (); + public bool matches (string full_name); + public bool matches_only (string full_name); + public FileAttributeMatcher (string attributes); + } + [ReferenceType] + public struct IOJob { + public void send_to_mainloop (GLib.IODataFunc func, pointer user_data, GLib.DestroyNotify notify, bool block); + } + [ReferenceType] + public struct LocalParentFileInfo { + public bool writable; + public bool is_sticky; + public int owner; + } + [ReferenceType] + public struct UnixMount { + public weak string mount_path; + public weak string device_path; + public weak string filesystem_type; + public bool is_read_only; + } + [ReferenceType] + public struct UnixMountPoint { + public weak string mount_path; + public weak string device_path; + public weak string filesystem_type; + public weak string dev_opt; + public bool is_read_only; + public bool is_user_mountable; + public bool is_loopback; + } + public callback void AsyncNextFilesCallback (GLib.FileEnumerator enumerator, GLib.List files, int num_files, pointer user_data, GLib.Error error); + public callback void AsyncReadyCallback (GLib.Object source_object, GLib.AsyncResult res, pointer user_data); + public callback void AsyncStopEnumeratingCallback (GLib.FileEnumerator enumerator, bool result, pointer user_data, GLib.Error error); + public callback bool FDSourceFunc (pointer user_data, GLib.IOCondition condition, int fd); + public callback void FileProgressCallback (int64 current_num_bytes, int64 total_num_bytes, pointer user_data); + public callback void IODataFunc (pointer user_data); + public callback void IOJobFunc (GLib.IOJob job, GLib.Cancellable cancellable, pointer user_data); + public callback void SimpleAsyncThreadFunc (GLib.SimpleAsyncResult res, GLib.Object object, GLib.Cancellable cancellable); + public callback void UnixMountCallback (pointer user_data); +} diff --git a/vapi/glib-2.0.vala b/vapi/glib-2.0.vala index 3365db297..7cc254dfc 100644 --- a/vapi/glib-2.0.vala +++ b/vapi/glib-2.0.vala @@ -1285,14 +1285,14 @@ namespace GLib { IS_EXECUTABLE, EXISTS } - + [ReferenceType (free_function = "fclose")] - [CCode (cname = "FILE", cheader_filename = "stdio.h,glib/gstdio.h")] - public struct File { + [CCode (cname = "FILE", cheader_filename = "stdio.h")] + public struct FileStream { [CCode (cname = "fopen")] - public static ref File open (string path, string mode); + public static FileStream open (string path, string mode); [CCode (cname = "fdopen")] - public static ref File fdopen (int fildes, string mode); + public static FileStream fdopen (int fildes, string mode); [CCode (cname = "fprintf")] [PrintfFormat ()] public void printf (string format, ...); @@ -1304,7 +1304,10 @@ namespace GLib { public void puts (string s); [CCode (cname = "fclose")] public void close (); - + } + + [CCode (cprefix = "g_file_", cheader_filename = "glib/gstdio.h")] + public struct FileUtils { public static bool get_contents (string! filename, out string contents, ref long length, out Error error); public static bool set_contents (string! filename, string contents, long length, out Error error); public static bool test (string filename, FileTest test); @@ -1319,7 +1322,7 @@ namespace GLib { [CCode (cname = "symlink")] public static int symlink (string! oldpath, string! newpath); } - + [ReferenceType (free_function = "g_dir_close")] public struct Dir { public static ref Dir open (string filename, uint _flags, out Error error); @@ -1349,10 +1352,10 @@ namespace GLib { } [CCode (cname = "stdout", cheader_filename = "stdio.h")] - public static File stdout; + public static FileStream stdout; [CCode (cname = "stderr", cheader_filename = "stdio.h")] - public static File stderr; + public static FileStream stderr; /* Shell-related Utilities */ diff --git a/vapi/gtk+-2.0.vala b/vapi/gtk+-2.0.vala index 7529f3ebb..b4a434fd2 100644 --- a/vapi/gtk+-2.0.vala +++ b/vapi/gtk+-2.0.vala @@ -1,4 +1,4 @@ -[CCode (cheader_filename = "gtk/gtk.h")] +[CCode (cprefix = "Gtk", lower_case_cprefix = "gtk_", cheader_filename = "gtk/gtk.h")] namespace Gtk { [CCode (cprefix = "GTK_ACCEL_")] public enum AccelFlags { @@ -4915,6 +4915,7 @@ namespace Gtk { public WindowGroup (); public void remove_window (Gtk.Window window); } + [CCode (cheader_filename = "gtk/gtk.h")] public interface Buildable { public virtual void add_child (Gtk.Builder builder, GLib.Object child, string type); public virtual weak GLib.Object construct_child (Gtk.Builder builder, string name); @@ -4928,6 +4929,7 @@ namespace Gtk { public virtual void set_buildable_property (Gtk.Builder builder, string name, GLib.Value value); public virtual void set_name (string name); } + [CCode (cheader_filename = "gtk/gtk.h")] public interface CellEditable { public static GLib.Type get_type (); [HasEmitter] @@ -4935,6 +4937,7 @@ namespace Gtk { [HasEmitter] public signal void remove_widget (); } + [CCode (cheader_filename = "gtk/gtk.h")] public interface CellLayout { public virtual void add_attribute (Gtk.CellRenderer cell, string attribute, int column); public virtual void clear (); @@ -4947,6 +4950,7 @@ namespace Gtk { public void set_attributes (Gtk.CellRenderer cell); public virtual void set_cell_data_func (Gtk.CellRenderer cell, Gtk.CellLayoutDataFunc func, pointer func_data, GLib.DestroyNotify destroy); } + [CCode (cheader_filename = "gtk/gtk.h")] public interface Editable { public void copy_clipboard (); public void cut_clipboard (); @@ -4966,6 +4970,7 @@ namespace Gtk { public signal void delete_text (int start_pos, int end_pos); public signal void changed (); } + [CCode (cheader_filename = "gtk/gtk.h")] public interface FileChooser { public void add_filter (Gtk.FileFilter filter); public bool add_shortcut_folder (string folder, GLib.Error error); @@ -5018,6 +5023,7 @@ namespace Gtk { public void unselect_filename (string filename); public void unselect_uri (string uri); } + [CCode (cheader_filename = "gtk/gtk.h")] public interface PrintOperationPreview { public virtual void end_preview (); public static GLib.Type get_type (); @@ -5026,6 +5032,7 @@ namespace Gtk { public signal void ready (Gtk.PrintContext context); public signal void got_page_size (Gtk.PrintContext context, Gtk.PageSetup page_setup); } + [CCode (cheader_filename = "gtk/gtk.h")] public interface RecentChooser { public virtual void add_filter (Gtk.RecentFilter filter); public static GLib.Quark error_quark (); @@ -5065,17 +5072,20 @@ namespace Gtk { public signal void selection_changed (); public signal void item_activated (); } + [CCode (cheader_filename = "gtk/gtk.h")] public interface TreeDragDest { public virtual bool drag_data_received (Gtk.TreePath dest, Gtk.SelectionData selection_data); public static GLib.Type get_type (); public virtual bool row_drop_possible (Gtk.TreePath dest_path, Gtk.SelectionData selection_data); } + [CCode (cheader_filename = "gtk/gtk.h")] public interface TreeDragSource { public virtual bool drag_data_delete (Gtk.TreePath path); public virtual bool drag_data_get (Gtk.TreePath path, Gtk.SelectionData selection_data); public static GLib.Type get_type (); public virtual bool row_draggable (Gtk.TreePath path); } + [CCode (cheader_filename = "gtk/gtk.h")] public interface TreeModel { public void @foreach (Gtk.TreeModelForeachFunc func, pointer user_data); public void get (ref Gtk.TreeIter iter, ...); @@ -5109,6 +5119,7 @@ namespace Gtk { [HasEmitter] public signal void rows_reordered (Gtk.TreePath path, ref Gtk.TreeIter iter, int new_order); } + [CCode (cheader_filename = "gtk/gtk.h")] public interface TreeSortable { public virtual bool get_sort_column_id (int sort_column_id, Gtk.SortType order); public static GLib.Type get_type (); @@ -6316,7 +6327,7 @@ namespace Gtk { public static void show_about_dialog (Gtk.Window parent, string first_property_name, ...); public static void text_layout_draw (pointer layout, Gtk.Widget widget, Gdk.Drawable drawable, Gdk.GC cursor_gc, int x_offset, int y_offset, int x, int y, int width, int height, GLib.List widgets); } -[CCode (cheader_filename = "gtk/gtk.h")] +[CCode (cprefix = "Gtk", lower_case_cprefix = "gtk_", cheader_filename = "gtk/gtk.h")] namespace Gtk { public struct Allocation { public int x; diff --git a/vapi/packages/gio-standalone/gio-standalone.files b/vapi/packages/gio-standalone/gio-standalone.files new file mode 100644 index 000000000..2554b9087 --- /dev/null +++ b/vapi/packages/gio-standalone/gio-standalone.files @@ -0,0 +1 @@ +gio diff --git a/vapi/packages/gio-standalone/gio-standalone.gidl b/vapi/packages/gio-standalone/gio-standalone.gidl new file mode 100644 index 000000000..ba6a8d99c --- /dev/null +++ b/vapi/packages/gio-standalone/gio-standalone.gidl @@ -0,0 +1,3559 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/vapi/packages/gio-standalone/gio-standalone.metadata b/vapi/packages/gio-standalone/gio-standalone.metadata new file mode 100644 index 000000000..101660a51 --- /dev/null +++ b/vapi/packages/gio-standalone/gio-standalone.metadata @@ -0,0 +1,4 @@ +GLib cprefix="G" lower_case_cprefix="g_" cheader_filename="gio/gvfs.h" +GFile cheader_filename="gio/gfile.h" +GMountOperation::reply has_emitter="1" + diff --git a/vapi/packages/gio-standalone/gio-standalone.namespace b/vapi/packages/gio-standalone/gio-standalone.namespace new file mode 100644 index 000000000..d7425e556 --- /dev/null +++ b/vapi/packages/gio-standalone/gio-standalone.namespace @@ -0,0 +1 @@ +GLib diff --git a/vapi/pango.vala b/vapi/pango.vala index 3a6bb3b97..c507991fe 100644 --- a/vapi/pango.vala +++ b/vapi/pango.vala @@ -1,4 +1,4 @@ -[CCode (cheader_filename = "pango/pango.h")] +[CCode (cprefix = "Pango", lower_case_cprefix = "pango_", cheader_filename = "pango/pango.h")] namespace Pango { [CCode (cprefix = "PANGO_ALIGN_")] public enum Alignment { @@ -806,7 +806,7 @@ namespace Pango { public static bool parse_variant (string str, Pango.Variant variant, bool warn); public static bool parse_weight (string str, Pango.Weight weight, bool warn); public static void quantize_line_geometry (int thickness, int position); - public static int read_line (GLib.File stream, GLib.String str); + public static int read_line (GLib.FileStream stream, GLib.String str); public static weak GLib.List reorder_items (GLib.List logical_items); public static bool scan_int (string pos, int @out); public static bool scan_string (string pos, GLib.String @out); diff --git a/vapigen/valagidlparser.vala b/vapigen/valagidlparser.vala index 8180d6a00..d8da32cb1 100644 --- a/vapigen/valagidlparser.vala +++ b/vapigen/valagidlparser.vala @@ -56,9 +56,9 @@ public class Vala.GIdlParser : CodeVisitor { codenode_attributes_map = new HashTable.full (str_hash, str_equal, g_free, g_free); - if (File.test (metadata_filename, FileTest.EXISTS)) { + if (FileUtils.test (metadata_filename, FileTest.EXISTS)) { string metadata; - File.get_contents (metadata_filename, out metadata, null, out error); + FileUtils.get_contents (metadata_filename, out metadata, null, out error); foreach (string line in metadata.split ("\n")) { var line_parts = line.split (" ", 2); @@ -83,8 +83,26 @@ public class Vala.GIdlParser : CodeVisitor { source_file.add_namespace (ns); } } - - private ref Namespace parse_module (IdlModule! module) { + + private string! fix_type_name (string! type_name, IdlModule! module) { + if (type_name.has_prefix (module.name)) { + return type_name.offset (module.name.len ()); + } else if (module.name == "GLib" && type_name.has_prefix ("G")) { + return type_name.offset (1); + } + return type_name; + } + + private string! fix_const_name (string! const_name, IdlModule! module) { + if (const_name.has_prefix (module.name.up () + "_")) { + return const_name.offset (module.name.len () + 1); + } else if (module.name == "GLib" && const_name.has_prefix ("G_")) { + return const_name.offset (2); + } + return const_name; + } + + private Namespace parse_module (IdlModule! module) { var ns = new Namespace (module.name, current_source_reference); var attributes = get_attributes (ns.name); @@ -93,6 +111,10 @@ public class Vala.GIdlParser : CodeVisitor { var nv = attr.split ("=", 2); if (nv[0] == "cheader_filename") { ns.set_cheader_filename (eval (nv[1])); + } else if (nv[0] == "cprefix") { + ns.set_cprefix (eval (nv[1])); + } else if (nv[0] == "lower_case_cprefix") { + ns.set_lower_case_cprefix (eval (nv[1])); } } } @@ -103,49 +125,35 @@ public class Vala.GIdlParser : CodeVisitor { if (cb == null) { continue; } - if (cb.name.has_prefix (module.name)) { - cb.name = cb.name.offset (module.name.len ()); - } + cb.name = fix_type_name (cb.name, module); ns.add_callback (cb); } else if (node.type == IdlNodeTypeId.STRUCT) { var st = parse_struct ((IdlNodeStruct) node); if (st == null) { continue; } - if (st.name.has_prefix (module.name)) { - st.name = st.name.offset (module.name.len ()); - } + st.name = fix_type_name (st.name, module); ns.add_struct (st); } else if (node.type == IdlNodeTypeId.BOXED) { var st = parse_boxed ((IdlNodeBoxed) node); - if (st.name.has_prefix (module.name)) { - st.name = st.name.offset (module.name.len ()); - } + st.name = fix_type_name (st.name, module); ns.add_struct (st); st.set_type_id (st.get_upper_case_cname ("TYPE_")); } else if (node.type == IdlNodeTypeId.ENUM) { var en = parse_enum ((IdlNodeEnum) node); - if (en.name.has_prefix (module.name)) { - en.name = en.name.offset (module.name.len ()); - } + en.name = fix_type_name (en.name, module); ns.add_enum (en); } else if (node.type == IdlNodeTypeId.OBJECT) { var cl = parse_object ((IdlNodeInterface) node); - if (cl.name.has_prefix (module.name)) { - cl.name = cl.name.offset (module.name.len ()); - } + cl.name = fix_type_name (cl.name, module); ns.add_class (cl); } else if (node.type == IdlNodeTypeId.INTERFACE) { var iface = parse_interface ((IdlNodeInterface) node); - if (iface.name.has_prefix (module.name)) { - iface.name = iface.name.offset (module.name.len ()); - } + iface.name = fix_type_name (iface.name, module); ns.add_interface (iface); } else if (node.type == IdlNodeTypeId.CONSTANT) { var c = parse_constant ((IdlNodeConstant) node); - if (c.name.has_prefix (module.name.up ())) { - c.name = c.name.offset (module.name.len () + 1); - } + c.name = fix_const_name (c.name, module); ns.add_constant (c); } else if (node.type == IdlNodeTypeId.FUNCTION) { var m = parse_function ((IdlNodeFunction) node); @@ -389,11 +397,21 @@ public class Vala.GIdlParser : CodeVisitor { return cl; } - - private ref Interface parse_interface (IdlNodeInterface! node) { + + private Interface parse_interface (IdlNodeInterface! node) { var iface = new Interface (node.gtype_name, current_source_reference); iface.access = MemberAccessibility.PUBLIC; + var attributes = get_attributes (iface.name); + if (attributes != null) { + foreach (string attr in attributes) { + var nv = attr.split ("=", 2); + if (nv[0] == "cheader_filename") { + iface.add_cheader_filename (eval (nv[1])); + } + } + } + foreach (string prereq_name in node.prerequisites) { var prereq = new TypeReference (); parse_type_string (prereq, prereq_name); @@ -518,8 +536,10 @@ public class Vala.GIdlParser : CodeVisitor { type.type_name = "ushort"; } else if (n == "gshort") { type.type_name = "short"; - } else if (n == "gconstpointer") { + } else if (n == "gconstpointer" || n == "void") { type.type_name = "pointer"; + } else if (n == "goffset") { + type.type_name = "int64"; } else if (n == "value_array") { type.namespace_name = "GLib"; type.type_name = "ValueArray"; @@ -529,7 +549,7 @@ public class Vala.GIdlParser : CodeVisitor { type.type_name = "int"; } else if (n == "FILE") { type.namespace_name = "GLib"; - type.type_name = "File"; + type.type_name = "FileStream"; } else { parse_type_string (type, n); if (type_node.is_pointer && is_value_type (n)) { diff --git a/vapigen/valavapigen.vala b/vapigen/valavapigen.vala index 1540e9628..bde1bd3b3 100644 --- a/vapigen/valavapigen.vala +++ b/vapigen/valavapigen.vala @@ -61,19 +61,19 @@ class Vala.VAPIGen { if (vapi_directories != null) { foreach (string vapidir in vapi_directories) { var filename = Path.build_filename (vapidir, basename, null); - if (File.test (filename, FileTest.EXISTS)) { + if (FileUtils.test (filename, FileTest.EXISTS)) { return filename; } } } var filename = Path.build_filename ("/usr/local/share/vala/vapi", basename, null); - if (File.test (filename, FileTest.EXISTS)) { + if (FileUtils.test (filename, FileTest.EXISTS)) { return filename; } filename = Path.build_filename ("/usr/share/vala/vapi", basename, null); - if (File.test (filename, FileTest.EXISTS)) { + if (FileUtils.test (filename, FileTest.EXISTS)) { return filename; } @@ -114,7 +114,7 @@ class Vala.VAPIGen { } foreach (string source in sources) { - if (File.test (source, FileTest.EXISTS)) { + if (FileUtils.test (source, FileTest.EXISTS)) { context.add_source_file (new SourceFile (context, source)); } else { Report.error (null, "%s not found".printf (source));