NetSurf
|
Go to the source code of this file.
Typedefs | |
typedef nserror(* | hotlist_folder_enter_cb) (void *ctx, const char *title) |
Client callback for hotlist_iterate, reporting entry into folder. More... | |
typedef nserror(* | hotlist_address_cb) (void *ctx, struct nsurl *url, const char *title) |
Client callback for hotlist_iterate, reporting a hotlist address. More... | |
typedef nserror(* | hotlist_folder_leave_cb) (void *ctx) |
Client callback for hotlist_iterate, reporting a hotlist folder departure. More... | |
Functions | |
nserror | hotlist_init (const char *load_path, const char *save_path) |
Initialise the hotlist. More... | |
nserror | hotlist_manager_init (void *core_window_handle) |
Initialise the hotlist manager. More... | |
nserror | hotlist_manager_fini (void) |
Finalise the hotlist manager. More... | |
nserror | hotlist_fini (void) |
Finalise the hotlist. More... | |
nserror | hotlist_add_url (struct nsurl *url) |
Add an entry to the hotlist for given URL. More... | |
bool | hotlist_has_url (struct nsurl *url) |
Check whether given URL is present in hotlist. More... | |
void | hotlist_remove_url (struct nsurl *url) |
Remove any entries matching the given URL from the hotlist. More... | |
void | hotlist_update_url (struct nsurl *url) |
Update given URL, e.g. More... | |
nserror | hotlist_add_entry (struct nsurl *url, const char *title, bool at_y, int y) |
Add an entry to the hotlist for given Title/URL. More... | |
nserror | hotlist_add_folder (const char *title, bool at_y, int y) |
Add a folder to the hotlist. More... | |
nserror | hotlist_export (const char *path, const char *title) |
Save hotlist to file. More... | |
nserror | hotlist_iterate (void *ctx, hotlist_folder_enter_cb enter_cb, hotlist_address_cb address_cb, hotlist_folder_leave_cb leave_cb) |
Walk (depth first) the hotlist, calling callbacks on entering folders, address nodes, and on leaving folders. More... | |
void | hotlist_redraw (int x, int y, struct rect *clip, const struct redraw_context *ctx) |
Redraw the hotlist. More... | |
void | hotlist_mouse_action (enum browser_mouse_state mouse, int x, int y) |
Handles all kinds of mouse action. More... | |
bool | hotlist_keypress (uint32_t key) |
Key press handling. More... | |
bool | hotlist_has_selection (void) |
Determine whether there is a selection. More... | |
bool | hotlist_get_selection (struct nsurl **url, const char **title) |
Get the first selected node. More... | |
void | hotlist_edit_selection (void) |
Edit the first selected node. More... | |
nserror | hotlist_expand (bool only_folders) |
Expand the treeview's nodes. More... | |
nserror | hotlist_contract (bool all) |
Contract the treeview's nodes. More... | |
typedef nserror(* hotlist_folder_enter_cb) (void *ctx, const char *title) |
typedef nserror(* hotlist_folder_leave_cb) (void *ctx) |
Add an entry to the hotlist for given Title/URL.
url | URL for entry to be added, or NULL |
title | Title for entry being added (copied), or NULL |
at_y | Iff true, insert at y-offest |
y | Y-offset in px from top of hotlist. Ignored if (!at_y). |
Definition at line 1623 of file hotlist.c.
References hl_ctx, hotlist_add_entry_internal(), NSERROR_OK, nsurl_create(), nsurl_ref(), nsurl_unref(), hotlist_ctx::tree, treeview_get_relation(), and treeview_update_url_walk_ctx::url.
Referenced by ami_hotlist_icon_drop(), atari_hotlist_add_page(), HOOKF(), hotlist_menu_select(), and MENUHANDLER().
nserror hotlist_add_folder | ( | const char * | title, |
bool | at_y, | ||
int | y | ||
) |
Add a folder to the hotlist.
title | Title for folder being added, or NULL |
at_y | Iff true, insert at y-offest |
y | Y-offset in px from top of hotlist. Ignored if (!at_y). |
Definition at line 1660 of file hotlist.c.
References hl_ctx, hotlist_add_folder_internal(), NSERROR_OK, hotlist_ctx::tree, and treeview_get_relation().
Referenced by ami_hotlist_scan(), handle_event(), HOOKF(), hotlist_menu_select(), hotlist_toolbar_click(), and MENUHANDLER().
Add an entry to the hotlist for given URL.
url | URL for node being added |
Definition at line 1430 of file hotlist.c.
References hotlist_ctx::default_folder, hotlist_folder::folder, hl_ctx, hotlist_add_entry_internal(), hotlist_add_folder_internal(), hotlist_schedule_save(), messages_get(), NSERROR_NOMEM, NSERROR_OK, hotlist_ctx::tree, TREE_REL_FIRST_CHILD, and treeview_node_expand().
Referenced by addbookmarks_button_clicked_cb(), ami_gui_event(), HOOKF(), nsgtk_on_link_bookmark_activate_menu(), ro_gui_hotlist_add_page(), ro_gui_hotlist_addurl_bounce(), and toolbar_favorite_click().
nserror hotlist_contract | ( | bool | all | ) |
Contract the treeview's nodes.
all | Iff false, only entries are contracted. |
Definition at line 1747 of file hotlist.c.
References hl_ctx, hotlist_ctx::tree, and treeview_contract().
Referenced by HOOKF(), hotlist_menu_select(), hotlist_toolbar_click(), and MENUHANDLER().
void hotlist_edit_selection | ( | void | ) |
Edit the first selected node.
Definition at line 1733 of file hotlist.c.
References hl_ctx, hotlist_ctx::tree, and treeview_edit_selection().
Referenced by handle_event(), HOOKF(), hotlist_menu_select(), and MENUHANDLER().
nserror hotlist_expand | ( | bool | only_folders | ) |
Expand the treeview's nodes.
only_folders | Iff true, only folders are expanded. |
Definition at line 1740 of file hotlist.c.
References hl_ctx, hotlist_ctx::tree, and treeview_expand().
Referenced by HOOKF(), hotlist_menu_select(), hotlist_toolbar_click(), and MENUHANDLER().
nserror hotlist_export | ( | const char * | path, |
const char * | title | ||
) |
Save hotlist to file.
path | The path to save hotlist to |
title | The title to give the hotlist, or NULL for default |
Definition at line 1086 of file hotlist.c.
References treeview_export_walk_ctx::fp, hl_ctx, hotlist_export_enter_cb(), hotlist_export_leave_cb(), NSERROR_OK, NSERROR_SAVE_FAILED, path(), hotlist_ctx::tree, TREE_NODE_ENTRY, TREE_NODE_FOLDER, and treeview_walk().
Referenced by HOOKF(), hotlist_save(), MENUHANDLER(), and ro_gui_save_content().
nserror hotlist_fini | ( | void | ) |
Finalise the hotlist.
This destroys the hotlist treeview and the hotlist module's internal data. After calling this if hotlist is required again, hotlist_init must be called.
Definition at line 1387 of file hotlist.c.
References hotlist_ctx::built, treeview_field_desc::field, hotlist_ctx::fields, guit, hl_ctx, HL_N_FIELDS, hotlist_save(), hotlist_schedule_save_cb(), netsurf_table::misc, NSERROR_OK, NSLOG, hotlist_ctx::save_path, hotlist_ctx::save_scheduled, gui_misc_table::schedule, hotlist_ctx::tree, treeview_destroy(), and treeview_fini().
Referenced by atari_hotlist_finish(), gui_quit(), nsgtk_finalise(), nsw32_hotlist_finalise(), and ro_gui_hotlist_finalise().
bool hotlist_get_selection | ( | struct nsurl ** | url, |
const char ** | title | ||
) |
Get the first selected node.
url | Updated to the selected entry's address, or NULL |
title | Updated to the selected entry's title, or NULL |
Definition at line 1711 of file hotlist.c.
References hotlist_entry::data, hl_ctx, HL_TITLE, hotlist_ctx::tree, TREE_NODE_ENTRY, treeview_get_selection(), type, hotlist_entry::url, and treeview_field_data::value.
Referenced by ami_hotlist_drag_end().
bool hotlist_has_selection | ( | void | ) |
Determine whether there is a selection.
Definition at line 1704 of file hotlist.c.
References hl_ctx, hotlist_ctx::tree, and treeview_has_selection().
Referenced by ami_hotlist_drag_end(), hotlist_menu_prepare(), and hotlist_toolbar_update().
bool hotlist_has_url | ( | struct nsurl * | url | ) |
Check whether given URL is present in hotlist.
url | Address to look for in hotlist |
Definition at line 1493 of file hotlist.c.
References hotlist_ctx::built, treeview_has_url_walk_ctx::found, hl_ctx, hotlist_has_url_walk_cb(), NSERROR_OK, hotlist_ctx::tree, TREE_NODE_ENTRY, treeview_walk(), and treeview_has_url_walk_ctx::url.
Referenced by ami_gui_event(), ami_gui_update_hotlist_button(), atari_hotlist_add_page(), ro_gui_hotlist_has_page(), ro_gui_hotlist_remove_page(), and toolbar_favorite_click().
nserror hotlist_init | ( | const char * | load_path, |
const char * | save_path | ||
) |
Initialise the hotlist.
This opens the hotlist file, construct the hostlist, and creates a treeview. If there's no hotlist file, it generates a default hotlist.
This must be called before any other hotlist_* function. It must be called before URLs can be added to the hotlist, and before the hotlist can be queried to ask if URLs are present in the hotlist.
In read-only mode the hotlist can be modified, but changes will not persist over sessions.
load_path | The path to load hotlist from. |
save_path | The path to save hotlist to, or NULL for read-only mode. |
Definition at line 1290 of file hotlist.c.
References hotlist_ctx::built, hotlist_ctx::default_folder, hotlist_ctx::fields, hl_ctx, HL_N_FIELDS, hl_tree_cb_t, hotlist_initialise_entry_fields(), hotlist_populate(), NSERROR_NOMEM, NSERROR_OK, NSLOG, hotlist_ctx::save_path, hotlist_ctx::tree, treeview_create(), treeview_init(), and TREEVIEW_SEARCHABLE.
Referenced by atari_hotlist_init(), gui_init(), gui_init2(), nsgtk_setup(), and WinMain().
nserror hotlist_iterate | ( | void * | ctx, |
hotlist_folder_enter_cb | enter_cb, | ||
hotlist_address_cb | address_cb, | ||
hotlist_folder_leave_cb | leave_cb | ||
) |
Walk (depth first) the hotlist, calling callbacks on entering folders, address nodes, and on leaving folders.
ctx | Client context, passed back to callback function |
enter_cb | Function to call on entering nodes, or NULL |
address_cb | Function to call on address nodes, or NULL |
leave_cb | Function to call on leaving nodes, or NULL |
Example usage: Generate a menu containing hotlist entries. For flat list set enter_cb and leave_cb to NULL, or for hierarchical menu provide the folder callbacks.
Definition at line 1164 of file hotlist.c.
References hotlist_iterate_ctx::address_cb, hotlist_iterate_ctx::ctx, hotlist_iterate_ctx::enter_cb, hl_ctx, hotlist_iterate_enter_cb(), hotlist_iterate_leave_cb(), hotlist_iterate_ctx::leave_cb, NSERROR_OK, hotlist_ctx::tree, TREE_NODE_ENTRY, TREE_NODE_FOLDER, and treeview_walk().
Referenced by ami_hotlist_scan().
bool hotlist_keypress | ( | uint32_t | key | ) |
Key press handling.
key | The ucs4 character codepoint |
Definition at line 1697 of file hotlist.c.
References hl_ctx, hotlist_ctx::tree, and treeview_keypress().
Referenced by ami_hotlist_key(), atari_hotlist_keypress(), handle_event(), HOOKF(), hotlist_key(), hotlist_menu_select(), hotlist_toolbar_click(), MENUHANDLER(), nsgtk_hotlist_key(), and nsw32_hotlist_key().
nserror hotlist_manager_fini | ( | void | ) |
Finalise the hotlist manager.
This simply disconnects the underlying treeview from its corewindow, allowing destruction of a GUI hotlist window, without finalising the hotlist module.
Definition at line 1372 of file hotlist.c.
References hl_ctx, NSERROR_OK, hotlist_ctx::tree, and treeview_cw_detach().
Referenced by ami_hotlist_destroy(), and nsgtk_hotlist_destroy().
nserror hotlist_manager_init | ( | void * | core_window_handle | ) |
Initialise the hotlist manager.
This connects the underlying hotlist treeview to a corewindow for display.
The provided core window handle must be valid until hotlist_fini is called.
core_window_handle | The handle in which the hotlist is shown |
Definition at line 1354 of file hotlist.c.
References hl_ctx, NSERROR_OK, hotlist_ctx::tree, treeview_cw_attach(), and treeview_get_height().
Referenced by ami_hotlist_present(), atari_hotlist_init_phase2(), nsgtk_hotlist_init(), nsw32_hotlist_init(), and ro_hotlist_init().
void hotlist_mouse_action | ( | enum browser_mouse_state | mouse, |
int | x, | ||
int | y | ||
) |
Handles all kinds of mouse action.
mouse | The current mouse state |
x | X coordinate |
y | Y coordinate |
Definition at line 1690 of file hotlist.c.
References hl_ctx, hotlist_ctx::tree, and treeview_mouse_action().
Referenced by ami_hotlist_mouse(), atari_hotlist_mouse_action(), hotlist_mouse(), nsgtk_hotlist_mouse(), and nsw32_hotlist_mouse().
void hotlist_redraw | ( | int | x, |
int | y, | ||
struct rect * | clip, | ||
const struct redraw_context * | ctx | ||
) |
Redraw the hotlist.
x | X coordinate to render treeview at |
y | Y coordinate to render treeview at |
clip | Current clip rectangle (wrt tree origin) |
ctx | Current redraw context |
Definition at line 1682 of file hotlist.c.
References clip(), hl_ctx, hotlist_ctx::tree, and treeview_redraw().
Referenced by ami_hotlist_draw(), atari_hotlist_draw(), hotlist_draw(), nsgtk_hotlist_draw(), and nsw32_hotlist_draw().
void hotlist_remove_url | ( | struct nsurl * | url | ) |
Remove any entries matching the given URL from the hotlist.
url | Address to look for in hotlist |
Definition at line 1535 of file hotlist.c.
References hotlist_ctx::built, hl_ctx, hotlist_remove_url_walk_cb(), NSERROR_OK, hotlist_ctx::tree, TREE_NODE_ENTRY, treeview_walk(), and treeview_remove_url_walk_ctx::url.
Referenced by ami_gui_event(), ro_gui_hotlist_remove_confirmed(), ro_gui_hotlist_remove_page(), and toolbar_favorite_click().
void hotlist_update_url | ( | struct nsurl * | url | ) |
Update given URL, e.g.
new visited data
url | Address to update entries for |
Definition at line 1602 of file hotlist.c.
References hotlist_ctx::built, hl_ctx, hotlist_update_url_walk_cb(), NSERROR_OK, hotlist_ctx::tree, TREE_NODE_ENTRY, treeview_walk(), and treeview_update_url_walk_ctx::url.
Referenced by browser_window_content_done().