diff options
author | Michael Drake <tlsa@netsurf-browser.org> | 2013-10-23 13:20:43 +0100 |
---|---|---|
committer | Michael Drake <tlsa@netsurf-browser.org> | 2013-10-23 13:20:43 +0100 |
commit | 53a6d6becd2aa16a6e087d626bb070f5fbae235e (patch) | |
tree | 0154782c0761ee76c3d62bba5f6197218c55c9a4 | |
parent | 0bbaf1d24d4b0b7a6944438e689a81d820be0f3d (diff) | |
download | netsurf-53a6d6becd2aa16a6e087d626bb070f5fbae235e.tar.gz netsurf-53a6d6becd2aa16a6e087d626bb070f5fbae235e.tar.bz2 |
Show "-" for last visit date/time when visits count is 0.
-rw-r--r-- | desktop/hotlist.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/desktop/hotlist.c b/desktop/hotlist.c index 372ae5c7c..6671a77d3 100644 --- a/desktop/hotlist.c +++ b/desktop/hotlist.c @@ -82,18 +82,25 @@ static nserror hotlist_create_treeview_field_visits_data( int len; /* Last visited */ - last_visited = ctime(&data->last_visit); - last_visited2 = strdup(last_visited); + if (data->visits != 0) { + last_visited = ctime(&data->last_visit); + last_visited2 = strdup(last_visited); + len = 24; + } else { + last_visited2 = strdup("-"); + len = 1; + } if (last_visited2 == NULL) { return NSERROR_NOMEM; - } else { + + } 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_len = 24; + e->data[HL_LAST_VISIT].value_len = len; /* Visits */ len = snprintf(buffer, 16, "%u", data->visits); |