X-Git-Url: http://git.maemo.org/git/?p=modest;a=blobdiff_plain;f=src%2Fwidgets%2Fmodest-compact-mail-header-view.c;h=3889a642b4f26c2aeb72956d4c4f1fb9ed7dff36;hp=5837ad3a73aa97b5252e1ed5255adecce52c52fa;hb=ccdfe35c4e5ac57fffc0442f3770a3c118185e64;hpb=5879161f031517a16b4c516e90700b647cb62b1e diff --git a/src/widgets/modest-compact-mail-header-view.c b/src/widgets/modest-compact-mail-header-view.c index 5837ad3..3889a64 100644 --- a/src/widgets/modest-compact-mail-header-view.c +++ b/src/widgets/modest-compact-mail-header-view.c @@ -134,7 +134,7 @@ set_date_time (ModestCompactMailHeaderView *compact_mail_header) gchar date_buf[BUF_SIZE]; GString *buffer = g_string_new (""); - modest_text_utils_strftime (date_buf, BUF_SIZE, _HL("wdgt_va_week"), priv->date_to_show); + modest_text_utils_strftime (date_buf, BUF_SIZE, _HL_WEEK, priv->date_to_show); buffer = g_string_append (buffer, date_buf); buffer = g_string_append_c (buffer, ' '); buffer = g_string_append_unichar (buffer, 0x2015); @@ -144,7 +144,7 @@ set_date_time (ModestCompactMailHeaderView *compact_mail_header) gtk_label_set_text (GTK_LABEL (priv->time_label), buffer->str); g_string_free (buffer, TRUE); buffer = g_string_new (""); - modest_text_utils_strftime (date_buf, BUF_SIZE, _HL("wdgt_va_date_medium"), priv->date_to_show); + modest_text_utils_strftime (date_buf, BUF_SIZE, _HL_DATE_MEDIUM, priv->date_to_show); buffer = g_string_append (buffer, date_buf); gtk_label_set_text (GTK_LABEL (priv->date_label), buffer->str); @@ -331,6 +331,14 @@ datetime_format_changed (ModestDatetimeFormatter *formatter, } static void +unref_event_box (ModestCompactMailHeaderView *self, + GtkWidget *event_box) +{ + ModestCompactMailHeaderViewPriv *priv = MODEST_COMPACT_MAIL_HEADER_VIEW_GET_PRIVATE (self); + priv->event_box = NULL; +} + +static void modest_compact_mail_header_view_instance_init (GTypeInstance *instance, gpointer g_class) { ModestCompactMailHeaderView *self = (ModestCompactMailHeaderView *)instance; @@ -389,10 +397,6 @@ modest_compact_mail_header_view_instance_init (GTypeInstance *instance, gpointer gtk_box_pack_start (GTK_BOX (vbox), from_date_hbox, FALSE, FALSE, 0); - update_style (self); - - g_signal_connect (G_OBJECT (self), "notify::style", G_CALLBACK (on_notify_style), (gpointer) self); - priv->datetime_formatter = modest_datetime_formatter_new (); g_signal_connect (G_OBJECT (priv->datetime_formatter), "format-changed", G_CALLBACK (datetime_format_changed), (gpointer) self); @@ -415,12 +419,17 @@ modest_compact_mail_header_view_instance_init (GTypeInstance *instance, gpointer gtk_box_pack_start (GTK_BOX (main_vbox), headers_date_hbox, FALSE, FALSE, 0); main_align = gtk_alignment_new (0.0, 0.0, 1.0, 1.0); - gtk_alignment_set_padding (GTK_ALIGNMENT (main_align), 0, 0, MODEST_MARGIN_DOUBLE, 0); + gtk_alignment_set_padding (GTK_ALIGNMENT (main_align), 0, MODEST_MARGIN_HALF, MODEST_MARGIN_DOUBLE, 0); priv->event_box = gtk_event_box_new (); gtk_event_box_set_visible_window (GTK_EVENT_BOX (priv->event_box), TRUE); gtk_container_add (GTK_CONTAINER (main_align), main_vbox); gtk_container_add (GTK_CONTAINER (priv->event_box), main_align); gtk_box_pack_start (GTK_BOX (self), priv->event_box, TRUE, TRUE, 0); + g_object_weak_ref (G_OBJECT (priv->event_box), (GWeakNotify) unref_event_box, (gpointer) self); + + update_style (self); + + g_signal_connect (G_OBJECT (self), "notify::style", G_CALLBACK (on_notify_style), (gpointer) self); gtk_widget_show_all (priv->event_box); @@ -437,6 +446,11 @@ modest_compact_mail_header_view_finalize (GObject *object) ModestCompactMailHeaderView *self = (ModestCompactMailHeaderView *)object; ModestCompactMailHeaderViewPriv *priv = MODEST_COMPACT_MAIL_HEADER_VIEW_GET_PRIVATE (self); + if (priv->event_box) { + g_object_weak_unref (G_OBJECT (priv->event_box), (GWeakNotify) unref_event_box, (gpointer) self); + priv->event_box = NULL; + } + if (priv->datetime_formatter) { g_object_unref (priv->datetime_formatter); priv->datetime_formatter = NULL; @@ -683,7 +697,7 @@ update_style (ModestCompactMailHeaderView *self) g_return_if_fail (MODEST_IS_COMPACT_MAIL_HEADER_VIEW (self)); priv = MODEST_COMPACT_MAIL_HEADER_VIEW_GET_PRIVATE (self); - if (gtk_style_lookup_color (GTK_WIDGET (self)->style, "SecondaryTextColor", &style_color)) { + if (gtk_style_lookup_color (gtk_widget_get_style (GTK_WIDGET (self)), "SecondaryTextColor", &style_color)) { color.red = style_color.red; color.green = style_color.green; color.blue = style_color.blue; @@ -718,7 +732,9 @@ update_style (ModestCompactMailHeaderView *self) } pango_attr_list_unref (attr_list); +#ifdef MODEST_COMPACT_HEADER_BG gdk_color_parse (MODEST_COMPACT_HEADER_BG, &bg_color); +#endif gtk_widget_modify_bg (GTK_WIDGET (priv->event_box), GTK_STATE_NORMAL, &bg_color); }