From b219a4a96ed7f38bf3de46bff790b139955bd927 Mon Sep 17 00:00:00 2001 From: rootavish Date: Wed, 23 Jul 2014 00:18:47 +0530 Subject: Cleaned some code, added select-all functionality Select all functionality to select all content from the webview. Cleaned ev-jobs.c, it had a lot of unused code. --- libview/ev-jobs.c | 21 ++++----------------- libview/ev-web-view.c | 6 ++++++ libview/ev-web-view.h | 1 + shell/ev-window.c | 13 +++++++++++-- 4 files changed, 22 insertions(+), 19 deletions(-) diff --git a/libview/ev-jobs.c b/libview/ev-jobs.c index 38fe6a0f..884baabc 100644 --- a/libview/ev-jobs.c +++ b/libview/ev-jobs.c @@ -896,24 +896,11 @@ ev_job_web_thumbnail_dispose (GObject *object) ev_debug_message (DEBUG_JOBS, "%s (%p)", job->page, job); - if(job->offscreenwindow) { - gtk_widget_destroy(job->offscreenwindow); - job->offscreenwindow = NULL; - } - - if(job->webview) { - job->webview = NULL; - } - if(job->page) { g_free(job->page); job->page = NULL; } - if (&job->screenlock) - { - g_rw_lock_clear (&job->screenlock); - } (* G_OBJECT_CLASS (ev_job_web_thumbnail_parent_class)->dispose) (object); } @@ -972,9 +959,9 @@ ev_job_web_thumbnail_class_init (EvJobWebThumbnailClass *class) } EvJob * -ev_job_web_thumbnail_new (EvDocument *document, - gboolean *completed, - gchar *webpage, +ev_job_web_thumbnail_new (EvDocument *document, + gboolean *completed, + gchar *webpage, cairo_surface_t **surface) { EvJobWebThumbnail *job; @@ -989,7 +976,7 @@ ev_job_web_thumbnail_new (EvDocument *document, job->surface = surface; job->page = g_strdup(webpage); - g_rw_lock_init (&job->screenlock); + return EV_JOB (job); } diff --git a/libview/ev-web-view.c b/libview/ev-web-view.c index 136e1e96..fbfbad02 100644 --- a/libview/ev-web-view.c +++ b/libview/ev-web-view.c @@ -358,4 +358,10 @@ gboolean ev_web_view_get_has_selection(EvWebView *webview) { return webkit_web_view_has_selection(WEBKIT_WEB_VIEW(webview)); +} + +void +ev_web_view_select_all(EvWebView *webview) +{ + webkit_web_view_select_all(WEBKIT_WEB_VIEW(webview)); } \ No newline at end of file diff --git a/libview/ev-web-view.h b/libview/ev-web-view.h index 19d6c8a1..eaa2ef3f 100644 --- a/libview/ev-web-view.h +++ b/libview/ev-web-view.h @@ -64,6 +64,7 @@ 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); G_END_DECLS diff --git a/shell/ev-window.c b/shell/ev-window.c index 277488c6..9232cbb6 100644 --- a/shell/ev-window.c +++ b/shell/ev-window.c @@ -453,13 +453,13 @@ ev_window_setup_action_sensitivity (EvWindow *ev_window) ev_window_set_action_sensitive (ev_window, "EditRotateRight", has_pages && !(document->iswebdocument)); /* View menu */ - /*If it has pages it is a document, so our check for a webdocument won't lead to a crash. We need to switch these off since more than one + /*If it has pages it is a document, so our check for a webdocument won't lead to a crash. We need to switch these view modes off since more than one *webview is hard to manage, and would lead to unexpected behaviour in case the number of webviews gets too large. */ ev_window_set_action_sensitive (ev_window, "ViewContinuous", has_pages && !(document->iswebdocument)); ev_window_set_action_sensitive (ev_window, "ViewDual", has_pages && !(document->iswebdocument)); ev_window_set_action_sensitive (ev_window, "ViewBestFit", has_pages && !(document->iswebdocument)); - ev_window_set_action_sensitive (ev_window, "ViewPageWidth", has_pages); + ev_window_set_action_sensitive (ev_window, "ViewPageWidth", has_pages && !(document->iswebdocument)); ev_window_set_action_sensitive (ev_window, "ViewReload", has_pages); ev_window_set_action_sensitive (ev_window, "ViewAutoscroll", has_pages && !(document->iswebdocument)); ev_window_set_action_sensitive (ev_window, "ViewInvertedColors", has_pages); @@ -929,6 +929,13 @@ view_selection_changed_cb (EvView *view, ev_view_get_has_selection (view)); } +static void +web_view_selection_changed_cb(EvWebView *webview, + EvWindow *window) +{ + +} + static void ev_window_page_changed_cb (EvWindow *ev_window, gint old_page, @@ -3723,6 +3730,8 @@ ev_window_cmd_edit_select_all (GtkAction *action, EvWindow *ev_window) egg_find_bar_grab_focus(ev_window->priv->find_bar); } else if (ev_window->priv->document->iswebdocument == FALSE ) { ev_view_select_all (EV_VIEW (ev_window->priv->view)); + } else { + ev_web_view_select_all(EV_WEB_VIEW(ev_window->priv->webview)); } } -- cgit v1.2.1