pygobject r731 - in trunk: . gio



Author: johan
Date: Sat Jan 19 13:28:51 2008
New Revision: 731
URL: http://svn.gnome.org/viewvc/pygobject?rev=731&view=rev

Log:
2008-01-19  Johan Dahlin  <johan gnome org>

	* gio/gio.override: Implement InputStream.read efficiently without
	copying the strings, based on the standard libararys file.read() 
	implementation.

	* gio/gio-types.defs (Cancellable): Add wrapper.

	* gio/gio.defs (replace): Do not require cancellable argument 
	to be specified, default to NULL if not.



Modified:
   trunk/ChangeLog
   trunk/gio/gio-types.defs
   trunk/gio/gio.defs
   trunk/gio/gio.override

Modified: trunk/gio/gio-types.defs
==============================================================================
--- trunk/gio/gio-types.defs	(original)
+++ trunk/gio/gio-types.defs	Sat Jan 19 13:28:51 2008
@@ -60,6 +60,13 @@
   (gtype-id "G_TYPE_APP_LAUNCH_CONTEXT")
 )
 
+(define-object Cancellable
+  (in-module "gio")
+  (parent "GObject")
+  (c-name "GCancellable")
+  (gtype-id "G_TYPE_CANCELLABLE")
+)
+
 (define-object Drive
   (in-module "gio")
   (c-name "GDrive")
@@ -87,6 +94,13 @@
   (gtype-id "G_TYPE_INPUT_STREAM")
 )
 
+(define-object FileInputStream
+  (in-module "gio")
+  (parent "GInputStream")
+  (c-name "GFileInputStream")
+  (gtype-id "G_TYPE_FILE_INPUT_STREAM")
+)
+
 (define-object FilterInputStream
   (in-module "gio")
   (parent "GInputStream")

Modified: trunk/gio/gio.defs
==============================================================================
--- trunk/gio/gio.defs	(original)
+++ trunk/gio/gio.defs	Sat Jan 19 13:28:51 2008
@@ -321,7 +321,7 @@
   (return-type "gssize")
   (parameters
     '("gssize" "count")
-    '("GCancellable*" "cancellable")
+    '("GCancellable*" "cancellable" (default "NULL"))
     '("GError**" "error")
   )
 )
@@ -333,7 +333,7 @@
   (parameters
     '("gssize" "count")
     '("int" "io_priority")
-    '("GCancellable*" "cancellable")
+    '("GCancellable*" "cancellable" (default "NULL"))
     '("GAsyncReadyCallback" "callback")
     '("gpointer" "user_data")
   )
@@ -354,7 +354,7 @@
   (c-name "g_buffered_input_stream_read_byte")
   (return-type "int")
   (parameters
-    '("GCancellable*" "cancellable")
+    '("GCancellable*" "cancellable" (default "NULL"))
     '("GError**" "error")
   )
 )
@@ -616,7 +616,7 @@
   (c-name "g_data_input_stream_read_byte")
   (return-type "guchar")
   (parameters
-    '("GCancellable*" "cancellable")
+    '("GCancellable*" "cancellable" (default "NULL"))
     '("GError**" "error")
   )
 )
@@ -626,7 +626,7 @@
   (c-name "g_data_input_stream_read_int16")
   (return-type "gint16")
   (parameters
-    '("GCancellable*" "cancellable")
+    '("GCancellable*" "cancellable" (default "NULL"))
     '("GError**" "error")
   )
 )
@@ -636,7 +636,7 @@
   (c-name "g_data_input_stream_read_uint16")
   (return-type "guint16")
   (parameters
-    '("GCancellable*" "cancellable")
+    '("GCancellable*" "cancellable" (default "NULL"))
     '("GError**" "error")
   )
 )
@@ -646,7 +646,7 @@
   (c-name "g_data_input_stream_read_int32")
   (return-type "gint32")
   (parameters
-    '("GCancellable*" "cancellable")
+    '("GCancellable*" "cancellable" (default "NULL"))
     '("GError**" "error")
   )
 )
@@ -656,7 +656,7 @@
   (c-name "g_data_input_stream_read_uint32")
   (return-type "guint32")
   (parameters
-    '("GCancellable*" "cancellable")
+    '("GCancellable*" "cancellable" (default "NULL"))
     '("GError**" "error")
   )
 )
@@ -666,7 +666,7 @@
   (c-name "g_data_input_stream_read_int64")
   (return-type "gint64")
   (parameters
-    '("GCancellable*" "cancellable")
+    '("GCancellable*" "cancellable" (default "NULL"))
     '("GError**" "error")
   )
 )
@@ -676,7 +676,7 @@
   (c-name "g_data_input_stream_read_uint64")
   (return-type "guint64")
   (parameters
-    '("GCancellable*" "cancellable")
+    '("GCancellable*" "cancellable" (default "NULL"))
     '("GError**" "error")
   )
 )
@@ -687,7 +687,7 @@
   (return-type "char*")
   (parameters
     '("gsize*" "length")
-    '("GCancellable*" "cancellable")
+    '("GCancellable*" "cancellable" (default "NULL"))
     '("GError**" "error")
   )
 )
@@ -699,7 +699,7 @@
   (parameters
     '("const-gchar*" "stop_chars")
     '("gsize*" "length")
-    '("GCancellable*" "cancellable")
+    '("GCancellable*" "cancellable" (default "NULL"))
     '("GError**" "error")
   )
 )
@@ -743,7 +743,7 @@
   (return-type "gboolean")
   (parameters
     '("guchar" "data")
-    '("GCancellable*" "cancellable")
+    '("GCancellable*" "cancellable" (default "NULL"))
     '("GError**" "error")
   )
 )
@@ -754,7 +754,7 @@
   (return-type "gboolean")
   (parameters
     '("gint16" "data")
-    '("GCancellable*" "cancellable")
+    '("GCancellable*" "cancellable" (default "NULL"))
     '("GError**" "error")
   )
 )
@@ -765,7 +765,7 @@
   (return-type "gboolean")
   (parameters
     '("guint16" "data")
-    '("GCancellable*" "cancellable")
+    '("GCancellable*" "cancellable" (default "NULL"))
     '("GError**" "error")
   )
 )
@@ -776,7 +776,7 @@
   (return-type "gboolean")
   (parameters
     '("gint32" "data")
-    '("GCancellable*" "cancellable")
+    '("GCancellable*" "cancellable" (default "NULL"))
     '("GError**" "error")
   )
 )
@@ -787,7 +787,7 @@
   (return-type "gboolean")
   (parameters
     '("guint32" "data")
-    '("GCancellable*" "cancellable")
+    '("GCancellable*" "cancellable" (default "NULL"))
     '("GError**" "error")
   )
 )
@@ -798,7 +798,7 @@
   (return-type "gboolean")
   (parameters
     '("gint64" "data")
-    '("GCancellable*" "cancellable")
+    '("GCancellable*" "cancellable" (default "NULL"))
     '("GError**" "error")
   )
 )
@@ -809,7 +809,7 @@
   (return-type "gboolean")
   (parameters
     '("guint64" "data")
-    '("GCancellable*" "cancellable")
+    '("GCancellable*" "cancellable" (default "NULL"))
     '("GError**" "error")
   )
 )
@@ -820,7 +820,7 @@
   (return-type "gboolean")
   (parameters
     '("const-char*" "str")
-    '("GCancellable*" "cancellable")
+    '("GCancellable*" "cancellable" (default "NULL"))
     '("GError**" "error")
   )
 )
@@ -897,7 +897,7 @@
   (return-type "none")
   (parameters
     '("GMountUnmountFlags" "flags")
-    '("GCancellable*" "cancellable")
+    '("GCancellable*" "cancellable" (default "NULL"))
     '("GAsyncReadyCallback" "callback")
     '("gpointer" "user_data")
   )
@@ -918,7 +918,7 @@
   (c-name "g_drive_poll_for_media")
   (return-type "none")
   (parameters
-    '("GCancellable*" "cancellable")
+    '("GCancellable*" "cancellable" (default "NULL"))
     '("GAsyncReadyCallback" "callback")
     '("gpointer" "user_data")
   )
@@ -1004,7 +1004,7 @@
   (c-name "g_file_enumerator_next_file")
   (return-type "GFileInfo*")
   (parameters
-    '("GCancellable*" "cancellable")
+    '("GCancellable*" "cancellable" (default "NULL"))
     '("GError**" "error")
   )
 )
@@ -1014,7 +1014,7 @@
   (c-name "g_file_enumerator_close")
   (return-type "gboolean")
   (parameters
-    '("GCancellable*" "cancellable")
+    '("GCancellable*" "cancellable" (default "NULL"))
     '("GError**" "error")
   )
 )
@@ -1026,7 +1026,7 @@
   (parameters
     '("int" "num_files")
     '("int" "io_priority")
-    '("GCancellable*" "cancellable")
+    '("GCancellable*" "cancellable" (default "NULL"))
     '("GAsyncReadyCallback" "callback")
     '("gpointer" "user_data")
   )
@@ -1048,7 +1048,7 @@
   (return-type "none")
   (parameters
     '("int" "io_priority")
-    '("GCancellable*" "cancellable")
+    '("GCancellable*" "cancellable" (default "NULL"))
     '("GAsyncReadyCallback" "callback")
     '("gpointer" "user_data")
   )
@@ -1251,7 +1251,7 @@
   (c-name "g_file_read")
   (return-type "GFileInputStream*")
   (parameters
-    '("GCancellable*" "cancellable")
+    '("GCancellable*" "cancellable" (default "NULL"))
     '("GError**" "error")
   )
 )
@@ -1262,7 +1262,7 @@
   (return-type "none")
   (parameters
     '("int" "io_priority")
-    '("GCancellable*" "cancellable")
+    '("GCancellable*" "cancellable" (default "NULL"))
     '("GAsyncReadyCallback" "callback")
     '("gpointer" "user_data")
   )
@@ -1284,7 +1284,7 @@
   (return-type "GFileOutputStream*")
   (parameters
     '("GFileCreateFlags" "flags")
-    '("GCancellable*" "cancellable")
+    '("GCancellable*" "cancellable" (default "NULL"))
     '("GError**" "error")
   )
 )
@@ -1295,7 +1295,7 @@
   (return-type "GFileOutputStream*")
   (parameters
     '("GFileCreateFlags" "flags")
-    '("GCancellable*" "cancellable")
+    '("GCancellable*" "cancellable" (default "NULL"))
     '("GError**" "error")
   )
 )
@@ -1308,7 +1308,7 @@
     '("const-char*" "etag")
     '("gboolean" "make_backup")
     '("GFileCreateFlags" "flags")
-    '("GCancellable*" "cancellable")
+    '("GCancellable*" "cancellable" (default "NULL"))
     '("GError**" "error")
   )
 )
@@ -1320,7 +1320,7 @@
   (parameters
     '("GFileCreateFlags" "flags")
     '("int" "io_priority")
-    '("GCancellable*" "cancellable")
+    '("GCancellable*" "cancellable" (default "NULL"))
     '("GAsyncReadyCallback" "callback")
     '("gpointer" "user_data")
   )
@@ -1343,7 +1343,7 @@
   (parameters
     '("GFileCreateFlags" "flags")
     '("int" "io_priority")
-    '("GCancellable*" "cancellable")
+    '("GCancellable*" "cancellable" (default "NULL"))
     '("GAsyncReadyCallback" "callback")
     '("gpointer" "user_data")
   )
@@ -1368,7 +1368,7 @@
     '("gboolean" "make_backup")
     '("GFileCreateFlags" "flags")
     '("int" "io_priority")
-    '("GCancellable*" "cancellable")
+    '("GCancellable*" "cancellable" (default "NULL"))
     '("GAsyncReadyCallback" "callback")
     '("gpointer" "user_data")
   )
@@ -1389,7 +1389,7 @@
   (c-name "g_file_query_exists")
   (return-type "gboolean")
   (parameters
-    '("GCancellable*" "cancellable")
+    '("GCancellable*" "cancellable" (default "NULL"))
   )
 )
 
@@ -1400,7 +1400,7 @@
   (parameters
     '("const-char*" "attributes")
     '("GFileQueryInfoFlags" "flags")
-    '("GCancellable*" "cancellable")
+    '("GCancellable*" "cancellable" (default "NULL"))
     '("GError**" "error")
   )
 )
@@ -1413,7 +1413,7 @@
     '("const-char*" "attributes")
     '("GFileQueryInfoFlags" "flags")
     '("int" "io_priority")
-    '("GCancellable*" "cancellable")
+    '("GCancellable*" "cancellable" (default "NULL"))
     '("GAsyncReadyCallback" "callback")
     '("gpointer" "user_data")
   )
@@ -1435,7 +1435,7 @@
   (return-type "GFileInfo*")
   (parameters
     '("const-char*" "attributes")
-    '("GCancellable*" "cancellable")
+    '("GCancellable*" "cancellable" (default "NULL"))
     '("GError**" "error")
   )
 )
@@ -1445,7 +1445,7 @@
   (c-name "g_file_find_enclosing_mount")
   (return-type "GMount*")
   (parameters
-    '("GCancellable*" "cancellable")
+    '("GCancellable*" "cancellable" (default "NULL"))
     '("GError**" "error")
   )
 )
@@ -1456,7 +1456,7 @@
   (return-type "none")
   (parameters
     '("int" "io_priority")
-    '("GCancellable*" "cancellable")
+    '("GCancellable*" "cancellable" (default "NULL"))
     '("GAsyncReadyCallback" "callback")
     '("gpointer" "user_data")
   )
@@ -1479,7 +1479,7 @@
   (parameters
     '("const-char*" "attributes")
     '("GFileQueryInfoFlags" "flags")
-    '("GCancellable*" "cancellable")
+    '("GCancellable*" "cancellable" (default "NULL"))
     '("GError**" "error")
   )
 )
@@ -1492,7 +1492,7 @@
     '("const-char*" "attributes")
     '("GFileQueryInfoFlags" "flags")
     '("int" "io_priority")
-    '("GCancellable*" "cancellable")
+    '("GCancellable*" "cancellable" (default "NULL"))
     '("GAsyncReadyCallback" "callback")
     '("gpointer" "user_data")
   )
@@ -1514,7 +1514,7 @@
   (return-type "GFile*")
   (parameters
     '("const-char*" "display_name")
-    '("GCancellable*" "cancellable")
+    '("GCancellable*" "cancellable" (default "NULL"))
     '("GError**" "error")
   )
 )
@@ -1526,7 +1526,7 @@
   (parameters
     '("const-char*" "display_name")
     '("int" "io_priority")
-    '("GCancellable*" "cancellable")
+    '("GCancellable*" "cancellable" (default "NULL"))
     '("GAsyncReadyCallback" "callback")
     '("gpointer" "user_data")
   )
@@ -1547,7 +1547,7 @@
   (c-name "g_file_delete")
   (return-type "gboolean")
   (parameters
-    '("GCancellable*" "cancellable")
+    '("GCancellable*" "cancellable" (default "NULL"))
     '("GError**" "error")
   )
 )
@@ -1557,7 +1557,7 @@
   (c-name "g_file_trash")
   (return-type "gboolean")
   (parameters
-    '("GCancellable*" "cancellable")
+    '("GCancellable*" "cancellable" (default "NULL"))
     '("GError**" "error")
   )
 )
@@ -1569,7 +1569,7 @@
   (parameters
     '("GFile*" "destination")
     '("GFileCopyFlags" "flags")
-    '("GCancellable*" "cancellable")
+    '("GCancellable*" "cancellable" (default "NULL"))
     '("GFileProgressCallback" "progress_callback")
     '("gpointer" "progress_callback_data")
     '("GError**" "error")
@@ -1583,7 +1583,7 @@
   (parameters
     '("GFile*" "destination")
     '("GFileCopyFlags" "flags")
-    '("GCancellable*" "cancellable")
+    '("GCancellable*" "cancellable" (default "NULL"))
     '("GFileProgressCallback" "progress_callback")
     '("gpointer" "progress_callback_data")
     '("GError**" "error")
@@ -1595,7 +1595,7 @@
   (c-name "g_file_make_directory")
   (return-type "gboolean")
   (parameters
-    '("GCancellable*" "cancellable")
+    '("GCancellable*" "cancellable" (default "NULL"))
     '("GError**" "error")
   )
 )
@@ -1606,7 +1606,7 @@
   (return-type "gboolean")
   (parameters
     '("const-char*" "symlink_value")
-    '("GCancellable*" "cancellable")
+    '("GCancellable*" "cancellable" (default "NULL"))
     '("GError**" "error")
   )
 )
@@ -1616,7 +1616,7 @@
   (c-name "g_file_query_settable_attributes")
   (return-type "GFileAttributeInfoList*")
   (parameters
-    '("GCancellable*" "cancellable")
+    '("GCancellable*" "cancellable" (default "NULL"))
     '("GError**" "error")
   )
 )
@@ -1626,7 +1626,7 @@
   (c-name "g_file_query_writable_namespaces")
   (return-type "GFileAttributeInfoList*")
   (parameters
-    '("GCancellable*" "cancellable")
+    '("GCancellable*" "cancellable" (default "NULL"))
     '("GError**" "error")
   )
 )
@@ -1640,7 +1640,7 @@
     '("GFileAttributeType" "type")
     '("gpointer" "value_p")
     '("GFileQueryInfoFlags" "flags")
-    '("GCancellable*" "cancellable")
+    '("GCancellable*" "cancellable" (default "NULL"))
     '("GError**" "error")
   )
 )
@@ -1652,7 +1652,7 @@
   (parameters
     '("GFileInfo*" "info")
     '("GFileQueryInfoFlags" "flags")
-    '("GCancellable*" "cancellable")
+    '("GCancellable*" "cancellable" (default "NULL"))
     '("GError**" "error")
   )
 )
@@ -1665,7 +1665,7 @@
     '("GFileInfo*" "info")
     '("GFileQueryInfoFlags" "flags")
     '("int" "io_priority")
-    '("GCancellable*" "cancellable")
+    '("GCancellable*" "cancellable" (default "NULL"))
     '("GAsyncReadyCallback" "callback")
     '("gpointer" "user_data")
   )
@@ -1690,7 +1690,7 @@
     '("const-char*" "attribute")
     '("const-char*" "value")
     '("GFileQueryInfoFlags" "flags")
-    '("GCancellable*" "cancellable")
+    '("GCancellable*" "cancellable" (default "NULL"))
     '("GError**" "error")
   )
 )
@@ -1703,7 +1703,7 @@
     '("const-char*" "attribute")
     '("const-char*" "value")
     '("GFileQueryInfoFlags" "flags")
-    '("GCancellable*" "cancellable")
+    '("GCancellable*" "cancellable" (default "NULL"))
     '("GError**" "error")
   )
 )
@@ -1716,7 +1716,7 @@
     '("const-char*" "attribute")
     '("guint32" "value")
     '("GFileQueryInfoFlags" "flags")
-    '("GCancellable*" "cancellable")
+    '("GCancellable*" "cancellable" (default "NULL"))
     '("GError**" "error")
   )
 )
@@ -1729,7 +1729,7 @@
     '("const-char*" "attribute")
     '("gint32" "value")
     '("GFileQueryInfoFlags" "flags")
-    '("GCancellable*" "cancellable")
+    '("GCancellable*" "cancellable" (default "NULL"))
     '("GError**" "error")
   )
 )
@@ -1742,7 +1742,7 @@
     '("const-char*" "attribute")
     '("guint64" "value")
     '("GFileQueryInfoFlags" "flags")
-    '("GCancellable*" "cancellable")
+    '("GCancellable*" "cancellable" (default "NULL"))
     '("GError**" "error")
   )
 )
@@ -1755,7 +1755,7 @@
     '("const-char*" "attribute")
     '("gint64" "value")
     '("GFileQueryInfoFlags" "flags")
-    '("GCancellable*" "cancellable")
+    '("GCancellable*" "cancellable" (default "NULL"))
     '("GError**" "error")
   )
 )
@@ -1766,7 +1766,7 @@
   (return-type "none")
   (parameters
     '("GMountOperation*" "mount_operation")
-    '("GCancellable*" "cancellable")
+    '("GCancellable*" "cancellable" (default "NULL"))
     '("GAsyncReadyCallback" "callback")
     '("gpointer" "user_data")
   )
@@ -1788,7 +1788,7 @@
   (return-type "none")
   (parameters
     '("GMountOperation*" "mount_operation")
-    '("GCancellable*" "cancellable")
+    '("GCancellable*" "cancellable" (default "NULL"))
     '("GAsyncReadyCallback" "callback")
     '("gpointer" "user_data")
   )
@@ -1810,7 +1810,7 @@
   (return-type "none")
   (parameters
     '("GMountUnmountFlags" "flags")
-    '("GCancellable*" "cancellable")
+    '("GCancellable*" "cancellable" (default "NULL"))
     '("GAsyncReadyCallback" "callback")
     '("gpointer" "user_data")
   )
@@ -1832,7 +1832,7 @@
   (return-type "none")
   (parameters
     '("GMountUnmountFlags" "flags")
-    '("GCancellable*" "cancellable")
+    '("GCancellable*" "cancellable" (default "NULL"))
     '("GAsyncReadyCallback" "callback")
     '("gpointer" "user_data")
   )
@@ -1855,7 +1855,7 @@
   (parameters
     '("GFile*" "destination")
     '("GFileCopyFlags" "flags")
-    '("GCancellable*" "cancellable")
+    '("GCancellable*" "cancellable" (default "NULL"))
     '("GError**" "error")
   )
 )
@@ -1866,7 +1866,7 @@
   (return-type "GFileMonitor*")
   (parameters
     '("GFileMonitorFlags" "flags")
-    '("GCancellable*" "cancellable")
+    '("GCancellable*" "cancellable" (default "NULL"))
     '("GError**" "error")
   )
 )
@@ -1877,7 +1877,7 @@
   (return-type "GFileMonitor*")
   (parameters
     '("GFileMonitorFlags" "flags")
-    '("GCancellable*" "cancellable")
+    '("GCancellable*" "cancellable" (default "NULL"))
     '("GError**" "error")
   )
 )
@@ -1887,7 +1887,7 @@
   (c-name "g_file_load_contents")
   (return-type "gboolean")
   (parameters
-    '("GCancellable*" "cancellable")
+    '("GCancellable*" "cancellable" (default "NULL"))
     '("char**" "contents")
     '("gsize*" "length")
     '("char**" "etag_out")
@@ -1900,7 +1900,7 @@
   (c-name "g_file_load_contents_async")
   (return-type "none")
   (parameters
-    '("GCancellable*" "cancellable")
+    '("GCancellable*" "cancellable" (default "NULL"))
     '("GAsyncReadyCallback" "callback")
     '("gpointer" "user_data")
   )
@@ -1924,7 +1924,7 @@
   (c-name "g_file_load_partial_contents_async")
   (return-type "none")
   (parameters
-    '("GCancellable*" "cancellable")
+    '("GCancellable*" "cancellable" (default "NULL"))
     '("GFileReadMoreCallback" "read_more_callback")
     '("GAsyncReadyCallback" "callback")
     '("gpointer" "user_data")
@@ -1955,7 +1955,7 @@
     '("gboolean" "make_backup")
     '("GFileCreateFlags" "flags")
     '("char**" "new_etag")
-    '("GCancellable*" "cancellable")
+    '("GCancellable*" "cancellable" (default "NULL"))
     '("GError**" "error")
   )
 )
@@ -1970,7 +1970,7 @@
     '("const-char*" "etag")
     '("gboolean" "make_backup")
     '("GFileCreateFlags" "flags")
-    '("GCancellable*" "cancellable")
+    '("GCancellable*" "cancellable" (default "NULL"))
     '("GAsyncReadyCallback" "callback")
     '("gpointer" "user_data")
   )
@@ -2552,7 +2552,7 @@
   (return-type "GFileInfo*")
   (parameters
     '("char*" "attributes")
-    '("GCancellable*" "cancellable")
+    '("GCancellable*" "cancellable" (default "NULL"))
     '("GError**" "error")
   )
 )
@@ -2564,7 +2564,7 @@
   (parameters
     '("char*" "attributes")
     '("int" "io_priority")
-    '("GCancellable*" "cancellable")
+    '("GCancellable*" "cancellable" (default "NULL"))
     '("GAsyncReadyCallback" "callback")
     '("gpointer" "user_data")
   )
@@ -2599,7 +2599,7 @@
   (parameters
     '("goffset" "offset")
     '("GSeekType" "type")
-    '("GCancellable*" "cancellable")
+    '("GCancellable*" "cancellable" (default "NULL"))
     '("GError**" "error")
   )
 )
@@ -2702,7 +2702,7 @@
   (return-type "GFileInfo*")
   (parameters
     '("char*" "attributes")
-    '("GCancellable*" "cancellable")
+    '("GCancellable*" "cancellable" (default "NULL"))
     '("GError**" "error")
   )
 )
@@ -2714,7 +2714,7 @@
   (parameters
     '("char*" "attributes")
     '("int" "io_priority")
-    '("GCancellable*" "cancellable")
+    '("GCancellable*" "cancellable" (default "NULL"))
     '("GAsyncReadyCallback" "callback")
     '("gpointer" "user_data")
   )
@@ -2755,7 +2755,7 @@
   (parameters
     '("goffset" "offset")
     '("GSeekType" "type")
-    '("GCancellable*" "cancellable")
+    '("GCancellable*" "cancellable" (default "NULL"))
     '("GError**" "error")
   )
 )
@@ -2772,7 +2772,7 @@
   (return-type "gboolean")
   (parameters
     '("goffset" "size")
-    '("GCancellable*" "cancellable")
+    '("GCancellable*" "cancellable" (default "NULL"))
     '("GError**" "error")
   )
 )
@@ -2849,7 +2849,7 @@
   (parameters
     '("void*" "buffer")
     '("gsize" "count")
-    '("GCancellable*" "cancellable")
+    '("GCancellable*" "cancellable" (default "NULL"))
     '("GError**" "error")
   )
 )
@@ -2862,7 +2862,7 @@
     '("void*" "buffer")
     '("gsize" "count")
     '("gsize*" "bytes_read")
-    '("GCancellable*" "cancellable")
+    '("GCancellable*" "cancellable" (default "NULL"))
     '("GError**" "error")
   )
 )
@@ -2873,7 +2873,7 @@
   (return-type "gssize")
   (parameters
     '("gsize" "count")
-    '("GCancellable*" "cancellable")
+    '("GCancellable*" "cancellable" (default "NULL"))
     '("GError**" "error")
   )
 )
@@ -2883,7 +2883,7 @@
   (c-name "g_input_stream_close")
   (return-type "gboolean")
   (parameters
-    '("GCancellable*" "cancellable")
+    '("GCancellable*" "cancellable" (default "NULL"))
     '("GError**" "error")
   )
 )
@@ -2896,7 +2896,7 @@
     '("void*" "buffer")
     '("gsize" "count")
     '("int" "io_priority")
-    '("GCancellable*" "cancellable")
+    '("GCancellable*" "cancellable" (default "NULL"))
     '("GAsyncReadyCallback" "callback")
     '("gpointer" "user_data")
   )
@@ -2919,7 +2919,7 @@
   (parameters
     '("gsize" "count")
     '("int" "io_priority")
-    '("GCancellable*" "cancellable")
+    '("GCancellable*" "cancellable" (default "NULL"))
     '("GAsyncReadyCallback" "callback")
     '("gpointer" "user_data")
   )
@@ -2941,7 +2941,7 @@
   (return-type "none")
   (parameters
     '("int" "io_priority")
-    '("GCancellable*" "cancellable")
+    '("GCancellable*" "cancellable" (default "NULL"))
     '("GAsyncReadyCallback" "callback")
     '("gpointer" "user_data")
   )
@@ -3151,7 +3151,7 @@
     '("gpointer" "user_data")
     '("GDestroyNotify" "notify")
     '("gint" "io_priority")
-    '("GCancellable*" "cancellable")
+    '("GCancellable*" "cancellable" (default "NULL"))
   )
 )
 
@@ -3198,7 +3198,7 @@
   (parameters
     '("int" "size")
     '("char**" "type")
-    '("GCancellable*" "cancellable")
+    '("GCancellable*" "cancellable" (default "NULL"))
     '("GError**" "error")
   )
 )
@@ -3209,7 +3209,7 @@
   (return-type "none")
   (parameters
     '("int" "size")
-    '("GCancellable*" "cancellable")
+    '("GCancellable*" "cancellable" (default "NULL"))
     '("GAsyncReadyCallback" "callback")
     '("gpointer" "user_data")
   )
@@ -3400,7 +3400,7 @@
   (return-type "none")
   (parameters
     '("GMountUnmountFlags" "flags")
-    '("GCancellable*" "cancellable")
+    '("GCancellable*" "cancellable" (default "NULL"))
     '("GAsyncReadyCallback" "callback")
     '("gpointer" "user_data")
   )
@@ -3422,7 +3422,7 @@
   (return-type "none")
   (parameters
     '("GMountUnmountFlags" "flags")
-    '("GCancellable*" "cancellable")
+    '("GCancellable*" "cancellable" (default "NULL"))
     '("GAsyncReadyCallback" "callback")
     '("gpointer" "user_data")
   )
@@ -3444,7 +3444,7 @@
   (return-type "none")
   (parameters
     '("GMountOperation*" "mount_operation")
-    '("GCancellable*" "cancellable")
+    '("GCancellable*" "cancellable" (default "NULL"))
     '("GAsyncReadyCallback" "callback")
     '("gpointer" "user_data")
   )
@@ -3603,7 +3603,7 @@
   (parameters
     '("const-void*" "buffer")
     '("gsize" "count")
-    '("GCancellable*" "cancellable")
+    '("GCancellable*" "cancellable" (default "NULL"))
     '("GError**" "error")
   )
 )
@@ -3616,7 +3616,7 @@
     '("const-void*" "buffer")
     '("gsize" "count")
     '("gsize*" "bytes_written")
-    '("GCancellable*" "cancellable")
+    '("GCancellable*" "cancellable" (default "NULL"))
     '("GError**" "error")
   )
 )
@@ -3628,7 +3628,7 @@
   (parameters
     '("GInputStream*" "source")
     '("GOutputStreamSpliceFlags" "flags")
-    '("GCancellable*" "cancellable")
+    '("GCancellable*" "cancellable" (default "NULL"))
     '("GError**" "error")
   )
 )
@@ -3638,7 +3638,7 @@
   (c-name "g_output_stream_flush")
   (return-type "gboolean")
   (parameters
-    '("GCancellable*" "cancellable")
+    '("GCancellable*" "cancellable" (default "NULL"))
     '("GError**" "error")
   )
 )
@@ -3648,7 +3648,7 @@
   (c-name "g_output_stream_close")
   (return-type "gboolean")
   (parameters
-    '("GCancellable*" "cancellable")
+    '("GCancellable*" "cancellable" (default "NULL"))
     '("GError**" "error")
   )
 )
@@ -3661,7 +3661,7 @@
     '("const-void*" "buffer")
     '("gsize" "count")
     '("int" "io_priority")
-    '("GCancellable*" "cancellable")
+    '("GCancellable*" "cancellable" (default "NULL"))
     '("GAsyncReadyCallback" "callback")
     '("gpointer" "user_data")
   )
@@ -3685,7 +3685,7 @@
     '("GInputStream*" "source")
     '("GOutputStreamSpliceFlags" "flags")
     '("int" "io_priority")
-    '("GCancellable*" "cancellable")
+    '("GCancellable*" "cancellable" (default "NULL"))
     '("GAsyncReadyCallback" "callback")
     '("gpointer" "user_data")
   )
@@ -3707,7 +3707,7 @@
   (return-type "none")
   (parameters
     '("int" "io_priority")
-    '("GCancellable*" "cancellable")
+    '("GCancellable*" "cancellable" (default "NULL"))
     '("GAsyncReadyCallback" "callback")
     '("gpointer" "user_data")
   )
@@ -3729,7 +3729,7 @@
   (return-type "none")
   (parameters
     '("int" "io_priority")
-    '("GCancellable*" "cancellable")
+    '("GCancellable*" "cancellable" (default "NULL"))
     '("GAsyncReadyCallback" "callback")
     '("gpointer" "user_data")
   )
@@ -3804,7 +3804,7 @@
   (parameters
     '("goffset" "offset")
     '("GSeekType" "type")
-    '("GCancellable*" "cancellable")
+    '("GCancellable*" "cancellable" (default "NULL"))
     '("GError**" "error")
   )
 )
@@ -3821,7 +3821,7 @@
   (return-type "gboolean")
   (parameters
     '("goffset" "offset")
-    '("GCancellable*" "cancellable")
+    '("GCancellable*" "cancellable" (default "NULL"))
     '("GError**" "error")
   )
 )
@@ -3952,7 +3952,7 @@
   (parameters
     '("GSimpleAsyncThreadFunc" "func")
     '("int" "io_priority")
-    '("GCancellable*" "cancellable")
+    '("GCancellable*" "cancellable" (default "NULL"))
   )
 )
 
@@ -4199,7 +4199,7 @@
   (return-type "none")
   (parameters
     '("GMountOperation*" "mount_operation")
-    '("GCancellable*" "cancellable")
+    '("GCancellable*" "cancellable" (default "NULL"))
     '("GAsyncReadyCallback" "callback")
     '("gpointer" "user_data")
   )
@@ -4221,7 +4221,7 @@
   (return-type "none")
   (parameters
     '("GMountUnmountFlags" "flags")
-    '("GCancellable*" "cancellable")
+    '("GCancellable*" "cancellable" (default "NULL"))
     '("GAsyncReadyCallback" "callback")
     '("gpointer" "user_data")
   )

Modified: trunk/gio/gio.override
==============================================================================
--- trunk/gio/gio.override	(original)
+++ trunk/gio/gio.override	Sat Jan 19 13:28:51 2008
@@ -76,4 +76,74 @@
   
   return ret;
 }
+%%
+override g_input_stream_read kwargs
+static PyObject *
+_wrap_g_input_stream_read(PyGObject *self, PyObject *args, PyObject *kwargs)
+{
+  static char *kwlist[] = { "count", "cancellable", NULL };
+  PyGObject *pycancellable = NULL;
+  PyObject *v;
+  
+  GCancellable *cancellable;
+  gsize count = -1; 
+  GError *error = NULL;
+  size_t bytesread, buffersize, chunksize;
+  
+  if (!PyArg_ParseTupleAndKeywords(args, kwargs,
+				   "|iO!:GInputStream.skip",
+				   kwlist, &count,
+				   &PyGCancellable_Type, &pycancellable))
+        return NULL;
+
+  buffersize = 8192;
+
+  cancellable = pycancellable ? G_CANCELLABLE(pycancellable->obj) : NULL;
+
 
+  v = PyString_FromStringAndSize((char *)NULL, buffersize);
+  if (v == NULL)
+    return NULL;
+  
+  bytesread = 0;
+  for (;;)
+    {
+      pyg_begin_allow_threads;
+      errno = 0;
+      chunksize = g_input_stream_read(G_INPUT_STREAM(self->obj),
+				      PyString_AS_STRING((PyStringObject *)v) + bytesread,
+				      buffersize - bytesread, cancellable,
+				      &error);
+      pyg_end_allow_threads;
+      
+      if (pyg_error_check(&error))
+	{
+	  Py_DECREF(v);
+	  return NULL;
+	}
+      else if (chunksize == 0)
+	{
+	  PyErr_SetFromErrno(PyExc_IOError);
+	  Py_DECREF(v);
+	  return NULL;
+	}
+      
+      bytesread += chunksize;
+      if (bytesread < buffersize)
+	break;
+
+      if (count < 0)
+	{
+	  if (_PyString_Resize(&v, buffersize) < 0)
+	    return NULL;
+	}
+      else
+	/* Got what was requested. */
+	break;
+    }
+  
+  if (bytesread != buffersize)
+    _PyString_Resize(&v, bytesread);
+
+  return v;
+}



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