[evolution/webkit-composer: 26/30] Port modules to EEditor and drop Gtkhtml dependency



commit 62815b93aa68d88f67dd108494c887453eaad06c
Author: Dan VrÃtil <dvratil redhat com>
Date:   Tue Aug 28 17:56:25 2012 +0200

    Port modules to EEditor and drop Gtkhtml dependency

 modules/backup-restore/Makefile.am              |    2 -
 modules/composer-autosave/Makefile.am           |    6 +---
 modules/composer-autosave/e-composer-autosave.c |    8 ++++--
 modules/mail/Makefile.am                        |    6 +---
 modules/mail/e-mail-shell-backend.c             |   21 ++++++++++++++----
 modules/mail/e-mail-shell-view-private.h        |    1 -
 modules/mail/em-composer-prefs.c                |   26 +++++++++++-----------
 modules/mail/em-composer-prefs.h                |    7 ++++-
 modules/mail/em-mailer-prefs.c                  |    1 -
 modules/mailto-handler/Makefile.am              |    6 +---
 modules/mdn/Makefile.am                         |    6 +---
 11 files changed, 47 insertions(+), 43 deletions(-)
---
diff --git a/modules/backup-restore/Makefile.am b/modules/backup-restore/Makefile.am
index 4d23edf..824cb89 100644
--- a/modules/backup-restore/Makefile.am
+++ b/modules/backup-restore/Makefile.am
@@ -15,7 +15,6 @@ module_backup_restore_la_CPPFLAGS = \
 	-DLIBDIR=\""$(libdir)"\"				\
 	$(EVOLUTION_DATA_SERVER_CFLAGS)				\
 	$(GNOME_PLATFORM_CFLAGS)				\
-	$(GTKHTML_CFLAGS)					\
 	$(NULL)
 
 module_backup_restore_la_SOURCES = \
@@ -35,7 +34,6 @@ module_backup_restore_la_LIBADD = \
 	$(top_builddir)/libevolution-utils/libevolution-utils.la \
 	$(EVOLUTION_DATA_SERVER_LIBS)				\
 	$(GNOME_PLATFORM_LIBS)					\
-	$(GTKHTML_LIBS)						\
 	$(NULL)
 
 module_backup_restore_la_LDFLAGS = \
diff --git a/modules/composer-autosave/Makefile.am b/modules/composer-autosave/Makefile.am
index 3f62e4c..76b92a6 100644
--- a/modules/composer-autosave/Makefile.am
+++ b/modules/composer-autosave/Makefile.am
@@ -6,8 +6,7 @@ module_composer_autosave_la_CPPFLAGS = \
 	-I$(top_srcdir)/widgets					\
 	-DG_LOG_DOMAIN=\"evolution-composer-autosave\"		\
 	$(EVOLUTION_DATA_SERVER_CFLAGS)				\
-	$(GNOME_PLATFORM_CFLAGS)				\
-	$(GTKHTML_CFLAGS)
+	$(GNOME_PLATFORM_CFLAGS)
 
 module_composer_autosave_la_SOURCES = \
 	evolution-composer-autosave.c				\
@@ -23,8 +22,7 @@ module_composer_autosave_la_LIBADD = \
 	$(top_builddir)/e-util/libeutil.la			\
 	$(top_builddir)/libevolution-utils/libevolution-utils.la \
 	$(EVOLUTION_DATA_SERVER_LIBS)				\
-	$(GNOME_PLATFORM_LIBS)					\
-	$(GTKHTML_LIBS)
+	$(GNOME_PLATFORM_LIBS)
 
 module_composer_autosave_la_LDFLAGS = \
 	-module -avoid-version $(NO_UNDEFINED)
diff --git a/modules/composer-autosave/e-composer-autosave.c b/modules/composer-autosave/e-composer-autosave.c
index e24b164..b331b25 100644
--- a/modules/composer-autosave/e-composer-autosave.c
+++ b/modules/composer-autosave/e-composer-autosave.c
@@ -141,13 +141,15 @@ composer_autosave_timeout_cb (EComposerAutosave *autosave)
 static void
 composer_autosave_changed_cb (EComposerAutosave *autosave)
 {
-	GtkhtmlEditor *editor;
+	EEditor *editor;
+	EEditorWidget *editor_widget;
 	EExtensible *extensible;
 
 	extensible = e_extension_get_extensible (E_EXTENSION (autosave));
 
-	editor = GTKHTML_EDITOR (extensible);
-	autosave->changed = gtkhtml_editor_get_changed (editor);
+	editor = e_editor_window_get_editor (E_EDITOR_WINDOW (extensible));
+	editor_widget = e_editor_get_editor_widget (editor);
+	autosave->changed = e_editor_widget_get_changed (editor_widget);
 
 	if (autosave->changed && autosave->timeout_id == 0)
 		autosave->timeout_id = g_timeout_add_seconds (
diff --git a/modules/mail/Makefile.am b/modules/mail/Makefile.am
index 74391b2..d7df670 100644
--- a/modules/mail/Makefile.am
+++ b/modules/mail/Makefile.am
@@ -9,8 +9,7 @@ module_mail_la_CPPFLAGS = \
 	-DEVOLUTION_PRIVDATADIR=\""$(privdatadir)"\"			\
 	-DG_LOG_DOMAIN=\"evolution-module-mail\"			\
 	$(EVOLUTION_DATA_SERVER_CFLAGS)					\
-	$(GNOME_PLATFORM_CFLAGS)					\
-	$(GTKHTML_CFLAGS)
+	$(GNOME_PLATFORM_CFLAGS)
 
 module_mail_la_SOURCES = \
 	evolution-module-mail.c						\
@@ -69,8 +68,7 @@ module_mail_la_LIBADD = \
 	$(top_builddir)/libevolution-utils/libevolution-utils.la	\
 	$(libevolution_mail_settings_la)				\
 	$(EVOLUTION_DATA_SERVER_LIBS)					\
-	$(GNOME_PLATFORM_LIBS)						\
-	$(GTKHTML_LIBS)
+	$(GNOME_PLATFORM_LIBS)
 
 module_mail_la_LDFLAGS = \
 	-avoid-version -module $(NO_UNDEFINED)
diff --git a/modules/mail/e-mail-shell-backend.c b/modules/mail/e-mail-shell-backend.c
index 7db1b13..54013ec 100644
--- a/modules/mail/e-mail-shell-backend.c
+++ b/modules/mail/e-mail-shell-backend.c
@@ -374,14 +374,21 @@ mail_shell_backend_window_added_cb (GtkApplication *application,
 	session = e_mail_backend_get_session (backend);
 
 	/* This applies to both the composer and signature editor. */
-	if (GTKHTML_IS_EDITOR (window)) {
+	if (E_IS_EDITOR_WINDOW (window)) {
 		EShellSettings *shell_settings;
+		EEditor *editor;
+		EEditorWidget *editor_widget;
 		GList *spell_languages;
 		gboolean active = TRUE;
 
-		spell_languages = e_load_spell_languages ();
-		gtkhtml_editor_set_spell_languages (
-			GTKHTML_EDITOR (window), spell_languages);
+		editor = e_editor_window_get_editor (E_EDITOR_WINDOW (window));
+		editor_widget = e_editor_get_editor_widget (editor);
+
+		spell_languages = e_load_spell_languages (
+					e_editor_widget_get_spell_checker (
+						editor_widget));
+
+		e_editor_widget_set_spell_languages (editor_widget, spell_languages);
 		g_list_free (spell_languages);
 
 		shell_settings = e_shell_get_shell_settings (shell);
@@ -391,7 +398,11 @@ mail_shell_backend_window_added_cb (GtkApplication *application,
 			active = e_shell_settings_get_boolean (
 				shell_settings, "composer-format-html");
 
-		gtkhtml_editor_set_html_mode (GTKHTML_EDITOR (window), active);
+		e_editor_widget_set_mode (
+			editor_widget,
+			active ?
+				E_EDITOR_WIDGET_MODE_HTML :
+				E_EDITOR_WIDGET_MODE_PLAIN_TEXT);
 	}
 
 	if (E_IS_MSG_COMPOSER (window)) {
diff --git a/modules/mail/e-mail-shell-view-private.h b/modules/mail/e-mail-shell-view-private.h
index 0e9feb2..e58de20 100644
--- a/modules/mail/e-mail-shell-view-private.h
+++ b/modules/mail/e-mail-shell-view-private.h
@@ -25,7 +25,6 @@
 #include "e-mail-shell-view.h"
 
 #include <glib/gi18n.h>
-#include <gtkhtml/gtkhtml.h>
 #include <camel/camel-search-private.h>  /* for camel_search_word */
 
 #include <e-util/e-util.h>
diff --git a/modules/mail/em-composer-prefs.c b/modules/mail/em-composer-prefs.c
index 3a092ef..c506dd2 100644
--- a/modules/mail/em-composer-prefs.c
+++ b/modules/mail/em-composer-prefs.c
@@ -35,9 +35,6 @@
 #include <glib/gi18n.h>
 #include <glib/gstdio.h>
 
-#include <gtkhtml/gtkhtml.h>
-#include <editor/gtkhtml-spell-language.h>
-
 #include <e-util/e-util.h>
 #include <e-util/e-util-private.h>
 
@@ -134,10 +131,8 @@ composer_prefs_dispose (GObject *object)
 {
 	EMComposerPrefs *prefs = (EMComposerPrefs *) object;
 
-	if (prefs->builder != NULL) {
-		g_object_unref (prefs->builder);
-		prefs->builder = NULL;
-	}
+	g_clear_object (&prefs->builder);
+	g_clear_object (&prefs->spell_checker);
 
 	/* Chain up to parent's dispose() method. */
 	G_OBJECT_CLASS (em_composer_prefs_parent_class)->dispose (object);
@@ -194,7 +189,7 @@ spell_language_save (EMComposerPrefs *prefs)
 	/* Build a list of active spell languages. */
 	valid = gtk_tree_model_get_iter_first (model, &iter);
 	while (valid) {
-		const GtkhtmlSpellLanguage *language;
+		ESpellDictionary *language;
 		gboolean active;
 
 		gtk_tree_model_get (
@@ -222,19 +217,21 @@ spell_setup (EMComposerPrefs *prefs)
 	GtkListStore *store;
 
 	store = GTK_LIST_STORE (prefs->language_model);
-	available_languages = gtkhtml_spell_language_get_available ();
 
-	active_languages = e_load_spell_languages ();
+	available_languages = e_spell_checker_list_available_dicts (
+						prefs->spell_checker);
+
+	active_languages = e_load_spell_languages (prefs->spell_checker);
 
 	/* Populate the GtkListStore. */
 	while (available_languages != NULL) {
-		const GtkhtmlSpellLanguage *language;
+		ESpellDictionary *language;
 		GtkTreeIter tree_iter;
 		const gchar *name;
 		gboolean active;
 
 		language = available_languages->data;
-		name = gtkhtml_spell_language_get_name (language);
+		name = e_spell_dictionary_get_name (language);
 		active = (g_list_find (active_languages, language) != NULL);
 
 		gtk_list_store_append (store, &tree_iter);
@@ -246,7 +243,7 @@ spell_setup (EMComposerPrefs *prefs)
 		available_languages = available_languages->next;
 	}
 
-	g_list_free (active_languages);
+	g_list_free_full (active_languages, g_object_unref);
 }
 
 static GtkWidget *
@@ -340,6 +337,9 @@ em_composer_prefs_construct (EMComposerPrefs *prefs,
 	prefs->builder = gtk_builder_new ();
 	e_load_ui_builder_definition (prefs->builder, "mail-config.ui");
 
+
+	prefs->spell_checker = e_spell_checker_new ();
+
 	/** @HookPoint-EMConfig: Mail Composer Preferences
 	 * @Id: org.gnome.evolution.mail.composerPrefs
 	 * @Type: E_CONFIG_BOOK
diff --git a/modules/mail/em-composer-prefs.h b/modules/mail/em-composer-prefs.h
index 79a53bb..4246d1a 100644
--- a/modules/mail/em-composer-prefs.h
+++ b/modules/mail/em-composer-prefs.h
@@ -24,10 +24,11 @@
 #define EM_COMPOSER_PREFS_H
 
 #include <gtk/gtk.h>
-#include <gtkhtml/gtkhtml.h>
 
 #include <shell/e-shell.h>
+#include <widgets/misc/e-web-view-preview.h>
 #include <widgets/misc/e-preferences-window.h>
+#include <e-util/e-spell-checker.h>
 
 /* Standard GObject macros */
 #define EM_TYPE_COMPOSER_PREFS \
@@ -69,7 +70,9 @@ struct _EMComposerPrefs {
 	GtkComboBox *reply_style;
 
 	/* Signatures */
-	GtkHTML *sig_preview;
+	EWebViewPreview *sig_preview;
+
+	ESpellChecker *spell_checker;
 };
 
 struct _EMComposerPrefsClass {
diff --git a/modules/mail/em-mailer-prefs.c b/modules/mail/em-mailer-prefs.c
index 4720470..2a7df20 100644
--- a/modules/mail/em-mailer-prefs.c
+++ b/modules/mail/em-mailer-prefs.c
@@ -29,7 +29,6 @@
 
 #include "em-mailer-prefs.h"
 
-#include <gtkhtml/gtkhtml-properties.h>
 #include <libxml/tree.h>
 
 #include <e-util/e-util.h>
diff --git a/modules/mailto-handler/Makefile.am b/modules/mailto-handler/Makefile.am
index e33a120..275590e 100644
--- a/modules/mailto-handler/Makefile.am
+++ b/modules/mailto-handler/Makefile.am
@@ -5,8 +5,7 @@ module_mailto_handler_la_CPPFLAGS = \
 	-I$(top_srcdir)						\
 	-DG_LOG_DOMAIN=\"evolution-mailto-handler\"		\
 	$(EVOLUTION_DATA_SERVER_CFLAGS)				\
-	$(GNOME_PLATFORM_CFLAGS)				\
-	$(GTKHTML_CFLAGS)
+	$(GNOME_PLATFORM_CFLAGS)
 
 module_mailto_handler_la_SOURCES = \
 	evolution-mailto-handler.c
@@ -15,8 +14,7 @@ module_mailto_handler_la_LIBADD = \
 	$(top_builddir)/e-util/libeutil.la			\
 	$(top_builddir)/shell/libeshell.la			\
 	$(EVOLUTION_DATA_SERVER_LIBS)				\
-	$(GNOME_PLATFORM_LIBS)					\
-	$(GTKHTML_LIBS)
+	$(GNOME_PLATFORM_LIBS)
 
 module_mailto_handler_la_LDFLAGS = \
 	-module -avoid-version $(NO_UNDEFINED)
diff --git a/modules/mdn/Makefile.am b/modules/mdn/Makefile.am
index bd6cbb9..8c6eef5 100644
--- a/modules/mdn/Makefile.am
+++ b/modules/mdn/Makefile.am
@@ -6,8 +6,7 @@ module_mdn_la_CPPFLAGS = \
 	-I$(top_srcdir)/widgets					\
 	-DG_LOG_DOMAIN=\"evolution-mdn\"			\
 	$(EVOLUTION_DATA_SERVER_CFLAGS)				\
-	$(GNOME_PLATFORM_CFLAGS)				\
-	$(GTKHTML_CFLAGS)
+	$(GNOME_PLATFORM_CFLAGS)
 
 module_mdn_la_SOURCES = \
 	evolution-mdn.c
@@ -19,8 +18,7 @@ module_mdn_la_LIBADD = \
 	$(top_builddir)/shell/libeshell.la			\
 	$(top_builddir)/libevolution-utils/libevolution-utils.la \
 	$(EVOLUTION_DATA_SERVER_LIBS)				\
-	$(GNOME_PLATFORM_LIBS)					\
-	$(GTKHTML_LIBS)
+	$(GNOME_PLATFORM_LIBS)
 
 module_mdn_la_LDFLAGS = \
 	-module -avoid-version $(NO_UNDEFINED)



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