[evolution] Bug #669463 - HTML signature opens in editor as Plain text



commit f25826211b007a615118f9b583a66d7027eddeac
Author: Milan Crha <mcrha redhat com>
Date:   Thu May 3 14:43:32 2012 +0200

    Bug #669463 - HTML signature opens in editor as Plain text

 modules/mail/e-mail-shell-backend.c |   19 ++++++++-----
 widgets/misc/e-signature-editor.c   |   48 ++++++++++++++++++++++++++++++++++-
 widgets/misc/e-signature-editor.h   |    5 +++
 widgets/misc/e-signature-manager.c  |    2 +
 4 files changed, 66 insertions(+), 8 deletions(-)
---
diff --git a/modules/mail/e-mail-shell-backend.c b/modules/mail/e-mail-shell-backend.c
index f30d8e3..1039219 100644
--- a/modules/mail/e-mail-shell-backend.c
+++ b/modules/mail/e-mail-shell-backend.c
@@ -38,6 +38,7 @@
 #include <composer/e-msg-composer.h>
 
 #include <widgets/misc/e-preferences-window.h>
+#include <widgets/misc/e-signature-editor.h>
 #include <widgets/misc/e-web-view.h>
 
 #include <libemail-engine/e-mail-folder-utils.h>
@@ -361,7 +362,6 @@ mail_shell_backend_window_added_cb (GtkApplication *application,
 
 	/* This applies to both the composer and signature editor. */
 	if (GTKHTML_IS_EDITOR (window)) {
-		EShellSettings *shell_settings;
 		GList *spell_languages;
 		gboolean active = TRUE;
 
@@ -370,14 +370,19 @@ mail_shell_backend_window_added_cb (GtkApplication *application,
 			GTKHTML_EDITOR (window), spell_languages);
 		g_list_free (spell_languages);
 
-		shell_settings = e_shell_get_shell_settings (shell);
+		if (!E_IS_SIGNATURE_EDITOR (window) ||
+		    !e_signature_editor_get_editing_old (E_SIGNATURE_EDITOR (window))) {
+			EShellSettings *shell_settings;
 
-		/* Express mode does not honor this setting. */
-		if (!e_shell_get_express_mode (shell))
-			active = e_shell_settings_get_boolean (
-				shell_settings, "composer-format-html");
+			shell_settings = e_shell_get_shell_settings (shell);
 
-		gtkhtml_editor_set_html_mode (GTKHTML_EDITOR (window), active);
+			/* Express mode does not honor this setting. */
+			if (!e_shell_get_express_mode (shell))
+				active = e_shell_settings_get_boolean (
+					shell_settings, "composer-format-html");
+
+			gtkhtml_editor_set_html_mode (GTKHTML_EDITOR (window), active);
+		}
 	}
 
 	if (E_IS_MSG_COMPOSER (window)) {
diff --git a/widgets/misc/e-signature-editor.c b/widgets/misc/e-signature-editor.c
index 0ddfb8d..93b2e1d 100644
--- a/widgets/misc/e-signature-editor.c
+++ b/widgets/misc/e-signature-editor.c
@@ -40,7 +40,8 @@
 enum {
 	PROP_0,
 	PROP_FOCUS_TRACKER,
-	PROP_SIGNATURE
+	PROP_SIGNATURE,
+	PROP_EDITING_OLD
 };
 
 struct _ESignatureEditorPrivate {
@@ -49,6 +50,7 @@ struct _ESignatureEditorPrivate {
 	ESignature *signature;
 	GtkWidget *entry;
 	gchar *original_name;
+	gboolean editing_old;
 };
 
 static const gchar *ui =
@@ -254,6 +256,12 @@ signature_editor_set_property (GObject *object,
 				E_SIGNATURE_EDITOR (object),
 				g_value_get_object (value));
 			return;
+
+		case PROP_EDITING_OLD:
+			e_signature_editor_set_editing_old (
+				E_SIGNATURE_EDITOR (object),
+				g_value_get_boolean (value));
+			return;
 	}
 
 	G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
@@ -277,6 +285,12 @@ signature_editor_get_property (GObject *object,
 				value, e_signature_editor_get_signature (
 				E_SIGNATURE_EDITOR (object)));
 			return;
+
+		case PROP_EDITING_OLD:
+			g_value_set_boolean (
+				value, e_signature_editor_get_editing_old (
+				E_SIGNATURE_EDITOR (object)));
+			return;
 	}
 
 	G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
@@ -389,6 +403,16 @@ e_signature_editor_class_init (ESignatureEditorClass *class)
 			NULL,
 			E_TYPE_SIGNATURE,
 			G_PARAM_READWRITE));
+
+	g_object_class_install_property (
+		object_class,
+		PROP_EDITING_OLD,
+		g_param_spec_boolean (
+			"editing-old",
+			NULL,
+			NULL,
+			FALSE,
+			G_PARAM_READWRITE));
 }
 
 static void
@@ -585,3 +609,25 @@ exit:
 
 	g_object_notify (G_OBJECT (editor), "signature");
 }
+
+void
+e_signature_editor_set_editing_old (ESignatureEditor *editor,
+				    gboolean editing_old)
+{
+	g_return_if_fail (E_IS_SIGNATURE_EDITOR (editor));
+
+	if (editor->priv->editing_old == editing_old)
+		return;
+
+	editor->priv->editing_old = editing_old;
+
+	g_object_notify (G_OBJECT (editor), "editing-old");
+}
+
+gboolean
+e_signature_editor_get_editing_old (ESignatureEditor *editor)
+{
+	g_return_val_if_fail (E_IS_SIGNATURE_EDITOR (editor), FALSE);
+
+	return editor->priv->editing_old;
+}
diff --git a/widgets/misc/e-signature-editor.h b/widgets/misc/e-signature-editor.h
index 0d07cb8..f848e89 100644
--- a/widgets/misc/e-signature-editor.h
+++ b/widgets/misc/e-signature-editor.h
@@ -67,6 +67,11 @@ EFocusTracker *	e_signature_editor_get_focus_tracker
 ESignature *	e_signature_editor_get_signature (ESignatureEditor *editor);
 void		e_signature_editor_set_signature (ESignatureEditor *editor,
 						  ESignature *signature);
+void		e_signature_editor_set_editing_old
+						 (ESignatureEditor *editor,
+						  gboolean editing_old);
+gboolean	e_signature_editor_get_editing_old
+						 (ESignatureEditor *editor);
 
 G_END_DECLS
 
diff --git a/widgets/misc/e-signature-manager.c b/widgets/misc/e-signature-manager.c
index eb68dd2..888a9df 100644
--- a/widgets/misc/e-signature-manager.c
+++ b/widgets/misc/e-signature-manager.c
@@ -378,6 +378,8 @@ signature_manager_edit_signature (ESignatureManager *manager)
 	editor = e_signature_editor_new ();
 	e_signature_editor_set_signature (
 		E_SIGNATURE_EDITOR (editor), signature);
+	e_signature_editor_set_editing_old (
+		E_SIGNATURE_EDITOR (editor), TRUE);
 	signature_manager_emit_editor_created (manager, editor);
 
 	goto exit;



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