[gnome-photos/wip/rishi/share-point: 17/19] Add photos_base_item_load_async in save_to_stream_async
- From: Debarshi Ray <debarshir src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-photos/wip/rishi/share-point: 17/19] Add photos_base_item_load_async in save_to_stream_async
- Date: Sat, 20 Aug 2016 07:22:46 +0000 (UTC)
commit 6c030fd489d0285d0a7a0b0a185be5172938dc02
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 | 46 ++++++++++++++++++++++++++++++++++------------
1 files changed, 34 insertions(+), 12 deletions(-)
---
diff --git a/src/photos-base-item.c b/src/photos-base-item.c
index 9e0d549..678fb42 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,6 +3266,34 @@ photos_base_item_save_finish (PhotosBaseItem *self, GAsyncResult *res, GError **
return g_task_propagate_pointer (task, error);
}
+static void
+photos_base_item_save_to_stream_load (GObject *source_object, GAsyncResult *res, gpointer user_data)
+{
+ PhotosBaseItem *self = PHOTOS_BASE_ITEM (source_object);
+ PhotosBaseItemPrivate *priv;
+ GeglBuffer *buffer;
+ GeglNode *graph;
+ PhotosBaseItemSaveToStreamData *data;
+ GTask *task;
+ GCancellable *cancellable;
+
+ priv = self->priv;
+ task = G_TASK (user_data);
+ cancellable = g_task_get_cancellable (task);
+ data = (PhotosBaseItemSaveToStreamData *) g_task_get_task_data (task);
+
+ graph = photos_pipeline_get_graph (priv->pipeline);
+ buffer = photos_utils_create_buffer_from_node (graph);
+ photos_utils_buffer_zoom_async (buffer,
+ data->zoom,
+ cancellable,
+ photos_base_item_save_to_stream_buffer_zoom,
+ g_object_ref (task));
+
+ g_object_unref (buffer);
+ g_object_unref (task);
+}
+
void
photos_base_item_save_to_stream_async (PhotosBaseItem *self,
@@ -3274,8 +3305,6 @@ photos_base_item_save_to_stream_async (PhotosBaseItem *self,
{
PhotosBaseItemPrivate *priv;
GTask *task;
- GeglBuffer *buffer;
- GeglNode *graph;
PhotosBaseItemSaveToStreamData *data;
g_return_if_fail (PHOTOS_IS_BASE_ITEM (self));
@@ -3290,21 +3319,14 @@ 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);
+ data = photos_base_item_save_to_stream_data_new (stream, zoom);
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,
- cancellable,
- photos_base_item_save_to_stream_buffer_zoom,
- g_object_ref (task));
+ photos_base_item_load_async (self, cancellable, photos_base_item_save_to_stream_load, g_object_ref (task));
- g_object_unref (buffer);
g_object_unref (task);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]