diff options
Diffstat (limited to 'desktop/hotlist.c')
-rw-r--r-- | desktop/hotlist.c | 59 |
1 files changed, 36 insertions, 23 deletions
diff --git a/desktop/hotlist.c b/desktop/hotlist.c index 4bdd7c8cb..20c0890a1 100644 --- a/desktop/hotlist.c +++ b/desktop/hotlist.c @@ -193,29 +193,32 @@ static nserror hotlist_create_treeview_field_visits_data( struct hotlist_entry *e, const struct url_data *data) { char buffer[16]; - const char *last_visited; - char *last_visited2; - int len; + char *last_visited = NULL; + size_t len = 0; /* Last visited */ if (data->visits != 0) { - last_visited = ctime(&data->last_visit); - last_visited2 = strdup(last_visited); - len = 24; + const size_t lvsize = 256; + struct tm *lvtime; + + if ((lvtime = localtime(&data->last_visit)) != NULL) { + last_visited = malloc(lvsize); + if (last_visited != NULL) { + len = strftime(last_visited, lvsize, + "%a %b %e %H:%M:%S %Y", + lvtime); + } + } } else { - last_visited2 = strdup("-"); + last_visited = strdup("-"); len = 1; } - if (last_visited2 == NULL) { + if (last_visited == NULL) { return NSERROR_NOMEM; - - } else if (len == 24) { - assert(last_visited2[24] == '\n'); - last_visited2[24] = '\0'; } e->data[HL_LAST_VISIT].field = hl_ctx.fields[HL_LAST_VISIT].field; - e->data[HL_LAST_VISIT].value = last_visited2; + e->data[HL_LAST_VISIT].value = last_visited; e->data[HL_LAST_VISIT].value_len = len; /* Visits */ @@ -890,7 +893,9 @@ static nserror hotlist_load(const char *path, bool *loaded) corestring_lwc_html); if (html == NULL) { dom_node_unref(document); - guit->misc->warning("TreeLoadError", "(<html> not found)"); + NSLOG(netsurf, WARNING, + "%s (<html> not found)", + messages_get("TreeLoadError")); return NSERROR_OK; } @@ -899,7 +904,9 @@ static nserror hotlist_load(const char *path, bool *loaded) if (body == NULL) { dom_node_unref(html); dom_node_unref(document); - guit->misc->warning("TreeLoadError", "(<html>...<body> not found)"); + NSLOG(netsurf, WARNING, + "%s (<html>...<body> not found)", + messages_get("TreeLoadError")); return NSERROR_OK; } @@ -909,8 +916,9 @@ static nserror hotlist_load(const char *path, bool *loaded) dom_node_unref(body); dom_node_unref(html); dom_node_unref(document); - guit->misc->warning("TreeLoadError", - "(<html>...<body>...<ul> not found.)"); + NSLOG(netsurf, WARNING, + "%s (<html>...<body>...<ul> not found.)", + messages_get("TreeLoadError")); return NSERROR_OK; } @@ -934,7 +942,9 @@ static nserror hotlist_load(const char *path, bool *loaded) dom_node_unref(document); if (err != NSERROR_OK) { - guit->misc->warning("TreeLoadError", "(Failed building tree.)"); + NSLOG(netsurf, WARNING, + "%s (Failed building tree.)", + messages_get("TreeLoadError")); return NSERROR_OK; } @@ -961,13 +971,13 @@ static nserror hotlist_generate(void) const char *url; const char *msg_key; } default_entries[] = { - { "http://www.netsurf-browser.org/", + { "https://www.netsurf-browser.org/", "HotlistHomepage" }, - { "http://www.netsurf-browser.org/downloads/", + { "https://www.netsurf-browser.org/downloads/", "HotlistDownloads" }, - { "http://www.netsurf-browser.org/documentation", + { "https://www.netsurf-browser.org/documentation", "HotlistDocumentation" }, - { "http://www.netsurf-browser.org/contact", + { "https://www.netsurf-browser.org/contact", "HotlistContact" } }; const int n_entries = sizeof(default_entries) / @@ -1396,6 +1406,9 @@ nserror hotlist_fini(void) /* Destroy the hotlist treeview */ err = treeview_destroy(hl_ctx.tree); + if (err != NSERROR_OK) { + NSLOG(netsurf, INFO, "Problem destroying the hotlist treeview."); + } hl_ctx.built = false; /* Free hotlist treeview entry fields */ @@ -1616,7 +1629,7 @@ nserror hotlist_add_entry(nsurl *url, const char *title, bool at_y, int y) enum treeview_relationship rel; if (url == NULL) { - err = nsurl_create("http://netsurf-browser.org/", &url); + err = nsurl_create("https://netsurf-browser.org/", &url); if (err != NSERROR_OK) { return err; } |