[Xfce4-commits] <midori:master> Always allocate and free formatted dates in history panel
Christian Dywan
noreply at xfce.org
Mon Sep 6 03:04:03 CEST 2010
Updating branch refs/heads/master
to 802c1eb462ee1c5fe2ae471e48e26b0c3b6d9a67 (commit)
from be1a66349f6cdb69915875977ac638d6d4c6d5bd (commit)
commit 802c1eb462ee1c5fe2ae471e48e26b0c3b6d9a67
Author: Christian Dywan <christian at twotoasts.de>
Date: Sun Sep 5 22:33:01 2010 +0200
Always allocate and free formatted dates in history panel
panels/midori-history.c | 15 +++++++++------
1 files changed, 9 insertions(+), 6 deletions(-)
diff --git a/panels/midori-history.c b/panels/midori-history.c
index 17f79e3..0ccf795 100644
--- a/panels/midori-history.c
+++ b/panels/midori-history.c
@@ -136,21 +136,21 @@ midori_history_format_date (KatzeItem *item)
/* A negative age is a date in the future, the clock is probably off */
if (age < -1)
- ;
+ sdate = g_strdup ("");
else if (age > 7 || age < 0)
{
strftime (token, sizeof (token), "%x", localtime ((time_t*)&day));
sdate = g_strdup (token);
}
else if (age > 6)
- sdate = _("A week ago");
+ sdate = g_strdup (_("A week ago"));
else if (age > 1)
sdate = g_strdup_printf (ngettext ("%d day ago",
"%d days ago", (gint)age), (gint)age);
else if (age == 0)
- sdate = _("Today");
+ sdate = g_strdup (_("Today"));
else
- sdate = _("Yesterday");
+ sdate = g_strdup (_("Yesterday"));
return sdate;
}
@@ -563,8 +563,11 @@ midori_history_treeview_render_text_cb (GtkTreeViewColumn* column,
g_object_set (renderer, "markup", NULL,
"text", katze_item_get_name (item), NULL);
else if (KATZE_ITEM_IS_FOLDER (item))
- g_object_set (renderer, "markup", NULL,
- "text", midori_history_format_date (item), NULL);
+ {
+ gchar* formatted = midori_history_format_date (item);
+ g_object_set (renderer, "markup", NULL, "text", formatted, NULL);
+ g_free (formatted);
+ }
else
g_object_set (renderer, "markup", _("<i>Separator</i>"), NULL);
More information about the Xfce4-commits
mailing list