diff options
author | Carlos Garcia Campos <cgarcia@igalia.com> | 2012-09-04 20:48:26 +0800 |
---|---|---|
committer | Carlos Garcia Campos <carlosgc@gnome.org> | 2012-09-06 16:25:09 +0800 |
commit | b70fe20a489b0a89e4f8779551e87698434485a5 (patch) | |
tree | 08d63f5fce54bd741bea3279fab00ebd7ba65295 /lib/ephy-snapshot-service.h | |
parent | 8712d1d951319e69dabae819d80700023cd920b8 (diff) | |
download | gsoc2013-epiphany-b70fe20a489b0a89e4f8779551e87698434485a5.tar gsoc2013-epiphany-b70fe20a489b0a89e4f8779551e87698434485a5.tar.gz gsoc2013-epiphany-b70fe20a489b0a89e4f8779551e87698434485a5.tar.bz2 gsoc2013-epiphany-b70fe20a489b0a89e4f8779551e87698434485a5.tar.lz gsoc2013-epiphany-b70fe20a489b0a89e4f8779551e87698434485a5.tar.xz gsoc2013-epiphany-b70fe20a489b0a89e4f8779551e87698434485a5.tar.zst gsoc2013-epiphany-b70fe20a489b0a89e4f8779551e87698434485a5.zip |
ephy-snapshot-service: Split ephy_snapshot_service_get_snapshot_async()
ephy_snapshot_service_get_snapshot_async() receives an option web view
parameter, that it's only used in case the snapshot is not the in the
thumbnails cache. We can split the method into
ephy_snapshot_service_get_snapshot_async() to get a snapshot from a web
view and ephy_snapshot_service_get_snapshot_for_url_async() to get a
snapshot from the cache. The former uses the latter to try first if the
web view URI is in the cache.
Patch includes other cleanups and fixes:
- Add missing ephy_snapshot_service_save_snapshot_finish()
- Add EphySnapshotServiceError to handle errors
- Use GSimpleAsyncResult API instead of using GIOScheduler directly
- Use different async data structs for every async operation
https://bugzilla.gnome.org/show_bug.cgi?id=683327
Diffstat (limited to 'lib/ephy-snapshot-service.h')
-rw-r--r-- | lib/ephy-snapshot-service.h | 76 |
1 files changed, 48 insertions, 28 deletions
diff --git a/lib/ephy-snapshot-service.h b/lib/ephy-snapshot-service.h index deab02071..dacf21a63 100644 --- a/lib/ephy-snapshot-service.h +++ b/lib/ephy-snapshot-service.h @@ -39,6 +39,8 @@ G_BEGIN_DECLS #define EPHY_IS_SNAPSHOT_SERVICE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), EPHY_TYPE_SNAPSHOT_SERVICE)) #define EPHY_SNAPSHOT_SERVICE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), EPHY_TYPE_SNAPSHOT_SERVICE, EphySnapshotServiceClass)) +#define EPHY_SNAPSHOT_SERVICE_ERROR (ephy_snapshot_service_error_quark()) + typedef struct _EphySnapshotService EphySnapshotService; typedef struct _EphySnapshotServiceClass EphySnapshotServiceClass; typedef struct _EphySnapshotServicePrivate EphySnapshotServicePrivate; @@ -56,38 +58,56 @@ struct _EphySnapshotServiceClass GObjectClass parent_class; }; +typedef enum { + EPHY_SNAPSHOT_SERVICE_ERROR_NOT_FOUND, + EPHY_SNAPSHOT_SERVICE_ERROR_WEB_VIEW, + EPHY_SNAPSHOT_SERVICE_ERROR_INVALID +} EphySnapshotServiceError; + /* Values taken from the Web mockups. */ #define EPHY_THUMBNAIL_WIDTH 180 #define EPHY_THUMBNAIL_HEIGHT 135 -typedef void (* EphySnapshotServiceCallback) (GdkPixbuf *snapshot, - gpointer user_data); - -GType ephy_snapshot_service_get_type (void) G_GNUC_CONST; - -EphySnapshotService *ephy_snapshot_service_get_default (void); - -void ephy_snapshot_service_get_snapshot_async (EphySnapshotService *service, - WebKitWebView *webview, - const char *url, - const time_t mtime, - GCancellable *cancellable, - GAsyncReadyCallback callback, - gpointer user_data); - -GdkPixbuf * ephy_snapshot_service_get_snapshot_finish (EphySnapshotService *service, - 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); +GType ephy_snapshot_service_get_type (void) G_GNUC_CONST; +GQuark ephy_snapshot_service_error_quark (void); + +EphySnapshotService *ephy_snapshot_service_get_default (void); + +void ephy_snapshot_service_get_snapshot_for_url_async (EphySnapshotService *service, + const char *url, + const time_t mtime, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + +GdkPixbuf *ephy_snapshot_service_get_snapshot_for_url_finish (EphySnapshotService *service, + GAsyncResult *result, + GError **error); + +void ephy_snapshot_service_get_snapshot_async (EphySnapshotService *service, + WebKitWebView *web_view, + const time_t mtime, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + +GdkPixbuf *ephy_snapshot_service_get_snapshot_finish (EphySnapshotService *service, + 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); + +gboolean ephy_snapshot_service_save_snapshot_finish (EphySnapshotService *service, + GAsyncResult *result, + GError **error); + +GdkPixbuf *ephy_snapshot_service_crop_snapshot (cairo_surface_t *surface); G_END_DECLS |