aboutsummaryrefslogtreecommitdiffstats
path: root/composer
diff options
context:
space:
mode:
authorMilan Crha <mcrha@redhat.com>2013-10-18 02:08:06 +0800
committerMilan Crha <mcrha@redhat.com>2013-10-18 02:08:06 +0800
commit7cc6ab171116a07482120a0f766299e9697026c0 (patch)
treecb7921c90778fee2f516fc017f8fddb0ed6cfd4f /composer
parentaf81b13a8994954b8c722c23e8dc073466c962f3 (diff)
downloadgsoc2013-evolution-7cc6ab171116a07482120a0f766299e9697026c0.tar
gsoc2013-evolution-7cc6ab171116a07482120a0f766299e9697026c0.tar.gz
gsoc2013-evolution-7cc6ab171116a07482120a0f766299e9697026c0.tar.bz2
gsoc2013-evolution-7cc6ab171116a07482120a0f766299e9697026c0.tar.lz
gsoc2013-evolution-7cc6ab171116a07482120a0f766299e9697026c0.tar.xz
gsoc2013-evolution-7cc6ab171116a07482120a0f766299e9697026c0.tar.zst
gsoc2013-evolution-7cc6ab171116a07482120a0f766299e9697026c0.zip
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.
Diffstat (limited to 'composer')
-rw-r--r--composer/e-composer-private.c21
-rw-r--r--composer/e-composer-private.h2
2 files changed, 23 insertions, 0 deletions
diff --git a/composer/e-composer-private.c b/composer/e-composer-private.c
index 4ca523e6ed..90569a2e90 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 fc358b9320..66222826e0 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);