From 79942f24aa1337afafa0359b3d7ef2daa14f7268 Mon Sep 17 00:00:00 2001 From: Christian Dywan Date: Sat, 31 Mar 2012 03:33:00 +0200 Subject: [PATCH] Fallback midori_view_search_text to overlay --- midori/midori-view.c | 9 +++++++++ toolbars/midori-findbar.c | 16 ++++++++++++++++ toolbars/midori-findbar.h | 5 ++++- 3 files changed, 29 insertions(+), 1 deletion(-) diff --git a/midori/midori-view.c b/midori/midori-view.c index e985aec4..6d392f74 100644 --- a/midori/midori-view.c +++ b/midori/midori-view.c @@ -5593,6 +5593,15 @@ midori_view_search_text (MidoriView* view, { g_return_if_fail (MIDORI_IS_VIEW (view)); + #if GTK_CHECK_VERSION (3, 2, 0) + if (gtk_widget_get_visible (view->overlay_find)) + { + text = midori_findbar_get_text (MIDORI_FINDBAR (view->overlay_find)); + webkit_web_view_search_text (WEBKIT_WEB_VIEW (view->web_view), + text, case_sensitive, forward, TRUE); + return; + } + #endif g_signal_emit (view, signals[SEARCH_TEXT], 0, webkit_web_view_search_text (WEBKIT_WEB_VIEW (view->web_view), text, case_sensitive, forward, TRUE), NULL); diff --git a/toolbars/midori-findbar.c b/toolbars/midori-findbar.c index 22ab5da4..6ef47f21 100644 --- a/toolbars/midori-findbar.c +++ b/toolbars/midori-findbar.c @@ -145,6 +145,22 @@ midori_findbar_find_text (MidoriFindbar* findbar, midori_view_search_text (MIDORI_VIEW (view), text, case_sensitive, forward); } +/** + * midori_findbar_get_text: + * @findbar: #MidoriFindbar + * + * Returns: the text typed in the entry + * + * Since: 0.4.5 + **/ +const gchar* +midori_findbar_get_text (MidoriFindbar* findbar) +{ + g_return_val_if_fail (MIDORI_IS_FINDBAR (findbar), NULL); + + return gtk_entry_get_text (GTK_ENTRY (findbar->find_text)); +} + void midori_findbar_find (MidoriFindbar* findbar, gboolean forward) diff --git a/toolbars/midori-findbar.h b/toolbars/midori-findbar.h index 5f1a54c5..7a7ea194 100644 --- a/toolbars/midori-findbar.h +++ b/toolbars/midori-findbar.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2010 Christian Dywan + Copyright (C) 2012 Christian Dywan This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -47,6 +47,9 @@ midori_findbar_find_text (MidoriFindbar* findbar, const gchar* text, gboolean forward); +const gchar* +midori_findbar_get_text (MidoriFindbar* findbar); + void midori_findbar_set_can_find (MidoriFindbar* findbar, gboolean can_find);