hook gvariant vectors up to kdbus
[platform/upstream/glib.git] / gio / gfileiostream.c
index 85a8dd9..87c424a 100644 (file)
@@ -13,9 +13,7 @@
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General
- * Public License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
- * Boston, MA 02111-1307, USA.
+ * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
  *
  * Author: Alexander Larsson <alexl@redhat.com>
  */
@@ -25,8 +23,8 @@
 #include <glib.h>
 #include <gfileiostream.h>
 #include <gseekable.h>
-#include "gsimpleasyncresult.h"
 #include "gasyncresult.h"
+#include "gtask.h"
 #include "gcancellable.h"
 #include "gioerror.h"
 #include "gfileoutputstream.h"
@@ -85,14 +83,15 @@ static GFileInfo *g_file_io_stream_real_query_info_finish (GFileIOStream    *str
                                                           GAsyncResult         *result,
                                                           GError              **error);
 
-G_DEFINE_TYPE_WITH_CODE (GFileIOStream, g_file_io_stream, G_TYPE_IO_STREAM,
-                        G_IMPLEMENT_INTERFACE (G_TYPE_SEEKABLE,
-                                               g_file_io_stream_seekable_iface_init));
-
 struct _GFileIOStreamPrivate {
   GAsyncReadyCallback outstanding_callback;
 };
 
+G_DEFINE_TYPE_WITH_CODE (GFileIOStream, g_file_io_stream, G_TYPE_IO_STREAM,
+                         G_ADD_PRIVATE (GFileIOStream)
+                        G_IMPLEMENT_INTERFACE (G_TYPE_SEEKABLE,
+                                               g_file_io_stream_seekable_iface_init))
+
 static void
 g_file_io_stream_seekable_iface_init (GSeekableIface *iface)
 {
@@ -106,9 +105,7 @@ g_file_io_stream_seekable_iface_init (GSeekableIface *iface)
 static void
 g_file_io_stream_init (GFileIOStream *stream)
 {
-  stream->priv = G_TYPE_INSTANCE_GET_PRIVATE (stream,
-                                             G_TYPE_FILE_IO_STREAM,
-                                             GFileIOStreamPrivate);
+  stream->priv = g_file_io_stream_get_instance_private (stream);
 }
 
 /**
@@ -194,8 +191,7 @@ async_ready_callback_wrapper (GObject *source_object,
  * g_file_io_stream_query_info_async:
  * @stream: a #GFileIOStream.
  * @attributes: a file attribute query string.
- * @io_priority: the <link linkend="gio-GIOScheduler">I/O priority</link>
- *     of the request.
+ * @io_priority: the [I/O priority][gio-GIOScheduler] of the request
  * @cancellable: (allow-none): optional #GCancellable object, %NULL to ignore.
  * @callback: (scope async): callback to call when the request is satisfied
  * @user_data: (closure): the data to pass to callback function
@@ -227,10 +223,9 @@ g_file_io_stream_query_info_async (GFileIOStream     *stream,
 
   if (!g_io_stream_set_pending (io_stream, &error))
     {
-      g_simple_async_report_take_gerror_in_idle (G_OBJECT (stream),
-                                           callback,
-                                           user_data,
-                                           error);
+      g_task_report_error (stream, callback, user_data,
+                           g_file_io_stream_query_info_async,
+                           error);
       return;
     }
 
@@ -239,7 +234,7 @@ g_file_io_stream_query_info_async (GFileIOStream     *stream,
   stream->priv->outstanding_callback = callback;
   g_object_ref (stream);
   klass->query_info_async (stream, attributes, io_priority, cancellable,
-                             async_ready_callback_wrapper, user_data);
+                           async_ready_callback_wrapper, user_data);
 }
 
 /**
@@ -257,21 +252,18 @@ g_file_io_stream_query_info_async (GFileIOStream     *stream,
  **/
 GFileInfo *
 g_file_io_stream_query_info_finish (GFileIOStream     *stream,
-                                          GAsyncResult         *result,
-                                          GError              **error)
+                                   GAsyncResult         *result,
+                                   GError              **error)
 {
-  GSimpleAsyncResult *simple;
   GFileIOStreamClass *class;
 
   g_return_val_if_fail (G_IS_FILE_IO_STREAM (stream), NULL);
   g_return_val_if_fail (G_IS_ASYNC_RESULT (result), NULL);
 
-  if (G_IS_SIMPLE_ASYNC_RESULT (result))
-    {
-      simple = G_SIMPLE_ASYNC_RESULT (result);
-      if (g_simple_async_result_propagate_error (simple, error))
-       return NULL;
-    }
+  if (g_async_result_legacy_propagate_error (result, error))
+    return NULL;
+  else if (g_async_result_is_tagged (result, g_file_io_stream_query_info_async))
+    return g_task_propagate_pointer (G_TASK (result), error);
 
   class = G_FILE_IO_STREAM_GET_CLASS (stream);
   return class->query_info_finish (stream, result, error);
@@ -658,8 +650,6 @@ g_file_io_stream_real_query_info_finish (GFileIOStream     *stream,
 static void
 g_file_io_stream_class_init (GFileIOStreamClass *klass)
 {
-  g_type_class_add_private (klass, sizeof (GFileIOStreamPrivate));
-
   klass->tell = g_file_io_stream_real_tell;
   klass->can_seek = g_file_io_stream_real_can_seek;
   klass->seek = g_file_io_stream_real_seek;