From 48917cbb824218bedce1c09b9a361a4c5450d357 Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Wed, 24 Aug 2011 12:31:27 +0000 Subject: [PATCH] GTK changes for core search update (r12646). svn path=/trunk/netsurf/; revision=12647 --- gtk/scaffolding.c | 19 +++++++++---------- gtk/search.c | 22 ++++++++++++++-------- gtk/tabs.c | 5 +++-- 3 files changed, 26 insertions(+), 20 deletions(-) diff --git a/gtk/scaffolding.c b/gtk/scaffolding.c index 81a96a70a..f6f1283d5 100644 --- a/gtk/scaffolding.c +++ b/gtk/scaffolding.c @@ -1297,8 +1297,8 @@ MULTIHANDLER(reload) return TRUE; /* clear potential search effects */ - if (bw->search_context != NULL) - search_destroy_context(bw->search_context); + browser_window_search_destroy_context(bw); + nsgtk_search_set_forward_state(true, bw); nsgtk_search_set_back_state(true, bw); @@ -1316,8 +1316,8 @@ MULTIHANDLER(back) return TRUE; /* clear potential search effects */ - if (bw->search_context != NULL) - search_destroy_context(bw->search_context); + browser_window_search_destroy_context(bw); + nsgtk_search_set_forward_state(true, bw); nsgtk_search_set_back_state(true, bw); @@ -1336,8 +1336,8 @@ MULTIHANDLER(forward) return TRUE; /* clear potential search effects */ - if (bw->search_context != NULL) - search_destroy_context(bw->search_context); + browser_window_search_destroy_context(bw); + nsgtk_search_set_forward_state(true, bw); nsgtk_search_set_back_state(true, bw); @@ -2223,8 +2223,8 @@ void nsgtk_scaffolding_toggle_search_bar_visibility(nsgtk_scaffolding *g) gui_window_get_browser_window(g->top_level); g_object_get(G_OBJECT(g->search->bar), "visible", &vis, NULL); if (vis) { - if ((bw != NULL) && (bw->search_context != NULL)) - search_destroy_context(bw->search_context); + if (bw != NULL) + browser_window_search_destroy_context(bw); nsgtk_search_set_forward_state(true, bw); nsgtk_search_set_back_state(true, bw); gtk_widget_hide(GTK_WIDGET(g->search->bar)); @@ -2251,8 +2251,7 @@ void nsgtk_scaffolding_set_top_level (struct gui_window *gw) nsgtk_window_update_back_forward(nsgtk_get_scaffold(gw)); /* clear effects of potential searches */ - if (bw->search_context != NULL) - search_destroy_context(bw->search_context); + browser_window_search_destroy_context(bw); nsgtk_search_set_forward_state(true, bw); nsgtk_search_set_back_state(true, bw); diff --git a/gtk/search.c b/gtk/search.c index b4127eefb..47857ef29 100644 --- a/gtk/search.c +++ b/gtk/search.c @@ -70,8 +70,9 @@ gboolean nsgtk_search_forward_button_clicked(GtkWidget *widget, gpointer data) (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON( nsgtk_scaffolding_search(g)->checkAll)) ? SEARCH_FLAG_SHOWALL : 0); - if (search_verify_new(bw, &nsgtk_search_callbacks, (void *)bw)) - search_step(bw->search_context, flags, gtk_entry_get_text( + if (browser_window_search_verify_new(bw, &nsgtk_search_callbacks, + (void *)bw)) + browser_window_search_step(bw, flags, gtk_entry_get_text( nsgtk_scaffolding_search(g)->entry)); return TRUE; } @@ -91,8 +92,9 @@ gboolean nsgtk_search_back_button_clicked(GtkWidget *widget, gpointer data) (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON( nsgtk_scaffolding_search(g)->checkAll)) ? SEARCH_FLAG_SHOWALL : 0); - if (search_verify_new(bw, &nsgtk_search_callbacks, (void *)bw)) - search_step(bw->search_context, flags, gtk_entry_get_text( + if (browser_window_search_verify_new(bw, &nsgtk_search_callbacks, + (void *)bw)) + browser_window_search_step(bw, flags, gtk_entry_get_text( nsgtk_scaffolding_search(g)->entry)); return TRUE; } @@ -131,8 +133,10 @@ gboolean nsgtk_search_entry_changed(GtkWidget *widget, gpointer data) nsgtk_scaffolding *g = (nsgtk_scaffolding *)data; struct browser_window *bw = gui_window_get_browser_window( nsgtk_scaffolding_top_level(g)); - if ((bw != NULL) && (bw->search_context != NULL)) - search_destroy_context(bw->search_context); + + if (bw != NULL) + browser_window_search_destroy_context(bw); + nsgtk_search_set_forward_state(true, (void *)bw); nsgtk_search_set_back_state(true, (void *)bw); return TRUE; @@ -153,8 +157,10 @@ gboolean nsgtk_search_entry_activate(GtkWidget *widget, gpointer data) (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON( nsgtk_scaffolding_search(g)->checkAll)) ? SEARCH_FLAG_SHOWALL : 0); - if (search_verify_new(bw, &nsgtk_search_callbacks, (void *)bw)) - search_step(bw->search_context, flags, gtk_entry_get_text( + + if (browser_window_search_verify_new(bw, &nsgtk_search_callbacks, + (void *)bw)) + browser_window_search_step(bw, flags, gtk_entry_get_text( nsgtk_scaffolding_search(g)->entry)); return FALSE; } diff --git a/gtk/tabs.c b/gtk/tabs.c index 07e6b3365..267cc12c7 100644 --- a/gtk/tabs.c +++ b/gtk/tabs.c @@ -194,8 +194,9 @@ void nsgtk_tab_page_changed(GtkNotebook *notebook, gpointer *page, struct browser_window *bw = gui_window_get_browser_window(gw); if (bw == NULL) return; - if (bw->search_context != NULL) - search_destroy_context(bw->search_context); + + browser_window_search_destroy_context(bw); + nsgtk_search_set_forward_state(true, bw); nsgtk_search_set_back_state(true, bw); nsgtk_scaffolding_set_top_level(gw);