NetSurf
Functions
global_history.h File Reference
#include <stdbool.h>
#include <stdint.h>
#include "utils/errors.h"
#include "netsurf/mouse.h"
Include dependency graph for global_history.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

nserror global_history_init (struct core_window_callback_table *cw_t, void *core_window_handle)
 Initialise the global history. More...
 
nserror global_history_fini (void)
 Finalise the global history. More...
 
nserror global_history_add (struct nsurl *url)
 Add an entry to the global history. More...
 
nserror global_history_export (const char *path, const char *title)
 Save global history to file (html) More...
 
void global_history_redraw (int x, int y, struct rect *clip, const struct redraw_context *ctx)
 Redraw the global history. More...
 
void global_history_mouse_action (enum browser_mouse_state mouse, int x, int y)
 Handles all kinds of mouse action. More...
 
bool global_history_keypress (uint32_t key)
 Key press handling. More...
 
bool global_history_has_selection (void)
 Determine whether there is a selection. More...
 
bool global_history_get_selection (struct nsurl **url, const char **title)
 Get the first selected node. More...
 
nserror global_history_expand (bool only_folders)
 Expand the treeview's nodes. More...
 
nserror global_history_contract (bool all)
 Contract the treeview's nodes. More...
 

Function Documentation

◆ global_history_add()

nserror global_history_add ( struct nsurl url)

Add an entry to the global history.

If the URL already exists in the global history, the old node is removed.

Parameters
urlURL for node being added
Returns
NSERROR_OK on success, appropriate error otherwise

Definition at line 830 of file global_history.c.

References gh_ctx, global_history_add_entry(), NSERROR_BAD_PARAMETER, NSERROR_OK, NSLOG, global_history_ctx::tree, and urldb_get_url_data().

Referenced by browser_window_content_ready().

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

◆ global_history_contract()

nserror global_history_contract ( bool  all)

Contract the treeview's nodes.

Parameters
allIff false, only entries are contracted.
Returns
NSERROR_OK on success, appropriate error otherwise

Definition at line 1010 of file global_history.c.

References gh_ctx, global_history_ctx::tree, and treeview_contract().

Referenced by global_history_menu_select(), global_history_toolbar_click(), HOOKF(), and MENUHANDLER().

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

◆ global_history_expand()

nserror global_history_expand ( bool  only_folders)

Expand the treeview's nodes.

Parameters
only_foldersIff true, only folders are expanded.
Returns
NSERROR_OK on success, appropriate error otherwise

Definition at line 1003 of file global_history.c.

References gh_ctx, global_history_ctx::tree, and treeview_expand().

Referenced by global_history_menu_select(), global_history_toolbar_click(), HOOKF(), and MENUHANDLER().

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

◆ global_history_export()

nserror global_history_export ( const char *  path,
const char *  title 
)

Save global history to file (html)

Parameters
pathThe path to save history to
titleThe title to give the document, or NULL for default
Returns
NSERROR_OK on success, or appropriate error otherwise

Definition at line 913 of file global_history.c.

References treeview_export_walk_ctx::fp, gh_ctx, global_history_export_enter_cb(), global_history_export_leave_cb(), NSERROR_OK, NSERROR_SAVE_FAILED, path(), global_history_ctx::tree, TREE_NODE_ENTRY, TREE_NODE_FOLDER, and treeview_walk().

Referenced by HOOKF(), MENUHANDLER(), and ro_gui_save_content().

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

◆ global_history_fini()

nserror global_history_fini ( void  )

Finalise the global history.

This destroys the global history treeview and the global history module's internal data. After calling this if global history is required again, global_history_init must be called.

Returns
NSERROR_OK on success, appropriate error otherwise

Definition at line 800 of file global_history.c.

References global_history_ctx::built, treeview_field_desc::field, global_history_ctx::fields, gh_ctx, N_FIELDS, NSERROR_OK, NSLOG, global_history_ctx::tree, treeview_destroy(), and treeview_fini().

Referenced by ami_history_global_destroy(), atari_global_history_finish(), nsgtk_global_history_destroy(), nsw32_global_history_finalise(), and ro_gui_global_history_finalise().

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

◆ global_history_get_selection()

bool global_history_get_selection ( struct nsurl **  url,
const char **  title 
)

Get the first selected node.

Parameters
urlUpdated to the selected entry's address, or NULL
titleUpdated to the selected entry's title, or NULL
Returns
true iff global history has a selection

Definition at line 981 of file global_history.c.

References global_history_entry::data, gh_ctx, GH_TITLE, global_history_ctx::tree, TREE_NODE_ENTRY, treeview_get_selection(), type, global_history_entry::url, and treeview_field_data::value.

Referenced by ami_history_global_drag_end().

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

◆ global_history_has_selection()

bool global_history_has_selection ( void  )

Determine whether there is a selection.

Returns
true iff there is a selection

Definition at line 974 of file global_history.c.

References gh_ctx, global_history_ctx::tree, and treeview_has_selection().

Referenced by ami_history_global_drag_end(), global_history_menu_prepare(), and global_history_toolbar_update().

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

◆ global_history_init()

nserror global_history_init ( struct core_window_callback_table cw_t,
void *  core_window_handle 
)

Initialise the global history.

This iterates through the URL database, generating the global history data, and creates a treeview.

This must be called before any other global_history_* function.

Parameters
cw_tCallback table for core_window containing the treeview.
core_window_handleThe core_window in which the treeview is shown.
Returns
NSERROR_OK on success, appropriate error otherwise

Definition at line 726 of file global_history.c.

References global_history_ctx::built, cw_t, global_history_ctx::fields, global_history_folder::folder, global_history_ctx::folders, gh_ctx, GH_TODAY, gh_tree_cb_t, global_history_add_entry(), global_history_create_dir(), global_history_init_entries(), global_history_initialise_entry_fields(), global_history_initialise_time(), N_FIELDS, NSERROR_OK, NSLOG, global_history_ctx::tree, treeview_create(), TREEVIEW_DEL_EMPTY_DIRS, treeview_get_height(), treeview_init(), TREEVIEW_NO_MOVES, treeview_node_expand(), TREEVIEW_SEARCHABLE, and urldb_iterate_entries().

Referenced by ami_history_global_present(), atari_global_history_init_phase2(), nsgtk_global_history_init(), nsw32_global_history_init(), and ro_global_history_init().

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

◆ global_history_keypress()

bool global_history_keypress ( uint32_t  key)

Key press handling.

Parameters
keyThe ucs4 character codepoint
Returns
true if the keypress is dealt with, false otherwise.

Definition at line 967 of file global_history.c.

References gh_ctx, global_history_ctx::tree, and treeview_keypress().

Referenced by ami_history_global_key(), atari_global_history_keypress(), global_history_key(), global_history_menu_select(), global_history_toolbar_click(), HOOKF(), MENUHANDLER(), nsgtk_global_history_key(), and nsw32_global_history_key().

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

◆ global_history_mouse_action()

void global_history_mouse_action ( enum browser_mouse_state  mouse,
int  x,
int  y 
)

Handles all kinds of mouse action.

Parameters
mouseThe current mouse state
xX coordinate
yY coordinate

Definition at line 960 of file global_history.c.

References gh_ctx, global_history_ctx::tree, and treeview_mouse_action().

Referenced by ami_history_global_mouse(), atari_global_history_mouse_action(), global_history_mouse(), nsgtk_global_history_mouse(), and nsw32_global_history_mouse().

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

◆ global_history_redraw()

void global_history_redraw ( int  x,
int  y,
struct rect clip,
const struct redraw_context ctx 
)

Redraw the global history.

Parameters
xX coordinate to render treeview at
yY coordinate to render treeview at
clipCurrent clip rectangle (wrt tree origin)
ctxCurrent redraw context

Definition at line 952 of file global_history.c.

References clip(), gh_ctx, global_history_ctx::tree, and treeview_redraw().

Referenced by ami_history_global_draw(), atari_global_history_draw(), global_history_draw(), nsgtk_global_history_draw(), and nsw32_global_history_draw().

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