[evolution/wip-webkit2] EWebView - Intiliaze FindController when it's firstly used



commit 58ddeb2408da58e8d2b05a957eabe1af1d6a3d13
Author: Tomas Popela <tpopela redhat com>
Date:   Fri Nov 8 14:09:35 2013 +0100

    EWebView - Intiliaze FindController when it's firstly used

 e-util/e-web-view.c |   44 +++++++++++++++++++++++++-------------------
 1 files changed, 25 insertions(+), 19 deletions(-)
---
diff --git a/e-util/e-web-view.c b/e-util/e-web-view.c
index e5e5441..affee34 100644
--- a/e-util/e-web-view.c
+++ b/e-util/e-web-view.c
@@ -423,25 +423,6 @@ webkit_find_controller_failed_to_found_text_cb (WebKitFindController *find_contr
 }
 
 static void
-web_view_update_document_highlights (EWebView *web_view)
-{
-       WebKitFindController *find_controller;
-       GList *head, *link;
-
-       find_controller = web_view->priv->find_controller;
-
-       head = g_queue_peek_head_link (&web_view->priv->highlights);
-
-       for (link = head; link != NULL; link = g_list_next (link)) {
-               webkit_find_controller_search (
-                       find_controller,
-                       link->data,
-                       WEBKIT_FIND_OPTIONS_NONE,
-                       G_MAXUINT);
-       }
-}
-
-static void
 web_view_set_find_controller (EWebView *web_view)
 {
        WebKitFindController *find_controller;
@@ -461,6 +442,28 @@ web_view_set_find_controller (EWebView *web_view)
 }
 
 static void
+web_view_update_document_highlights (EWebView *web_view)
+{
+       WebKitFindController *find_controller;
+       GList *head, *link;
+
+       if (!web_view->priv->find_controller)
+               web_view_set_find_controller (web_view);
+
+       find_controller = web_view->priv->find_controller;
+
+       head = g_queue_peek_head_link (&web_view->priv->highlights);
+
+       for (link = head; link != NULL; link = g_list_next (link)) {
+               webkit_find_controller_search (
+                       find_controller,
+                       link->data,
+                       WEBKIT_FIND_OPTIONS_NONE,
+                       G_MAXUINT);
+       }
+}
+
+static void
 web_view_menu_item_deselect_cb (EWebView *web_view)
 {
        e_web_view_status_message (web_view, NULL);
@@ -2601,6 +2604,9 @@ e_web_view_clear_highlights (EWebView *web_view)
 {
        g_return_if_fail (E_IS_WEB_VIEW (web_view));
 
+       if (!web_view->priv->find_controller)
+               web_view_set_find_controller (web_view);
+
        webkit_find_controller_search_finish (web_view->priv->find_controller);
 
        while (!g_queue_is_empty (&web_view->priv->highlights))


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]