From e817bd447789cd670fb00b6507debfe84f8cf64f Mon Sep 17 00:00:00 2001 From: rootavish Date: Sat, 21 Jun 2014 15:01:33 +0530 Subject: Changed dependecy to webkit-1.0,added web view to window properties Currently the backend/epub/epub-document.c file has some dummy code, such as that for thumbnails, solely to get it to build. Now that we are done with all functions that we would possibly need to handle the backend, I am now working now on displaying the document via a webview, starting with this commit where i add a webview to the EvWindow properties. Similar to this I need to put in custom functions for epub, as rendering is done by the layout engine. I will also need to add some epub specific callback functions to the widgets. --- shell/Makefile.am | 4 +++- shell/ev-window.c | 30 ++++++++++++++++++++++++++---- 2 files changed, 29 insertions(+), 5 deletions(-) (limited to 'shell') diff --git a/shell/Makefile.am b/shell/Makefile.am index cd123aad..aff9fde0 100644 --- a/shell/Makefile.am +++ b/shell/Makefile.am @@ -20,6 +20,7 @@ AM_CPPFLAGS= \ -DATRIL_COMPILATION \ $(SHELL_CFLAGS) \ $(WARN_CFLAGS) \ + $(WEBKIT_CFLAGS) \ $(DISABLE_DEPRECATED) bin_PROGRAMS=atril @@ -109,7 +110,8 @@ atril_LDADD= \ $(top_builddir)/libdocument/libatrildocument.la \ $(top_builddir)/libview/libatrilview.la \ $(top_builddir)/libmisc/libevmisc.la \ - $(SHELL_LIBS) + $(SHELL_LIBS) \ + $(WEBKIT_LIBS) if PLATFORM_WIN32 atril_LDADD += atril-icon.o diff --git a/shell/ev-window.c b/shell/ev-window.c index 5b046ae7..9219a7cb 100644 --- a/shell/ev-window.c +++ b/shell/ev-window.c @@ -99,6 +99,9 @@ #include "ev-media-player-keys.h" #endif /* ENABLE_DBUS */ +#ifdef ENABLE_EPUB +#include +#endif typedef enum { PAGE_MODE_DOCUMENT, PAGE_MODE_PASSWORD @@ -141,7 +144,9 @@ struct _EvWindowPrivate { GtkWidget *sidebar_attachments; GtkWidget *sidebar_layers; GtkWidget *sidebar_annots; - +#ifdef ENABLE_EPUB + GtkWidget *web_view ; +#endif /* Settings */ GSettings *settings; GSettings *default_settings; @@ -5294,6 +5299,12 @@ ev_window_dispose (GObject *object) priv->view = NULL; } +#ifdef ENABLE_EPUB + if ( priv->web_view ) { + g_object_unref (priv->web_view); + priv->web_view = NULL ; + } +#endif if (priv->password_view) { g_object_unref (priv->password_view); priv->password_view = NULL; @@ -7019,6 +7030,9 @@ ev_window_init (EvWindow *ev_window) 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 () ; +#endif 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); @@ -7065,10 +7079,18 @@ ev_window_init (EvWindow *ev_window) /* We own a ref on these widgets, as we can swap them in and out */ g_object_ref (ev_window->priv->view); g_object_ref (ev_window->priv->password_view); - - gtk_container_add (GTK_CONTAINER (ev_window->priv->scrolled_window), +#ifdef ENABLE_EPUB + if (0) + { + gtk_container_add (GTK_CONTAINER (ev_window->priv->scrolled_window), + ev_window->priv->web_view); + } + else +#endif + { + gtk_container_add (GTK_CONTAINER (ev_window->priv->scrolled_window), ev_window->priv->view); - + } /* Connect to model signals */ g_signal_connect_swapped (ev_window->priv->model, "page-changed", -- cgit v1.2.1