summaryrefslogtreecommitdiff
path: root/libview
diff options
context:
space:
mode:
Diffstat (limited to 'libview')
-rw-r--r--libview/ev-web-view.c26
-rw-r--r--libview/ev-web-view.h9
2 files changed, 24 insertions, 11 deletions
diff --git a/libview/ev-web-view.c b/libview/ev-web-view.c
index b28befd7..a1caba36 100644
--- a/libview/ev-web-view.c
+++ b/libview/ev-web-view.c
@@ -1,7 +1,7 @@
/* this file is part of atril, a mate document viewer
*
* Copyright (C) 2014 Avishkar Gupta
- * Based on ev-view.c
+ * Based on ev-view.c, also a part of atril, a mate document viewer.
*
* Atril is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
@@ -28,8 +28,10 @@
#else
#include <webkit/webkit.h>
#endif
+
#include "ev-web-view.h"
#include "ev-document-model.h"
+
#define EV_WEB_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), EV_TYPE_WEB_VIEW, EvWebViewClass))
#define EV_IS_WEB_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), EV_TYPE_WEB_VIEW))
#define EV_WEB_VIEW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), EV_TYPE_WEB_VIEW, EvWebViewClass))
@@ -133,11 +135,12 @@ ev_web_view_change_page (EvWebView *webview,
g_return_if_fail(EV_IS_WEB_VIEW(webview));
EvDocumentClass *klass = EV_DOCUMENT_GET_CLASS(webview->document);
+
EvPage *page = klass->get_page(webview->document,new_page);
- webkit_web_view_load_uri(WEBKIT_WEB_VIEW(webview),(gchar*)page->backend_page);
webview->current_page = new_page;
ev_document_model_set_page(webview->model,new_page);
+ webkit_web_view_load_uri(WEBKIT_WEB_VIEW(webview),(gchar*)page->backend_page);
}
static void
@@ -187,11 +190,8 @@ ev_web_view_document_changed_cb (EvDocumentModel *model,
}
gint current_page = ev_document_model_get_page(model);
- if (webview->current_page != current_page) {
- ev_web_view_change_page (webview, current_page);
- } else {
- webkit_web_view_reload (WEBKIT_WEB_VIEW(webview));
- }
+
+ ev_web_view_change_page (webview, current_page);
}
}
@@ -365,6 +365,18 @@ ev_web_view_select_all(EvWebView *webview)
webkit_web_view_select_all(WEBKIT_WEB_VIEW(webview));
}
+void
+ev_web_view_copy(EvWebView *webview)
+{
+ /* If for some reason we don't have a selection any longer,best to be safe*/
+ if (ev_web_view_get_has_selection(webview) == FALSE)
+ return;
+ if (webkit_web_view_can_copy_clipboard(WEBKIT_WEB_VIEW(webview))) {
+ webkit_web_view_copy_clipboard(WEBKIT_WEB_VIEW(webview));
+ }
+
+}
+
gboolean
ev_web_view_zoom_in(EvWebView *webview)
{
diff --git a/libview/ev-web-view.h b/libview/ev-web-view.h
index ac957f5d..2c920434 100644
--- a/libview/ev-web-view.h
+++ b/libview/ev-web-view.h
@@ -1,7 +1,7 @@
-/* this file is part of atril, a mate document web_viewer
+/* this file is part of atril, a mate document viewer
*
* Copyright (C) 2014 Avishkar Gupta
- * Based on ev-view.h
+ * Based on ev-view.h, also a part of atril, a mate document viewer
*
* Atril is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
@@ -63,8 +63,9 @@ void ev_web_view_find_next (EvWebView *webview);
void ev_web_view_find_previous (EvWebView *webview);
/*Selection*/
-gboolean ev_web_view_get_has_selection (EvWebView *webview);
-void ev_web_view_select_all (EvWebView *webview);
+gboolean ev_web_view_get_has_selection (EvWebView *webview);
+void ev_web_view_select_all (EvWebView *webview);
+void ev_web_view_copy (EvWebView *webview);
/*Zoom control*/
gboolean ev_web_view_zoom_in (EvWebView *webview);