#include <modest-datetime-formatter.h>
#ifdef MODEST_TOOLKIT_HILDON2
#include <gconf/gconf-client.h>
-#include <glib/gi18n.h>
-#include <modest-text-utils.h>
#include <gtk/gtkmarshal.h>
#endif
+#include <glib/gi18n.h>
+#include "modest-text-utils.h"
typedef enum {
DATETIME_FORMAT_12H,
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);
}
static void
modest_datetime_formatter_instance_init (ModestDatetimeFormatter *obj)
{
- ModestDatetimeFormatterPrivate *priv;
-
- priv = MODEST_DATETIME_FORMATTER_GET_PRIVATE (obj);
-
init_format (obj);
}
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");
}
const gchar *
+modest_datetime_formatter_display_long_datetime (ModestDatetimeFormatter *self,
+ time_t date)
+{
+
+#define DATE_BUF_DOUBLE_SIZE 128
+
+ static gchar date_buf[DATE_BUF_DOUBLE_SIZE];
+
+ snprintf (date_buf, DATE_BUF_DOUBLE_SIZE,
+ "%s %s", modest_datetime_formatter_format_date (self, date),
+ modest_datetime_formatter_format_time (self, date));
+
+ return date_buf;
+}
+
+const gchar *
modest_datetime_formatter_display_datetime (ModestDatetimeFormatter *self,
time_t date)
{