mirror of
https://github.com/netsurf-browser/netsurf
synced 2024-12-29 23:39:56 +03:00
make the gtk_search structure private to teh gtk search object
This commit is contained in:
parent
e9b5b56ba6
commit
d94afaa0e1
@ -75,8 +75,8 @@ struct search_context {
|
||||
|
||||
|
||||
/* Exported function documented in search.h */
|
||||
struct search_context * search_create_context(struct content *c,
|
||||
content_type type, void *gui_data)
|
||||
struct search_context *
|
||||
search_create_context(struct content *c, content_type type, void *gui_data)
|
||||
{
|
||||
struct search_context *context;
|
||||
struct list_entry *search_head;
|
||||
|
@ -87,7 +87,7 @@
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<child>
|
||||
<object class="GtkCheckButton" id="FindHightlightAll">
|
||||
<object class="GtkCheckButton" id="FindHighlightAll">
|
||||
<property name="label" translatable="yes">gtkFindHighlightAll</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="visible">True</property>
|
||||
|
@ -38,18 +38,26 @@
|
||||
#include "gtk/search.h"
|
||||
|
||||
|
||||
struct gtk_search {
|
||||
GtkToolbar *bar;
|
||||
GtkEntry *entry;
|
||||
GtkToolButton *back;
|
||||
GtkToolButton *forward;
|
||||
GtkToolButton *close;
|
||||
GtkCheckButton *checkAll;
|
||||
GtkCheckButton *caseSens;
|
||||
|
||||
struct browser_window *bw;
|
||||
};
|
||||
|
||||
/**
|
||||
* activate search forwards button in gui.
|
||||
*
|
||||
* \param active activate/inactivate
|
||||
* \param gw The gui window in which to activite the search button in.
|
||||
* \param search the gtk search context
|
||||
*/
|
||||
static void nsgtk_search_set_forward_state(bool active, struct gui_window *gw)
|
||||
static void nsgtk_search_set_forward_state(bool active, struct gtk_search *search)
|
||||
{
|
||||
struct gtk_search *search;
|
||||
|
||||
search = nsgtk_window_get_search(gw);
|
||||
|
||||
gtk_widget_set_sensitive(GTK_WIDGET(search->forward), active);
|
||||
}
|
||||
|
||||
@ -58,14 +66,10 @@ static void nsgtk_search_set_forward_state(bool active, struct gui_window *gw)
|
||||
* activate search back button in gui.
|
||||
*
|
||||
* \param active activate/inactivate
|
||||
* \param gw The gui window in which to activite the search button in.
|
||||
* \param search the gtk search context
|
||||
*/
|
||||
static void nsgtk_search_set_back_state(bool active, struct gui_window *gw)
|
||||
static void nsgtk_search_set_back_state(bool active, struct gtk_search *search)
|
||||
{
|
||||
struct gtk_search *search;
|
||||
|
||||
search = nsgtk_window_get_search(gw);
|
||||
|
||||
gtk_widget_set_sensitive(GTK_WIDGET(search->back), active);
|
||||
}
|
||||
|
||||
@ -77,13 +81,10 @@ static gboolean
|
||||
nsgtk_search_forward_button_clicked(GtkWidget *widget, gpointer data)
|
||||
{
|
||||
struct gtk_search *search;
|
||||
struct browser_window *bw;
|
||||
search_flags_t flags;
|
||||
|
||||
search = (struct gtk_search *)data;
|
||||
|
||||
bw = nsgtk_get_browser_window(search->gw);
|
||||
|
||||
flags = SEARCH_FLAG_FORWARDS;
|
||||
|
||||
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(search->caseSens))) {
|
||||
@ -94,7 +95,8 @@ nsgtk_search_forward_button_clicked(GtkWidget *widget, gpointer data)
|
||||
flags |= SEARCH_FLAG_SHOWALL;
|
||||
}
|
||||
|
||||
browser_window_search(bw, search->gw, flags, gtk_entry_get_text(search->entry));
|
||||
browser_window_search(search->bw, search, flags,
|
||||
gtk_entry_get_text(search->entry));
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
@ -106,13 +108,10 @@ static gboolean
|
||||
nsgtk_search_back_button_clicked(GtkWidget *widget, gpointer data)
|
||||
{
|
||||
struct gtk_search *search;
|
||||
struct browser_window *bw;
|
||||
search_flags_t flags;
|
||||
|
||||
search = (struct gtk_search *)data;
|
||||
|
||||
bw = nsgtk_get_browser_window(search->gw);
|
||||
|
||||
flags = 0;
|
||||
|
||||
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(search->caseSens))) {
|
||||
@ -123,7 +122,8 @@ nsgtk_search_back_button_clicked(GtkWidget *widget, gpointer data)
|
||||
flags |= SEARCH_FLAG_SHOWALL;
|
||||
}
|
||||
|
||||
browser_window_search(bw, search->gw, flags, gtk_entry_get_text(search->entry));
|
||||
browser_window_search(search->bw, search, flags,
|
||||
gtk_entry_get_text(search->entry));
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
@ -150,13 +150,10 @@ nsgtk_search_close_button_clicked(GtkWidget *widget, gpointer data)
|
||||
static gboolean nsgtk_search_entry_changed(GtkWidget *widget, gpointer data)
|
||||
{
|
||||
struct gtk_search *search;
|
||||
struct browser_window *bw;
|
||||
search_flags_t flags;
|
||||
|
||||
search = (struct gtk_search *)data;
|
||||
|
||||
bw = nsgtk_get_browser_window(search->gw);
|
||||
|
||||
flags = 0;
|
||||
|
||||
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(search->caseSens))) {
|
||||
@ -167,7 +164,8 @@ static gboolean nsgtk_search_entry_changed(GtkWidget *widget, gpointer data)
|
||||
flags |= SEARCH_FLAG_SHOWALL;
|
||||
}
|
||||
|
||||
browser_window_search(bw, search->gw, flags, gtk_entry_get_text(search->entry));
|
||||
browser_window_search(search->bw, search, flags,
|
||||
gtk_entry_get_text(search->entry));
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
@ -178,16 +176,10 @@ static gboolean nsgtk_search_entry_changed(GtkWidget *widget, gpointer data)
|
||||
static gboolean nsgtk_search_entry_activate(GtkWidget *widget, gpointer data)
|
||||
{
|
||||
struct gtk_search *search;
|
||||
struct browser_window *bw;
|
||||
search_flags_t flags;
|
||||
|
||||
search = (struct gtk_search *)data;
|
||||
|
||||
nsgtk_search_set_forward_state(true, search->gw);
|
||||
nsgtk_search_set_back_state(true, search->gw);
|
||||
|
||||
bw = nsgtk_get_browser_window(search->gw);
|
||||
|
||||
flags = SEARCH_FLAG_FORWARDS;
|
||||
|
||||
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(search->caseSens))) {
|
||||
@ -198,7 +190,8 @@ static gboolean nsgtk_search_entry_activate(GtkWidget *widget, gpointer data)
|
||||
flags |= SEARCH_FLAG_SHOWALL;
|
||||
}
|
||||
|
||||
browser_window_search(bw, search->gw, flags, gtk_entry_get_text(search->entry));
|
||||
browser_window_search(search->bw, search, flags,
|
||||
gtk_entry_get_text(search->entry));
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
@ -232,7 +225,7 @@ nserror nsgtk_search_toggle_visibility(struct gtk_search *search)
|
||||
{
|
||||
gboolean vis;
|
||||
|
||||
browser_window_search_clear(nsgtk_get_browser_window(search->gw));
|
||||
browser_window_search_clear(search->bw);
|
||||
|
||||
g_object_get(G_OBJECT(search->bar), "visible", &vis, NULL);
|
||||
if (vis) {
|
||||
@ -286,8 +279,8 @@ nserror nsgtk_search_restyle(struct gtk_search *search)
|
||||
/* exported interface documented in gtk/search.h */
|
||||
nserror
|
||||
nsgtk_search_create(GtkBuilder *builder,
|
||||
struct gtk_search **search_out,
|
||||
struct gui_window *gw)
|
||||
struct browser_window *bw,
|
||||
struct gtk_search **search_out)
|
||||
{
|
||||
struct gtk_search *search;
|
||||
|
||||
@ -296,7 +289,7 @@ nsgtk_search_create(GtkBuilder *builder,
|
||||
return NSERROR_NOMEM;
|
||||
}
|
||||
|
||||
search->gw = gw;
|
||||
search->bw = bw;
|
||||
|
||||
search->bar = GTK_TOOLBAR(gtk_builder_get_object(builder, "findbar"));
|
||||
search->entry = GTK_ENTRY(gtk_builder_get_object(builder, "Find"));
|
||||
|
@ -18,7 +18,7 @@
|
||||
|
||||
/**
|
||||
* \file
|
||||
* free text page search for gtk interfaces
|
||||
* free text page search for gtk interface
|
||||
*/
|
||||
|
||||
#ifndef NETSURF_GTK_SEARCH_H_
|
||||
@ -26,28 +26,17 @@
|
||||
|
||||
extern struct gui_search_table *nsgtk_search_table;
|
||||
|
||||
struct nsgtk_scaffolding;
|
||||
|
||||
struct gtk_search {
|
||||
GtkToolbar *bar;
|
||||
GtkEntry *entry;
|
||||
GtkToolButton *back;
|
||||
GtkToolButton *forward;
|
||||
GtkToolButton *close;
|
||||
GtkCheckButton *checkAll;
|
||||
GtkCheckButton *caseSens;
|
||||
|
||||
struct gui_window *gw;
|
||||
};
|
||||
struct gtk_search;
|
||||
|
||||
/**
|
||||
* create text search context
|
||||
*
|
||||
* \param builder the gtk builder containing the search toolbar
|
||||
* \param search_out search context result
|
||||
* \param bw The browsing context to run the find operations against
|
||||
* \param search search context result
|
||||
* \return NSERROR_OK and search_out updated
|
||||
*/
|
||||
nserror nsgtk_search_create(GtkBuilder *builder, struct gtk_search **search_out, struct gui_window *gw);
|
||||
nserror nsgtk_search_create(GtkBuilder *builder, struct browser_window *bw, struct gtk_search **search);
|
||||
|
||||
/**
|
||||
* update search toolbar size and style
|
||||
|
@ -792,7 +792,7 @@ gui_window_create(struct browser_window *bw,
|
||||
}
|
||||
|
||||
/* local page text search toolbar */
|
||||
res = nsgtk_search_create(tab_builder, &g->search, g);
|
||||
res = nsgtk_search_create(tab_builder, g->bw, &g->search);
|
||||
if (res != NSERROR_OK) {
|
||||
free(g);
|
||||
g_object_unref(tab_builder);
|
||||
|
Loading…
Reference in New Issue
Block a user