[evolution] Bug #709396 - Quoted text truncated when "Keep signature above" is set



commit 7cc6ab171116a07482120a0f766299e9697026c0
Author: Milan Crha <mcrha redhat com>
Date:   Thu Oct 17 20:08:06 2013 +0200

    Bug #709396 - Quoted text truncated when "Keep signature above" is set
    
    The GtkComboBox::changed signal is not called only on active-id change,
    but also on any content change, including each row add/change/removal
    into its model. These signals are delivered on the main thread, thus
    the result of e_mail_signature_combo_box_load_selected() is delivered
    later, which means that a call like gtk_list_store_clear() queues as
    many 'load_selected' operations as is the list items count. Such thing
    confused GtkHTML editor enough to garble the message body. This change
    is kind of workaround, which avoids unnecessary signature updates.

 composer/e-composer-private.c |   21 +++++++++++++++++++++
 composer/e-composer-private.h |    2 ++
 2 files changed, 23 insertions(+), 0 deletions(-)
---
diff --git a/composer/e-composer-private.c b/composer/e-composer-private.c
index 4ca523e..90569a2 100644
--- a/composer/e-composer-private.c
+++ b/composer/e-composer-private.c
@@ -465,6 +465,7 @@ e_composer_private_finalize (EMsgComposer *composer)
        g_free (composer->priv->charset);
        g_free (composer->priv->mime_type);
        g_free (composer->priv->mime_body);
+       g_free (composer->priv->selected_signature_uid);
 
        g_hash_table_destroy (composer->priv->inline_images);
        g_hash_table_destroy (composer->priv->inline_images_by_url);
@@ -1023,11 +1024,18 @@ exit:
        g_object_unref (composer);
 }
 
+static gboolean
+is_null_or_none (const gchar *text)
+{
+       return !text || g_strcmp0 (text, "none") == 0;
+}
+
 void
 e_composer_update_signature (EMsgComposer *composer)
 {
        EComposerHeaderTable *table;
        EMailSignatureComboBox *combo_box;
+       const gchar *signature_uid;
 
        g_return_if_fail (E_IS_MSG_COMPOSER (composer));
 
@@ -1036,6 +1044,19 @@ e_composer_update_signature (EMsgComposer *composer)
                return;
 
        table = e_msg_composer_get_header_table (composer);
+       signature_uid = e_composer_header_table_get_signature_uid (table);
+
+       /* this is a case when the signature combo cleared itself for a reload */
+       if (!signature_uid)
+               return;
+
+       if (g_strcmp0 (signature_uid, composer->priv->selected_signature_uid) == 0 ||
+           (is_null_or_none (signature_uid) && is_null_or_none (composer->priv->selected_signature_uid)))
+               return;
+
+       g_free (composer->priv->selected_signature_uid);
+       composer->priv->selected_signature_uid = g_strdup (signature_uid);
+
        combo_box = e_composer_header_table_get_signature_combo_box (table);
 
        /* XXX Signature files should be local and therefore load quickly,
diff --git a/composer/e-composer-private.h b/composer/e-composer-private.h
index fc358b9..6622282 100644
--- a/composer/e-composer-private.h
+++ b/composer/e-composer-private.h
@@ -99,6 +99,8 @@ struct _EMsgComposerPrivate {
        CamelMimeMessage *redirect;
 
        gboolean is_from_message;
+
+       gchar *selected_signature_uid;
 };
 
 void           e_composer_private_constructed  (EMsgComposer *composer);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]