void ephy_find_toolbar_close (EphyFindToolbar *toolbar) { gtk_search_bar_set_search_mode (GTK_SEARCH_BAR (toolbar), FALSE); if (toolbar->web_view == NULL) return; webkit_find_controller_search_finish (toolbar->controller); }
void ephy_find_toolbar_close (EphyFindToolbar *toolbar) { EphyFindToolbarPrivate *priv = toolbar->priv; gtk_widget_hide (GTK_WIDGET (toolbar)); if (priv->web_view == NULL) return; #ifdef HAVE_WEBKIT2 webkit_find_controller_search_finish (toolbar->priv->controller); #else webkit_web_view_set_highlight_text_matches (priv->web_view, FALSE); #endif }
static void clear_status (EphyFindToolbar *toolbar) { g_object_set (toolbar->entry, "primary-icon-name", "edit-find-symbolic", NULL); gtk_widget_set_sensitive (toolbar->prev, FALSE); gtk_widget_set_sensitive (toolbar->next, FALSE); if (toolbar->web_view == NULL) return; webkit_find_controller_search_finish (toolbar->controller); }
void inSiteSearchToggle(RuskWindow *rusk) { if(!gtk_widget_is_visible(GTK_WIDGET(rusk->insiteSearch))) { gtk_widget_set_visible(GTK_WIDGET(rusk->insiteSearch), TRUE); gtk_window_set_focus(rusk->window, GTK_WIDGET(rusk->insiteSearch)); WebKitFindController *finder = webkit_web_view_get_find_controller(rusk->webview); runInSiteSearch(rusk, webkit_find_controller_get_search_text(finder), TRUE); webkit_find_controller_search_previous(finder); }else { webkit_find_controller_search_finish(webkit_web_view_get_find_controller(rusk->webview)); gtk_widget_set_visible(GTK_WIDGET(rusk->insiteSearch), FALSE); gtk_window_set_focus(rusk->window, GTK_WIDGET(rusk->webview)); } }
long wxWebViewWebKit::Find(const wxString& text, int flags) { WebKitFindController* findctrl = webkit_web_view_get_find_controller(m_web_view); bool newSearch = false; if(text != m_findText || (flags & wxWEBVIEW_FIND_MATCH_CASE) != (m_findFlags & wxWEBVIEW_FIND_MATCH_CASE)) { newSearch = true; //If it is a new search we need to clear existing highlights webkit_find_controller_search_finish(findctrl); } m_findFlags = flags; m_findText = text; //If the search string is empty then we clear any selection and highlight if(text.empty()) { webkit_find_controller_search_finish(findctrl); ClearSelection(); return wxNOT_FOUND; } bool wrap = false, forward = true; guint32 options = WEBKIT_FIND_OPTIONS_NONE; if(flags & wxWEBVIEW_FIND_WRAP) { wrap = true; options |= WEBKIT_FIND_OPTIONS_WRAP_AROUND; } if(!(flags & wxWEBVIEW_FIND_MATCH_CASE)) { options |= WEBKIT_FIND_OPTIONS_CASE_INSENSITIVE; } if(flags & wxWEBVIEW_FIND_BACKWARDS) { forward = false; options |= WEBKIT_FIND_OPTIONS_BACKWARDS; } if(newSearch) { //Initially we count the matches to know how many we have m_findCount = -1; webkit_find_controller_count_matches(findctrl, wxGTK_CONV(text), options, G_MAXUINT); GMainContext *main_context = g_main_context_get_thread_default(); while (m_findCount == -1) { g_main_context_iteration(main_context, TRUE); } //Highlight them if needed if(flags & wxWEBVIEW_FIND_HIGHLIGHT_RESULT) { webkit_find_controller_search(findctrl, wxGTK_CONV(text), options, G_MAXUINT); } //In this case we return early to match IE behaviour m_findPosition = -1; return m_findCount; } else { if(forward) m_findPosition++; else m_findPosition--; if(m_findPosition < 0) m_findPosition += m_findCount; if(m_findPosition > m_findCount) m_findPosition -= m_findCount; } if(forward) { webkit_find_controller_search_next(findctrl); if(m_findPosition == m_findCount && !wrap) { return wxNOT_FOUND; } } else { webkit_find_controller_search_previous(findctrl); if(m_findPosition == -1 && !wrap) { return wxNOT_FOUND; } } return newSearch ? m_findCount : m_findPosition; }