summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVincent Sanders <vince@kyllikki.org>2017-05-28 20:56:33 (GMT)
committer Vincent Sanders <vince@kyllikki.org>2017-05-28 20:56:33 (GMT)
commitf1fdd93ffda5181f325905c8509a2bea9d78eb41 (patch)
treee11fc515501520fb9b6e8e7f394fb073e21efad8
parent6736ab9b724702c82b4aebc61c3d51c48d9c958c (diff)
downloadnetsurf-f1fdd93ffda5181f325905c8509a2bea9d78eb41.tar.gz
netsurf-f1fdd93ffda5181f325905c8509a2bea9d78eb41.tar.bz2
Add local history get url API
-rw-r--r--desktop/local_history.c21
-rw-r--r--desktop/local_history.h30
2 files changed, 43 insertions, 8 deletions
diff --git a/desktop/local_history.c b/desktop/local_history.c
index 06f3002..6d07c8a 100644
--- a/desktop/local_history.c
+++ b/desktop/local_history.c
@@ -91,7 +91,10 @@ local_history_mouse_action(struct local_history_session *session,
{
if (mouse & BROWSER_MOUSE_PRESS_1) {
browser_window_history_click(session->bw, x, y, false);
+ } else if (mouse & BROWSER_MOUSE_PRESS_2) {
+ browser_window_history_click(session->bw, x, y, true);
}
+
}
/* exported interface documented in desktop/local_history.h */
@@ -134,3 +137,21 @@ local_history_get_size(struct local_history_session *session,
return NSERROR_OK;
}
+
+
+/* exported interface documented in desktop/local_history.h */
+nserror
+local_history_get_url(struct local_history_session *session,
+ int x, int y,
+ const char **url_out)
+{
+ const char *url;
+ url = browser_window_history_position_url(session->bw, x, y);
+ if (url == NULL) {
+ return NSERROR_NOT_FOUND;
+ }
+
+ *url_out = url;
+
+ return NSERROR_OK;
+}
diff --git a/desktop/local_history.h b/desktop/local_history.h
index 5425e70..2ce2a5c 100644
--- a/desktop/local_history.h
+++ b/desktop/local_history.h
@@ -33,9 +33,9 @@ struct local_history_session;
struct browser_window;
/**
- * Initialise the global history.
+ * Initialise the local history.
*
- * This iterates through the URL database, generating the global history data,
+ * This iterates through the URL database, generating the local history data,
* and creates a treeview.
*
* This must be called before any other local_history_* function.
@@ -52,10 +52,10 @@ nserror local_history_init(struct core_window_callback_table *cw_t,
struct local_history_session **session);
/**
- * Finalise the global history.
+ * Finalise the local history.
*
- * This destroys the global history treeview and the global history module's
- * internal data. After calling this if global history is required again,
+ * This destroys the local history treeview and the local history module's
+ * internal data. After calling this if ocall history is required again,
* local_history_init must be called.
*
* \param session The local history session to finalise.
@@ -65,7 +65,7 @@ nserror local_history_fini(struct local_history_session *session);
/**
- * Redraw the global history.
+ * Redraw the local history.
*
* \param session The local history session context.
* \param x X coordinate to render history at
@@ -104,13 +104,27 @@ bool local_history_keypress(struct local_history_session *session, uint32_t key)
nserror local_history_set(struct local_history_session *session, struct browser_window *bw);
/**
- * get size of local history content area
+ * get size of local history content area.
*
- * \param session The local history session context.
+ * \param[in] session The local history session context.
* \param[out] width on sucessful return the width of the localhistory content
* \param[out] height on sucessful return the height of the localhistory content
* \return NSERROR_OK or appropriate error code.
*/
nserror local_history_get_size(struct local_history_session *session, int *width, int *height);
+/**
+ * get url of entry at position in local history content area.
+ *
+ * \todo the returned url should be a referenced nsurl.
+ *
+ * \param[in] session The local history session context.
+ * \param[in] x The x coordinate to get url of.
+ * \param[in] y The y coordinate to get url of.
+ * \param[out] url_out string representation of the url at the coordinates.
+ * \return NSERROR_OK and url_out updated or NSERROR_NOT_FOUND if no url at
+ * location.
+ */
+nserror local_history_get_url(struct local_history_session *session, int x, int y, const char **url_out);
+
#endif