summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--atril-view.h1
-rw-r--r--backend/epub/epub-document.c98
-rw-r--r--libdocument/ev-document.c7
-rw-r--r--libdocument/ev-document.h2
-rw-r--r--libview/Makefile.am6
-rw-r--r--previewer/Makefile.am6
-rw-r--r--shell/ev-window.c194
7 files changed, 214 insertions, 100 deletions
diff --git a/atril-view.h b/atril-view.h
index b9261c97..7ed8898a 100644
--- a/atril-view.h
+++ b/atril-view.h
@@ -26,6 +26,7 @@
#include <libview/ev-document-model.h>
#include <libview/ev-print-operation.h>
#include <libview/ev-view.h>
+#include <libview/ev-web-view.h>
#include <libview/ev-view-type-builtins.h>
#include <libview/ev-stock-icons.h>
diff --git a/backend/epub/epub-document.c b/backend/epub/epub-document.c
index 7539fef8..bf1dc00b 100644
--- a/backend/epub/epub-document.c
+++ b/backend/epub/epub-document.c
@@ -1,3 +1,25 @@
+/* this file is part of atril, a mate document viewer
+ *
+ * Copyright (C) 2014 Avishkar Gupta
+ *
+ * Author:
+ * Avishkar Gupta <[email protected]>
+ *
+ * Atril 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.
+ *
+ * Atril 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, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
#include "ev-file-helpers.h"
#include "epub-document.h"
#include "unzip.h"
@@ -11,7 +33,12 @@
#include <glib/gi18n.h>
#include <glib/gstdio.h>
-#include <webkit/webkit.h>
+#if GTK_CHECK_VERSION(3, 0, 0)
+ #include <webkit2/webkit2.h>
+#else
+ #include <webkit/webkit.h>
+#endif
+
#include <gtk/gtk.h>
typedef enum _xmlParseReturnType
@@ -42,8 +69,6 @@ struct _EpubDocument
gchar* tmp_archive_dir ;
/*Stores the contentlist in a sorted manner*/
GList* contentList ;
- /*uri of the current page being displayed in the webview*/
- gchar* currentpageuri ;
/* A variable to hold our epubDocument for unzipping*/
unzFile epubDocument ;
};
@@ -68,10 +93,10 @@ epub_document_thumbnails_get_thumbnail (EvDocumentThumbnails *document,
cairo_surface_t* surface=NULL;
gchar* uri = (gchar*) rc->page->backend_page;
epub_webkit_render (&surface,uri);
- while ( !surface )
- ;
- gint width = cairo_image_surface_get_width (surface);
- gint height = cairo_image_surface_get_height (surface);
+ if ( !surface ) {
+ return NULL ;
+ }
+
if (surface) {
thumbnail = ev_document_misc_pixbuf_from_surface (surface);
cairo_surface_destroy (surface);
@@ -118,7 +143,7 @@ epub_document_get_n_pages (EvDocument *document)
return g_list_length(epub_document->contentList);
}
-
+#if !GTK_CHECK_VERSION(3, 0, 0)
static void
webkit_render_cb(GtkWidget *web_view,
GParamSpec *specification,
@@ -148,6 +173,51 @@ epub_webkit_render(cairo_surface_t **surface,
webkit_web_view_load_uri(WEBKIT_WEB_VIEW(web_view),uri);
}
+#else /* The webkit2 code for GTK3 */
+
+static void
+snapshot_chain_cb(WebKitWebView *web_view,
+ GAsyncResult* res,
+ cairo_surface_t **surface)
+{
+ GError * err = NULL ;
+ *surface = webkit_web_view_get_snapshot_finish(WEBKIT_WEB_VIEW(web_view),res,&err);
+ if ( err ) {
+ surface = NULL ;
+ }
+}
+
+static void
+webkit_render_cb(WebKitWebView *webview,
+ WebKitLoadEvent load_status,
+ cairo_surface_t **surface)
+{
+ if ( load_status != WEBKIT_LOAD_FINISHED )
+ return ;
+
+ webkit_web_view_get_snapshot(webview,
+ WEBKIT_SNAPSHOT_REGION_FULL_DOCUMENT,
+ WEBKIT_SNAPSHOT_OPTIONS_INCLUDE_SELECTION_HIGHLIGHTING,
+ NULL,
+ (GAsyncReadyCallback)snapshot_chain_cb,
+ surface);
+}
+
+static void epub_webkit_render(cairo_surface_t **surface,
+ const char* uri)
+{
+ GtkWidget *offscreen_window = gtk_offscreen_window_new ();
+ gtk_window_set_default_size(GTK_WINDOW(offscreen_window),800,600);
+ GtkWidget* scroll_view = gtk_scrolled_window_new (NULL,NULL);
+ gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW(scroll_view),GTK_POLICY_AUTOMATIC,GTK_POLICY_AUTOMATIC);
+ GtkWidget* web_view = webkit_web_view_new ();
+ gtk_container_add(GTK_CONTAINER(offscreen_window),scroll_view);
+ gtk_container_add(GTK_CONTAINER(scroll_view),web_view);
+ webkit_web_view_load_uri(WEBKIT_WEB_VIEW(web_view),uri);
+ gtk_widget_show_all(offscreen_window);
+ g_signal_connect(web_view,"load-changed",G_CALLBACK(webkit_render_cb),surface);
+}
+#endif
/**
* epub_remove_temporary_dir : Removes a directory recursively.
* This function is same as comics_remove_temporary_dir
@@ -793,7 +863,6 @@ epub_document_init (EpubDocument *epub_document)
epub_document->archivename = NULL ;
epub_document->tmp_archive_dir = NULL ;
epub_document->contentList = NULL ;
- epub_document->currentpageuri = NULL;
}
static gboolean
@@ -869,11 +938,12 @@ epub_document_finalize (GObject *object)
if ( epub_document->contentList ) {
g_list_free_full(epub_document->contentList,(GDestroyNotify)free_tree_nodes);
}
-
- g_free (epub_document->tmp_archive_dir);
- g_free (epub_document->currentpageuri);
- g_free (epub_document->archivename);
-
+ if ( epub_document->tmp_archive_dir) {
+ g_free (epub_document->tmp_archive_dir);
+ }
+ if ( epub_document->archivename) {
+ g_free (epub_document->archivename);
+ }
G_OBJECT_CLASS (epub_document_parent_class)->finalize (object);
}
diff --git a/libdocument/ev-document.c b/libdocument/ev-document.c
index fee64ed1..a242bdf6 100644
--- a/libdocument/ev-document.c
+++ b/libdocument/ev-document.c
@@ -621,13 +621,6 @@ ev_document_render (EvDocument *document,
return klass->render (document, rc);
}
-/*gchar*
-ev_web_document_render(EvDocument *document)
-{
- Layout engine takes care of the rendering, so what we are essentially doing is serving pages to the webview
- EvDocumentClass *klass = EV_DOCUMENT_GET_CLASS (document);
- klass->webkit_render(document);
-}*/
const gchar *
ev_document_get_uri (EvDocument *document)
{
diff --git a/libdocument/ev-document.h b/libdocument/ev-document.h
index 578b0937..fe2fd628 100644
--- a/libdocument/ev-document.h
+++ b/libdocument/ev-document.h
@@ -85,7 +85,7 @@ struct _EvDocument
GObject base;
EvDocumentPrivate *priv;
- /*
+ /*
* Since we can only access the members of this structure from the window frontend,
* we need a flag to detemine whether to replace the atril-view with a web-view.
*/
diff --git a/libview/Makefile.am b/libview/Makefile.am
index 7dd0a950..a5d28360 100644
--- a/libview/Makefile.am
+++ b/libview/Makefile.am
@@ -19,6 +19,7 @@ INST_H_SRC_FILES = \
ev-print-operation.h \
ev-stock-icons.h \
ev-view.h \
+ ev-web-view.h \
ev-view-presentation.h
INST_H_FILES = \
@@ -41,6 +42,7 @@ libatrilview_la_SOURCES = \
ev-timeline.c \
ev-transition-animation.c \
ev-view.c \
+ ev-web-view.c \
ev-view-accessible.c \
ev-view-marshal.c \
ev-view-cursor.c \
@@ -63,6 +65,7 @@ libatrilview_la_CFLAGS = \
$(LIBVIEW_CFLAGS) \
$(WARN_CFLAGS) \
$(DISABLE_DEPRECATED) \
+ $(WEBKIT_CFLAGS) \
$(AM_CFLAGS)
libatrilview_la_LDFLAGS = \
@@ -73,7 +76,8 @@ libatrilview_la_LDFLAGS = \
libatrilview_la_LIBADD = \
$(top_builddir)/libdocument/libatrildocument.la \
- $(LIBVIEW_LIBS)
+ $(LIBVIEW_LIBS) \
+ $(WEBKIT_CFLAGS)
BUILT_SOURCES = \
ev-view-marshal.h \
diff --git a/previewer/Makefile.am b/previewer/Makefile.am
index 756446c4..5ac0d110 100644
--- a/previewer/Makefile.am
+++ b/previewer/Makefile.am
@@ -21,7 +21,8 @@ atril_previewer_CFLAGS = \
$(PREVIEWER_CFLAGS) \
$(WARN_CFLAGS) \
$(DISABLE_DEPRECATED) \
- $(AM_CFLAGS)
+ $(AM_CFLAGS) \
+ $(WEBKIT_CFLAGS)
atril_previewer_LDFLAGS = $(AM_LDFLAGS)
@@ -33,7 +34,8 @@ atril_previewer_LDADD = \
$(top_builddir)/libdocument/libatrildocument.la \
$(top_builddir)/libview/libatrilview.la \
$(top_builddir)/libmisc/libevmisc.la \
- $(PREVIEWER_LIBS)
+ $(PREVIEWER_LIBS) \
+ $(WEBKIT_LIBS)
EXTRA_DIST = $(man_MANS)
diff --git a/shell/ev-window.c b/shell/ev-window.c
index 1c80bd52..4f2c1ac2 100644
--- a/shell/ev-window.c
+++ b/shell/ev-window.c
@@ -87,6 +87,7 @@
#include "ev-utils.h"
#include "ev-keyring.h"
#include "ev-view.h"
+#include "ev-web-view.h"
#include "ev-view-presentation.h"
#include "ev-view-type-builtins.h"
#include "ev-window.h"
@@ -99,13 +100,6 @@
#include "ev-media-player-keys.h"
#endif /* ENABLE_DBUS */
-#ifdef ENABLE_EPUB
- #if GTK_CHECK_VERSION(3, 0, 0)
- #include <webkit2/webkit2.h>
- #else
- #include <webkit/webkit.h>
- #endif
-#endif
typedef enum {
PAGE_MODE_DOCUMENT,
PAGE_MODE_PASSWORD
@@ -148,10 +142,8 @@ struct _EvWindowPrivate {
GtkWidget *sidebar_attachments;
GtkWidget *sidebar_layers;
GtkWidget *sidebar_annots;
-
#ifdef ENABLE_EPUB
- /* For web documents.(epub) */
- GtkWidget *web_view ;
+ GtkWidget *webview;
#endif
/* Settings */
GSettings *settings;
@@ -491,7 +483,7 @@ ev_window_update_actions (EvWindow *ev_window)
n_pages = ev_document_get_n_pages (ev_window->priv->document);
has_pages = n_pages > 0;
}
-
+
can_find_in_page = (ev_window->priv->find_job &&
ev_job_find_has_results (EV_JOB_FIND (ev_window->priv->find_job)));
@@ -507,15 +499,16 @@ ev_window_update_actions (EvWindow *ev_window)
presentation_mode = EV_WINDOW_IS_PRESENTATION (ev_window);
- ev_window_set_action_sensitive (ev_window, "ViewZoomIn",
- has_pages &&
- ev_view_can_zoom_in (view) &&
- !presentation_mode);
- ev_window_set_action_sensitive (ev_window, "ViewZoomOut",
- has_pages &&
- ev_view_can_zoom_out (view) &&
- !presentation_mode);
-
+ if (ev_window->priv->document && ev_window->priv->document->iswebdocument == FALSE ) {
+ ev_window_set_action_sensitive (ev_window, "ViewZoomIn",
+ has_pages &&
+ ev_view_can_zoom_in (view) &&
+ !presentation_mode);
+ ev_window_set_action_sensitive (ev_window, "ViewZoomOut",
+ has_pages &&
+ ev_view_can_zoom_out (view) &&
+ !presentation_mode);
+ }
/* Go menu */
if (has_pages) {
ev_window_set_action_sensitive (ev_window, "GoPreviousPage", page > 0);
@@ -1312,9 +1305,6 @@ static void
ev_window_set_icon_from_thumbnail (EvJobThumbnail *job,
EvWindow *ev_window)
{
- if (ev_window->priv->document->iswebdocument == TRUE) {
- return;
- }
if (job->thumbnail) {
if (ev_document_model_get_inverted_colors (ev_window->priv->model))
ev_document_misc_invert_pixbuf (job->thumbnail);
@@ -1421,8 +1411,8 @@ ev_window_setup_document (EvWindow *ev_window)
else {
if ( gtk_widget_get_parent(ev_window->priv->view) != NULL )
gtk_widget_grab_focus (ev_window->priv->view);
- else if ( document->iswebdocument == TRUE )
- gtk_widget_grab_focus (ev_window->priv->web_view);
+ else
+ gtk_widget_grab_focus (ev_window->priv->webview);
}
return FALSE;
}
@@ -1449,17 +1439,17 @@ ev_window_set_document (EvWindow *ev_window, EvDocument *document)
_("The document contains only empty pages"));
}
#ifdef ENABLE_EPUB
- GtkWidget *parent= gtk_widget_get_parent(ev_window->priv->web_view);
+ GtkWidget *parent= gtk_widget_get_parent(ev_window->priv->webview);
if (document->iswebdocument == TRUE &&
parent == NULL )
{
/*We have encountered a web document, replace the atril view with a web view, if the web view is not already loaded.*/
gtk_container_remove (GTK_CONTAINER(ev_window->priv->scrolled_window),
ev_window->priv->view);
+ g_object_unref(ev_window->priv->view);
gtk_container_add (GTK_CONTAINER (ev_window->priv->scrolled_window),
- ev_window->priv->web_view);
- gtk_widget_show(ev_window->priv->web_view);
- g_object_ref_sink (ev_window->priv->view);
+ ev_window->priv->webview);
+ gtk_widget_show(ev_window->priv->webview);
}
#endif
if (EV_WINDOW_IS_PRESENTATION (ev_window) && document->iswebdocument == FALSE) {
@@ -1537,6 +1527,9 @@ static void
ev_window_handle_link (EvWindow *ev_window,
EvLinkDest *dest)
{
+ if (ev_window->priv->document->iswebdocument == FALSE ) {
+ return;
+ }
if (dest) {
EvLink *link;
EvLinkAction *link_action;
@@ -1830,6 +1823,8 @@ static void
ev_window_load_remote_failed (EvWindow *ev_window,
GError *error)
{
+ if ( !ev_window->priv->view ) return;
+
ev_view_set_loading (EV_VIEW (ev_window->priv->view), FALSE);
ev_window->priv->in_reload = FALSE;
ev_window_error_message (ev_window, error,
@@ -2109,7 +2104,7 @@ ev_window_open_document (EvWindow *ev_window,
setup_document_from_metadata (ev_window);
setup_view_from_metadata (ev_window);
- if (dest) {
+ if (dest && document->iswebdocument == FALSE) {
EvLink *link;
EvLinkAction *link_action;
@@ -2303,13 +2298,10 @@ ev_window_reload_document (EvWindow *ev_window,
EvLinkDest *dest)
{
gint page;
-
-
ev_window_clear_reload_job (ev_window);
ev_window->priv->in_reload = TRUE;
page = ev_document_model_get_page (ev_window->priv->model);
-
if (ev_window->priv->dest)
g_object_unref (ev_window->priv->dest);
ev_window->priv->dest = dest ? g_object_ref (dest) : NULL;
@@ -3633,12 +3625,18 @@ ev_window_cmd_focus_page_selector (GtkAction *act, EvWindow *window)
static void
ev_window_cmd_scroll_forward (GtkAction *action, EvWindow *window)
{
+ /*If the webview is occupying the window*/
+ if ( window->priv->document->iswebdocument == FALSE ) return ;
+
ev_view_scroll (EV_VIEW (window->priv->view), GTK_SCROLL_PAGE_FORWARD, FALSE);
}
static void
ev_window_cmd_scroll_backward (GtkAction *action, EvWindow *window)
{
+ /*If the webview is occupying the window*/
+ if ( window->priv->document->iswebdocument == FALSE ) return ;
+
ev_view_scroll (EV_VIEW (window->priv->view), GTK_SCROLL_PAGE_BACKWARD, FALSE);
}
@@ -3701,7 +3699,7 @@ ev_window_cmd_edit_select_all (GtkAction *action, EvWindow *ev_window)
*/
if (ev_window->priv->chrome & EV_CHROME_FINDBAR) {
egg_find_bar_grab_focus(ev_window->priv->find_bar);
- } else {
+ } else if (ev_window->priv->document->iswebdocument == FALSE ) {
ev_view_select_all (EV_VIEW (ev_window->priv->view));
}
}
@@ -3729,7 +3727,11 @@ ev_window_cmd_edit_find_next (GtkAction *action, EvWindow *ev_window)
update_chrome_flag (ev_window, EV_CHROME_FINDBAR, TRUE);
update_chrome_visibility (ev_window);
gtk_widget_grab_focus (ev_window->priv->find_bar);
- ev_view_find_next (EV_VIEW (ev_window->priv->view));
+ if (ev_window->priv->document->iswebdocument == FALSE) {
+ ev_view_find_next (EV_VIEW (ev_window->priv->view));
+ } else {
+ ev_web_view_find_next(EV_WEB_VIEW(ev_window->priv->webview));
+ }
}
static void
@@ -3740,14 +3742,19 @@ ev_window_cmd_edit_find_previous (GtkAction *action, EvWindow *ev_window)
update_chrome_flag (ev_window, EV_CHROME_FINDBAR, TRUE);
update_chrome_visibility (ev_window);
gtk_widget_grab_focus (ev_window->priv->find_bar);
- ev_view_find_previous (EV_VIEW (ev_window->priv->view));
+ if (ev_window->priv->document->iswebdocument == FALSE) {
+ ev_view_find_previous (EV_VIEW (ev_window->priv->view));
+ } else {
+ ev_web_view_find_previous(EV_WEB_VIEW(ev_window->priv->webview));
+ }
}
static void
ev_window_cmd_edit_copy (GtkAction *action, EvWindow *ev_window)
{
g_return_if_fail (EV_IS_WINDOW (ev_window));
-
+ if ( ev_window->priv->document->iswebdocument == TRUE ) return;
+
ev_view_copy (EV_VIEW (ev_window->priv->view));
}
@@ -3860,8 +3867,12 @@ ev_window_run_fullscreen (EvWindow *window)
if (fullscreen_window)
gtk_window_fullscreen (GTK_WINDOW (window));
- gtk_widget_grab_focus (window->priv->view);
-
+ if (window->priv->view) {
+ gtk_widget_grab_focus (window->priv->view);
+ }
+ else {
+ gtk_widget_grab_focus(window->priv->webview);
+ }
if (window->priv->metadata && !ev_window_is_empty (window))
ev_metadata_set_boolean (window->priv->metadata, "fullscreen", TRUE);
}
@@ -3989,9 +4000,13 @@ ev_window_stop_presentation (EvWindow *window,
update_chrome_visibility (window);
if (unfullscreen_window)
gtk_window_unfullscreen (GTK_WINDOW (window));
-
- gtk_widget_grab_focus (window->priv->view);
-
+
+ if (window->priv->view) {
+ gtk_widget_grab_focus (window->priv->view);
+ } else {
+ gtk_widget_grab_focus (window->priv->webview);
+ }
+
ev_application_screensaver_enable (EV_APP);
if (window->priv->metadata && !ev_window_is_empty (window))
@@ -4131,7 +4146,7 @@ ev_window_set_page_mode (EvWindow *window,
child = window->priv->view;
}
else {
- child=window->priv->web_view;
+ child=window->priv->webview;
}
break;
case PAGE_MODE_PASSWORD:
@@ -4272,7 +4287,7 @@ static void
ev_window_cmd_view_zoom_in (GtkAction *action, EvWindow *ev_window)
{
g_return_if_fail (EV_IS_WINDOW (ev_window));
-
+ if ( ev_window->priv->document->iswebdocument == TRUE ) return ;
ev_document_model_set_sizing_mode (ev_window->priv->model, EV_SIZING_FREE);
ev_view_zoom_in (EV_VIEW (ev_window->priv->view));
}
@@ -4281,7 +4296,8 @@ static void
ev_window_cmd_view_zoom_out (GtkAction *action, EvWindow *ev_window)
{
g_return_if_fail (EV_IS_WINDOW (ev_window));
-
+ if ( ev_window->priv->document->iswebdocument == TRUE ) return ;
+
ev_document_model_set_sizing_mode (ev_window->priv->model, EV_SIZING_FREE);
ev_view_zoom_out (EV_VIEW (ev_window->priv->view));
}
@@ -4290,8 +4306,11 @@ static void
ev_window_cmd_go_previous_page (GtkAction *action, EvWindow *ev_window)
{
g_return_if_fail (EV_IS_WINDOW (ev_window));
-/* webkit_web_view_load_uri(WEBKIT_WEB_VIEW(ev_window->web_view),"");*/
- ev_view_previous_page (EV_VIEW (ev_window->priv->view));
+ if ( ev_window->priv->document->iswebdocument == TRUE ) {
+ ev_web_view_previous_page(EV_WEB_VIEW(ev_window->priv->webview));
+ } else {
+ ev_view_previous_page (EV_VIEW (ev_window->priv->view));
+ }
}
static void
@@ -4299,7 +4318,11 @@ ev_window_cmd_go_next_page (GtkAction *action, EvWindow *ev_window)
{
g_return_if_fail (EV_IS_WINDOW (ev_window));
- ev_view_next_page (EV_VIEW (ev_window->priv->view));
+ if ( ev_window->priv->document->iswebdocument == TRUE ) {
+ ev_web_view_next_page(EV_WEB_VIEW(ev_window->priv->webview));
+ } else {
+ ev_view_next_page (EV_VIEW (ev_window->priv->view));
+ }
}
static void
@@ -4407,7 +4430,7 @@ static void
ev_window_cmd_escape (GtkAction *action, EvWindow *window)
{
GtkWidget *widget;
-
+ if ( window->priv->document->iswebdocument == FALSE ) return ;
ev_view_autoscroll_stop (EV_VIEW (window->priv->view));
widget = gtk_window_get_focus (GTK_WINDOW (window));
@@ -4746,6 +4769,8 @@ view_menu_link_popup (EvWindow *ev_window,
gboolean show_external = FALSE;
gboolean show_internal = FALSE;
GtkAction *action;
+
+ if ( ev_window->priv->document->iswebdocument == TRUE ) return ;
if (ev_window->priv->link)
g_object_unref (ev_window->priv->link);
@@ -4798,7 +4823,8 @@ view_menu_image_popup (EvWindow *ev_window,
{
GtkAction *action;
gboolean show_image = FALSE;
-
+
+ if (ev_window->priv->document->iswebdocument == TRUE ) return ;
if (ev_window->priv->image)
g_object_unref (ev_window->priv->image);
@@ -4824,7 +4850,7 @@ view_menu_annot_popup (EvWindow *ev_window,
{
GtkAction *action;
gboolean show_annot = FALSE;
-
+ if (ev_window->priv->document->iswebdocument == TRUE ) return ;
if (ev_window->priv->annot)
g_object_unref (ev_window->priv->annot);
ev_window->priv->annot = (annot) ? g_object_ref (annot) : NULL;
@@ -4973,7 +4999,7 @@ ev_window_find_job_updated_cb (EvJobFind *job,
EvWindow *ev_window)
{
ev_window_update_actions (ev_window);
-
+ if (ev_window->priv->document->iswebdocument == TRUE ) return ;
ev_view_find_changed (EV_VIEW (ev_window->priv->view),
ev_job_find_get_results (job),
page);
@@ -5002,6 +5028,7 @@ static void
find_bar_previous_cb (EggFindBar *find_bar,
EvWindow *ev_window)
{
+ if (ev_window->priv->document->iswebdocument == TRUE ) return ;
ev_view_find_previous (EV_VIEW (ev_window->priv->view));
}
@@ -5009,6 +5036,7 @@ static void
find_bar_next_cb (EggFindBar *find_bar,
EvWindow *ev_window)
{
+ if (ev_window->priv->document->iswebdocument == TRUE ) return ;
ev_view_find_next (EV_VIEW (ev_window->priv->view));
}
@@ -5016,6 +5044,7 @@ static void
find_bar_close_cb (EggFindBar *find_bar,
EvWindow *ev_window)
{
+ if (ev_window->priv->document->iswebdocument == TRUE ) return ;
ev_view_find_cancel (EV_VIEW (ev_window->priv->view));
ev_window_clear_find_job (ev_window);
update_chrome_flag (ev_window, EV_CHROME_FINDBAR, FALSE);
@@ -5032,7 +5061,7 @@ find_bar_search_changed_cb (EggFindBar *find_bar,
if (!ev_window->priv->document || !EV_IS_DOCUMENT_FIND (ev_window->priv->document))
return;
-
+ if (ev_window->priv->document->iswebdocument == TRUE ) return ;
/* Either the string or case sensitivity could have changed. */
case_sensitive = egg_find_bar_get_case_sensitive (find_bar);
search_string = egg_find_bar_get_search_string (find_bar);
@@ -5068,7 +5097,7 @@ find_bar_visibility_changed_cb (EggFindBar *find_bar,
EvWindow *ev_window)
{
gboolean visible;
-
+ if (ev_window->priv->document->iswebdocument == TRUE ) return ;
visible = gtk_widget_get_visible (GTK_WIDGET (find_bar));
if (ev_window->priv->document &&
@@ -5089,6 +5118,7 @@ find_bar_scroll (EggFindBar *find_bar,
GtkScrollType scroll,
EvWindow *ev_window)
{
+ if (ev_window->priv->document->iswebdocument == TRUE ) return ;
ev_view_scroll (EV_VIEW (ev_window->priv->view), scroll, FALSE);
}
@@ -5348,14 +5378,14 @@ ev_window_dispose (GObject *object)
}
#ifdef ENABLE_EPUB
- if ( priv->web_view ) {
- if (gtk_widget_get_parent(priv->web_view) == NULL ) {
- g_object_ref_sink (priv->web_view);
- g_object_unref (priv->web_view);
+ if ( priv->webview ) {
+ if (gtk_widget_get_parent(priv->webview) == NULL ) {
+ g_object_ref_sink (priv->webview);
+ g_object_unref (priv->webview);
}else {
- g_object_unref (priv->web_view);
+ g_object_unref (priv->webview);
}
- priv->web_view = NULL ;
+ priv->webview = NULL ;
}
#endif
if (priv->password_view) {
@@ -5488,11 +5518,11 @@ ev_window_key_press_event (GtkWidget *widget,
g_object_unref (priv->view);
}
- else if ( priv->web_view && (parent=gtk_widget_get_parent(priv->web_view) ) != NULL) {
- g_object_ref (priv->web_view);
- if (gtk_widget_is_sensitive (priv->web_view))
- handled = gtk_widget_event (priv->web_view, (GdkEvent*) event);
- g_object_unref (priv->web_view);
+ else if ( priv->webview && (parent=gtk_widget_get_parent(priv->webview) ) != NULL) {
+ g_object_ref (priv->webview);
+ if (gtk_widget_is_sensitive (priv->webview))
+ handled = gtk_widget_event (priv->webview, (GdkEvent*) event);
+ g_object_unref (priv->webview);
}
if (!handled && !EV_WINDOW_IS_PRESENTATION (ev_window)) {
@@ -5755,7 +5785,10 @@ static const GtkActionEntry attachment_popup_entries [] = {
static void
sidebar_links_link_activated_cb (EvSidebarLinks *sidebar_links, EvLink *link, EvWindow *window)
{
- ev_view_handle_link (EV_VIEW (window->priv->view), link);
+ if (window->priv->document->iswebdocument == FALSE ) {
+ ev_view_handle_link (EV_VIEW (window->priv->view), link);
+ }
+ ev_web_view_handle_link(EV_WEB_VIEW(window->priv->webview), link);
}
static void
@@ -5768,6 +5801,7 @@ activate_link_cb (EvPageAction *page_action, EvLink *link, EvWindow *window)
static void
navigation_action_activate_link_cb (EvNavigationAction *action, EvLink *link, EvWindow *window)
{
+ if (window->priv->document->iswebdocument == FALSE ) return;
ev_view_handle_link (EV_VIEW (window->priv->view), link);
gtk_widget_grab_focus (window->priv->view);
@@ -5777,7 +5811,13 @@ static void
sidebar_layers_visibility_changed (EvSidebarLayers *layers,
EvWindow *window)
{
- ev_view_reload (EV_VIEW (window->priv->view));
+ if (window->priv->document->iswebdocument == FALSE ) {
+ ev_view_reload (EV_VIEW (window->priv->view));
+ }
+ else
+ {
+ ev_web_view_reload(EV_WEB_VIEW(window->priv->webview));
+ }
}
static void
@@ -5785,6 +5825,7 @@ sidebar_annots_annot_activated_cb (EvSidebarAnnotations *sidebar_annots,
EvMapping *annot_mapping,
EvWindow *window)
{
+ if (window->priv->document->iswebdocument == FALSE ) return;
ev_view_focus_annotation (EV_VIEW (window->priv->view), annot_mapping);
}
@@ -5793,6 +5834,7 @@ sidebar_annots_begin_annot_add (EvSidebarAnnotations *sidebar_annots,
EvAnnotationType annot_type,
EvWindow *window)
{
+ if (window->priv->document->iswebdocument == FALSE ) return;
ev_view_begin_add_annotation (EV_VIEW (window->priv->view), annot_type);
}
@@ -5809,6 +5851,7 @@ static void
sidebar_annots_annot_add_cancelled (EvSidebarAnnotations *sidebar_annots,
EvWindow *window)
{
+ if (window->priv->document->iswebdocument == FALSE ) return;
ev_view_cancel_add_annotation (EV_VIEW (window->priv->view));
}
@@ -6212,6 +6255,7 @@ view_external_link_cb (EvView *view, EvLinkAction *action, EvWindow *window)
static void
ev_view_popup_cmd_open_link (GtkAction *action, EvWindow *window)
{
+ if (window->priv->document->iswebdocument == FALSE ) return;
ev_view_handle_link (EV_VIEW (window->priv->view), window->priv->link);
}
@@ -6236,7 +6280,7 @@ static void
ev_view_popup_cmd_copy_link_address (GtkAction *action, EvWindow *window)
{
EvLinkAction *ev_action;
-
+ if (window->priv->document->iswebdocument == FALSE ) return;
ev_action = ev_link_get_action (window->priv->link);
if (!ev_action)
return;
@@ -6411,6 +6455,8 @@ static void
ev_view_popup_cmd_annot_properties (GtkAction *action,
EvWindow *window)
{
+ if (window->priv->document->iswebdocument == FALSE ) return;
+
const gchar *author;
GdkColor color;
gdouble opacity;
@@ -6796,8 +6842,9 @@ method_call_cb (GDBusConnection *connection,
GDBusMethodInvocation *invocation,
gpointer user_data)
{
- EvWindow *window = EV_WINDOW (user_data);
-
+ EvWindow *window = EV_WINDOW (user_data);
+ if (window->priv->document->iswebdocument == FALSE ) return;
+
if (g_strcmp0 (method_name, "SyncView") != 0)
return;
@@ -7090,14 +7137,11 @@ ev_window_init (EvWindow *ev_window)
ev_window->priv->view_box);
gtk_widget_show (ev_window->priv->view_box);
+ ev_window->priv->view = ev_view_new ();
#ifdef ENABLE_EPUB
- ev_window->priv->web_view = webkit_web_view_new () ;
-
- /*Signals for the web view*/
- g_signal_connect_swapped(ev_window,"destroy",G_CALLBACK(gtk_widget_destroy),ev_window->priv->web_view);
+ ev_window->priv->webview = ev_web_view_new();
#endif
- ev_window->priv->view = ev_view_new ();
ev_view_set_page_cache_size (EV_VIEW (ev_window->priv->view), PAGE_CACHE_SIZE);
ev_view_set_model (EV_VIEW (ev_window->priv->view), ev_window->priv->model);