[gnome-photos/wip/rishi/share-point-1] Add photos_base_item_load_async in save_to_stream_async
- From: Umang Jain <uajain src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-photos/wip/rishi/share-point-1] Add photos_base_item_load_async in save_to_stream_async
- Date: Fri, 19 Aug 2016 21:08:18 +0000 (UTC)
commit 357acc60dac570f8a4a68f1c4c0b5a570882cf82
Author: Umang Jain <mailumangjain gmail com>
Date: Mon Aug 15 14:38:24 2016 +0530
Add photos_base_item_load_async in save_to_stream_async
src/photos-base-item.c | 58 ++++++++++++++++++++++++++++++++---------------
1 files changed, 39 insertions(+), 19 deletions(-)
---
diff --git a/src/photos-base-item.c b/src/photos-base-item.c
index 9e0d549..cca1c0e 100644
--- a/src/photos-base-item.c
+++ b/src/photos-base-item.c
@@ -155,6 +155,7 @@ struct _PhotosBaseItemSaveToStreamData
GFile *file;
GFileIOStream *iostream;
GOutputStream *ostream;
+ gdouble zoom;
};
static GdkPixbuf *failed_icon;
@@ -219,12 +220,13 @@ photos_base_item_save_buffer_data_free (PhotosBaseItemSaveBufferData *data)
static PhotosBaseItemSaveToStreamData *
-photos_base_item_save_to_stream_data_new (GOutputStream *ostream)
+photos_base_item_save_to_stream_data_new (GOutputStream *ostream, gdouble zoom)
{
PhotosBaseItemSaveToStreamData *data;
data = g_slice_new0 (PhotosBaseItemSaveToStreamData);
data->ostream = g_object_ref (ostream);
+ data->zoom = zoom;
return data;
}
@@ -3237,6 +3239,7 @@ photos_base_item_save_async (PhotosBaseItem *self,
g_task_set_source_tag (task, photos_base_item_save_async);
g_task_set_task_data (task, data, (GDestroyNotify) photos_base_item_save_data_free);
+ //photos_base_item_load_async (self, cancellable, photos_base_item_guess_save_sizes_load, g_object_ref
(task));
graph = photos_pipeline_get_graph (priv->pipeline);
buffer = photos_utils_create_buffer_from_node (graph);
photos_utils_buffer_zoom_async (buffer,
@@ -3263,26 +3266,24 @@ photos_base_item_save_finish (PhotosBaseItem *self, GAsyncResult *res, GError **
return g_task_propagate_pointer (task, error);
}
-
-void
-photos_base_item_save_to_stream_async (PhotosBaseItem *self,
- GOutputStream *stream,
- gdouble zoom,
- GCancellable *cancellable,
- GAsyncReadyCallback callback,
- gpointer user_data)
+static void
+photos_base_item_save_to_stream_loaded (GObject *source_object, GAsyncResult *res, gpointer user_data)
{
+ PhotosBaseItem *self = PHOTOS_BASE_ITEM (source_object);
PhotosBaseItemPrivate *priv;
- GTask *task;
GeglBuffer *buffer;
GeglNode *graph;
PhotosBaseItemSaveToStreamData *data;
+ GTask *task;
+ GCancellable *cancellable;
- g_return_if_fail (PHOTOS_IS_BASE_ITEM (self));
priv = self->priv;
+ task = G_TASK (user_data);
+ cancellable = g_task_get_cancellable (task);
+ data = (PhotosBaseItemSaveToStreamData *) g_task_get_task_data (task);
g_return_if_fail (!priv->collection);
- g_return_if_fail (G_IS_OUTPUT_STREAM (stream));
+ g_return_if_fail (G_IS_OUTPUT_STREAM (data->ostream));
g_return_if_fail (priv->edit_graph != NULL);
g_return_if_fail (priv->filename != NULL && priv->filename[0] != '\0');
g_return_if_fail (priv->load_graph != NULL);
@@ -3290,16 +3291,10 @@ photos_base_item_save_to_stream_async (PhotosBaseItem *self,
g_return_if_fail (priv->processor != NULL);
g_return_if_fail (!gegl_processor_work (priv->processor, NULL));
- data = photos_base_item_save_to_stream_data_new (stream);
-
- task = g_task_new (self, cancellable, callback, user_data);
- g_task_set_source_tag (task, photos_base_item_save_to_stream_async);
- g_task_set_task_data (task, data, (GDestroyNotify) photos_base_item_save_to_stream_data_free);
-
graph = photos_pipeline_get_graph (priv->pipeline);
buffer = photos_utils_create_buffer_from_node (graph);
photos_utils_buffer_zoom_async (buffer,
- zoom,
+ data->zoom,
cancellable,
photos_base_item_save_to_stream_buffer_zoom,
g_object_ref (task));
@@ -3309,6 +3304,31 @@ photos_base_item_save_to_stream_async (PhotosBaseItem *self,
}
+void
+photos_base_item_save_to_stream_async (PhotosBaseItem *self,
+ GOutputStream *stream,
+ gdouble zoom,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data)
+{
+
+ PhotosBaseItemSaveToStreamData *data;
+ GTask *task;
+
+ g_return_if_fail (PHOTOS_IS_BASE_ITEM (self));
+
+ task = g_task_new (self, cancellable, callback, user_data);
+ g_task_set_source_tag (task, photos_base_item_save_to_stream_async);
+ data = photos_base_item_save_to_stream_data_new (stream, zoom);
+ g_task_set_task_data (task, data, (GDestroyNotify) photos_base_item_save_to_stream_data_free);
+
+ photos_base_item_load_async (self, cancellable, photos_base_item_save_to_stream_loaded, g_object_ref
(task));
+
+ g_object_unref (task);
+}
+
+
gboolean
photos_base_item_save_to_stream_finish (PhotosBaseItem *self, GAsyncResult *res, GError **error)
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]