NetSurf
Data Structures | Macros | Functions | Variables
global_history.c File Reference

Implementation of GTK global history manager. More...

#include <stdint.h>
#include <stdlib.h>
#include <gtk/gtk.h>
#include "utils/log.h"
#include "netsurf/keypress.h"
#include "netsurf/plotters.h"
#include "desktop/global_history.h"
#include "gtk/compat.h"
#include "gtk/plotters.h"
#include "gtk/resources.h"
#include "gtk/corewindow.h"
#include "gtk/global_history.h"
Include dependency graph for global_history.c:

Go to the source code of this file.

Data Structures

struct  nsgtk_global_history_window
 
struct  menu_events
 

Macros

#define MENUPROTO(x)
 
#define MENUEVENT(x)   { #x, G_CALLBACK(nsgtk_on_##x##_activate) }
 
#define MENUHANDLER(x)
 

Functions

 MENUPROTO (export)
 
 MENUPROTO (delete_selected)
 
 MENUPROTO (delete_all)
 
 MENUPROTO (select_all)
 
 MENUPROTO (clear_selection)
 
 MENUPROTO (expand_all)
 
 MENUPROTO (expand_directories)
 
 MENUPROTO (expand_addresses)
 
 MENUPROTO (collapse_all)
 
 MENUPROTO (collapse_directories)
 
 MENUPROTO (collapse_addresses)
 
 MENUPROTO (launch)
 
 MENUHANDLER (delete_selected)
 
 MENUHANDLER (delete_all)
 
 MENUHANDLER (select_all)
 
 MENUHANDLER (clear_selection)
 
 MENUHANDLER (expand_all)
 
 MENUHANDLER (expand_directories)
 
 MENUHANDLER (expand_addresses)
 
 MENUHANDLER (collapse_all)
 
 MENUHANDLER (collapse_directories)
 
 MENUHANDLER (collapse_addresses)
 
 MENUHANDLER (launch)
 
 MENUHANDLER (export)
 
static void nsgtk_global_history_init_menu (struct nsgtk_global_history_window *ghwin)
 Connects menu events in the global history window. More...
 
static nserror nsgtk_global_history_mouse (struct nsgtk_corewindow *nsgtk_cw, browser_mouse_state mouse_state, int x, int y)
 callback for mouse action on global history window More...
 
static nserror nsgtk_global_history_key (struct nsgtk_corewindow *nsgtk_cw, uint32_t nskey)
 callback for keypress on global history window More...
 
static nserror nsgtk_global_history_draw (struct nsgtk_corewindow *nsgtk_cw, struct rect *r)
 callback on draw event for global history window More...
 
static nserror nsgtk_global_history_init (void)
 Creates the window for the global history tree. More...
 
nserror nsgtk_global_history_present (void)
 make the global history window visible. More...
 
nserror nsgtk_global_history_destroy (void)
 Destroys the global history window and performs any other necessary cleanup actions. More...
 

Variables

static struct nsgtk_global_history_windowglobal_history_window = NULL
 
static struct menu_events menu_events []
 

Detailed Description

Implementation of GTK global history manager.

Definition in file global_history.c.

Macro Definition Documentation

◆ MENUEVENT

#define MENUEVENT (   x)    { #x, G_CALLBACK(nsgtk_on_##x##_activate) }

Definition at line 50 of file global_history.c.

◆ MENUHANDLER

#define MENUHANDLER (   x)
Value:
gboolean nsgtk_on_##x##_activate(GtkMenuItem *widget, \
gpointer g)

Definition at line 51 of file global_history.c.

◆ MENUPROTO

#define MENUPROTO (   x)
Value:
static gboolean nsgtk_on_##x##_activate( \
GtkMenuItem *widget, gpointer g)

Definition at line 48 of file global_history.c.

Function Documentation

◆ MENUHANDLER() [1/12]

MENUHANDLER ( clear_selection  )

Definition at line 125 of file global_history.c.

References global_history_keypress(), NS_KEY_CLEAR_SELECTION, and NS_KEY_ESCAPE.

Here is the call graph for this function:

◆ MENUHANDLER() [2/12]

MENUHANDLER ( collapse_addresses  )

Definition at line 164 of file global_history.c.

References global_history_contract().

Here is the call graph for this function:

◆ MENUHANDLER() [3/12]

MENUHANDLER ( collapse_all  )

Definition at line 152 of file global_history.c.

References global_history_contract().

Here is the call graph for this function:

◆ MENUHANDLER() [4/12]

MENUHANDLER ( collapse_directories  )

Definition at line 158 of file global_history.c.

References global_history_contract().

Here is the call graph for this function:

◆ MENUHANDLER() [5/12]

MENUHANDLER ( delete_all  )

Definition at line 108 of file global_history.c.

References global_history_keypress(), NS_KEY_DELETE_LEFT, NS_KEY_ESCAPE, and NS_KEY_SELECT_ALL.

Here is the call graph for this function:

◆ MENUHANDLER() [6/12]

MENUHANDLER ( delete_selected  )

Definition at line 102 of file global_history.c.

References global_history_keypress(), and NS_KEY_DELETE_LEFT.

Here is the call graph for this function:

◆ MENUHANDLER() [7/12]

MENUHANDLER ( expand_addresses  )

Definition at line 146 of file global_history.c.

References global_history_expand().

Here is the call graph for this function:

◆ MENUHANDLER() [8/12]

MENUHANDLER ( expand_all  )

Definition at line 134 of file global_history.c.

References global_history_expand().

Here is the call graph for this function:

◆ MENUHANDLER() [9/12]

MENUHANDLER ( expand_directories  )

Definition at line 140 of file global_history.c.

References global_history_expand().

Here is the call graph for this function:

◆ MENUHANDLER() [10/12]

MENUHANDLER ( export  )

Definition at line 177 of file global_history.c.

References global_history_export(), NSGTK_STOCK_CANCEL, NSGTK_STOCK_SAVE, and nsgtk_global_history_window::wnd.

Here is the call graph for this function:

◆ MENUHANDLER() [11/12]

MENUHANDLER ( launch  )

Definition at line 170 of file global_history.c.

References global_history_keypress(), and NS_KEY_CR.

Here is the call graph for this function:

◆ MENUHANDLER() [12/12]

MENUHANDLER ( select_all  )

Definition at line 117 of file global_history.c.

References global_history_keypress(), NS_KEY_ESCAPE, and NS_KEY_SELECT_ALL.

Here is the call graph for this function:

◆ MENUPROTO() [1/12]

MENUPROTO ( clear_selection  )

◆ MENUPROTO() [2/12]

MENUPROTO ( collapse_addresses  )

◆ MENUPROTO() [3/12]

MENUPROTO ( collapse_all  )

◆ MENUPROTO() [4/12]

MENUPROTO ( collapse_directories  )

◆ MENUPROTO() [5/12]

MENUPROTO ( delete_all  )

◆ MENUPROTO() [6/12]

MENUPROTO ( delete_selected  )

◆ MENUPROTO() [7/12]

MENUPROTO ( expand_addresses  )

◆ MENUPROTO() [8/12]

MENUPROTO ( expand_all  )

◆ MENUPROTO() [9/12]

MENUPROTO ( expand_directories  )

◆ MENUPROTO() [10/12]

MENUPROTO ( export  )

◆ MENUPROTO() [11/12]

MENUPROTO ( launch  )

◆ MENUPROTO() [12/12]

MENUPROTO ( select_all  )

◆ nsgtk_global_history_destroy()

nserror nsgtk_global_history_destroy ( void  )

Destroys the global history window and performs any other necessary cleanup actions.

Definition at line 381 of file global_history.c.

References nsgtk_global_history_window::builder, nsgtk_global_history_window::core, global_history_fini(), global_history_window, NSERROR_OK, nsgtk_corewindow_fini(), and nsgtk_global_history_window::wnd.

Referenced by nsgtk_finalise().

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

◆ nsgtk_global_history_draw()

static nserror nsgtk_global_history_draw ( struct nsgtk_corewindow nsgtk_cw,
struct rect r 
)
static

callback on draw event for global history window

Parameters
nsgtk_cwThe nsgtk core window structure.
rThe rectangle of the window that needs updating.
Returns
NSERROR_OK on success otherwise apropriate error code

Definition at line 282 of file global_history.c.

References global_history_redraw(), redraw_context::interactive, NSERROR_OK, and nsgtk_plotters.

Referenced by nsgtk_global_history_init().

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

◆ nsgtk_global_history_init()

static nserror nsgtk_global_history_init ( void  )
static

Creates the window for the global history tree.

Returns
NSERROR_OK on success else appropriate error code on faliure.

Definition at line 300 of file global_history.c.

References nsgtk_global_history_window::builder, nsgtk_global_history_window::core, nsgtk_corewindow::draw, nsgtk_corewindow::drawing_area, global_history_init(), global_history_window, nsgtk_corewindow::key, nsgtk_corewindow::mouse, NSERROR_NOMEM, NSERROR_OK, nsgtk_builder_new_from_resname(), nsgtk_corewindow_init(), nsgtk_global_history_draw(), nsgtk_global_history_init_menu(), nsgtk_global_history_key(), nsgtk_global_history_mouse(), NSLOG, nsgtk_corewindow::scrolled, and nsgtk_global_history_window::wnd.

Referenced by nsgtk_global_history_present().

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

◆ nsgtk_global_history_init_menu()

static void nsgtk_global_history_init_menu ( struct nsgtk_global_history_window ghwin)
static

Connects menu events in the global history window.

Definition at line 214 of file global_history.c.

References nsgtk_global_history_window::builder, menu_events, and NSLOG.

Referenced by nsgtk_global_history_init().

Here is the caller graph for this function:

◆ nsgtk_global_history_key()

static nserror nsgtk_global_history_key ( struct nsgtk_corewindow nsgtk_cw,
uint32_t  nskey 
)
static

callback for keypress on global history window

Parameters
nsgtk_cwThe nsgtk core window structure.
nskeyThe netsurf key code
Returns
NSERROR_OK on success otherwise apropriate error code

Definition at line 265 of file global_history.c.

References global_history_keypress(), NSERROR_NOT_IMPLEMENTED, and NSERROR_OK.

Referenced by nsgtk_global_history_init().

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

◆ nsgtk_global_history_mouse()

static nserror nsgtk_global_history_mouse ( struct nsgtk_corewindow nsgtk_cw,
browser_mouse_state  mouse_state,
int  x,
int  y 
)
static

callback for mouse action on global history window

Parameters
nsgtk_cwThe nsgtk core window structure.
mouse_statenetsurf mouse state on event
xlocation of event
ylocation of event
Returns
NSERROR_OK on success otherwise apropriate error code

Definition at line 247 of file global_history.c.

References global_history_mouse_action(), and NSERROR_OK.

Referenced by nsgtk_global_history_init().

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

◆ nsgtk_global_history_present()

nserror nsgtk_global_history_present ( void  )

make the global history window visible.

Returns
NSERROR_OK on success else appropriate error code on faliure.

Definition at line 368 of file global_history.c.

References global_history_window, NSERROR_OK, nsgtk_global_history_init(), and nsgtk_global_history_window::wnd.

Referenced by globalhistory_button_clicked_cb().

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

Variable Documentation

◆ global_history_window

struct nsgtk_global_history_window* global_history_window = NULL
static

◆ menu_events

struct menu_events menu_events[]
static
Initial value:
= {
MENUEVENT(export),
MENUEVENT(delete_selected),
MENUEVENT(delete_all),
MENUEVENT(select_all),
MENUEVENT(clear_selection),
MENUEVENT(expand_all),
MENUEVENT(expand_directories),
MENUEVENT(expand_addresses),
MENUEVENT(collapse_all),
MENUEVENT(collapse_directories),
MENUEVENT(collapse_addresses),
MENUEVENT(launch),
{NULL, NULL}
}
#define MENUEVENT(x)

Definition at line 78 of file global_history.c.

Referenced by nsgtk_global_history_init_menu().