From 299575121caff536a41c9c8a0347d4247f58f34a Mon Sep 17 00:00:00 2001 From: Jose Dapena Paz Date: Mon, 14 Dec 2009 12:58:21 +0100 Subject: [PATCH] On updating the signature in editor, set signature color properly. Fix 2/3 NB#147995. --- src/hildon2/modest-msg-edit-window.c | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/src/hildon2/modest-msg-edit-window.c b/src/hildon2/modest-msg-edit-window.c index 02d1423..426f3d0 100644 --- a/src/hildon2/modest-msg-edit-window.c +++ b/src/hildon2/modest-msg-edit-window.c @@ -4041,12 +4041,29 @@ update_signature (ModestMsgEditWindow *self, priv->last_from_account = modest_selector_picker_get_active_id (MODEST_SELECTOR_PICKER (priv->from_field)); signature = modest_account_mgr_get_signature_from_recipient (mgr, new_account, &has_new_signature); if (has_new_signature) { + gboolean is_rich; gchar *full_signature = g_strconcat ((gtk_text_iter_starts_line (&iter)) ? "" : "\n", MODEST_TEXT_UTILS_SIGNATURE_MARKER, "\n", signature, NULL); - gtk_text_buffer_insert (priv->text_buffer, &iter, full_signature, -1); - g_free (full_signature); + is_rich = wp_text_buffer_is_rich_text (WP_TEXT_BUFFER (priv->text_buffer)); + if (is_rich) { + WPTextBufferFormat *fmt; + GdkColor style_color; + if (!gtk_style_lookup_color (GTK_WIDGET (self)->style, "SecondaryTextColor", &style_color)) { + gdk_color_parse ("grey", &style_color); + } + fmt = g_new0 (WPTextBufferFormat, 1); + fmt->color = style_color; + fmt->cs.color = 0x1; + wp_text_buffer_insert_with_attribute (WP_TEXT_BUFFER (priv->text_buffer), &iter, + full_signature, -1, + fmt, TRUE); + g_free (fmt); + g_free (full_signature); + } else { + gtk_text_buffer_insert (priv->text_buffer, &iter, full_signature, -1); + } } g_free (signature); gtk_text_buffer_end_user_action (priv->text_buffer); -- 1.7.9.5