NetSurf
|
#include <errno.h>
#include <assert.h>
#include <stdlib.h>
#include <string.h>
#include <dom/dom.h>
#include <dom/bindings/hubbub/parser.h>
#include "utils/corestrings.h"
#include "utils/messages.h"
#include "utils/utils.h"
#include "utils/utf8.h"
#include "utils/libdom.h"
#include "utils/log.h"
#include "utils/nsurl.h"
#include "content/urldb.h"
#include "netsurf/misc.h"
#include "desktop/gui_internal.h"
#include "desktop/hotlist.h"
#include "desktop/treeview.h"
#include "netsurf/browser_window.h"
Go to the source code of this file.
Data Structures | |
struct | hotlist_folder |
struct | hotlist_ctx |
struct | hotlist_entry |
struct | hotlist_load_ctx |
struct | treeview_export_walk_ctx |
struct | hotlist_iterate_ctx |
struct | treeview_has_url_walk_ctx |
struct | treeview_remove_url_walk_ctx |
struct | treeview_update_url_walk_ctx |
Macros | |
#define | N_DAYS 28 |
#define | N_SEC_PER_DAY (60 * 60 * 24) |
Enumerations | |
enum | hotlist_fields { HL_TITLE , HL_URL , HL_LAST_VISIT , HL_VISITS , HL_FOLDER , HL_N_FIELDS } |
Functions | |
static nserror | hotlist_get_temp_path (const char *path, char **temp_path) |
static nserror | hotlist_save (const char *path) |
static void | hotlist_schedule_save_cb (void *p) |
Scheduler callback for saving the hotlist. More... | |
static nserror | hotlist_schedule_save (void) |
Schedule a hotlist save. More... | |
static nserror | hotlist_create_treeview_field_visits_data (struct hotlist_entry *e, const struct url_data *data) |
Set a hotlist entry's data from the url_data. More... | |
static nserror | hotlist_create_treeview_field_data (struct hotlist_entry *e, const char *title, const struct url_data *data) |
Set a hotlist entry's data from the url_data. More... | |
static nserror | hotlist_entry_insert (struct hotlist_entry *e, treeview_node *relation, enum treeview_relationship rel) |
Add a hotlist entry to the treeview. More... | |
static void | hotlist_delete_entry_internal (struct hotlist_entry *e) |
Delete a hotlist entry. More... | |
static nserror | hotlist_create_entry (nsurl *url, const char *title, const struct url_data *data, struct hotlist_entry **entry) |
Create hotlist entry data for URL. More... | |
static nserror | hotlist_add_entry_internal (nsurl *url, const char *title, const struct url_data *data, treeview_node *relation, enum treeview_relationship rel, treeview_node **entry) |
Add an entry to the hotlist (creates the entry). More... | |
static nserror | hotlist_add_folder_internal (const char *title, treeview_node *relation, enum treeview_relationship rel, struct hotlist_folder **folder, bool default_folder) |
Add folder to the hotlist (creates the folder). More... | |
static nserror | hotlist_tree_node_folder_cb (struct treeview_node_msg msg, void *data) |
static nserror | hotlist_tree_node_entry_cb (struct treeview_node_msg msg, void *data) |
callback for hotlist treeview entry manipulation. More... | |
static nserror | hotlist_load_entry (dom_node *li, hotlist_load_ctx *ctx) |
Parse an entry represented as a li. More... | |
static nserror | hotlist_load_directory_cb (dom_node *node, void *ctx) |
static nserror | hotlist_load_directory (dom_node *ul, hotlist_load_ctx *ctx) |
Parse a directory represented as a ul. More... | |
static nserror | hotlist_load (const char *path, bool *loaded) |
static nserror | hotlist_generate (void) |
static nserror | hotlist_export_enter_cb (void *ctx, void *node_data, enum treeview_node_type type, bool *abort) |
Callback for treeview_walk node entering. More... | |
static nserror | hotlist_export_leave_cb (void *ctx, void *node_data, enum treeview_node_type type, bool *abort) |
Callback for treeview_walk node leaving. More... | |
nserror | hotlist_export (const char *path, const char *title) |
Save hotlist to file. More... | |
static nserror | hotlist_iterate_enter_cb (void *ctx, void *node_data, enum treeview_node_type type, bool *abort) |
Callback for hotlist_iterate node entering. More... | |
static nserror | hotlist_iterate_leave_cb (void *ctx, void *node_data, enum treeview_node_type type, bool *abort) |
Callback for hotlist_iterate node leaving. 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... | |
static nserror | hotlist_initialise_entry_fields (void) |
Initialise the treeview entry feilds. More... | |
static nserror | hotlist_populate (const char *path) |
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 (nsurl *url) |
Add an entry to the hotlist for given URL. More... | |
static nserror | hotlist_has_url_walk_cb (void *ctx, void *node_data, enum treeview_node_type type, bool *abort) |
Callback for treeview_walk. More... | |
bool | hotlist_has_url (nsurl *url) |
Check whether given URL is present in hotlist. More... | |
static nserror | hotlist_remove_url_walk_cb (void *ctx, void *node_data, enum treeview_node_type type, bool *abort) |
Callback for treeview_walk. More... | |
void | hotlist_remove_url (nsurl *url) |
Remove any entries matching the given URL from the hotlist. More... | |
static nserror | hotlist_update_url_walk_cb (void *ctx, void *node_data, enum treeview_node_type type, bool *abort) |
Callback for treeview_walk. More... | |
void | hotlist_update_url (nsurl *url) |
Update given URL, e.g. More... | |
nserror | hotlist_add_entry (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... | |
void | hotlist_redraw (int x, int y, struct rect *clip, const struct redraw_context *ctx) |
Redraw the hotlist. More... | |
void | hotlist_mouse_action (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 (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... | |
Variables | |
struct hotlist_ctx | hl_ctx |
struct treeview_callback_table | hl_tree_cb_t |
enum hotlist_fields |
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().
|
static |
Add an entry to the hotlist (creates the entry).
url | URL for entry to add to hotlist. |
title | Title for entry, or NULL if using title from data |
data | URL data for the entry, or NULL |
relation | Existing node to insert as relation of, or NULL |
rel | Entry's relationship to relation |
entry | Updated to new treeview entry node |
Definition at line 406 of file hotlist.c.
References hotlist_entry::data, hotlist_entry::entry, hotlist_create_entry(), hotlist_delete_entry_internal(), hotlist_entry_insert(), NSERROR_OK, hotlist_entry::url, and urldb_set_url_persistence().
Referenced by hotlist_add_entry(), hotlist_add_url(), hotlist_generate(), and hotlist_load_entry().
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().
|
static |
Add folder to the hotlist (creates the folder).
title | Title for folder, or NULL if using title from data |
relation | Existing node to insert as relation of, or NULL |
rel | Folder's relationship to relation |
folder | Updated to new hotlist folder data |
default_folder | Add to the default folder. |
Definition at line 443 of file hotlist.c.
References hotlist_ctx::built, hotlist_folder::data, treeview_field_desc::field, treeview_field_data::field, hotlist_ctx::fields, hotlist_folder::folder, hl_ctx, HL_FOLDER, messages_get(), NSERROR_NOMEM, NSERROR_OK, hotlist_ctx::tree, TREE_OPTION_NONE, TREE_OPTION_SPECIAL_DIR, TREE_OPTION_SUPPRESS_REDRAW, TREE_OPTION_SUPPRESS_RESIZE, treeview_create_node_folder(), treeview_field_data::value, and treeview_field_data::value_len.
Referenced by hotlist_add_folder(), hotlist_add_url(), hotlist_generate(), and hotlist_load_directory_cb().
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().
|
static |
Create hotlist entry data for URL.
url | URL for entry to add to hotlist. |
title | Title for entry, or NULL if using title from data |
data | URL data for the entry, or NULL |
entry | Updated to new hotlist entry data |
Definition at line 349 of file hotlist.c.
References hotlist_entry::data, hotlist_entry::entry, hotlist_create_treeview_field_data(), NSERROR_NOMEM, NSERROR_OK, nsurl_ref(), nsurl_unref(), hotlist_entry::url, urldb_add_url(), and urldb_get_url_data().
Referenced by hotlist_add_entry_internal().
|
static |
Set a hotlist entry's data from the url_data.
e | hotlist entry to set up |
title | Title for entry, or NULL if using title from data |
data | Data associated with entry's URL |
Definition at line 251 of file hotlist.c.
References hotlist_entry::data, treeview_field_desc::field, treeview_field_data::field, hotlist_ctx::fields, hl_ctx, HL_TITLE, HL_URL, hotlist_create_treeview_field_visits_data(), NSERROR_NOMEM, NSERROR_OK, nsurl_access(), nsurl_length(), url_data::title, hotlist_entry::url, treeview_field_data::value, and treeview_field_data::value_len.
Referenced by hotlist_create_entry().
|
static |
Set a hotlist entry's data from the url_data.
e | hotlist entry to set up. |
data | Data associated with entry's URL. |
Definition at line 192 of file hotlist.c.
References buffer, hotlist_entry::data, treeview_field_desc::field, treeview_field_data::field, hotlist_ctx::fields, hl_ctx, HL_LAST_VISIT, HL_VISITS, url_data::last_visit, NSERROR_NOMEM, NSERROR_OK, treeview_field_data::value, treeview_field_data::value_len, and url_data::visits.
Referenced by hotlist_create_treeview_field_data(), and hotlist_update_url_walk_cb().
|
static |
Delete a hotlist entry.
This does not delete the treeview node, rather it should only be called from the treeview node delete event message.
e | Entry to delete |
Definition at line 324 of file hotlist.c.
References hotlist_entry::data, hotlist_entry::entry, HL_LAST_VISIT, HL_TITLE, HL_VISITS, nsurl_unref(), hotlist_entry::url, and treeview_field_data::value.
Referenced by hotlist_add_entry_internal(), and hotlist_tree_node_entry_cb().
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().
|
static |
Add a hotlist entry to the treeview.
e | Entry to add to treeview |
relation | Existing node to insert as relation of, or NULL |
rel | Folder's relationship to relation |
It is assumed that the entry is unique (for its URL) in the global hotlist table
Definition at line 299 of file hotlist.c.
References hotlist_ctx::built, hotlist_entry::data, hotlist_entry::entry, hl_ctx, NSERROR_OK, hotlist_ctx::tree, TREE_OPTION_NONE, TREE_OPTION_SUPPRESS_REDRAW, TREE_OPTION_SUPPRESS_RESIZE, and treeview_create_node_entry().
Referenced by hotlist_add_entry_internal().
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().
|
static |
Callback for treeview_walk node entering.
Definition at line 1023 of file hotlist.c.
References hotlist_folder::data, hotlist_entry::data, hotlist_ctx::default_folder, treeview_export_walk_ctx::fp, hl_ctx, HL_TITLE, HL_URL, NSERROR_OK, NSERROR_SAVE_FAILED, TREE_NODE_ENTRY, TREE_NODE_FOLDER, type, utf8_to_html(), treeview_field_data::value, and treeview_field_data::value_len.
Referenced by hotlist_export().
|
static |
Callback for treeview_walk node leaving.
Definition at line 1074 of file hotlist.c.
References treeview_export_walk_ctx::fp, NSERROR_OK, TREE_NODE_FOLDER, and type.
Referenced by hotlist_export().
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().
|
static |
Definition at line 962 of file hotlist.c.
References hotlist_folder::folder, hotlist_add_entry_internal(), hotlist_add_folder_internal(), messages_get(), NSERROR_NOMEM, NSERROR_OK, nsurl_create(), nsurl_unref(), and TREE_REL_FIRST_CHILD.
Referenced by hotlist_populate().
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().
|
static |
Definition at line 85 of file hotlist.c.
References NSERROR_NOMEM, NSERROR_OK, NSERROR_UNKNOWN, and path().
Referenced by hotlist_load(), and hotlist_save().
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().
|
static |
Callback for treeview_walk.
Definition at line 1475 of file hotlist.c.
References treeview_has_url_walk_ctx::found, NSERROR_OK, nsurl_compare(), NSURL_COMPLETE, TREE_NODE_ENTRY, type, hotlist_entry::url, and treeview_has_url_walk_ctx::url.
Referenced by hotlist_has_url().
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().
|
static |
Initialise the treeview entry feilds.
Definition at line 1193 of file hotlist.c.
References treeview_field_desc::field, hotlist_ctx::fields, treeview_field_desc::flags, hl_ctx, HL_FOLDER, HL_LAST_VISIT, HL_N_FIELDS, HL_TITLE, HL_URL, HL_VISITS, messages_get(), NSERROR_OK, NSERROR_UNKNOWN, TREE_FLAG_ALLOW_EDIT, TREE_FLAG_COPY_TEXT, TREE_FLAG_DEFAULT, TREE_FLAG_SEARCHABLE, and TREE_FLAG_SHOW_NAME.
Referenced by hotlist_init().
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().
|
static |
Callback for hotlist_iterate node entering.
Definition at line 1134 of file hotlist.c.
References hotlist_iterate_ctx::address_cb, hotlist_iterate_ctx::ctx, hotlist_folder::data, hotlist_entry::data, HL_TITLE, NSERROR_OK, TREE_NODE_ENTRY, TREE_NODE_FOLDER, type, hotlist_entry::url, and treeview_field_data::value.
Referenced by hotlist_iterate().
|
static |
Callback for hotlist_iterate node leaving.
Definition at line 1152 of file hotlist.c.
References hotlist_iterate_ctx::ctx, hotlist_iterate_ctx::leave_cb, NSERROR_OK, TREE_NODE_FOLDER, and type.
Referenced by hotlist_iterate().
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().
|
static |
Definition at line 858 of file hotlist.c.
References hl_ctx, hotlist_get_temp_path(), hotlist_load_directory(), hotlist_load_ctx::last_was_h4, libdom_find_first_element(), libdom_parse_file(), messages_get(), NSERROR_OK, NSLOG, path(), hotlist_load_ctx::rel, hotlist_load_ctx::relshp, hotlist_load_ctx::title, hotlist_ctx::tree, hotlist_load_ctx::tree, and TREE_REL_FIRST_CHILD.
Referenced by hotlist_populate().
|
static |
Parse a directory represented as a ul.
ul | DOM node for parsed ul. |
ctx | The hotlist context. |
Definition at line 733 of file hotlist.c.
References hotlist_load_directory_cb(), and libdom_iterate_child_elements().
Referenced by hotlist_load(), and hotlist_load_directory_cb().
|
static |
Definition at line 744 of file hotlist.c.
References hotlist_ctx::default_folder, hotlist_folder::folder, hl_ctx, hotlist_add_folder_internal(), hotlist_load_directory(), hotlist_load_entry(), hotlist_load_ctx::last_was_h4, NSERROR_DOM, NSERROR_NOMEM, NSERROR_OK, NSLOG, hotlist_load_ctx::rel, hotlist_load_ctx::relshp, hotlist_load_ctx::title, hotlist_load_ctx::tree, TREE_REL_FIRST_CHILD, and TREE_REL_NEXT_SIBLING.
Referenced by hotlist_load_directory().
|
static |
Parse an entry represented as a li.
li | DOM node for parsed li |
ctx | Our hotlist loading context. |
Definition at line 647 of file hotlist.c.
References hotlist_add_entry_internal(), libdom_find_first_element(), messages_get(), NSERROR_INVALID, NSERROR_OK, NSLOG, nsurl_create(), nsurl_unref(), hotlist_load_ctx::rel, hotlist_load_ctx::relshp, and TREE_REL_NEXT_SIBLING.
Referenced by hotlist_load_directory_cb().
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().
|
static |
Definition at line 1268 of file hotlist.c.
References hotlist_generate(), hotlist_load(), NSERROR_OK, and path().
Referenced by hotlist_init().
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().
|
static |
Callback for treeview_walk.
Definition at line 1517 of file hotlist.c.
References hotlist_entry::entry, hl_ctx, NSERROR_OK, nsurl_compare(), NSURL_COMPLETE, hotlist_ctx::tree, TREE_NODE_ENTRY, TREE_OPTION_NONE, treeview_delete_node(), type, hotlist_entry::url, and treeview_remove_url_walk_ctx::url.
Referenced by hotlist_remove_url().
|
static |
Definition at line 113 of file hotlist.c.
References hotlist_export(), hotlist_get_temp_path(), NSERROR_OK, NSERROR_SAVE_FAILED, NSLOG, and path().
Referenced by gui_init(), hotlist_fini(), hotlist_schedule_save_cb(), and ro_gui_create_dirs().
|
static |
Schedule a hotlist save.
Definition at line 170 of file hotlist.c.
References guit, hl_ctx, hotlist_schedule_save_cb(), netsurf_table::misc, NSERROR_OK, hotlist_ctx::save_path, hotlist_ctx::save_scheduled, and gui_misc_table::schedule.
Referenced by hotlist_add_url(), and hotlist_tree_node_entry_cb().
|
static |
Scheduler callback for saving the hotlist.
p | Unused user data. |
Definition at line 158 of file hotlist.c.
References hl_ctx, hotlist_save(), hotlist_ctx::save_path, and hotlist_ctx::save_scheduled.
Referenced by hotlist_fini(), and hotlist_schedule_save().
|
static |
callback for hotlist treeview entry manipulation.
Definition at line 538 of file hotlist.c.
References BROWSER_MOUSE_MOD_1, BROWSER_MOUSE_MOD_2, browser_window_create(), BW_CREATE_HISTORY, hotlist_entry::data, treeview_node_msg::data, hotlist_entry::entry, treeview_node_msg::field, treeview_field_desc::field, hotlist_ctx::fields, hl_ctx, HL_TITLE, HL_URL, hotlist_delete_entry_internal(), hotlist_schedule_save(), treeview_node_msg::mouse, treeview_node_msg::msg, treeview_node_msg::node_edit, treeview_node_msg::node_launch, NSERROR_OK, nsurl_access(), nsurl_create(), nsurl_length(), nsurl_unref(), treeview_node_msg::text, hotlist_ctx::tree, TREE_MSG_NODE_DELETE, TREE_MSG_NODE_EDIT, TREE_MSG_NODE_LAUNCH, treeview_update_node_entry(), hotlist_entry::url, treeview_field_data::value, and treeview_field_data::value_len.
|
static |
Definition at line 491 of file hotlist.c.
References hotlist_folder::data, treeview_node_msg::data, hotlist_ctx::default_folder, treeview_node_msg::field, treeview_field_desc::field, hotlist_ctx::fields, hotlist_folder::folder, hl_ctx, HL_FOLDER, treeview_node_msg::msg, treeview_node_msg::node_edit, NSERROR_OK, treeview_node_msg::text, hotlist_ctx::tree, TREE_MSG_NODE_DELETE, TREE_MSG_NODE_EDIT, TREE_MSG_NODE_LAUNCH, treeview_update_node_folder(), treeview_field_data::value, and treeview_field_data::value_len.
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().
|
static |
Callback for treeview_walk.
Definition at line 1559 of file hotlist.c.
References hotlist_entry::data, treeview_update_url_walk_ctx::data, hotlist_entry::entry, hl_ctx, HL_LAST_VISIT, HL_VISITS, hotlist_create_treeview_field_visits_data(), NSERROR_NOMEM, NSERROR_OK, nsurl_compare(), NSURL_COMPLETE, hotlist_ctx::tree, TREE_NODE_ENTRY, treeview_update_node_entry(), type, hotlist_entry::url, treeview_update_url_walk_ctx::url, urldb_add_url(), urldb_get_url_data(), and treeview_field_data::value.
Referenced by hotlist_update_url().
struct hotlist_ctx hl_ctx |
Definition at line 68 of file hotlist.c.
Referenced by hotlist_add_entry(), hotlist_add_folder(), hotlist_add_folder_internal(), hotlist_add_url(), hotlist_contract(), hotlist_create_treeview_field_data(), hotlist_create_treeview_field_visits_data(), hotlist_edit_selection(), hotlist_entry_insert(), hotlist_expand(), hotlist_export(), hotlist_export_enter_cb(), hotlist_fini(), hotlist_get_selection(), hotlist_has_selection(), hotlist_has_url(), hotlist_init(), hotlist_initialise_entry_fields(), hotlist_iterate(), hotlist_keypress(), hotlist_load(), hotlist_load_directory_cb(), hotlist_manager_fini(), hotlist_manager_init(), hotlist_mouse_action(), hotlist_redraw(), hotlist_remove_url(), hotlist_remove_url_walk_cb(), hotlist_schedule_save(), hotlist_schedule_save_cb(), hotlist_tree_node_entry_cb(), hotlist_tree_node_folder_cb(), hotlist_update_url(), and hotlist_update_url_walk_cb().
struct treeview_callback_table hl_tree_cb_t |
Definition at line 624 of file hotlist.c.
Referenced by hotlist_init().