[gthumb] added a GthTask to save images asynchronously



commit 518d3c320179cb47e463a4195d3372f808538928
Author: Paolo Bacchilega <paobac src gnome org>
Date:   Sat Jan 19 16:52:03 2013 +0100

    added a GthTask to save images asynchronously

 extensions/desktop_background/actions.c         |   25 ++-
 extensions/gstreamer_tools/actions.c            |   23 ++-
 extensions/image_viewer/gth-image-viewer-page.c |   23 ++-
 gthumb/Makefile.am                              |    2 +
 gthumb/gth-image-saver.c                        |  187 ++++++++++++++++---
 gthumb/gth-image.h                              |    1 +
 gthumb/gth-overwrite-dialog.h                   |    2 +
 gthumb/gth-save-image-task.c                    |  230 +++++++++++++++++++++++
 gthumb/gth-save-image-task.h                    |   60 ++++++
 9 files changed, 493 insertions(+), 60 deletions(-)
---
diff --git a/extensions/desktop_background/actions.c b/extensions/desktop_background/actions.c
index aba6f87..6dbf7e3 100644
--- a/extensions/desktop_background/actions.c
+++ b/extensions/desktop_background/actions.c
@@ -214,9 +214,9 @@ wallpaper_data_set (WallpaperData *wdata)
 
 
 static void
-wallpaper_save_ready_cb (GthFileData *a,
-			 GError      *error,
-			 gpointer     user_data)
+save_wallpaper_task_completed_cb (GthTask  *task,
+				  GError   *error,
+				  gpointer  user_data)
 {
 	WallpaperData *wdata = user_data;
 
@@ -267,18 +267,23 @@ gth_browser_activate_action_tool_desktop_background (GtkAction  *action,
 		viewer_page = gth_browser_get_viewer_page (browser);
 		if (viewer_page != NULL) {
 			GthImage *image;
+			GthTask  *task;
 
 			image = gth_image_new_for_surface (gth_image_viewer_page_get_image (GTH_IMAGE_VIEWER_PAGE (viewer_page)));
 			file_data = gth_file_data_new (wdata->new_file, NULL);
-			gth_image_save_to_file (image,
-						"image/jpeg",
-						file_data,
-						TRUE,
-						NULL,
-						wallpaper_save_ready_cb,
-						wdata);
+			task = gth_save_image_task_new (image,
+							"image/jpeg",
+							file_data,
+							GTH_OVERWRITE_RESPONSE_YES);
+			g_signal_connect (task,
+					  "completed",
+					  G_CALLBACK (save_wallpaper_task_completed_cb),
+					  wdata);
+			gth_browser_exec_task (GTH_BROWSER (browser), task, FALSE);
+
 			saving_wallpaper = TRUE;
 
+			_g_object_unref (task);
 			g_object_unref (image);
 		}
 	}
diff --git a/extensions/gstreamer_tools/actions.c b/extensions/gstreamer_tools/actions.c
index 521b1f4..ac12898 100644
--- a/extensions/gstreamer_tools/actions.c
+++ b/extensions/gstreamer_tools/actions.c
@@ -55,9 +55,9 @@ save_date_free (SaveData *save_data)
 
 
 static void
-screenshot_saved_cb (GthFileData *file_data,
-		     GError      *error,
-		     gpointer     user_data)
+save_screenshot_task_completed_cb (GthTask  *task,
+				   GError   *error,
+				   gpointer  user_data)
 {
 	SaveData           *save_data = user_data;
 	GthMediaViewerPage *page = save_data->page;
@@ -80,6 +80,7 @@ save_as_response_cb (GtkDialog  *file_sel,
 	GFile       *folder;
 	char        *folder_uri;
 	const char  *mime_type;
+	GthTask     *task;
 
 	if (response != GTK_RESPONSE_OK) {
 		GthMediaViewerPage *page = save_data->page;
@@ -100,13 +101,15 @@ save_as_response_cb (GtkDialog  *file_sel,
 
 	save_data->file_data = gth_file_data_new (file, NULL);
 	gth_file_data_set_mime_type (save_data->file_data, mime_type);
-	gth_image_save_to_file (save_data->image,
-				mime_type,
-				save_data->file_data,
-				TRUE,
-				NULL,
-				screenshot_saved_cb,
-				save_data);
+	task = gth_save_image_task_new (save_data->image,
+					mime_type,
+					save_data->file_data,
+					GTH_OVERWRITE_RESPONSE_YES);
+	g_signal_connect (task,
+			  "completed",
+			  G_CALLBACK (save_screenshot_task_completed_cb),
+			  save_data);
+	gth_browser_exec_task (GTH_BROWSER (save_data->browser), task, FALSE);
 
 	gtk_widget_destroy (GTK_WIDGET (file_sel));
 
diff --git a/extensions/image_viewer/gth-image-viewer-page.c b/extensions/image_viewer/gth-image-viewer-page.c
index abf9490..fae4371 100644
--- a/extensions/image_viewer/gth-image-viewer-page.c
+++ b/extensions/image_viewer/gth-image-viewer-page.c
@@ -1051,9 +1051,9 @@ save_data_free (SaveData *data)
 
 
 static void
-image_saved_cb (GthFileData *file_data,
-		GError      *error,
-		gpointer     user_data)
+save_image_task_completed_cb (GthTask *task,
+			      GError      *error,
+			      gpointer     user_data)
 {
 	SaveData           *data = user_data;
 	GthImageViewerPage *self = data->self;
@@ -1101,6 +1101,7 @@ _gth_image_viewer_page_real_save (GthViewerPage *base,
 	SaveData           *data;
 	GthFileData        *current_file;
 	GthImage           *image;
+	GthTask            *task;
 
 	self = (GthImageViewerPage *) base;
 
@@ -1140,14 +1141,14 @@ _gth_image_viewer_page_real_save (GthViewerPage *base,
 	g_file_info_set_attribute_boolean (data->file_to_save->info, "gth::file::is-modified", FALSE);
 
 	image = gth_image_new_for_surface (gth_image_viewer_get_current_image (GTH_IMAGE_VIEWER (self->priv->viewer)));
-	gth_image_save_to_file (image,
-				mime_type,
-				data->file_to_save,
-			        TRUE,
-			        NULL,
-				image_saved_cb,
-				data);
+	task = gth_save_image_task_new (image, mime_type, data->file_to_save, GTH_OVERWRITE_RESPONSE_YES);
+	g_signal_connect (task,
+			  "completed",
+			  G_CALLBACK (save_image_task_completed_cb),
+			  data);
+	gth_browser_exec_task (GTH_BROWSER (self->priv->browser), task, FALSE);
 
+	_g_object_unref (task);
 	_g_object_unref (image);
 }
 
diff --git a/gthumb/Makefile.am b/gthumb/Makefile.am
index 13d0c83..77d0b09 100644
--- a/gthumb/Makefile.am
+++ b/gthumb/Makefile.am
@@ -93,6 +93,7 @@ PUBLIC_HEADER_FILES = 					\
 	gth-progress-dialog.h				\
 	gth-request-dialog.h				\
 	gth-save-file-data-task.h			\
+	gth-save-image-task.h				\
 	gth-screensaver.h				\
 	gth-sidebar.h					\
 	gth-statusbar.h					\
@@ -233,6 +234,7 @@ gthumb_SOURCES = 					\
 	gth-progress-dialog.c				\
 	gth-request-dialog.c				\
 	gth-save-file-data-task.c			\
+	gth-save-image-task.c				\
 	gth-screensaver.c				\
 	gth-sidebar.c					\
 	gth-source-tree.c				\
diff --git a/gthumb/gth-image-saver.c b/gthumb/gth-image-saver.c
index fbe6512..c2436ae 100644
--- a/gthumb/gth-image-saver.c
+++ b/gthumb/gth-image-saver.c
@@ -271,7 +271,117 @@ gth_image_save_to_buffer (GthImage      *image,
 	}
 
 	return FALSE;
+}
+
+
+/* -- gth_image_save_to_buffer_async -- */
+
+
+typedef struct {
+	GthImage        *image;
+	char            *mime_type;
+	GthFileData     *file_data;
+	gboolean         replace;
+	GCancellable    *cancellable;
+	GthFileDataFunc  ready_func;
+	gpointer         user_data;
+} SaveArguments;
+
+
+static void
+save_arguments_free (SaveArguments *arguments)
+{
+	_g_object_unref (arguments->image);
+	g_free (arguments->mime_type);
+	_g_object_unref (arguments->file_data);
+	_g_object_unref (arguments->cancellable);
+	g_free (arguments);
+}
+
+
+static void
+gth_image_save_to_buffer_async (GthImage            *image,
+				const char          *mime_type,
+				GthFileData         *file_data,
+				GCancellable        *cancellable,
+				GAsyncReadyCallback  callback,
+				gpointer             user_data);
+
+
+static gboolean
+gth_image_save_to_buffer_finish (GAsyncResult      *result,
+		       	         GthImageSaveData **save_data,
+		       	         GError           **error)
+{
+	  GSimpleAsyncResult *simple;
+
+	  g_return_val_if_fail (g_simple_async_result_is_valid (result, NULL, gth_image_save_to_buffer_async), FALSE);
+
+	  simple = G_SIMPLE_ASYNC_RESULT (result);
+
+	  if (g_simple_async_result_propagate_error (simple, error))
+		  return FALSE;
+
+	  *save_data = g_simple_async_result_get_op_res_gpointer (simple);
 
+	  return TRUE;
+}
+
+
+static void
+save_to_buffer_thread (GSimpleAsyncResult *result,
+		       GObject	 	  *object,
+		       GCancellable	  *cancellable)
+{
+	SaveArguments    *arguments;
+	GthImageSaveData *data;
+	GError           *error = NULL;
+
+	arguments = g_simple_async_result_get_op_res_gpointer (result);
+	data = _gth_image_save_to_buffer_common (arguments->image,
+						 arguments->mime_type,
+						 arguments->file_data,
+						 cancellable,
+						 &error);
+	if (data != NULL)
+		g_simple_async_result_set_op_res_gpointer (result, data, NULL);
+	else
+		g_simple_async_result_take_error (result, error);
+}
+
+
+static void
+gth_image_save_to_buffer_async (GthImage            *image,
+				const char          *mime_type,
+				GthFileData         *file_data,
+				GCancellable        *cancellable,
+				GAsyncReadyCallback  callback,
+				gpointer             user_data)
+{
+	GSimpleAsyncResult *result;
+	SaveArguments      *arguments;
+
+	g_return_if_fail (image != NULL);
+	g_return_if_fail (file_data != NULL);
+
+	arguments = g_new0 (SaveArguments, 1);
+	arguments->image = g_object_ref (image);
+	arguments->mime_type = g_strdup (mime_type);
+	arguments->file_data = g_object_ref (file_data);
+
+	result = g_simple_async_result_new (NULL,
+					    callback,
+					    user_data,
+					    gth_image_save_to_buffer_async);
+	g_simple_async_result_set_op_res_gpointer (result,
+						   arguments,
+						   (GDestroyNotify) save_arguments_free);
+	g_simple_async_result_run_in_thread (result,
+					     save_to_buffer_thread,
+					     G_PRIORITY_DEFAULT,
+					     cancellable);
+
+	g_object_unref (result);
 }
 
 
@@ -361,6 +471,39 @@ save_files (GthImageSaveData *data,
 }
 
 
+static void
+save_to_buffer_ready_cb (GObject      *source_object,
+			 GAsyncResult *result,
+			 gpointer      user_data)
+{
+	SaveArguments    *arguments = user_data;
+	GthImageSaveData *data = NULL;
+	GError           *error = NULL;
+	GthImageSaveFile *file;
+
+	if (! gth_image_save_to_buffer_finish (result, &data, &error)) {
+		gth_file_data_ready_with_error (arguments->file_data,
+						arguments->ready_func,
+						arguments->user_data,
+						error);
+		save_arguments_free (arguments);
+		return;
+	}
+
+	data->replace = arguments->replace;
+
+	file = g_new0 (GthImageSaveFile, 1);
+	file->file = g_object_ref (data->file_data->file);
+	file->buffer = data->buffer;
+	file->buffer_size = data->buffer_size;
+	data->files = g_list_prepend (data->files, file);
+
+	save_files (data, arguments->ready_func, arguments->user_data);
+
+	save_arguments_free (arguments);
+}
+
+
 void
 gth_image_save_to_file (GthImage        *image,
 			const char      *mime_type,
@@ -370,36 +513,22 @@ gth_image_save_to_file (GthImage        *image,
 			GthFileDataFunc  ready_func,
 			gpointer         user_data)
 {
-	GthImageSaveData *data;
-	GError           *error = NULL;
-
-	data = _gth_image_save_to_buffer_common (image,
-						 mime_type,
-						 file_data,
-						 cancellable,
-						 &error);
-
-	if (data == NULL) {
-		gth_file_data_ready_with_error (file_data, ready_func, user_data, error);
-		return;
-	}
-
-	data->replace = replace;
+	SaveArguments *arguments;
 
-	if (data->error == NULL) {
-		GthImageSaveFile *file;
+	g_return_if_fail (image != NULL);
+	g_return_if_fail (file_data != NULL);
 
-		file = g_new0 (GthImageSaveFile, 1);
-		file->file = g_object_ref (data->file_data->file);
-		file->buffer = data->buffer;
-		file->buffer_size = data->buffer_size;
-		data->files = g_list_prepend (data->files, file);
-	}
-	else {
-		gth_image_save_data_free (data);
-		gth_file_data_ready_with_error (file_data, ready_func, user_data, error);
-		return;
-	}
+	arguments = g_new0 (SaveArguments, 1);
+	arguments->file_data = g_object_ref (file_data);
+	arguments->replace = replace;
+	arguments->cancellable = _g_object_ref (cancellable);
+	arguments->ready_func = ready_func;
+	arguments->user_data = user_data;
 
-	save_files (data, ready_func, user_data);
+	gth_image_save_to_buffer_async (image,
+					mime_type,
+					file_data,
+					cancellable,
+					save_to_buffer_ready_cb,
+					arguments);
 }
diff --git a/gthumb/gth-image.h b/gthumb/gth-image.h
index f7e598d..a4bf01c 100644
--- a/gthumb/gth-image.h
+++ b/gthumb/gth-image.h
@@ -25,6 +25,7 @@
 #include <glib.h>
 #include <glib-object.h>
 #include <gdk-pixbuf/gdk-pixbuf.h>
+#include <cairo.h>
 #include "gth-file-data.h"
 
 G_BEGIN_DECLS
diff --git a/gthumb/gth-overwrite-dialog.h b/gthumb/gth-overwrite-dialog.h
index 5de39ff..5f30e5b 100644
--- a/gthumb/gth-overwrite-dialog.h
+++ b/gthumb/gth-overwrite-dialog.h
@@ -37,6 +37,8 @@ typedef enum {
 	GTH_OVERWRITE_RESPONSE_CANCEL
 } GthOverwriteResponse;
 
+#define GTH_OVERWRITE_RESPONSE_ASK GTH_OVERWRITE_RESPONSE_UNSPECIFIED
+
 #define GTH_TYPE_OVERWRITE_DIALOG            (gth_overwrite_dialog_get_type ())
 #define GTH_OVERWRITE_DIALOG(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTH_TYPE_OVERWRITE_DIALOG, GthOverwriteDialog))
 #define GTH_OVERWRITE_DIALOG_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), GTH_TYPE_OVERWRITE_DIALOG, GthOverwriteDialogClass))
diff --git a/gthumb/gth-save-image-task.c b/gthumb/gth-save-image-task.c
new file mode 100644
index 0000000..60a5585
--- /dev/null
+++ b/gthumb/gth-save-image-task.c
@@ -0,0 +1,230 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+/*
+ *  GThumb
+ *
+ *  Copyright (C) 2012 Free Software Foundation, Inc.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <config.h>
+#include <glib/gi18n.h>
+#include "glib-utils.h"
+#include "gth-image-saver.h"
+#include "gth-save-image-task.h"
+
+
+struct _GthSaveImageTaskPrivate {
+	GthImage             *image;
+	char                 *mime_type;
+	GthFileData          *file_data;
+	GthOverwriteResponse  overwrite_mode;
+};
+
+
+G_DEFINE_TYPE (GthSaveImageTask, gth_save_image_task, GTH_TYPE_TASK)
+
+
+static void
+gth_save_image_task_finalize (GObject *object)
+{
+	GthSaveImageTask *self;
+
+	self = GTH_SAVE_IMAGE_TASK (object);
+
+	_g_object_unref (self->priv->image);
+	g_free (self->priv->mime_type);
+	_g_object_unref (self->priv->file_data);
+
+	G_OBJECT_CLASS (gth_save_image_task_parent_class)->finalize (object);
+}
+
+
+static void save_image (GthSaveImageTask *self);
+
+
+static void
+overwrite_dialog_respnse_cb (GtkDialog *dialog,
+			     int        response,
+			     gpointer   user_data)
+{
+	GthSaveImageTask *self = user_data;
+
+	if (response != GTK_RESPONSE_OK)
+		response = GTH_OVERWRITE_RESPONSE_CANCEL;
+	else
+		response = gth_overwrite_dialog_get_response (GTH_OVERWRITE_DIALOG (dialog));
+
+	if (response == GTH_OVERWRITE_RESPONSE_RENAME)
+		gtk_widget_hide (GTK_WIDGET (dialog));
+	else
+		gtk_widget_destroy (GTK_WIDGET (dialog));
+	gth_task_dialog (GTH_TASK (self), FALSE, NULL);
+
+	switch (response) {
+	case GTH_OVERWRITE_RESPONSE_YES:
+		self->priv->overwrite_mode = GTH_OVERWRITE_RESPONSE_YES;
+		save_image (self);
+		break;
+
+	case GTH_OVERWRITE_RESPONSE_NO:
+		gth_task_completed (GTH_TASK (self), NULL);
+		break;
+
+	case GTH_OVERWRITE_RESPONSE_RENAME:
+		{
+			GFile *parent;
+			GFile *new_file;
+
+			parent = g_file_get_parent (self->priv->file_data->file);
+			new_file = g_file_get_child_for_display_name (parent, gth_overwrite_dialog_get_filename (GTH_OVERWRITE_DIALOG (dialog)), NULL);
+			gth_file_data_set_file (self->priv->file_data, new_file);
+			save_image (self);
+
+			gtk_widget_destroy (GTK_WIDGET (dialog));
+			g_object_unref (new_file);
+			g_object_unref (parent);
+		}
+		break;
+
+	case GTH_OVERWRITE_RESPONSE_CANCEL:
+		{
+			GError *error;
+
+			error = g_error_new_literal (GTH_TASK_ERROR, GTH_TASK_ERROR_CANCELLED, "");
+			gth_task_completed (GTH_TASK (self), error);
+		}
+		break;
+
+	default:
+		g_assert_not_reached ();
+		break;
+	}
+}
+
+
+static void
+save_to_file_ready_cb (GthFileData *file_data,
+		       GError      *error,
+		       gpointer     user_data)
+{
+	GthSaveImageTask *self = user_data;
+
+	if (error != NULL) {
+		if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_EXISTS)) {
+			GtkWidget *d;
+
+			d = gth_overwrite_dialog_new (NULL,
+						      self->priv->image,
+						      self->priv->file_data->file,
+						      self->priv->overwrite_mode,
+						      TRUE);
+			g_signal_connect (d,
+					  "response",
+					  G_CALLBACK (overwrite_dialog_respnse_cb),
+					  self);
+			gtk_widget_show (d);
+
+			gth_task_dialog (GTH_TASK (self), TRUE, d);
+		}
+		else
+			gth_task_completed (GTH_TASK (self), error);
+
+		return;
+	}
+
+	gth_task_completed (GTH_TASK (self), NULL);
+}
+
+
+static void
+save_image (GthSaveImageTask *self)
+{
+	char *filename;
+	char *description;
+
+	filename = g_strdup (g_file_info_get_display_name (self->priv->file_data->info));
+	if (filename == NULL)
+		filename = g_file_get_parse_name (self->priv->file_data->file);
+	/* Translators: %s is a filename */
+	description = g_strdup_printf (_("Saving '%s'"), filename);
+	gth_task_progress (GTH_TASK (self), description, NULL, TRUE, 0.0);
+
+	gth_image_save_to_file (self->priv->image,
+			        self->priv->mime_type,
+			        self->priv->file_data,
+			        ((self->priv->overwrite_mode == GTH_OVERWRITE_RESPONSE_YES)
+			         || (self->priv->overwrite_mode == GTH_OVERWRITE_RESPONSE_ALWAYS_YES)),
+			        gth_task_get_cancellable (GTH_TASK (self)),
+			        save_to_file_ready_cb,
+			        self);
+
+	g_free (description);
+	g_free (filename);
+}
+
+
+static void
+gth_save_image_task_exec (GthTask *task)
+{
+	save_image (GTH_SAVE_IMAGE_TASK (task));
+}
+
+
+static void
+gth_save_image_task_class_init (GthSaveImageTaskClass *klass)
+{
+	GObjectClass *object_class;
+	GthTaskClass *task_class;
+
+	g_type_class_add_private (klass, sizeof (GthSaveImageTaskPrivate));
+
+	object_class = G_OBJECT_CLASS (klass);
+	object_class->finalize = gth_save_image_task_finalize;
+
+	task_class = GTH_TASK_CLASS (klass);
+	task_class->exec = gth_save_image_task_exec;
+}
+
+
+static void
+gth_save_image_task_init (GthSaveImageTask *self)
+{
+	self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, GTH_TYPE_SAVE_IMAGE_TASK, GthSaveImageTaskPrivate);
+	self->priv->image = NULL;
+	self->priv->mime_type = NULL;
+	self->priv->file_data = NULL;
+}
+
+
+GthTask *
+gth_save_image_task_new (GthImage             *image,
+			 const char           *mime_type,
+			 GthFileData          *file_data,
+			 GthOverwriteResponse  overwrite_mode)
+{
+	GthSaveImageTask *self;
+
+	g_return_val_if_fail (image != NULL, NULL);
+	g_return_val_if_fail (file_data != NULL, NULL);
+
+	self = (GthSaveImageTask *) g_object_new (GTH_TYPE_SAVE_IMAGE_TASK, NULL);
+	self->priv->image = g_object_ref (image);
+	self->priv->mime_type = g_strdup (mime_type);
+	self->priv->file_data = gth_file_data_dup (file_data);
+	self->priv->overwrite_mode = overwrite_mode;
+
+	return (GthTask *) self;
+}
diff --git a/gthumb/gth-save-image-task.h b/gthumb/gth-save-image-task.h
new file mode 100644
index 0000000..ca3caa2
--- /dev/null
+++ b/gthumb/gth-save-image-task.h
@@ -0,0 +1,60 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+/*
+ *  GThumb
+ *
+ *  Copyright (C) 2012 The Free Software Foundation, Inc.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef GTH_SAVE_IMAGE_TASK_H
+#define GTH_SAVE_IMAGE_TASK_H
+
+#include <glib.h>
+#include "gth-image.h"
+#include "gth-overwrite-dialog.h"
+#include "gth-task.h"
+
+G_BEGIN_DECLS
+
+#define GTH_TYPE_SAVE_IMAGE_TASK            (gth_save_image_task_get_type ())
+#define GTH_SAVE_IMAGE_TASK(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTH_TYPE_SAVE_IMAGE_TASK, GthSaveImageTask))
+#define GTH_SAVE_IMAGE_TASK_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), GTH_TYPE_SAVE_IMAGE_TASK, GthSaveImageTaskClass))
+#define GTH_IS_SAVE_IMAGE_TASK(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTH_TYPE_SAVE_IMAGE_TASK))
+#define GTH_IS_SAVE_IMAGE_TASK_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTH_TYPE_SAVE_IMAGE_TASK))
+#define GTH_SAVE_IMAGE_TASK_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS((obj), GTH_TYPE_SAVE_IMAGE_TASK, GthSaveImageTaskClass))
+
+typedef struct _GthSaveImageTask        GthSaveImageTask;
+typedef struct _GthSaveImageTaskClass   GthSaveImageTaskClass;
+typedef struct _GthSaveImageTaskPrivate GthSaveImageTaskPrivate;
+
+struct _GthSaveImageTask {
+	GthTask __parent;
+	GthSaveImageTaskPrivate *priv;
+};
+
+struct _GthSaveImageTaskClass {
+	GthTaskClass __parent;
+};
+
+GType       gth_save_image_task_get_type   (void);
+GthTask *   gth_save_image_task_new        (GthImage             *image,
+					    const char           *mime_type,
+					    GthFileData          *file_data,
+					    GthOverwriteResponse  overwrite_mode);
+
+G_END_DECLS
+
+#endif /* GTH_SAVE_IMAGE_TASK_H */



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]