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



commit 3b17d1b69ab02dd11c720faf7f75acc02f32eb83
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                |   38 ++++++++++++++--------
 modules/mail/em-composer-prefs.h                |    9 +++--
 modules/mail/em-mailer-prefs.c                  |    1 -
 modules/mailto-handler/Makefile.am              |    6 +--
 modules/mdn/Makefile.am                         |    6 +--
 11 files changed, 58 insertions(+), 46 deletions(-)
---
diff --git a/modules/backup-restore/Makefile.am b/modules/backup-restore/Makefile.am
index 06312e5..311f47c 100644
--- a/modules/backup-restore/Makefile.am
+++ b/modules/backup-restore/Makefile.am
@@ -14,7 +14,6 @@ module_backup_restore_la_CPPFLAGS = \
 	-DLIBDIR=\""$(libdir)"\"				\
 	$(EVOLUTION_DATA_SERVER_CFLAGS)				\
 	$(GNOME_PLATFORM_CFLAGS)				\
-	$(GTKHTML_CFLAGS)					\
 	$(NULL)
 
 module_backup_restore_la_SOURCES = \
@@ -32,7 +31,6 @@ module_backup_restore_la_LIBADD = \
 	$(top_builddir)/libemail-engine/libemail-engine.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 1a3b166..7246f4c 100644
--- a/modules/composer-autosave/Makefile.am
+++ b/modules/composer-autosave/Makefile.am
@@ -5,8 +5,7 @@ module_composer_autosave_la_CPPFLAGS = \
 	-I$(top_srcdir)						\
 	-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				\
@@ -20,8 +19,7 @@ module_composer_autosave_la_LIBADD = \
 	$(top_builddir)/composer/libcomposer.la			\
 	$(top_builddir)/e-util/libeutil.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 cf0dd3b..033de5b 100644
--- a/modules/composer-autosave/e-composer-autosave.c
+++ b/modules/composer-autosave/e-composer-autosave.c
@@ -140,13 +140,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 0e78ab7..ade1b53 100644
--- a/modules/mail/Makefile.am
+++ b/modules/mail/Makefile.am
@@ -8,8 +8,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						\
@@ -61,8 +60,7 @@ module_mail_la_LIBADD = \
 	$(top_builddir)/em-format/libemformat.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 1abcb8a..2f7cee6 100644
--- a/modules/mail/e-mail-shell-backend.c
+++ b/modules/mail/e-mail-shell-backend.c
@@ -368,14 +368,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);
@@ -385,7 +392,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 bd9db02..76b1e91 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 <libemail-engine/e-mail-folder-utils.h>
diff --git a/modules/mail/em-composer-prefs.c b/modules/mail/em-composer-prefs.c
index 58066e0..554f20c 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 <composer/e-msg-composer.h>
 
 #include <shell/e-shell-utils.h>
@@ -128,10 +125,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);
@@ -188,7 +183,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 (
@@ -216,19 +211,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);
@@ -240,7 +237,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 *
@@ -284,7 +281,17 @@ static EMConfigItem emcp_items[] = {
 	{ E_CONFIG_PAGE,
 	  (gchar *) "20.spellcheck",
 	  (gchar *) "vboxSpellChecking",
-	  emcp_widget_glade }
+	  emcp_widget_glade },
+
+	{ E_CONFIG_SECTION_TABLE,
+	  (gchar *) "20.spellcheck/00.languages",
+	  (gchar *) "languages-table",
+	  emcp_widget_glade },
+
+	{ E_CONFIG_SECTION,
+	  (gchar *) "20.spellcheck/00.options",
+	  (gchar *) "spell-options-vbox",
+	  emcp_widget_glade },
 };
 
 static void
@@ -324,6 +331,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
 	 * @Class: org.gnome.evolution.mail.config:1.0
diff --git a/modules/mail/em-composer-prefs.h b/modules/mail/em-composer-prefs.h
index 211f414..f96ad0a 100644
--- a/modules/mail/em-composer-prefs.h
+++ b/modules/mail/em-composer-prefs.h
@@ -24,7 +24,6 @@
 #define EM_COMPOSER_PREFS_H
 
 #include <gtk/gtk.h>
-#include <gtkhtml/gtkhtml.h>
 
 #include <shell/e-shell.h>
 
@@ -55,7 +54,7 @@ typedef struct _EMComposerPrefsClass EMComposerPrefsClass;
 struct _ESignature;
 
 struct _EMComposerPrefs {
-	GtkBox parent;
+	GtkVBox parent;
 
 	GtkBuilder *builder;
 
@@ -68,11 +67,13 @@ struct _EMComposerPrefs {
 	GtkComboBox *reply_style;
 
 	/* Signatures */
-	GtkHTML *sig_preview;
+	EWebViewPreview *sig_preview;
+
+	ESpellChecker *spell_checker;
 };
 
 struct _EMComposerPrefsClass {
-	GtkBoxClass parent_class;
+	GtkVBoxClass parent_class;
 };
 
 GType		em_composer_prefs_get_type	(void);
diff --git a/modules/mail/em-mailer-prefs.c b/modules/mail/em-mailer-prefs.c
index 83a23ef..ccd42f4 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 <shell/e-shell-utils.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 f185bcb..d1352f5 100644
--- a/modules/mdn/Makefile.am
+++ b/modules/mdn/Makefile.am
@@ -5,8 +5,7 @@ module_mdn_la_CPPFLAGS = \
 	-I$(top_srcdir)						\
 	-DG_LOG_DOMAIN=\"evolution-mdn\"			\
 	$(EVOLUTION_DATA_SERVER_CFLAGS)				\
-	$(GNOME_PLATFORM_CFLAGS)				\
-	$(GTKHTML_CFLAGS)
+	$(GNOME_PLATFORM_CFLAGS)
 
 module_mdn_la_SOURCES = \
 	evolution-mdn.c
@@ -17,8 +16,7 @@ module_mdn_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_mdn_la_LDFLAGS = \
 	-module -avoid-version $(NO_UNDEFINED)



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