Show inline find while typing in an overlay
This commit is contained in:
parent
f3af1983ed
commit
e75b814432
3 changed files with 17 additions and 2 deletions
|
@ -15,6 +15,7 @@
|
||||||
#include "midori-searchaction.h"
|
#include "midori-searchaction.h"
|
||||||
#include "midori-platform.h"
|
#include "midori-platform.h"
|
||||||
#include "midori-core.h"
|
#include "midori-core.h"
|
||||||
|
#include "midori-findbar.h"
|
||||||
|
|
||||||
#include "marshal.h"
|
#include "marshal.h"
|
||||||
|
|
||||||
|
@ -116,6 +117,7 @@ struct _MidoriView
|
||||||
#if GTK_CHECK_VERSION (3, 2, 0)
|
#if GTK_CHECK_VERSION (3, 2, 0)
|
||||||
GtkWidget* overlay;
|
GtkWidget* overlay;
|
||||||
GtkWidget* overlay_label;
|
GtkWidget* overlay_label;
|
||||||
|
GtkWidget* overlay_find;
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -2044,7 +2046,12 @@ gtk_widget_key_press_event_cb (WebKitWebView* web_view,
|
||||||
&& !webkit_web_view_can_paste_clipboard (web_view))
|
&& !webkit_web_view_can_paste_clipboard (web_view))
|
||||||
{
|
{
|
||||||
gchar* text = character ? g_strdup_printf ("%c", character) : NULL;
|
gchar* text = character ? g_strdup_printf ("%c", character) : NULL;
|
||||||
|
#if GTK_CHECK_VERSION(3, 2, 0)
|
||||||
|
midori_findbar_search_text (MIDORI_FINDBAR (view->overlay_find),
|
||||||
|
(GtkWidget*)view, TRUE, katze_str_non_null (text));
|
||||||
|
#else
|
||||||
g_signal_emit (view, signals[SEARCH_TEXT], 0, TRUE, text ? text : "");
|
g_signal_emit (view, signals[SEARCH_TEXT], 0, TRUE, text ? text : "");
|
||||||
|
#endif
|
||||||
g_free (text);
|
g_free (text);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
@ -3174,10 +3181,17 @@ midori_view_init (MidoriView* view)
|
||||||
gtk_container_add (GTK_CONTAINER (view->overlay), view->scrolled_window);
|
gtk_container_add (GTK_CONTAINER (view->overlay), view->scrolled_window);
|
||||||
gtk_box_pack_start (GTK_BOX (view), view->overlay, TRUE, TRUE, 0);
|
gtk_box_pack_start (GTK_BOX (view), view->overlay, TRUE, TRUE, 0);
|
||||||
|
|
||||||
|
/* Overlays must be created before showing GtkOverlay as of GTK+ 3.2 */
|
||||||
view->overlay_label = gtk_label_new (NULL);
|
view->overlay_label = gtk_label_new (NULL);
|
||||||
gtk_widget_set_halign (view->overlay_label, GTK_ALIGN_START);
|
gtk_widget_set_halign (view->overlay_label, GTK_ALIGN_START);
|
||||||
gtk_widget_set_valign (view->overlay_label, GTK_ALIGN_END);
|
gtk_widget_set_valign (view->overlay_label, GTK_ALIGN_END);
|
||||||
gtk_overlay_add_overlay (GTK_OVERLAY (view->overlay), view->overlay_label);
|
gtk_overlay_add_overlay (GTK_OVERLAY (view->overlay), view->overlay_label);
|
||||||
|
view->overlay_find = g_object_new (MIDORI_TYPE_FINDBAR, NULL);
|
||||||
|
gtk_widget_set_halign (view->overlay_find, GTK_ALIGN_END);
|
||||||
|
gtk_widget_set_valign (view->overlay_find, GTK_ALIGN_START);
|
||||||
|
gtk_overlay_add_overlay (GTK_OVERLAY (view->overlay),
|
||||||
|
view->overlay_find);
|
||||||
|
gtk_widget_set_no_show_all (view->overlay_find, TRUE);
|
||||||
#else
|
#else
|
||||||
gtk_box_pack_start (GTK_BOX (view), view->scrolled_window, TRUE, TRUE, 0);
|
gtk_box_pack_start (GTK_BOX (view), view->scrolled_window, TRUE, TRUE, 0);
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -253,6 +253,7 @@ midori_findbar_init (MidoriFindbar* findbar)
|
||||||
#endif
|
#endif
|
||||||
gtk_toolbar_set_icon_size (GTK_TOOLBAR (findbar), GTK_ICON_SIZE_MENU);
|
gtk_toolbar_set_icon_size (GTK_TOOLBAR (findbar), GTK_ICON_SIZE_MENU);
|
||||||
gtk_toolbar_set_style (GTK_TOOLBAR (findbar), GTK_TOOLBAR_BOTH_HORIZ);
|
gtk_toolbar_set_style (GTK_TOOLBAR (findbar), GTK_TOOLBAR_BOTH_HORIZ);
|
||||||
|
gtk_toolbar_set_show_arrow (GTK_TOOLBAR (findbar), FALSE);
|
||||||
g_signal_connect (findbar, "key-press-event",
|
g_signal_connect (findbar, "key-press-event",
|
||||||
G_CALLBACK (midori_findbar_find_key_press_event_cb), NULL);
|
G_CALLBACK (midori_findbar_find_key_press_event_cb), NULL);
|
||||||
|
|
||||||
|
@ -336,7 +337,7 @@ void
|
||||||
midori_findbar_search_text (MidoriFindbar* findbar,
|
midori_findbar_search_text (MidoriFindbar* findbar,
|
||||||
GtkWidget* view,
|
GtkWidget* view,
|
||||||
gboolean found,
|
gboolean found,
|
||||||
gchar* typing)
|
const gchar* typing)
|
||||||
{
|
{
|
||||||
const gchar* text;
|
const gchar* text;
|
||||||
gboolean case_sensitive;
|
gboolean case_sensitive;
|
||||||
|
|
|
@ -55,7 +55,7 @@ void
|
||||||
midori_findbar_search_text (MidoriFindbar* findbar,
|
midori_findbar_search_text (MidoriFindbar* findbar,
|
||||||
GtkWidget* view,
|
GtkWidget* view,
|
||||||
gboolean found,
|
gboolean found,
|
||||||
gchar* typing);
|
const gchar* typing);
|
||||||
|
|
||||||
void
|
void
|
||||||
midori_findbar_set_close_button_left (MidoriFindbar* findbar,
|
midori_findbar_set_close_button_left (MidoriFindbar* findbar,
|
||||||
|
|
Loading…
Reference in a new issue