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



commit 336b9f7bbe1dc6bfd220b95e0766337bc715048e
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/shell/Makefile.am |    6 +--
 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, 49 insertions(+), 31 deletions(-)
---
diff --git a/doc/reference/shell/Makefile.am b/doc/reference/shell/Makefile.am
index 2e26691..6f51734 100644
--- a/doc/reference/shell/Makefile.am
+++ b/doc/reference/shell/Makefile.am
@@ -51,8 +51,7 @@ expand_content_files=
 GTKDOC_CFLAGS= \
 	-I$(top_builddir)						\
 	-I$(top_srcdir)							\
-	$(EVOLUTION_DATA_SERVER_CFLAGS)					\
-	$(GTKHTML_CFLAGS)
+	$(EVOLUTION_DATA_SERVER_CFLAGS)
 GTKDOC_LIBS=								\
 	$(top_builddir)/libemail-utils/libemail-utils.la		\
 	$(top_builddir)/libemail-engine/libemail-engine.la		\
@@ -63,8 +62,7 @@ GTKDOC_LIBS=								\
 	$(top_builddir)/smclient/libeggdesktopfile.la			\
 	$(top_builddir)/widgets/menus/libmenus.la			\
 	$(top_builddir)/widgets/misc/libemiscwidgets.la			\
-	$(EVOLUTION_DATA_SERVER_LIBS)					\
-	$(GTKHTML_LIBS)
+	$(EVOLUTION_DATA_SERVER_LIBS)
 
 # This includes the standard gtk-doc make rules, copied by gtkdocize.
 include $(top_srcdir)/gtk-doc.make
diff --git a/mail/Makefile.am b/mail/Makefile.am
index 1995e64..d87b7ce 100644
--- a/mail/Makefile.am
+++ b/mail/Makefile.am
@@ -22,7 +22,6 @@ libevolution_mail_la_CPPFLAGS =				\
 	$(CERT_UI_CFLAGS)				\
 	$(CANBERRA_CFLAGS)				\
 	$(CLUTTER_CFLAGS)				\
-	$(GTKHTML_CFLAGS)                               \
 	$(LIBSOUP_CFLAGS)				\
 	-DEVOLUTION_DATADIR=\""$(datadir)"\"		\
 	-DEVOLUTION_PRIVDATADIR=\""$(privdatadir)"\"	\
@@ -213,7 +212,6 @@ libevolution_mail_la_LIBADD =				\
 	$(CERT_UI_LIBS)					\
 	$(CANBERRA_LIBS)				\
 	$(CLUTTER_LIBS)					\
-	$(GTKHTML_LIBS)					\
 	$(E_WIDGETS_LIBS)				\
 	$(SMIME_LIBS)					\
 	$(LIBSOUP_LIBS)					\
diff --git a/mail/e-mail-reader-utils.c b/mail/e-mail-reader-utils.c
index 6f0a982..e6e4984 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 "libevolution-utils/e-alert-dialog.h"
diff --git a/mail/em-composer-utils.c b/mail/em-composer-utils.c
index 28b1962..f5bcd0b 100644
--- a/mail/em-composer-utils.c
+++ b/mail/em-composer-utils.c
@@ -467,10 +467,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;
@@ -479,7 +481,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");
@@ -487,7 +491,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++) {
@@ -572,7 +577,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));
 	}
 
@@ -605,14 +615,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 */
@@ -656,19 +667,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);
 
@@ -693,19 +708,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;
@@ -716,7 +735,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;
@@ -774,13 +793,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;
@@ -800,7 +823,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;
 		}
@@ -1526,6 +1549,7 @@ emu_update_composers_security (EMsgComposer *composer,
                                guint32 validity_found)
 {
 	EShell *shell;
+	EEditor *editor;
 	EShellSettings *shell_settings;
 	GtkAction *action;
 	gboolean sign_by_default;
@@ -1534,6 +1558,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 &&
@@ -2805,14 +2830,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");
 
@@ -2828,6 +2854,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 6d40087..155776b 100644
--- a/mail/importers/Makefile.am
+++ b/mail/importers/Makefile.am
@@ -9,8 +9,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				\
@@ -31,7 +30,6 @@ libevolution_mail_importers_la_LIBADD =				\
 	$(top_builddir)/libemail-engine/libemail-engine.la \
 	$(top_builddir)/libemail-utils/libemail-utils.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 7f4cf87..0d413e7 100644
--- a/shell/Makefile.am
+++ b/shell/Makefile.am
@@ -65,7 +65,6 @@ libeshell_la_CPPFLAGS =						\
 	$(EVOLUTION_DATA_SERVER_CFLAGS)				\
 	$(GNOME_PLATFORM_CFLAGS)				\
 	$(EGG_SMCLIENT_CFLAGS)					\
-	$(GTKHTML_CFLAGS)					\
 	$(CLUTTER_CFLAGS)
 
 libeshell_la_SOURCES =				\
@@ -138,7 +137,6 @@ evolution_CPPFLAGS =						\
 	-DLIBDIR=\""$(datadir)"\"				\
 	$(EVOLUTION_DATA_SERVER_CFLAGS)				\
 	$(GNOME_PLATFORM_CFLAGS)				\
-	$(GTKHTML_CFLAGS)					\
 	$(DBUS_GLIB_CFLAGS)					\
 	$(CLUTTER_CFLAGS)
 



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