[evolution/wip/webkit2] Use set date/time format in Tasks/Memos previews



commit 4d1d1ff379028874eb58c07f1000db9d5061ab8e
Author: Milan Crha <mcrha redhat com>
Date:   Thu Sep 24 11:36:47 2015 +0200

    Use set date/time format in Tasks/Memos previews

 calendar/gui/e-cal-component-preview.c |   21 +++++----------------
 1 files changed, 5 insertions(+), 16 deletions(-)
---
diff --git a/calendar/gui/e-cal-component-preview.c b/calendar/gui/e-cal-component-preview.c
index 8b67324..07a1d44 100644
--- a/calendar/gui/e-cal-component-preview.c
+++ b/calendar/gui/e-cal-component-preview.c
@@ -159,13 +159,11 @@ update_comp_info (ECalComponentPreview *preview,
 static gchar *
 timet_to_str_with_zone (ECalComponentDateTime *dt,
                         ECalClient *client,
-                        icaltimezone *default_zone,
-                        gboolean use_24_hour_format)
+                        icaltimezone *default_zone)
 {
        struct icaltimetype itt;
        icaltimezone *zone = NULL;
        struct tm tm;
-       gchar buf[256];
 
        if (dt->tzid != NULL) {
                e_cal_client_get_timezone_sync (
@@ -179,11 +177,7 @@ timet_to_str_with_zone (ECalComponentDateTime *dt,
                icaltimezone_convert_time (&itt, zone, default_zone);
        tm = icaltimetype_to_tm (&itt);
 
-       e_time_format_date_and_time (
-               &tm, use_24_hour_format,
-               FALSE, FALSE, buf, sizeof (buf));
-
-       return g_locale_to_utf8 (buf, -1, NULL, NULL, NULL);
+       return e_datetime_format_format_tm ("calendar", "table", itt.is_date ? DTFormatKindDate : 
DTFormatKindDateTime, &tm);
 }
 
 static void
@@ -193,7 +187,6 @@ cal_component_preview_write_html (ECalComponentPreview *preview,
        ECalClient *client;
        ECalComponent *comp;
        icaltimezone *default_zone;
-       gboolean use_24_hour_format;
        ECalComponentText text;
        ECalComponentDateTime dt;
        gchar *str;
@@ -208,7 +201,6 @@ cal_component_preview_write_html (ECalComponentPreview *preview,
        client = preview->priv->client;
        comp = preview->priv->comp;
        default_zone = preview->priv->timezone;
-       use_24_hour_format = preview->priv->use_24_hour_format;
 
        /* write document header */
        e_cal_component_get_summary (comp, &text);
@@ -266,8 +258,7 @@ cal_component_preview_write_html (ECalComponentPreview *preview,
        /* write start date */
        e_cal_component_get_dtstart (comp, &dt);
        if (dt.value != NULL) {
-               str = timet_to_str_with_zone (
-                       &dt, client, default_zone, use_24_hour_format);
+               str = timet_to_str_with_zone (&dt, client, default_zone);
                g_string_append_printf (
                        buffer, "<tr><th>%s</th><td>%s</td></tr>",
                        _("Start Date:"), str);
@@ -278,8 +269,7 @@ cal_component_preview_write_html (ECalComponentPreview *preview,
        /* write end date */
        e_cal_component_get_dtend (comp, &dt);
        if (dt.value != NULL) {
-               str = timet_to_str_with_zone (
-                       &dt, client, default_zone, use_24_hour_format);
+               str = timet_to_str_with_zone (&dt, client, default_zone);
                g_string_append_printf (
                        buffer,"<tr><th>%s</th><td>%s</td></tr>",
                        _("End Date:"), str);
@@ -290,8 +280,7 @@ cal_component_preview_write_html (ECalComponentPreview *preview,
        /* write Due Date */
        e_cal_component_get_due (comp, &dt);
        if (dt.value != NULL) {
-               str = timet_to_str_with_zone (
-                       &dt, client, default_zone, use_24_hour_format);
+               str = timet_to_str_with_zone (&dt, client, default_zone);
                g_string_append_printf (
                        buffer, "<tr><th>%s</th><td>%s</td></tr>",
                        _("Due Date:"), str);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]