summaryrefslogtreecommitdiff
path: root/libview/ev-web-view.c
diff options
context:
space:
mode:
authorrootavish <[email protected]>2014-08-10 01:05:45 +0530
committerrootavish <[email protected]>2014-08-10 01:05:45 +0530
commit1548bcb4629a6a41641a0188003215b3098aa5fc (patch)
tree368ef186c9aa1a60eeeba84fabcaceb6d30bd30f /libview/ev-web-view.c
parent3a013d3b19c5a81372560e735cf6f9f5c3ebdd37 (diff)
downloadatril-1548bcb4629a6a41641a0188003215b3098aa5fc.tar.bz2
atril-1548bcb4629a6a41641a0188003215b3098aa5fc.tar.xz
Page Label handling, other fixes
Added the function to handle links from the toolbar, also added functions to disconnect all ev-view handlers once it has been replaced by ev-web-view, and vice-versa(to drop all handler associated to ev-web-view). Also the unref call to job_thumb was causing thumbnail jobs to crash with GTK2, so had to revert that, now we're back to the document folder not getting deleted from disk.
Diffstat (limited to 'libview/ev-web-view.c')
-rw-r--r--libview/ev-web-view.c32
1 files changed, 31 insertions, 1 deletions
diff --git a/libview/ev-web-view.c b/libview/ev-web-view.c
index f88dd84a..b1fe3b08 100644
--- a/libview/ev-web-view.c
+++ b/libview/ev-web-view.c
@@ -22,6 +22,7 @@
#include <glib/gi18n-lib.h>
#include <gtk/gtk.h>
+#include <stdlib.h>
#if GTK_CHECK_VERSION (3, 0, 0)
#include <webkit2/webkit2.h>
@@ -420,6 +421,15 @@ ev_web_view_handle_link(EvWebView *webview,EvLink *link)
break;
}
+ case EV_LINK_DEST_TYPE_PAGE_LABEL: {
+ const gchar *text = ev_link_dest_get_page_label (dest);
+ gint page = atoi(text);
+
+ if (page <= ev_document_get_n_pages(webview->document) && page > 0) {
+ ev_document_model_set_page(webview->model,page-1);
+ }
+ break;
+ }
case EV_LINK_DEST_TYPE_HLINK: {
const gchar *uri = ev_link_dest_get_named_dest(dest);
ev_document_model_set_page(webview->model,ev_link_dest_get_page(dest));
@@ -430,7 +440,6 @@ ev_web_view_handle_link(EvWebView *webview,EvLink *link)
}
}
}
-
/* Searching */
#if !GTK_CHECK_VERSION (3, 0, 0)
@@ -841,4 +850,25 @@ ev_web_view_zoom_out(EvWebView *webview)
webkit_web_view_zoom_out(WEBKIT_WEB_VIEW(webview));
#endif
return TRUE;
+}
+
+/**
+ * ev_web_view_disconnect_handlers
+ * @webview : #EvWebView instance
+ *
+ * This function call will disconnect all model signal handlers from the webview, to ensure smooth operation of the Atril-view.
+ * Equivalent to function ev_view_disconnect_handlers in ev-view.c
+ */
+void
+ev_web_view_disconnect_handlers(EvWebView *webview)
+{
+ g_signal_handlers_disconnect_by_func(webview->model,
+ ev_web_view_document_changed_cb,
+ webview);
+ g_signal_handlers_disconnect_by_func(webview->model,
+ ev_web_view_inverted_colors_changed_cb,
+ webview);
+ g_signal_handlers_disconnect_by_func(webview->model,
+ ev_web_view_page_changed_cb,
+ webview);
} \ No newline at end of file