diff options
Diffstat (limited to 'src/history.c')
-rw-r--r-- | src/history.c | 34 |
1 files changed, 21 insertions, 13 deletions
diff --git a/src/history.c b/src/history.c index 4b8fb426..626c3015 100644 --- a/src/history.c +++ b/src/history.c @@ -75,19 +75,6 @@ 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) @@ -137,6 +124,27 @@ 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 |