static void ephy_find_toolbar_set_web_view (EphyFindToolbar *toolbar, WebKitWebView *web_view) { if (toolbar->web_view == web_view) return; if (toolbar->web_view != NULL) { g_signal_handlers_disconnect_matched (toolbar->controller, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, toolbar); } toolbar->web_view = web_view; if (web_view != NULL) { toolbar->controller = webkit_web_view_get_find_controller (web_view); g_signal_connect_object (toolbar->controller, "found-text", G_CALLBACK (found_text_cb), toolbar, 0); g_signal_connect_object (toolbar->controller, "failed-to-find-text", G_CALLBACK (failed_to_find_text_cb), toolbar, 0); g_signal_connect (web_view, "load-changed", G_CALLBACK (ephy_find_toolbar_load_changed_cb), toolbar); clear_status (toolbar); g_signal_connect_object (EPHY_WEB_VIEW (web_view), "search-key-press", G_CALLBACK (tab_search_key_press_cb), toolbar, 0); } }
static void load_changed_cb (WebKitWebView *view, WebKitLoadEvent load_event, EphySession *session) { if (!ephy_web_view_load_failed (EPHY_WEB_VIEW (view))) ephy_session_save (session, SESSION_STATE); }
void ephy_find_toolbar_set_embed (EphyFindToolbar *toolbar, EphyEmbed *embed) { EphyFindToolbarPrivate *priv = toolbar->priv; WebKitWebView *web_view = EPHY_GET_WEBKIT_WEB_VIEW_FROM_EMBED(embed); if (priv->web_view == web_view) return; if (priv->web_view != NULL) { #ifdef HAVE_WEBKIT2 g_signal_handlers_disconnect_matched (priv->controller, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, toolbar); #endif g_signal_handlers_disconnect_matched (EPHY_WEB_VIEW (web_view), G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, toolbar); } priv->web_view = web_view; if (web_view != NULL) { #ifdef HAVE_WEBKIT2 priv->controller = webkit_web_view_get_find_controller (web_view); g_signal_connect_object (priv->controller, "found-text", G_CALLBACK (found_text_cb), toolbar, 0); g_signal_connect_object (priv->controller, "failed-to-find-text", G_CALLBACK (failed_to_find_text_cb), toolbar, 0); #endif clear_status (toolbar); g_signal_connect_object (EPHY_WEB_VIEW (web_view), "search-key-press", G_CALLBACK (tab_search_key_press_cb), toolbar, 0); } }