aboutsummaryrefslogtreecommitdiff
path: root/src/history.c
diff options
context:
space:
mode:
authorJohannes Hofmann <Johannes.Hofmann@gmx.de>2010-08-20 23:24:19 +0200
committerJohannes Hofmann <Johannes.Hofmann@gmx.de>2010-08-20 23:24:19 +0200
commitf5c598b518d1f906148534d015f50075d3e8242d (patch)
tree21dd70add5b366c3dd80641b77f6b18e0baa009e /src/history.c
parente98d02a01ffeb18ede86af025e51ae1ec011c75a (diff)
parent5f0fc0e48b8cbee7e1795935da0abff6627fd498 (diff)
merge
Diffstat (limited to 'src/history.c')
-rw-r--r--src/history.c38
1 files changed, 23 insertions, 15 deletions
diff --git a/src/history.c b/src/history.c
index 4b8fb426..15ab19db 100644
--- a/src/history.c
+++ b/src/history.c
@@ -75,22 +75,9 @@ int a_History_add_url(DilloUrl *url)
}
/*
- * Set the page-title for a given URL (by idx)
- * (this is known when the first chunks of HTML data arrive)
- */
-int a_History_set_title(int idx, const char *title)
-{
- dReturn_val_if_fail(idx >= 0 && idx < history_size, 0);
-
- dFree(history[idx].title);
- history[idx].title = dStrdup(title);
- return 1;
-}
-
-/*
* Return the DilloUrl field (by index)
*/
-DilloUrl *a_History_get_url(int idx)
+const DilloUrl *a_History_get_url(int idx)
{
_MSG("a_History_get_url: ");
/* History_show(); */
@@ -137,11 +124,32 @@ const char *a_History_get_title_by_url(const DilloUrl *url, int force)
return NULL;
}
+/*
+ * Set the page-title for a given URL
+ */
+void a_History_set_title_by_url(const DilloUrl *url, const char *title)
+{
+ int i;
+
+ dReturn_if (url == NULL);
+
+ for (i = history_size - 1; i >= 0; --i)
+ if (a_Url_cmp(url, history[i].url) == 0)
+ break;
+
+ if (i >= 0) {
+ dFree(history[i].title);
+ history[i].title = dStrdup(title);
+ } else {
+ MSG_ERR("a_History_set_title_by_url: %s not found\n", URL_STR(url));
+ }
+}
+
/*
* Free all the memory used by this module
*/
-void a_History_free()
+void a_History_freeall()
{
int i;