[epiphany/overview] ephy-snapshot-service: add a public method to save a snapshot



commit 998252cd9f5b499f942175b4ea4373d8394481c6
Author: Claudio Saavedra <csaavedra igalia com>
Date:   Sun Aug 19 18:05:29 2012 +0300

    ephy-snapshot-service: add a public method to save a snapshot

 lib/ephy-snapshot-service.c |   27 +++++++++++++++++++++++++++
 lib/ephy-snapshot-service.h |    8 ++++++++
 2 files changed, 35 insertions(+), 0 deletions(-)
---
diff --git a/lib/ephy-snapshot-service.c b/lib/ephy-snapshot-service.c
index 86c046b..4908c6a 100644
--- a/lib/ephy-snapshot-service.c
+++ b/lib/ephy-snapshot-service.c
@@ -379,6 +379,33 @@ ephy_snapshot_service_get_snapshot_finish (EphySnapshotService *service,
   return op->snapshot ? g_object_ref (op->snapshot) : NULL;
 }
 
+void
+ephy_snapshot_service_save_snapshot_async (EphySnapshotService *service,
+                                           GdkPixbuf *snapshot,
+                                           const char *url,
+                                           time_t mtime,
+                                           GCancellable *cancellable,
+                                           GAsyncReadyCallback callback,
+                                           gpointer user_data)
+{
+  SnapshotOp *op;
+
+  g_return_if_fail (EPHY_IS_SNAPSHOT_SERVICE (service));
+  g_return_if_fail (GDK_IS_PIXBUF (snapshot));
+  g_return_if_fail (url != NULL);
+
+  op = g_slice_alloc0 (sizeof(SnapshotOp));
+  op->snapshot = g_object_ref (snapshot);
+  op->url = g_strdup (url);
+  op->mtime = mtime;
+  op->cancellable = cancellable ? g_object_ref (cancellable) : NULL;
+  op->callback = callback;
+  op->user_data = user_data;
+
+  g_io_scheduler_push_job (io_scheduler_save_thumbnail,
+                           op, NULL, G_PRIORITY_LOW, NULL);
+}
+
 GdkPixbuf *
 ephy_snapshot_service_crop_snapshot (cairo_surface_t *surface)
 {
diff --git a/lib/ephy-snapshot-service.h b/lib/ephy-snapshot-service.h
index d5b8591..4de9745 100644
--- a/lib/ephy-snapshot-service.h
+++ b/lib/ephy-snapshot-service.h
@@ -79,6 +79,14 @@ GdkPixbuf * ephy_snapshot_service_get_snapshot_finish (EphySnapshotService *serv
                                                        GAsyncResult *result,
                                                        GError **error);
 
+void ephy_snapshot_service_save_snapshot_async (EphySnapshotService *service,
+                                                GdkPixbuf *snapshot,
+                                                const char *url,
+                                                time_t mtime,
+                                                GCancellable *cancellable,
+                                                GAsyncReadyCallback callback,
+                                                gpointer user_data);
+
 GdkPixbuf*  ephy_snapshot_service_crop_snapshot (cairo_surface_t *surface);
 
 G_END_DECLS



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