Skip to content

Commit

Permalink
keep timestr local to ui/item_list_view.c lwindolf#998
Browse files Browse the repository at this point in the history
  • Loading branch information
rich-coe committed Aug 13, 2023
1 parent 9a6c2cf commit 594879e
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 36 deletions.
26 changes: 1 addition & 25 deletions src/item.c
Original file line number Diff line number Diff line change
Expand Up @@ -82,12 +82,7 @@ item_new (void)
LifereaItem *
item_load (gulong id)
{
itemPtr item;
item = db_item_load (id);
if (NULL != item) {
item->timestr = date_format (item->time, NULL);
}
return item;
return db_item_load (id);
}

LifereaItem *
Expand All @@ -105,7 +100,6 @@ item_copy (LifereaItem *item)
copy->popupStatus = FALSE;
copy->flagStatus = item->flagStatus;
copy->time = item->time;
copy->timestr = g_strdup( item->timestr );
copy->validTime = item->validTime;
copy->validGuid = item->validGuid;
copy->hasEnclosure = item->hasEnclosure;
Expand Down Expand Up @@ -252,24 +246,6 @@ item_get_author(LifereaItem *item)
return author;
}

void
item_unload (itemPtr item)
{
g_free (item->title);
g_free (item->source);
g_free (item->sourceId);
g_free (item->description);
g_free (item->commentFeedId);
g_free (item->nodeId);
g_free (item->parentNodeId);
g_free (item->timestr);

g_assert (NULL == item->tmpdata); /* should be free after rendering */
metadata_list_free (item->metadata);

g_free (item);
}

const gchar *
item_get_base_url (LifereaItem *item)
{
Expand Down
3 changes: 1 addition & 2 deletions src/item.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ struct _LifereaItem {
GSList *metadata; /*<< Metadata of this item */
GHashTable *tmpdata; /*<< Temporary data hash used during stateful parsing */
gint64 time; /*<< Last modified date of the headline */
gchar *timestr; /*<< Last modifed date as a string */

gchar *commentFeedId; /*<< Id of the comment feed of this item (or NULL if there is no comment feed) */

Expand Down Expand Up @@ -239,4 +238,4 @@ gchar * item_render (LifereaItem *item, guint viewMode);

G_END_DECLS

#endif
#endif
11 changes: 2 additions & 9 deletions src/ui/item_list_view.c
Original file line number Diff line number Diff line change
Expand Up @@ -467,20 +467,14 @@ item_list_view_update_item_internal (ItemListView *ilv, itemPtr item, GtkTreeIte
gchar *title, *time_str;
const GIcon *state_icon;
gint state = 0;
gboolean fixeddatefmt;
int fontWeight = PANGO_WEIGHT_BOLD;

if (item->flagStatus)
state += 2;
if (!item->readStatus)
state += 1;

conf_get_bool_value (FIXED_DATE_FORMAT, &fixeddatefmt);

if (fixeddatefmt)
time_str = item->timestr;
else
time_str = (0 != item->time) ? date_format ((time_t)item->time, NULL) : g_strdup ("");
time_str = date_format ((time_t)item->time, NULL);

title = item->title && strlen (item->title) ? item->title : _("*** No title ***");
title = g_strstrip (g_markup_escape_text (title, -1));
Expand Down Expand Up @@ -540,8 +534,7 @@ item_list_view_update_item_internal (ItemListView *ilv, itemPtr item, GtkTreeIte
-1);
}

if (!fixeddatefmt)
g_free (time_str);
g_free (time_str);
g_free (title);
}

Expand Down

0 comments on commit 594879e

Please sign in to comment.