X-Git-Url: http://git.maemo.org/git/?a=blobdiff_plain;f=src%2Fmodest-datetime-formatter.c;h=9678420d40ec2decec69ec293915ebb5d425670a;hb=3c6c80beb03bf24a24f9ec6e830da399418b24cc;hp=277fea10553016884a53fb08eadce9d9ccfdd50a;hpb=30c9b30c66e233dacfbd9f006de8822e08e4272e;p=modest diff --git a/src/modest-datetime-formatter.c b/src/modest-datetime-formatter.c index 277fea1..9678420 100644 --- a/src/modest-datetime-formatter.c +++ b/src/modest-datetime-formatter.c @@ -31,10 +31,10 @@ #include #ifdef MODEST_TOOLKIT_HILDON2 #include -#include -#include #include #endif +#include +#include "modest-text-utils.h" typedef enum { DATETIME_FORMAT_12H, @@ -116,7 +116,7 @@ modest_datetime_formatter_class_init (ModestDatetimeFormatterClass *klass) G_SIGNAL_RUN_FIRST, G_STRUCT_OFFSET (ModestDatetimeFormatterClass, format_changed), NULL, NULL, - gtk_marshal_VOID__VOID, + g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0); } @@ -188,10 +188,6 @@ init_format (ModestDatetimeFormatter *obj) static void modest_datetime_formatter_instance_init (ModestDatetimeFormatter *obj) { - ModestDatetimeFormatterPrivate *priv; - - priv = MODEST_DATETIME_FORMATTER_GET_PRIVATE (obj); - init_format (obj); } @@ -256,15 +252,18 @@ modest_datetime_formatter_format_time (ModestDatetimeFormatter *self, ModestDatetimeFormatterPrivate *priv; const gchar *format_string = NULL; gboolean is_pm; + struct tm localtime_tm = {0, }; + time_t date_copy; g_return_val_if_fail (MODEST_IS_DATETIME_FORMATTER (self), NULL); priv = MODEST_DATETIME_FORMATTER_GET_PRIVATE (self); - - is_pm = (date / (60 * 60 * 12)) % 2; + date_copy = date; + localtime_r (&date_copy, &localtime_tm); + is_pm = (localtime_tm.tm_hour/12) % 2; switch (priv->current_format) { case DATETIME_FORMAT_12H: - format_string = is_pm?_HL("wdgt_12h_time_pm"):_HL("wdgt_12h_time_am"); + format_string = is_pm?_HL("wdgt_va_12h_time_pm"):_HL("wdgt_va_12h_time_am"); break; case DATETIME_FORMAT_24H: format_string = _HL("wdgt_va_24h_time");