Searching text can now be case-sensitive
This commit is contained in:
parent
8349bfee10
commit
a8defcdbe2
|
@ -58,6 +58,7 @@ struct _Surfer
|
|||
/* find */
|
||||
GtkWidget * fi_dialog;
|
||||
GtkWidget * fi_text;
|
||||
GtkWidget * fi_case;
|
||||
};
|
||||
|
||||
#endif /* !SURFER_COMMON_H */
|
||||
|
|
|
@ -239,7 +239,7 @@ int ghtml_set_base(GtkWidget * widget, char const * url)
|
|||
|
||||
/* useful */
|
||||
/* ghtml_find */
|
||||
void ghtml_find(GtkWidget * ghtml, char const * text)
|
||||
void ghtml_find(GtkWidget * ghtml, char const * text, gboolean sensitive)
|
||||
{
|
||||
/* FIXME implement */
|
||||
}
|
||||
|
|
|
@ -337,7 +337,7 @@ char const * ghtml_get_title(GtkWidget * ghtml)
|
|||
|
||||
/* useful */
|
||||
/* ghtml_find */
|
||||
void ghtml_find(GtkWidget * ghtml, char const * text)
|
||||
void ghtml_find(GtkWidget * ghtml, char const * text, gboolean sensitive)
|
||||
{
|
||||
/* FIXME implement */
|
||||
}
|
||||
|
|
|
@ -152,7 +152,7 @@ char const * ghtml_get_title(GtkWidget * widget)
|
|||
static void _find_match(GHtml * ghtml, char const * buf, char const * str,
|
||||
size_t tlen);
|
||||
|
||||
void ghtml_find(GtkWidget * widget, char const * text)
|
||||
void ghtml_find(GtkWidget * widget, char const * text, gboolean sensitive)
|
||||
{
|
||||
GHtml * ghtml;
|
||||
size_t tlen;
|
||||
|
|
|
@ -173,13 +173,13 @@ int ghtml_set_base(GtkWidget * ghtml, char const * url)
|
|||
|
||||
/* useful */
|
||||
/* ghtml_find */
|
||||
void ghtml_find(GtkWidget * ghtml, char const * text)
|
||||
void ghtml_find(GtkWidget * ghtml, char const * text, gboolean sensitive)
|
||||
{
|
||||
GtkWidget * view;
|
||||
|
||||
view = g_object_get_data(G_OBJECT(ghtml), "view");
|
||||
webkit_web_view_search_text(WEBKIT_WEB_VIEW(view), text, TRUE, TRUE,
|
||||
TRUE);
|
||||
webkit_web_view_search_text(WEBKIT_WEB_VIEW(view), text, sensitive,
|
||||
TRUE, TRUE);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -52,7 +52,7 @@ void ghtml_stop(GtkWidget * ghtml);
|
|||
void ghtml_select_all(GtkWidget * ghtml);
|
||||
void ghtml_unselect_all(GtkWidget * ghtml);
|
||||
|
||||
void ghtml_find(GtkWidget * ghtml, char const * text);
|
||||
void ghtml_find(GtkWidget * ghtml, char const * text, gboolean sensitive);
|
||||
|
||||
void ghtml_zoom_in(GtkWidget * ghtml);
|
||||
void ghtml_zoom_out(GtkWidget * ghtml);
|
||||
|
|
|
@ -536,6 +536,10 @@ void surfer_find(Surfer * surfer, char const * text)
|
|||
gtk_box_pack_start(GTK_BOX(hbox), surfer->fi_text, TRUE, TRUE,
|
||||
4);
|
||||
gtk_box_pack_start(GTK_BOX(vbox), hbox, TRUE, TRUE, 4);
|
||||
surfer->fi_case = gtk_check_button_new_with_label(
|
||||
"Case-sensitive");
|
||||
gtk_box_pack_start(GTK_BOX(vbox), surfer->fi_case, TRUE, TRUE,
|
||||
4);
|
||||
gtk_widget_show_all(vbox);
|
||||
g_signal_connect(G_OBJECT(surfer->fi_dialog), "response",
|
||||
G_CALLBACK(_on_find_response), surfer);
|
||||
|
@ -549,11 +553,14 @@ static void _on_find_activate(GtkWidget * widget, gpointer data)
|
|||
{
|
||||
Surfer * surfer = data;
|
||||
char const * text;
|
||||
gboolean sensitive;
|
||||
|
||||
if((text = gtk_entry_get_text(GTK_ENTRY(widget))) == NULL
|
||||
|| strlen(text) == 0)
|
||||
return;
|
||||
ghtml_find(surfer->view, text);
|
||||
sensitive = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(
|
||||
surfer->fi_case));
|
||||
ghtml_find(surfer->view, text, sensitive);
|
||||
}
|
||||
|
||||
static void _on_find_response(GtkWidget * widget, gint response, gpointer data)
|
||||
|
|
Loading…
Reference in New Issue
Block a user