[epiphany/overview] ephy-overview-store: add a method to set a snapshot for a row
- From: Claudio Saavedra <csaavedra src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [epiphany/overview] ephy-overview-store: add a method to set a snapshot for a row
- Date: Mon, 20 Aug 2012 16:12:19 +0000 (UTC)
commit 3e659cb8630a11ecb1f4744549c384fb0326dc0e
Author: Claudio Saavedra <csaavedra igalia com>
Date: Sun Aug 19 18:17:43 2012 +0300
ephy-overview-store: add a method to set a snapshot for a row
This will internally crop the snapshot and save it to the cache using
the snapshotting service.
lib/widgets/ephy-overview-store.c | 36 ++++++++++++++++++++++++++++++++++++
lib/widgets/ephy-overview-store.h | 4 ++++
2 files changed, 40 insertions(+), 0 deletions(-)
---
diff --git a/lib/widgets/ephy-overview-store.c b/lib/widgets/ephy-overview-store.c
index 5177ebc..cd5e8b2 100644
--- a/lib/widgets/ephy-overview-store.c
+++ b/lib/widgets/ephy-overview-store.c
@@ -289,6 +289,42 @@ ephy_overview_store_set_snapshot_internal (EphyOverviewStore *store,
}
static void
+history_service_get_url_for_saving (EphyHistoryService *service,
+ gboolean success,
+ EphyHistoryURL *url,
+ GdkPixbuf *pixbuf)
+{
+ EphySnapshotService *snapshot_service;
+ int timestamp;
+
+ snapshot_service = ephy_snapshot_service_get_default ();
+ timestamp = success ? (url->visit_count / 5) : 0;
+
+ ephy_snapshot_service_save_snapshot_async (snapshot_service,
+ pixbuf, url->url, timestamp,
+ NULL, NULL, NULL);
+ g_object_unref (pixbuf);
+}
+
+void
+ephy_overview_store_set_snapshot (EphyOverviewStore *store,
+ GtkTreeIter *iter,
+ cairo_surface_t *snapshot)
+{
+ GdkPixbuf *pixbuf;
+ char *url;
+
+ pixbuf = ephy_snapshot_service_crop_snapshot (snapshot);
+ ephy_overview_store_set_snapshot_internal (store, iter, pixbuf);
+ gtk_tree_model_get (GTK_TREE_MODEL (store), iter,
+ EPHY_OVERVIEW_STORE_URI, &url,
+ -1);
+ ephy_history_service_get_url (store->priv->history_service, url,
+ NULL, (EphyHistoryJobCallback) history_service_get_url_for_saving,
+ pixbuf);
+}
+
+static void
on_snapshot_retrieved_cb (GObject *object,
GAsyncResult *res,
PeekContext *ctx)
diff --git a/lib/widgets/ephy-overview-store.h b/lib/widgets/ephy-overview-store.h
index 6d80a36..b618bb9 100644
--- a/lib/widgets/ephy-overview-store.h
+++ b/lib/widgets/ephy-overview-store.h
@@ -85,6 +85,10 @@ gboolean ephy_overview_store_find_url (EphyOverviewStore *store,
const char *url,
GtkTreeIter *iter);
+void ephy_overview_store_set_snapshot (EphyOverviewStore *store,
+ GtkTreeIter *iter,
+ cairo_surface_t *snapshot);
+
G_END_DECLS
#endif /* _EPHY_OVERVIEW_STORE_H */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]