[evolution/webkit-composer: 71/147] Preliminary port of /mail to EEditor, drop Gtkhtml dependency from mail and shell



commit 198984d573023af5b0029cdd7333ac0d7ba885ef
Author: Dan VrÃtil <dvratil redhat com>
Date:   Tue Aug 28 18:17:27 2012 +0200

    Preliminary port of /mail to EEditor, drop Gtkhtml dependency from mail and shell

 doc/reference/libeshell/Makefile.am |    2 -
 mail/Makefile.am                    |    2 -
 mail/e-mail-reader-utils.c          |    1 -
 mail/em-composer-utils.c            |   63 +++++++++++++++++++++++++----------
 mail/importers/Makefile.am          |    6 +--
 shell/Makefile.am                   |    2 -
 6 files changed, 47 insertions(+), 29 deletions(-)
---
diff --git a/doc/reference/libeshell/Makefile.am b/doc/reference/libeshell/Makefile.am
index c9afa90..ec786ee 100644
--- a/doc/reference/libeshell/Makefile.am
+++ b/doc/reference/libeshell/Makefile.am
@@ -23,7 +23,6 @@ GTKDOC_CFLAGS= \
 	-I$(top_builddir)						\
 	$(EVOLUTION_DATA_SERVER_CFLAGS)					\
 	$(GNOME_PLATFORM_CFLAGS)					\
-	$(GTKHTML_CFLAGS)						\
 	$(NULL)
 
 GTKDOC_LIBS=								\
@@ -32,7 +31,6 @@ GTKDOC_LIBS=								\
 	$(top_builddir)/e-util/libeutil.la				\
 	$(EVOLUTION_DATA_SERVER_LIBS)					\
 	$(GNOME_PLATFORM_LIBS)						\
-	$(GTKHTML_LIBS)							\
 	$(NULL)
 
 # This includes the standard gtk-doc make rules, copied by gtkdocize.
diff --git a/mail/Makefile.am b/mail/Makefile.am
index c0fdeb3..fa5962a 100644
--- a/mail/Makefile.am
+++ b/mail/Makefile.am
@@ -31,7 +31,6 @@ libevolution_mail_la_CPPFLAGS =				\
 	$(GNOME_PLATFORM_CFLAGS)			\
 	$(CERT_UI_CFLAGS)				\
 	$(CANBERRA_CFLAGS)				\
-	$(GTKHTML_CFLAGS)				\
 	$(LIBSOUP_CFLAGS)
 
 mailinclude_HEADERS =					\
@@ -201,7 +200,6 @@ libevolution_mail_la_LIBADD =				\
 	$(GNOME_PLATFORM_LIBS)				\
 	$(CERT_UI_LIBS)					\
 	$(CANBERRA_LIBS)				\
-	$(GTKHTML_LIBS)					\
 	$(SMIME_LIBS)					\
 	$(LIBSOUP_LIBS)					\
 	-lresolv
diff --git a/mail/e-mail-reader-utils.c b/mail/e-mail-reader-utils.c
index 11ac330..1995fa8 100644
--- a/mail/e-mail-reader-utils.c
+++ b/mail/e-mail-reader-utils.c
@@ -29,7 +29,6 @@
 
 #include <glib/gi18n.h>
 #include <libxml/tree.h>
-#include <gtkhtml/gtkhtml.h>
 #include <camel/camel.h>
 
 #include "shell/e-shell-utils.h"
diff --git a/mail/em-composer-utils.c b/mail/em-composer-utils.c
index 9962101..36a7a68 100644
--- a/mail/em-composer-utils.c
+++ b/mail/em-composer-utils.c
@@ -464,10 +464,12 @@ composer_presend_check_unwanted_html (EMsgComposer *composer,
                                       EMailSession *session)
 {
 	EDestination **recipients;
+	EEditor *editor;
+	EEditorWidget *editor_widget;
 	EComposerHeaderTable *table;
 	GSettings *settings;
 	gboolean check_passed = TRUE;
-	gboolean html_mode;
+	EEditorWidgetMode html_mode;
 	gboolean send_html;
 	gboolean confirm_html;
 	gint ii;
@@ -476,7 +478,9 @@ composer_presend_check_unwanted_html (EMsgComposer *composer,
 
 	table = e_msg_composer_get_header_table (composer);
 	recipients = e_composer_header_table_get_destinations (table);
-	html_mode = gtkhtml_editor_get_html_mode (GTKHTML_EDITOR (composer));
+	editor = e_editor_window_get_editor (E_EDITOR_WINDOW (composer));
+	editor_widget = e_editor_get_editor_widget (editor);
+	html_mode = e_editor_widget_get_mode (editor_widget);
 
 	send_html = g_settings_get_boolean (settings, "composer-send-html");
 	confirm_html = g_settings_get_boolean (settings, "prompt-on-unwanted-html");
@@ -484,7 +488,8 @@ composer_presend_check_unwanted_html (EMsgComposer *composer,
 	/* Only show this warning if our default is to send html.  If it
 	 * isn't, we've manually switched into html mode in the composer
 	 * and (presumably) had a good reason for doing this. */
-	if (html_mode && send_html && confirm_html && recipients != NULL) {
+	if (html_mode == E_EDITOR_WIDGET_MODE_HTML && send_html &&
+	    confirm_html && recipients != NULL) {
 		gboolean html_problem = FALSE;
 
 		for (ii = 0; recipients[ii] != NULL; ii++) {
@@ -569,7 +574,12 @@ composer_send_completed (EMailSession *session,
 
 exit:
 	if (set_changed) {
-		gtkhtml_editor_set_changed (GTKHTML_EDITOR (context->composer), TRUE);
+		EEditor *editor;
+		EEditorWidget *editor_widget;
+
+		editor = e_editor_window_get_editor (E_EDITOR_WINDOW (context->composer));
+		editor_widget = e_editor_get_editor_widget (editor);
+		e_editor_widget_set_changed (editor_widget, TRUE);
 		gtk_window_present (GTK_WINDOW (context->composer));
 	}
 
@@ -602,14 +612,15 @@ em_utils_composer_send_cb (EMsgComposer *composer,
 static void
 composer_set_no_change (EMsgComposer *composer)
 {
-	GtkhtmlEditor *editor;
+	EEditor *editor;
+	EEditorWidget *editor_widget;
 
 	g_return_if_fail (composer != NULL);
 
-	editor = GTKHTML_EDITOR (composer);
+	editor = e_editor_window_get_editor (E_EDITOR_WINDOW (composer));
+	editor_widget = e_editor_get_editor_widget (editor);
 
-	gtkhtml_editor_drop_undo (editor);
-	gtkhtml_editor_set_changed (editor, FALSE);
+	e_editor_widget_set_changed (editor_widget, FALSE);
 }
 
 /* delete original messages from Outbox folder */
@@ -653,19 +664,23 @@ composer_save_to_drafts_complete (EMailSession *session,
                                   AsyncContext *context)
 {
 	GError *error = NULL;
+	EEditor *editor;
+	EEditorWidget *editor_widget;
+
+	editor = e_editor_window_get_editor (E_EDITOR_WINDOW (context->composer));
+	editor_widget = e_editor_get_editor_widget (editor);
 
 	/* We don't really care if this failed.  If something other than
 	 * cancellation happened, emit a runtime warning so the error is
 	 * not completely lost. */
-
 	e_mail_session_handle_draft_headers_finish (session, result, &error);
 
 	if (e_activity_handle_cancellation (context->activity, error)) {
-		gtkhtml_editor_set_changed (GTKHTML_EDITOR (context->composer), TRUE);
+		e_editor_widget_set_changed (editor_widget, TRUE);
 		g_error_free (error);
 
 	} else if (error != NULL) {
-		gtkhtml_editor_set_changed (GTKHTML_EDITOR (context->composer), TRUE);
+		e_editor_widget_set_changed (editor_widget, TRUE);
 		g_warning ("%s", error->message);
 		g_error_free (error);
 
@@ -690,19 +705,23 @@ composer_save_to_drafts_cleanup (CamelFolder *drafts_folder,
 {
 	CamelSession *session;
 	EAlertSink *alert_sink;
+	EEditor *editor;
+	EEditorWidget *editor_widget;
 	GCancellable *cancellable;
 	GError *error = NULL;
 
 	session = e_msg_composer_get_session (context->composer);
 	alert_sink = e_activity_get_alert_sink (context->activity);
 	cancellable = e_activity_get_cancellable (context->activity);
+	editor = e_editor_window_get_editor (E_EDITOR_WINDOW (context->composer));
+	editor_widget = e_editor_get_editor_widget (editor);
 
 	e_mail_folder_append_message_finish (
 		drafts_folder, result, &context->message_uid, &error);
 
 	if (e_activity_handle_cancellation (context->activity, error)) {
 		g_warn_if_fail (context->message_uid == NULL);
-		gtkhtml_editor_set_changed (GTKHTML_EDITOR (context->composer), TRUE);
+		e_editor_widget_set_changed (editor_widget, TRUE);
 		async_context_free (context);
 		g_error_free (error);
 		return;
@@ -713,7 +732,7 @@ composer_save_to_drafts_cleanup (CamelFolder *drafts_folder,
 			alert_sink,
 			"mail-composer:save-to-drafts-error",
 			error->message, NULL);
-		gtkhtml_editor_set_changed (GTKHTML_EDITOR (context->composer), TRUE);
+		e_editor_widget_set_changed (editor_widget, TRUE);
 		async_context_free (context);
 		g_error_free (error);
 		return;
@@ -771,13 +790,17 @@ composer_save_to_drafts_got_folder (EMailSession *session,
 {
 	CamelFolder *drafts_folder;
 	GError *error = NULL;
+	EEditor *editor;
+	EEditorWidget *editor_widget;
 
 	drafts_folder = e_mail_session_uri_to_folder_finish (
 		session, result, &error);
+	editor = e_editor_window_get_editor (E_EDITOR_WINDOW (context->composer));
+	editor_widget = e_editor_get_editor_widget (editor);
 
 	if (e_activity_handle_cancellation (context->activity, error)) {
 		g_warn_if_fail (drafts_folder == NULL);
-		gtkhtml_editor_set_changed (GTKHTML_EDITOR (context->composer), TRUE);
+		e_editor_widget_set_changed (editor_widget, TRUE);
 		async_context_free (context);
 		g_error_free (error);
 		return;
@@ -797,7 +820,7 @@ composer_save_to_drafts_got_folder (EMailSession *session,
 			GTK_WINDOW (context->composer),
 			"mail:ask-default-drafts", NULL);
 		if (response != GTK_RESPONSE_YES) {
-			gtkhtml_editor_set_changed (GTKHTML_EDITOR (context->composer), TRUE);
+			e_editor_widget_set_changed (editor_widget, TRUE);
 			async_context_free (context);
 			return;
 		}
@@ -1522,6 +1545,7 @@ emu_update_composers_security (EMsgComposer *composer,
                                guint32 validity_found)
 {
 	EShell *shell;
+	EEditor *editor;
 	EShellSettings *shell_settings;
 	GtkAction *action;
 	gboolean sign_by_default;
@@ -1530,6 +1554,7 @@ emu_update_composers_security (EMsgComposer *composer,
 
 	shell = e_msg_composer_get_shell (composer);
 	shell_settings = e_shell_get_shell_settings (shell);
+	editor = e_editor_window_get_editor (E_EDITOR_WINDOW (composer));
 
 	sign_by_default =
 		(validity_found & E_MAIL_PART_VALIDITY_SIGNED) != 0 &&
@@ -2843,14 +2868,15 @@ composer_set_body (EMsgComposer *composer,
 		break;
 	}
 
+	/* FIXME WEBKIT No signature yet...
 	if (has_body_text && start_bottom) {
 		GtkhtmlEditor *editor = GTKHTML_EDITOR (composer);
 		gboolean move_cursor_to_end;
 		gboolean top_signature;
 
-		/* If we are placing signature on top, then move cursor to the end,
-		 * otherwise try to find the signature place and place cursor just
-		 * before the signature. We added there an empty line already. */
+		// If we are placing signature on top, then move cursor to the end,
+		// otherwise try to find the signature place and place cursor just
+		// before the signature. We added there an empty line already.
 		gtkhtml_editor_run_command (editor, "block-selection");
 		gtkhtml_editor_run_command (editor, "cursor-bod");
 
@@ -2866,6 +2892,7 @@ composer_set_body (EMsgComposer *composer,
 			gtkhtml_editor_run_command (editor, "selection-move-left");
 		gtkhtml_editor_run_command (editor, "unblock-selection");
 	}
+	*/
 
 	g_object_unref (settings);
 }
diff --git a/mail/importers/Makefile.am b/mail/importers/Makefile.am
index 339bbe2..c0a23e4 100644
--- a/mail/importers/Makefile.am
+++ b/mail/importers/Makefile.am
@@ -8,8 +8,7 @@ libevolution_mail_importers_la_CPPFLAGS = \
 	-DG_LOG_DOMAIN=\"evolution-mail-importer\"	\
 	-DEVOLUTION_PRIVDATADIR=\""$(privdatadir)"\"	\
 	$(EVOLUTION_DATA_SERVER_CFLAGS)			\
-	$(GNOME_PLATFORM_CFLAGS)			\
-	$(GTKHTML_CFLAGS)
+	$(GNOME_PLATFORM_CFLAGS)
 
 libevolution_mail_importers_la_SOURCES =	\
 	mail-importer.c				\
@@ -27,7 +26,6 @@ libevolution_mail_importers_la_LIBADD =				\
 	$(top_builddir)/shell/libeshell.la			\
 	$(top_builddir)/libemail-engine/libemail-engine.la \
 	$(EVOLUTION_DATA_SERVER_LIBS)				\
-	$(GNOME_PLATFORM_LIBS)					\
-	$(GTKHTML_LIBS)
+	$(GNOME_PLATFORM_LIBS)
 
 -include $(top_srcdir)/git.mk
diff --git a/shell/Makefile.am b/shell/Makefile.am
index d1d3fdb..309b42d 100644
--- a/shell/Makefile.am
+++ b/shell/Makefile.am
@@ -57,7 +57,6 @@ libeshell_la_CPPFLAGS =						\
 	-DG_LOG_DOMAIN=\"evolution-shell\"			\
 	$(EVOLUTION_DATA_SERVER_CFLAGS)				\
 	$(GNOME_PLATFORM_CFLAGS)				\
-	$(GTKHTML_CFLAGS)					\
 	$(CLUTTER_GTK_CFLAGS)
 
 libeshell_la_SOURCES =				\
@@ -120,7 +119,6 @@ evolution_CPPFLAGS =						\
 	-DLIBDIR=\""$(datadir)"\"				\
 	$(EVOLUTION_DATA_SERVER_CFLAGS)				\
 	$(GNOME_PLATFORM_CFLAGS)				\
-	$(GTKHTML_CFLAGS)					\
 	$(CLUTTER_GTK_CFLAGS)
 
 evolution_SOURCES =				\



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