Show "-" for last visit date/time when visits count is 0.

This commit is contained in:
Michael Drake 2013-10-23 13:20:43 +01:00
parent 0bbaf1d24d
commit 53a6d6becd
1 changed files with 11 additions and 4 deletions

View File

@ -82,18 +82,25 @@ static nserror hotlist_create_treeview_field_visits_data(
int len; int len;
/* Last visited */ /* Last visited */
if (data->visits != 0) {
last_visited = ctime(&data->last_visit); last_visited = ctime(&data->last_visit);
last_visited2 = strdup(last_visited); last_visited2 = strdup(last_visited);
len = 24;
} else {
last_visited2 = strdup("-");
len = 1;
}
if (last_visited2 == NULL) { if (last_visited2 == NULL) {
return NSERROR_NOMEM; return NSERROR_NOMEM;
} else {
} else if (len == 24) {
assert(last_visited2[24] == '\n'); assert(last_visited2[24] == '\n');
last_visited2[24] = '\0'; last_visited2[24] = '\0';
} }
e->data[HL_LAST_VISIT].field = hl_ctx.fields[HL_LAST_VISIT].field; 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_visited2;
e->data[HL_LAST_VISIT].value_len = 24; e->data[HL_LAST_VISIT].value_len = len;
/* Visits */ /* Visits */
len = snprintf(buffer, 16, "%u", data->visits); len = snprintf(buffer, 16, "%u", data->visits);