[evolution/webkit-composer: 67/210] Port modules to EEditor.



commit ab3b963ca52c2e74cdf8bfe0603dff6b64e1af1a
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                |   36 ++-
 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  |  303 -----------------------
 modules/settings/e-settings-web-view-gtkhtml.h  |   65 -----
 modules/settings/evolution-module-settings.c    |    2 -
 10 files changed, 46 insertions(+), 398 deletions(-)
---
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/e-mail-shell-backend.c b/modules/mail/e-mail-shell-backend.c
index 8535e83..d12f67f 100644
--- a/modules/mail/e-mail-shell-backend.c
+++ b/modules/mail/e-mail-shell-backend.c
@@ -367,14 +367,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");
@@ -384,7 +389,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 9986feb..429c7cf 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 57de8ab..74fe03b 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>
@@ -103,10 +100,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);
@@ -163,7 +158,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 (
@@ -191,19 +186,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);
@@ -215,7 +212,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 *
@@ -259,7 +256,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
@@ -300,6 +307,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 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 5652487..aefe562 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/settings/Makefile.am b/modules/settings/Makefile.am
index d7c00b7..c894adf 100644
--- a/modules/settings/Makefile.am
+++ b/modules/settings/Makefile.am
@@ -47,8 +47,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 f1c31ab..7c6139e 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 */
@@ -60,7 +59,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]