[gnome-photos] base-item: Rework PhotosBaseItemSaveData to be more flexible
- From: Debarshi Ray <debarshir src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-photos] base-item: Rework PhotosBaseItemSaveData to be more flexible
- Date: Thu, 7 Jan 2016 16:53:38 +0000 (UTC)
commit 2aeb904aa95ae667badde937b10201e4f6a5f4a4
Author: Debarshi Ray <debarshir gnome org>
Date: Sun Jan 3 13:32:00 2016 +0100
base-item: Rework PhotosBaseItemSaveData to be more flexible
This will be used by the following patch to carry the MIME type of the
item whose size is being guessed.
https://bugzilla.gnome.org/show_bug.cgi?id=759363
src/photos-base-item.c | 15 +++++++++++----
1 files changed, 11 insertions(+), 4 deletions(-)
---
diff --git a/src/photos-base-item.c b/src/photos-base-item.c
index 6cdb510..2253567 100644
--- a/src/photos-base-item.c
+++ b/src/photos-base-item.c
@@ -144,13 +144,20 @@ static void photos_base_item_populate_from_cursor (PhotosBaseItem *self, Tracker
static PhotosBaseItemSaveData *
-photos_base_item_save_data_new (GFile *dir, const gchar *type)
+photos_base_item_save_data_new (GFile *dir, GeglBuffer *buffer, const gchar *type)
{
PhotosBaseItemSaveData *data;
data = g_slice_new0 (PhotosBaseItemSaveData);
- data->dir = g_object_ref (dir);
+
+ if (dir != NULL)
+ data->dir = g_object_ref (dir);
+
+ if (buffer != NULL)
+ data->buffer = g_object_ref (buffer);
+
data->type = g_strdup (type);
+
return data;
}
@@ -158,7 +165,7 @@ photos_base_item_save_data_new (GFile *dir, const gchar *type)
static void
photos_base_item_save_data_free (PhotosBaseItemSaveData *data)
{
- g_object_unref (data->dir);
+ g_clear_object (&data->dir);
g_clear_object (&data->buffer);
g_free (data->type);
g_slice_free (PhotosBaseItemSaveData, data);
@@ -2171,7 +2178,7 @@ photos_base_item_save_async (PhotosBaseItem *self,
else
type = "jpeg";
- data = photos_base_item_save_data_new (dir, type);
+ data = photos_base_item_save_data_new (dir, NULL, type);
task = g_task_new (self, cancellable, callback, user_data);
g_task_set_source_tag (task, photos_base_item_save_async);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]