Fix gtk web page searching
This commit is contained in:
parent
f09011cb0e
commit
a67c49eacf
|
@ -1385,8 +1385,8 @@ MULTIHANDLER(reload)
|
|||
/* clear potential search effects */
|
||||
browser_window_search_clear(bw);
|
||||
|
||||
nsgtk_search_set_forward_state(true, bw);
|
||||
nsgtk_search_set_back_state(true, bw);
|
||||
nsgtk_search_set_forward_state(true, g->top_level);
|
||||
nsgtk_search_set_back_state(true, g->top_level);
|
||||
|
||||
browser_window_reload(bw, true);
|
||||
|
||||
|
@ -1404,8 +1404,8 @@ MULTIHANDLER(back)
|
|||
/* clear potential search effects */
|
||||
browser_window_search_clear(bw);
|
||||
|
||||
nsgtk_search_set_forward_state(true, bw);
|
||||
nsgtk_search_set_back_state(true, bw);
|
||||
nsgtk_search_set_forward_state(true, g->top_level);
|
||||
nsgtk_search_set_back_state(true, g->top_level);
|
||||
|
||||
browser_window_history_back(bw, false);
|
||||
nsgtk_window_update_back_forward(g);
|
||||
|
@ -1424,8 +1424,8 @@ MULTIHANDLER(forward)
|
|||
/* clear potential search effects */
|
||||
browser_window_search_clear(bw);
|
||||
|
||||
nsgtk_search_set_forward_state(true, bw);
|
||||
nsgtk_search_set_back_state(true, bw);
|
||||
nsgtk_search_set_forward_state(true, g->top_level);
|
||||
nsgtk_search_set_back_state(true, g->top_level);
|
||||
|
||||
browser_window_history_forward(bw, false);
|
||||
nsgtk_window_update_back_forward(g);
|
||||
|
@ -2392,14 +2392,16 @@ void nsgtk_scaffolding_set_websearch(nsgtk_scaffolding *g, const char *content)
|
|||
void nsgtk_scaffolding_toggle_search_bar_visibility(nsgtk_scaffolding *g)
|
||||
{
|
||||
gboolean vis;
|
||||
struct browser_window *bw =
|
||||
nsgtk_get_browser_window(g->top_level);
|
||||
struct browser_window *bw = nsgtk_get_browser_window(g->top_level);
|
||||
|
||||
g_object_get(G_OBJECT(g->search->bar), "visible", &vis, NULL);
|
||||
if (vis) {
|
||||
if (bw != NULL)
|
||||
if (bw != NULL) {
|
||||
browser_window_search_clear(bw);
|
||||
nsgtk_search_set_forward_state(true, bw);
|
||||
nsgtk_search_set_back_state(true, bw);
|
||||
}
|
||||
nsgtk_search_set_forward_state(true, g->top_level);
|
||||
nsgtk_search_set_back_state(true, g->top_level);
|
||||
|
||||
gtk_widget_hide(GTK_WIDGET(g->search->bar));
|
||||
} else {
|
||||
gtk_widget_show(GTK_WIDGET(g->search->bar));
|
||||
|
@ -2436,8 +2438,8 @@ void nsgtk_scaffolding_set_top_level(struct gui_window *gw)
|
|||
/* clear effects of potential searches */
|
||||
browser_window_search_clear(bw);
|
||||
|
||||
nsgtk_search_set_forward_state(true, bw);
|
||||
nsgtk_search_set_back_state(true, bw);
|
||||
nsgtk_search_set_forward_state(true, gw);
|
||||
nsgtk_search_set_back_state(true, gw);
|
||||
|
||||
nsgtk_scaffolding_set_icon(gw);
|
||||
|
||||
|
|
126
gtk/search.c
126
gtk/search.c
|
@ -40,13 +40,63 @@
|
|||
#include "utils/messages.h"
|
||||
#include "utils/utils.h"
|
||||
|
||||
static void nsgtk_search_set_status(bool found, void *p);
|
||||
static void nsgtk_search_set_hourglass(bool active, void *p);
|
||||
static void nsgtk_search_add_recent(const char *string, void *p);
|
||||
/**
|
||||
* Change the displayed search status.
|
||||
* \param found search pattern matched in text
|
||||
* \param p the pointer sent to search_verify_new() / search_create_context()
|
||||
*/
|
||||
|
||||
static void nsgtk_search_set_status(bool found, void *p)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* display hourglass while searching
|
||||
* \param active start/stop indicator
|
||||
* \param p the pointer sent to search_verify_new() / search_create_context()
|
||||
*/
|
||||
|
||||
static void nsgtk_search_set_hourglass(bool active, void *p)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* add search string to recent searches list
|
||||
* front is at liberty how to implement the bare notification
|
||||
* should normally store a strdup() of the string;
|
||||
* core gives no guarantee of the integrity of the const char *
|
||||
* \param string search pattern
|
||||
* \param p the pointer sent to search_verify_new() / search_create_context()
|
||||
*/
|
||||
|
||||
static void nsgtk_search_add_recent(const char *string, void *p)
|
||||
{
|
||||
}
|
||||
|
||||
/* exported function documented in gtk/search.h */
|
||||
void nsgtk_search_set_forward_state(bool active, struct gui_window *gw)
|
||||
{
|
||||
if (gw != NULL && nsgtk_get_browser_window(gw) != NULL) {
|
||||
struct gtk_scaffolding *g = nsgtk_get_scaffold(gw);
|
||||
gtk_widget_set_sensitive(
|
||||
GTK_WIDGET(nsgtk_scaffolding_search(g)->buttons[1]),
|
||||
active);
|
||||
}
|
||||
}
|
||||
|
||||
/* exported function documented in gtk/search.h */
|
||||
void nsgtk_search_set_back_state(bool active, struct gui_window *gw)
|
||||
{
|
||||
if (gw != NULL && nsgtk_get_browser_window(gw) != NULL) {
|
||||
struct gtk_scaffolding *g = nsgtk_get_scaffold(gw);
|
||||
gtk_widget_set_sensitive(GTK_WIDGET(nsgtk_scaffolding_search(
|
||||
g)->buttons[0]), active);
|
||||
}
|
||||
}
|
||||
|
||||
static struct gui_search_callbacks nsgtk_search_callbacks = {
|
||||
nsgtk_search_set_forward_state,
|
||||
nsgtk_search_set_back_state,
|
||||
(void *)nsgtk_search_set_forward_state,
|
||||
(void *)nsgtk_search_set_back_state,
|
||||
nsgtk_search_set_status,
|
||||
nsgtk_search_set_hourglass,
|
||||
nsgtk_search_add_recent
|
||||
|
@ -117,8 +167,8 @@ gboolean nsgtk_search_entry_changed(GtkWidget *widget, gpointer data)
|
|||
|
||||
assert(bw != NULL);
|
||||
|
||||
nsgtk_search_set_forward_state(true, (void *)bw);
|
||||
nsgtk_search_set_back_state(true, (void *)bw);
|
||||
nsgtk_search_set_forward_state(true, gw);
|
||||
nsgtk_search_set_back_state(true, gw);
|
||||
|
||||
search_flags_t flags = SEARCH_FLAG_FORWARDS |
|
||||
(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(
|
||||
|
@ -197,67 +247,5 @@ gboolean nsgtk_websearch_clear(GtkWidget *widget, GdkEventFocus *f,
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Change the displayed search status.
|
||||
* \param found search pattern matched in text
|
||||
* \param p the pointer sent to search_verify_new() / search_create_context()
|
||||
*/
|
||||
|
||||
void nsgtk_search_set_status(bool found, void *p)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* display hourglass while searching
|
||||
* \param active start/stop indicator
|
||||
* \param p the pointer sent to search_verify_new() / search_create_context()
|
||||
*/
|
||||
|
||||
void nsgtk_search_set_hourglass(bool active, void *p)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* add search string to recent searches list
|
||||
* front is at liberty how to implement the bare notification
|
||||
* should normally store a strdup() of the string;
|
||||
* core gives no guarantee of the integrity of the const char *
|
||||
* \param string search pattern
|
||||
* \param p the pointer sent to search_verify_new() / search_create_context()
|
||||
*/
|
||||
|
||||
void nsgtk_search_add_recent(const char *string, void *p)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* activate search forwards button in gui
|
||||
* \param active activate/inactivate
|
||||
* \param p the pointer sent to search_verify_new() / search_create_context()
|
||||
*/
|
||||
|
||||
void nsgtk_search_set_forward_state(bool active, void *p)
|
||||
{
|
||||
struct gui_window *gw = (struct gui_window *)p;
|
||||
if (gw != NULL && nsgtk_get_browser_window(gw) != NULL) {
|
||||
struct gtk_scaffolding *g = nsgtk_get_scaffold(gw);
|
||||
gtk_widget_set_sensitive(GTK_WIDGET(nsgtk_scaffolding_search(
|
||||
g)->buttons[1]), active);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* activate search back button in gui
|
||||
* \param active activate/inactivate
|
||||
* \param p the pointer sent to search_verify_new() / search_create_context()
|
||||
*/
|
||||
|
||||
void nsgtk_search_set_back_state(bool active, void *p)
|
||||
{
|
||||
struct gui_window *gw = (struct gui_window *)p;
|
||||
if (gw != NULL && nsgtk_get_browser_window(gw) != NULL) {
|
||||
struct gtk_scaffolding *g = nsgtk_get_scaffold(gw);
|
||||
gtk_widget_set_sensitive(GTK_WIDGET(nsgtk_scaffolding_search(
|
||||
g)->buttons[0]), active);
|
||||
}
|
||||
}
|
||||
|
|
24
gtk/search.h
24
gtk/search.h
|
@ -25,15 +25,27 @@
|
|||
void nsgtk_search_bar_toggle_visibility(struct gtk_scaffolding * g);
|
||||
gboolean nsgtk_search_entry_changed(GtkWidget *widget, gpointer data);
|
||||
gboolean nsgtk_search_entry_activate(GtkWidget *widget, gpointer data);
|
||||
gboolean nsgtk_search_entry_key(GtkWidget *widget, GdkEventKey *event,
|
||||
gpointer data);
|
||||
gboolean nsgtk_search_entry_key(GtkWidget *widget, GdkEventKey *event, gpointer data);
|
||||
gboolean nsgtk_search_forward_button_clicked(GtkWidget *widget, gpointer data);
|
||||
gboolean nsgtk_search_back_button_clicked(GtkWidget *widget, gpointer data);
|
||||
gboolean nsgtk_search_close_button_clicked(GtkWidget *widget, gpointer data);
|
||||
gboolean nsgtk_websearch_activate(GtkWidget *widget, gpointer data);
|
||||
gboolean nsgtk_websearch_clear(GtkWidget *widget, GdkEventFocus *f,
|
||||
gpointer data);
|
||||
void nsgtk_search_set_forward_state(bool active, void *p);
|
||||
void nsgtk_search_set_back_state(bool active, void *p);
|
||||
gboolean nsgtk_websearch_clear(GtkWidget *widget, GdkEventFocus *f, gpointer data);
|
||||
|
||||
/**
|
||||
* activate search forwards button in gui.
|
||||
*
|
||||
* \param active activate/inactivate
|
||||
* \param p the pointer sent to search_verify_new() / search_create_context()
|
||||
*/
|
||||
void nsgtk_search_set_forward_state(bool active, struct gui_window *gw);
|
||||
|
||||
/**
|
||||
* activate search back button in gui.
|
||||
*
|
||||
* \param active activate/inactivate
|
||||
* \param p the pointer sent to search_verify_new() / search_create_context()
|
||||
*/
|
||||
void nsgtk_search_set_back_state(bool active, struct gui_window *gw);
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue