summaryrefslogtreecommitdiff
path: root/desktop/hotlist.h
diff options
context:
space:
mode:
authorMichael Drake <tlsa@netsurf-browser.org>2013-09-03 19:43:59 +0100
committerMichael Drake <tlsa@netsurf-browser.org>2013-09-03 19:43:59 +0100
commit541724fb0dc4ba82bce76ad779770d37266c1818 (patch)
tree183526345170312b83f2530136983adbec3fd5a7 /desktop/hotlist.h
parent1658554437f651a144311c18f21eb2bf449250c1 (diff)
downloadnetsurf-541724fb0dc4ba82bce76ad779770d37266c1818.tar.gz
netsurf-541724fb0dc4ba82bce76ad779770d37266c1818.tar.bz2
Add hotlist iteration function.
Diffstat (limited to 'desktop/hotlist.h')
-rw-r--r--desktop/hotlist.h48
1 files changed, 48 insertions, 0 deletions
diff --git a/desktop/hotlist.h b/desktop/hotlist.h
index 121eb95ef..c6e74f2cc 100644
--- a/desktop/hotlist.h
+++ b/desktop/hotlist.h
@@ -118,6 +118,54 @@ nserror hotlist_add_folder(const char *title, bool at_y, int y);
nserror hotlist_export(const char *path, const char *title);
/**
+ * Client callback for hotlist_iterate, reporting entry into folder
+ *
+ * \param ctx Client context
+ * \param title The entered folder's title
+ * \return NSERROR_OK on success, or appropriate error otherwise
+ */
+typedef nserror (*hotlist_folder_enter_cb)(void *ctx, const char *title);
+
+/**
+ * Client callback for hotlist_iterate, reporting a hotlist address
+ *
+ * \param ctx Client context
+ * \param url The entry's address
+ * \param title The entry's title
+ * \return NSERROR_OK on success, or appropriate error otherwise
+ */
+typedef nserror (*hotlist_address_cb)(void *ctx, nsurl *url, const char *title);
+
+/**
+ * Client callback for hotlist_iterate, reporting a hotlist folder departure
+ *
+ * \param ctx Client context
+ * \param title The departed folder's title
+ * \return NSERROR_OK on success, or appropriate error otherwise
+ */
+typedef nserror (*hotlist_folder_leave_cb)(void *ctx);
+
+
+/**
+ * Walk (depth first) the hotlist, calling callbacks on entering folders,
+ * address nodes, and on leaving folders.
+ *
+ * \param ctx Client context, passed back to callback function
+ * \param enter_cb Function to call on entering nodes, or NULL
+ * \param address_cb Function to call on address nodes, or NULL
+ * \param leave_cb Function to call on leaving nodes, or NULL
+ * \return NSERROR_OK on success, or appropriate error otherwise
+ *
+ * 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.
+ */
+nserror hotlist_iterate(void *ctx,
+ hotlist_folder_enter_cb enter_cb,
+ hotlist_address_cb address_cb,
+ hotlist_folder_leave_cb leave_cb);
+
+/**
* Redraw the hotlist.
*
* \param x X coordinate to render treeview at