]> git.armaanb.net Git - chorizo.git/commitdiff
Port searching for text to WebKit2
authorPeter Hofmann <scm@uninformativ.de>
Sun, 9 Nov 2014 11:04:51 +0000 (12:04 +0100)
committerPeter Hofmann <scm@uninformativ.de>
Sun, 9 Nov 2014 11:04:51 +0000 (12:04 +0100)
browser.c

index e198383e3bdee9ddbf877bf8530c12ea99d8c4c0..9ee25e50f73f86c3a32a18e8b74ddf6584f3cd98 100644 (file)
--- a/browser.c
+++ b/browser.c
@@ -628,7 +628,7 @@ key_location(GtkWidget *widget, GdkEvent *event, gpointer data)
                                                if (search_text != NULL)
                                                        g_free(search_text);
                                                search_text = g_strdup(t + 1);  /* XXX whacky */
-                                               search(c, 1);
+                                               search(c, 0);
                                        }
                                        else if (!keywords_try_search(WEBKIT_WEB_VIEW(c->web_view), t))
                                        {
@@ -846,14 +846,27 @@ void
 search(gpointer data, gint direction)
 {
        struct Client *c = (struct Client *)data;
+       WebKitWebView *web_view = WEBKIT_WEB_VIEW(c->web_view);
+       WebKitFindController *fc = webkit_web_view_get_find_controller(web_view);
 
        if (search_text == NULL)
                return;
 
-       /*
-       webkit_web_view_search_text(WEBKIT_WEB_VIEW(c->web_view), search_text,
-                                   FALSE, direction == 1, TRUE);
-                                                               */
+       switch (direction)
+       {
+               case 0:
+                       webkit_find_controller_search(fc, search_text,
+                                                     WEBKIT_FIND_OPTIONS_CASE_INSENSITIVE |
+                                                     WEBKIT_FIND_OPTIONS_WRAP_AROUND,
+                                                     G_MAXUINT);
+                       break;
+               case 1:
+                       webkit_find_controller_search_next(fc);
+                       break;
+               case -1:
+                       webkit_find_controller_search_previous(fc);
+                       break;
+       }
 }
 
 Window