1
/* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
3
* Copyright © 2012 Igalia S.L.
5
* This program is free software; you can redistribute it and/or modify
6
* it under the terms of the GNU General Public License as published by
7
* the Free Software Foundation; either version 2, or (at your option)
10
* This program is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
* GNU General Public License for more details.
15
* You should have received a copy of the GNU General Public License
16
* along with this program; if not, write to the Free Software
17
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21
#ifndef _EPHY_SNAPSHOT_SERVICE_H
22
#define _EPHY_SNAPSHOT_SERVICE_H
26
#include <webkit2/webkit2.h>
28
#include <webkit/webkit.h>
31
#include <glib-object.h>
35
#define EPHY_TYPE_SNAPSHOT_SERVICE (ephy_snapshot_service_get_type())
36
#define EPHY_SNAPSHOT_SERVICE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EPHY_TYPE_SNAPSHOT_SERVICE, EphySnapshotService))
37
#define EPHY_SNAPSHOT_SERVICE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), EPHY_TYPE_SNAPSHOT_SERVICE, EphySnapshotServiceClass))
38
#define EPHY_IS_SNAPSHOT_SERVICE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EPHY_TYPE_SNAPSHOT_SERVICE))
39
#define EPHY_IS_SNAPSHOT_SERVICE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), EPHY_TYPE_SNAPSHOT_SERVICE))
40
#define EPHY_SNAPSHOT_SERVICE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), EPHY_TYPE_SNAPSHOT_SERVICE, EphySnapshotServiceClass))
42
#define EPHY_SNAPSHOT_SERVICE_ERROR (ephy_snapshot_service_error_quark())
44
typedef struct _EphySnapshotService EphySnapshotService;
45
typedef struct _EphySnapshotServiceClass EphySnapshotServiceClass;
46
typedef struct _EphySnapshotServicePrivate EphySnapshotServicePrivate;
48
struct _EphySnapshotService
53
EphySnapshotServicePrivate *priv;
56
struct _EphySnapshotServiceClass
58
GObjectClass parent_class;
62
EPHY_SNAPSHOT_SERVICE_ERROR_NOT_FOUND,
63
EPHY_SNAPSHOT_SERVICE_ERROR_WEB_VIEW,
64
EPHY_SNAPSHOT_SERVICE_ERROR_INVALID
65
} EphySnapshotServiceError;
67
/* Values taken from the Web mockups. */
68
#define EPHY_THUMBNAIL_WIDTH 180
69
#define EPHY_THUMBNAIL_HEIGHT 135
71
GType ephy_snapshot_service_get_type (void) G_GNUC_CONST;
72
GQuark ephy_snapshot_service_error_quark (void);
74
EphySnapshotService *ephy_snapshot_service_get_default (void);
76
void ephy_snapshot_service_get_snapshot_for_url_async (EphySnapshotService *service,
79
GCancellable *cancellable,
80
GAsyncReadyCallback callback,
83
GdkPixbuf *ephy_snapshot_service_get_snapshot_for_url_finish (EphySnapshotService *service,
87
void ephy_snapshot_service_get_snapshot_async (EphySnapshotService *service,
88
WebKitWebView *web_view,
90
GCancellable *cancellable,
91
GAsyncReadyCallback callback,
94
GdkPixbuf *ephy_snapshot_service_get_snapshot_finish (EphySnapshotService *service,
98
void ephy_snapshot_service_save_snapshot_async (EphySnapshotService *service,
102
GCancellable *cancellable,
103
GAsyncReadyCallback callback,
106
gboolean ephy_snapshot_service_save_snapshot_finish (EphySnapshotService *service,
107
GAsyncResult *result,
110
GdkPixbuf *ephy_snapshot_service_crop_snapshot (cairo_surface_t *surface);
114
#endif /* _EPHY_SNAPSHOT_SERVICE_H */