[evolution/wip/webkit-composer: 133/372] Port modules to EEditor.



commit 98c8a092520c7afdb0338f463a3b1ef01cc52870
Author: Dan Vrátil <dvratil redhat com>
Date:   Tue Aug 28 17:56:25 2012 +0200

    Port modules to EEditor.

 modules/composer-autosave/e-composer-autosave.c |    8 +-
 modules/mail/e-mail-shell-backend.c             |   17 +-
 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/settings/Makefile.am                    |    2 -
 modules/settings/e-settings-web-view-gtkhtml.c  |  302 -----------------------
 modules/settings/e-settings-web-view-gtkhtml.h  |   64 -----
 modules/settings/evolution-module-settings.c    |    2 -
 10 files changed, 44 insertions(+), 400 deletions(-)
---
diff --git a/modules/composer-autosave/e-composer-autosave.c b/modules/composer-autosave/e-composer-autosave.c
index f2aed78..ce39a4f 100644
--- a/modules/composer-autosave/e-composer-autosave.c
+++ b/modules/composer-autosave/e-composer-autosave.c
@@ -125,13 +125,15 @@ composer_autosave_timeout_cb (gpointer user_data)
 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->priv->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->priv->changed && autosave->priv->timeout_id == 0) {
                autosave->priv->timeout_id = e_named_timeout_add_seconds (
diff --git a/modules/mail/e-mail-shell-backend.c b/modules/mail/e-mail-shell-backend.c
index b8afd2c..cad96dc 100644
--- a/modules/mail/e-mail-shell-backend.c
+++ b/modules/mail/e-mail-shell-backend.c
@@ -447,14 +447,19 @@ 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)) {
+               EEditor *editor;
+               EEditorWidget *editor_widget;
                GSettings *settings;
                GList *spell_languages;
                gboolean active = TRUE;
 
+               editor = e_editor_window_get_editor (E_EDITOR_WINDOW (window));
+               editor_widget = e_editor_get_editor_widget (editor);
+
                spell_languages = e_load_spell_languages ();
-               gtkhtml_editor_set_spell_languages (
-                       GTKHTML_EDITOR (window), spell_languages);
+
+               e_editor_widget_set_spell_languages (editor_widget, spell_languages);
                g_list_free (spell_languages);
 
                settings = g_settings_new ("org.gnome.evolution.mail");
@@ -464,7 +469,11 @@ mail_shell_backend_window_added_cb (GtkApplication *application,
 
                g_object_unref (settings);
 
-               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 c2c6614..8beff1e 100644
--- a/modules/mail/e-mail-shell-view-private.h
+++ b/modules/mail/e-mail-shell-view-private.h
@@ -24,7 +24,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 <mail/e-mail-label-action.h>
diff --git a/modules/mail/em-composer-prefs.c b/modules/mail/em-composer-prefs.c
index 090dc2e..8aacff2 100644
--- a/modules/mail/em-composer-prefs.c
+++ b/modules/mail/em-composer-prefs.c
@@ -34,10 +34,6 @@
 #include <glib/gi18n.h>
 #include <glib/gstdio.h>
 
-#include <gtkhtml/gtkhtml.h>
-#include <editor/gtkhtml-spell-language.h>
-#include <libedataserver/libedataserver.h>
-
 #include <composer/e-msg-composer.h>
 
 #include <shell/e-shell-utils.h>
@@ -108,10 +104,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);
@@ -168,7 +162,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 (
@@ -196,19 +190,21 @@ spell_setup (EMComposerPrefs *prefs)
        GtkListStore *store;
 
        store = GTK_LIST_STORE (prefs->language_model);
-       available_languages = gtkhtml_spell_language_get_available ();
+
+       available_languages =
+               e_spell_checker_list_available_dicts (prefs->spell_checker);
 
        active_languages = e_load_spell_languages ();
 
        /* 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);
@@ -220,7 +216,7 @@ spell_setup (EMComposerPrefs *prefs)
                available_languages = available_languages->next;
        }
 
-       g_list_free (active_languages);
+       g_list_free_full (active_languages, g_object_unref);
 }
 
 #define MAIL_SEND_ACCOUNT_OVERRIDE_KEY "sao-mail-send-account-override"
@@ -1002,10 +998,15 @@ static EMConfigItem emcp_items[] = {
          (gchar *) "vboxSpellChecking",
          emcp_widget_glade },
 
-       { E_CONFIG_PAGE,
-         (gchar *) "90.accountoverride",
-         (gchar *) "send-account-override-grid",
-         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
@@ -1048,6 +1049,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 = g_object_new (E_TYPE_SPELL_CHECKER, NULL);
+
        /** @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 cb986f5..b10c8b8 100644
--- a/modules/mail/em-composer-prefs.h
+++ b/modules/mail/em-composer-prefs.h
@@ -23,7 +23,6 @@
 #define EM_COMPOSER_PREFS_H
 
 #include <gtk/gtk.h>
-#include <gtkhtml/gtkhtml.h>
 
 #include <shell/e-shell.h>
 
@@ -54,7 +53,7 @@ typedef struct _EMComposerPrefsClass EMComposerPrefsClass;
 struct _ESignature;
 
 struct _EMComposerPrefs {
-       GtkBox parent;
+       GtkVBox parent;
 
        GtkBuilder *builder;
 
@@ -67,11 +66,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 2a150a7..456a00b 100644
--- a/modules/mail/em-mailer-prefs.c
+++ b/modules/mail/em-mailer-prefs.c
@@ -28,7 +28,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/settings/Makefile.am b/modules/settings/Makefile.am
index faf0fdf..81ed4eb 100644
--- a/modules/settings/Makefile.am
+++ b/modules/settings/Makefile.am
@@ -49,8 +49,6 @@ module_settings_la_SOURCES = \
        e-settings-spell-entry.h \
        e-settings-web-view.c \
        e-settings-web-view.h \
-       e-settings-web-view-gtkhtml.c \
-       e-settings-web-view-gtkhtml.h \
        e-settings-weekday-chooser.c \
        e-settings-weekday-chooser.h \
        $(NULL)
diff --git a/modules/settings/evolution-module-settings.c b/modules/settings/evolution-module-settings.c
index af08158..e8166bc 100644
--- a/modules/settings/evolution-module-settings.c
+++ b/modules/settings/evolution-module-settings.c
@@ -33,7 +33,6 @@
 #include "e-settings-name-selector-entry.h"
 #include "e-settings-spell-entry.h"
 #include "e-settings-web-view.h"
-#include "e-settings-web-view-gtkhtml.h"
 #include "e-settings-weekday-chooser.h"
 
 /* Module Entry Points */
@@ -61,7 +60,6 @@ e_module_load (GTypeModule *type_module)
        e_settings_name_selector_entry_type_register (type_module);
        e_settings_spell_entry_type_register (type_module);
        e_settings_web_view_type_register (type_module);
-       e_settings_web_view_gtkhtml_type_register (type_module);
        e_settings_weekday_chooser_type_register (type_module);
 }
 


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