X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=gio%2Fgfileiostream.c;h=87c424a8cc4b41d563bc40bab43be9a842cd34ed;hb=3c6efd4d5077862adc918c651ab7c49dc133d643;hp=85a8dd9097be42126f10908d37cdd5deaa19a5de;hpb=1b033919845cef366842373da9f1cfb56f522d01;p=platform%2Fupstream%2Fglib.git
diff --git a/gio/gfileiostream.c b/gio/gfileiostream.c
index 85a8dd9..87c424a 100644
--- a/gio/gfileiostream.c
+++ b/gio/gfileiostream.c
@@ -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 .
*
* Author: Alexander Larsson
*/
@@ -25,8 +23,8 @@
#include
#include
#include
-#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 I/O priority
- * 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;