[gnome-utils] [logview] translate last update time
- From: Cosimo Cecchi <cosimoc src gnome org>
- To: svn-commits-list gnome org
- Subject: [gnome-utils] [logview] translate last update time
- Date: Sat, 23 May 2009 09:15:40 -0400 (EDT)
commit 062c3c3a471147529ff7ed76c10c3db3dc935630
Author: Cosimo Cecchi <cosimoc gnome org>
Date: Sat May 23 15:13:20 2009 +0200
[logview] translate last update time
Use strftime() instead of ctime() to get the string for the last update
time, as the latter does not localize the output (#582832).
---
logview/logview-window.c | 26 ++++++++++++--------------
1 files changed, 12 insertions(+), 14 deletions(-)
diff --git a/logview/logview-window.c b/logview/logview-window.c
index 00ee415..c32aea8 100644
--- a/logview/logview-window.c
+++ b/logview/logview-window.c
@@ -196,35 +196,33 @@ static void
logview_update_statusbar (LogviewWindow *logview, LogviewLog *active)
{
char *statusbar_text;
- char *size, *modified, *index;
+ char *size, *modified, *timestring_utf8;
time_t timestamp;
+ char timestring[255];
if (active == NULL) {
gtk_statusbar_pop (GTK_STATUSBAR (logview->priv->statusbar), 0);
return;
}
- /* ctime returned string has "\n\0" causes statusbar display a invalid char */
timestamp = logview_log_get_timestamp (active);
- modified = ctime (×tamp);
- index = strrchr (modified, '\n');
- if (index && *index != '\0')
- *index = '\0';
+ strftime (timestring, sizeof (timestring), "%a %b %e %T %Y", localtime (×tamp));
+ timestring_utf8 = g_locale_to_utf8 (timestring, -1, NULL, NULL, NULL);
- modified = g_strdup_printf (_("last update: %s"), modified);
+ modified = g_strdup_printf (_("last update: %s"), timestring_utf8);
size = g_format_size_for_display (logview_log_get_file_size (active));
statusbar_text = g_strdup_printf (_("%d lines (%s) - %s"),
logview_log_get_cached_lines_number (active),
size, modified);
- if (statusbar_text) {
- gtk_statusbar_pop (GTK_STATUSBAR (logview->priv->statusbar), 0);
- gtk_statusbar_push (GTK_STATUSBAR (logview->priv->statusbar), 0, statusbar_text);
- g_free (size);
- g_free (modified);
- g_free (statusbar_text);
- }
+ gtk_statusbar_pop (GTK_STATUSBAR (logview->priv->statusbar), 0);
+ gtk_statusbar_push (GTK_STATUSBAR (logview->priv->statusbar), 0, statusbar_text);
+
+ g_free (size);
+ g_free (timestring_utf8);
+ g_free (modified);
+ g_free (statusbar_text);
}
#define DEFAULT_LOGVIEW_FONT "Monospace 10"
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]