NetSurf
Data Structures | Functions | Variables
search.c File Reference

find in page gtk frontend implementation More...

#include <stdlib.h>
#include <stdbool.h>
#include <gtk/gtk.h>
#include "utils/nsoption.h"
#include "netsurf/search.h"
#include "desktop/search.h"
#include "gtk/compat.h"
#include "gtk/toolbar_items.h"
#include "gtk/window.h"
#include "gtk/search.h"
Include dependency graph for search.c:

Go to the source code of this file.

Data Structures

struct  gtk_search
 

Functions

static void nsgtk_search_set_forward_state (bool active, struct gtk_search *search)
 activate search forwards button in gui. More...
 
static void nsgtk_search_set_back_state (bool active, struct gtk_search *search)
 activate search back button in gui. More...
 
static gboolean nsgtk_search_forward_button_clicked (GtkWidget *widget, gpointer data)
 connected to the search forward button More...
 
static gboolean nsgtk_search_back_button_clicked (GtkWidget *widget, gpointer data)
 connected to the search back button More...
 
static gboolean nsgtk_search_close_button_clicked (GtkWidget *widget, gpointer data)
 connected to the search close button More...
 
static gboolean nsgtk_search_entry_changed (GtkWidget *widget, gpointer data)
 connected to the search entry [typing] More...
 
static gboolean nsgtk_search_entry_activate (GtkWidget *widget, gpointer data)
 connected to the search entry [return key] More...
 
static gboolean nsgtk_search_entry_key (GtkWidget *widget, GdkEventKey *event, gpointer data)
 allows escape key to close search bar too More...
 
nserror nsgtk_search_toggle_visibility (struct gtk_search *search)
 toggle search bar visibility More...
 
nserror nsgtk_search_restyle (struct gtk_search *search)
 update search toolbar size and style More...
 
nserror nsgtk_search_create (GtkBuilder *builder, struct browser_window *bw, struct gtk_search **search_out)
 create text search context More...
 

Variables

static struct gui_search_table search_table
 
struct gui_search_tablensgtk_search_table = &search_table
 

Detailed Description

find in page gtk frontend implementation

Todo:
this whole thing should be named find rather than search as that generally means web search and is confusing.

Definition in file search.c.

Function Documentation

◆ nsgtk_search_back_button_clicked()

static gboolean nsgtk_search_back_button_clicked ( GtkWidget *  widget,
gpointer  data 
)
static

connected to the search back button

Definition at line 109 of file search.c.

References browser_window_search(), gtk_search::bw, gtk_search::caseSens, gtk_search::checkAll, gtk_search::entry, SEARCH_FLAG_CASE_SENSITIVE, and SEARCH_FLAG_SHOWALL.

Referenced by nsgtk_search_create().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ nsgtk_search_close_button_clicked()

static gboolean nsgtk_search_close_button_clicked ( GtkWidget *  widget,
gpointer  data 
)
static

connected to the search close button

Definition at line 136 of file search.c.

References nsgtk_search_toggle_visibility().

Referenced by nsgtk_search_create().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ nsgtk_search_create()

nserror nsgtk_search_create ( GtkBuilder *  builder,
struct browser_window bw,
struct gtk_search **  search 
)

create text search context

Parameters
builderthe gtk builder containing the search toolbar
bwThe browsing context to run the find operations against
searchsearch context result
Returns
NSERROR_OK and search_out updated

Definition at line 284 of file search.c.

References gtk_search::back, gtk_search::bar, gtk_search::bw, gtk_search::caseSens, gtk_search::checkAll, gtk_search::close, gtk_search::entry, gtk_search::forward, NSERROR_NOMEM, NSERROR_OK, nsgtk_search_back_button_clicked(), nsgtk_search_close_button_clicked(), nsgtk_search_entry_activate(), nsgtk_search_entry_changed(), nsgtk_search_entry_key(), nsgtk_search_forward_button_clicked(), and nsgtk_search_restyle().

Referenced by gui_window_create().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ nsgtk_search_entry_activate()

static gboolean nsgtk_search_entry_activate ( GtkWidget *  widget,
gpointer  data 
)
static

connected to the search entry [return key]

Definition at line 177 of file search.c.

References browser_window_search(), gtk_search::bw, gtk_search::caseSens, gtk_search::checkAll, gtk_search::entry, SEARCH_FLAG_CASE_SENSITIVE, SEARCH_FLAG_FORWARDS, and SEARCH_FLAG_SHOWALL.

Referenced by nsgtk_search_create().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ nsgtk_search_entry_changed()

static gboolean nsgtk_search_entry_changed ( GtkWidget *  widget,
gpointer  data 
)
static

connected to the search entry [typing]

Definition at line 151 of file search.c.

References browser_window_search(), gtk_search::bw, gtk_search::caseSens, gtk_search::checkAll, gtk_search::entry, SEARCH_FLAG_CASE_SENSITIVE, and SEARCH_FLAG_SHOWALL.

Referenced by nsgtk_search_create(), and nsgtk_search_toggle_visibility().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ nsgtk_search_entry_key()

static gboolean nsgtk_search_entry_key ( GtkWidget *  widget,
GdkEventKey *  event,
gpointer  data 
)
static

allows escape key to close search bar too

Definition at line 204 of file search.c.

References GDK_KEY, and nsgtk_search_toggle_visibility().

Referenced by nsgtk_search_create().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ nsgtk_search_forward_button_clicked()

static gboolean nsgtk_search_forward_button_clicked ( GtkWidget *  widget,
gpointer  data 
)
static

connected to the search forward button

Definition at line 82 of file search.c.

References browser_window_search(), gtk_search::bw, gtk_search::caseSens, gtk_search::checkAll, gtk_search::entry, SEARCH_FLAG_CASE_SENSITIVE, SEARCH_FLAG_FORWARDS, and SEARCH_FLAG_SHOWALL.

Referenced by nsgtk_search_create().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ nsgtk_search_restyle()

nserror nsgtk_search_restyle ( struct gtk_search search)

update search toolbar size and style

Definition at line 245 of file search.c.

References gtk_search::bar, NSERROR_OK, and nsoption_int.

Referenced by nsgtk_search_create(), and nsgtk_window_update_all().

Here is the caller graph for this function:

◆ nsgtk_search_set_back_state()

static void nsgtk_search_set_back_state ( bool  active,
struct gtk_search search 
)
static

activate search back button in gui.

Parameters
activeactivate/inactivate
searchthe gtk search context

Definition at line 72 of file search.c.

References gtk_search::back.

◆ nsgtk_search_set_forward_state()

static void nsgtk_search_set_forward_state ( bool  active,
struct gtk_search search 
)
static

activate search forwards button in gui.

Parameters
activeactivate/inactivate
searchthe gtk search context

Definition at line 60 of file search.c.

References gtk_search::forward.

◆ nsgtk_search_toggle_visibility()

nserror nsgtk_search_toggle_visibility ( struct gtk_search search)

toggle search bar visibility

Definition at line 225 of file search.c.

References gtk_search::bar, browser_window_search_clear(), gtk_search::bw, gtk_search::entry, NSERROR_OK, and nsgtk_search_entry_changed().

Referenced by gui_window_create(), nsgtk_search_close_button_clicked(), nsgtk_search_entry_key(), and nsgtk_window_search_toggle().

Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ nsgtk_search_table

struct gui_search_table* nsgtk_search_table = &search_table

Definition at line 221 of file search.c.

Referenced by main().

◆ search_table

struct gui_search_table search_table
static
Initial value:
= {
.forward_state = (void *)nsgtk_search_set_forward_state,
.back_state = (void *)nsgtk_search_set_back_state,
}
static void nsgtk_search_set_back_state(bool active, struct gtk_search *search)
activate search back button in gui.
Definition: search.c:72
static void nsgtk_search_set_forward_state(bool active, struct gtk_search *search)
activate search forwards button in gui.
Definition: search.c:60

Definition at line 216 of file search.c.