summaryrefslogtreecommitdiff
path: root/logview/src/logview-window.c
diff options
context:
space:
mode:
authorrbuj <[email protected]>2019-07-28 12:27:20 +0200
committerlukefromdc <[email protected]>2019-07-29 04:28:57 +0000
commit101ca8cd593f42fb8cacfcccc660aa396315d0e7 (patch)
treebda6360cb74d56593544ec9c74b67de1ed68f2ef /logview/src/logview-window.c
parent7a1ab75de40e9b4623e082e9a84cb7ce05d4ab0e (diff)
downloadmate-utils-101ca8cd593f42fb8cacfcccc660aa396315d0e7.tar.bz2
mate-utils-101ca8cd593f42fb8cacfcccc660aa396315d0e7.tar.xz
logview: Use preferred date&time representation for current locale
Status bar date&time. Use g_date_time_format instead of strftime %c: the preferred date and time representation for the current locale
Diffstat (limited to 'logview/src/logview-window.c')
-rw-r--r--logview/src/logview-window.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/logview/src/logview-window.c b/logview/src/logview-window.c
index 6a3e4d9d..56a0b32f 100644
--- a/logview/src/logview-window.c
+++ b/logview/src/logview-window.c
@@ -200,10 +200,10 @@ _gtk_text_buffer_apply_tag_to_rectangle (GtkTextBuffer *buffer, int line_start,
static void
logview_update_statusbar (LogviewWindow *logview, LogviewLog *active)
{
+ GDateTime *date_time;
char *statusbar_text;
- char *size, *modified, *timestring_utf8;
+ char *size, *modified, *timestring;
time_t timestamp;
- char timestring[255];
if (active == NULL) {
gtk_statusbar_pop (GTK_STATUSBAR (logview->priv->statusbar), 0);
@@ -211,12 +211,11 @@ logview_update_statusbar (LogviewWindow *logview, LogviewLog *active)
}
timestamp = logview_log_get_timestamp (active);
- strftime (timestring, sizeof (timestring), "%a %b %e %T %Y", localtime (&timestamp));
- timestring_utf8 = g_locale_to_utf8 (timestring, -1, NULL, NULL, NULL);
+ date_time = g_date_time_new_from_unix_local (timestamp);
+ timestring = g_date_time_format (date_time, "%c");
+ modified = g_strdup_printf (_("last update: %s"), timestring);
- modified = g_strdup_printf (_("last update: %s"), timestring_utf8);
-
- size = g_format_size (logview_log_get_file_size (active));
+ size = g_format_size (logview_log_get_file_size (active));
statusbar_text = g_strdup_printf (_("%d lines (%s) - %s"),
logview_log_get_cached_lines_number (active),
@@ -226,9 +225,10 @@ logview_update_statusbar (LogviewWindow *logview, LogviewLog *active)
gtk_statusbar_push (GTK_STATUSBAR (logview->priv->statusbar), 0, statusbar_text);
g_free (size);
- g_free (timestring_utf8);
+ g_free (timestring);
g_free (modified);
g_free (statusbar_text);
+ g_date_time_unref (date_time);
}
#define DEFAULT_LOGVIEW_FONT "Monospace 10"