X-Git-Url: http://git.maemo.org/git/?a=blobdiff_plain;f=src%2Fmodest-datetime-formatter.c;h=7aa9b24f96b2626cc473986a8166e6f4430d3dac;hb=c8da463e4086bd9695e146e253b9035c5e2609b5;hp=dd3ee9cabb1329a21656d0a609ed625e8fdf32a1;hpb=ce5a9ce7588e132c0c059344c7645994c536d091;p=modest diff --git a/src/modest-datetime-formatter.c b/src/modest-datetime-formatter.c index dd3ee9c..7aa9b24 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, @@ -42,7 +42,8 @@ typedef enum { DATETIME_FORMAT_LOCALE, } DatetimeFormat; -#define HILDON2_GCONF_FORMAT_KEY "/apps/clock/time-format" +#define HILDON2_GCONF_FORMAT_DIR "/apps/clock" +#define HILDON2_GCONF_FORMAT_KEY HILDON2_GCONF_FORMAT_DIR "/time-format" /* 'private'/'protected' functions */ static void modest_datetime_formatter_class_init (ModestDatetimeFormatterClass *klass); @@ -115,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); } @@ -169,6 +170,9 @@ init_format (ModestDatetimeFormatter *obj) GError *err = NULL; gconf = gconf_client_get_default (); + gconf_client_add_dir (gconf, HILDON2_GCONF_FORMAT_DIR, + GCONF_CLIENT_PRELOAD_ONELEVEL, + &err); priv->gconf_handler = gconf_client_notify_add (gconf, HILDON2_GCONF_FORMAT_KEY, clock_format_changed, (gpointer) obj, NULL, &err); @@ -196,11 +200,15 @@ modest_datetime_formatter_finalize (GObject *obj) { #ifdef MODEST_TOOLKIT_HILDON2 ModestDatetimeFormatterPrivate *priv; + GConfClient *gconf; priv = MODEST_DATETIME_FORMATTER_GET_PRIVATE (obj); - gconf_client_notify_remove (gconf_client_get_default (), + gconf = gconf_client_get_default (); + gconf_client_notify_remove (gconf, priv->gconf_handler); priv->gconf_handler = 0; + gconf_client_remove_dir (gconf, HILDON2_GCONF_FORMAT_DIR, + NULL); #endif G_OBJECT_CLASS (parent_class)->finalize (obj); } @@ -256,7 +264,7 @@ modest_datetime_formatter_format_time (ModestDatetimeFormatter *self, 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"); @@ -271,6 +279,22 @@ modest_datetime_formatter_format_time (ModestDatetimeFormatter *self, } 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) {