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



commit 1bef172bac40e03202300fdba49c250e29666f4d
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/libeshell/Makefile.am |  2 --
 mail/Makefile.am                    |  2 --
 mail/e-mail-reader-utils.c          |  1 -
 mail/em-composer-utils.c            | 64 ++++++++++++++++++++++++++-----------
 mail/importers/Makefile.am          |  6 ++--
 shell/Makefile.am                   |  2 --
 6 files changed, 48 insertions(+), 29 deletions(-)
---
diff --git a/doc/reference/libeshell/Makefile.am b/doc/reference/libeshell/Makefile.am
index c9afa90..ec786ee 100644
--- a/doc/reference/libeshell/Makefile.am
+++ b/doc/reference/libeshell/Makefile.am
@@ -23,7 +23,6 @@ GTKDOC_CFLAGS= \
        -I$(top_builddir)                                               \
        $(EVOLUTION_DATA_SERVER_CFLAGS)                                 \
        $(GNOME_PLATFORM_CFLAGS)                                        \
-       $(GTKHTML_CFLAGS)                                               \
        $(NULL)
 
 GTKDOC_LIBS=                                                           \
@@ -32,7 +31,6 @@ GTKDOC_LIBS=                                                          \
        $(top_builddir)/e-util/libeutil.la                              \
        $(EVOLUTION_DATA_SERVER_LIBS)                                   \
        $(GNOME_PLATFORM_LIBS)                                          \
-       $(GTKHTML_LIBS)                                                 \
        $(NULL)
 
 # This includes the standard gtk-doc make rules, copied by gtkdocize.
diff --git a/mail/Makefile.am b/mail/Makefile.am
index c0fdeb3..fa5962a 100644
--- a/mail/Makefile.am
+++ b/mail/Makefile.am
@@ -31,7 +31,6 @@ libevolution_mail_la_CPPFLAGS =                               \
        $(GNOME_PLATFORM_CFLAGS)                        \
        $(CERT_UI_CFLAGS)                               \
        $(CANBERRA_CFLAGS)                              \
-       $(GTKHTML_CFLAGS)                               \
        $(LIBSOUP_CFLAGS)
 
 mailinclude_HEADERS =                                  \
@@ -201,7 +200,6 @@ libevolution_mail_la_LIBADD =                               \
        $(GNOME_PLATFORM_LIBS)                          \
        $(CERT_UI_LIBS)                                 \
        $(CANBERRA_LIBS)                                \
-       $(GTKHTML_LIBS)                                 \
        $(SMIME_LIBS)                                   \
        $(LIBSOUP_LIBS)                                 \
        -lresolv
diff --git a/mail/e-mail-reader-utils.c b/mail/e-mail-reader-utils.c
index 7436920..752c05b 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 "shell/e-shell-utils.h"
diff --git a/mail/em-composer-utils.c b/mail/em-composer-utils.c
index 64e1e2d..5bb73e4 100644
--- a/mail/em-composer-utils.c
+++ b/mail/em-composer-utils.c
@@ -465,10 +465,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;
@@ -477,7 +479,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");
@@ -485,7 +489,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++) {
@@ -580,7 +585,12 @@ exit:
        g_clear_error (&error);
 
        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));
        }
 
@@ -613,14 +623,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 */
@@ -664,19 +675,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);
 
@@ -701,18 +716,22 @@ composer_save_to_drafts_cleanup (CamelFolder *drafts_folder,
 {
        CamelSession *session;
        EAlertSink *alert_sink;
+       EEditor *editor;
+       EEditorWidget *editor_widget;
        GCancellable *cancellable;
        GError *error = NULL;
 
        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;
@@ -723,7 +742,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;
@@ -785,13 +804,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;
@@ -811,7 +834,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;
                }
@@ -1535,12 +1558,15 @@ static void
 emu_update_composers_security (EMsgComposer *composer,
                                guint32 validity_found)
 {
+       EEditor *editor;
        GtkAction *action;
        GSettings *settings;
        gboolean sign_by_default;
 
        g_return_if_fail (composer != NULL);
 
+       editor = e_editor_window_get_editor (E_EDITOR_WINDOW (composer));
+
        settings = g_settings_new ("org.gnome.evolution.mail");
 
        sign_by_default =
@@ -2931,14 +2957,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");
 
@@ -2954,6 +2981,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 339bbe2..c0a23e4 100644
--- a/mail/importers/Makefile.am
+++ b/mail/importers/Makefile.am
@@ -8,8 +8,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                         \
@@ -27,7 +26,6 @@ libevolution_mail_importers_la_LIBADD =                               \
        $(top_builddir)/shell/libeshell.la                      \
        $(top_builddir)/libemail-engine/libemail-engine.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 d36547e..5ff4c26 100644
--- a/shell/Makefile.am
+++ b/shell/Makefile.am
@@ -61,7 +61,6 @@ libeshell_la_CPPFLAGS =                                               \
        -DG_LOG_DOMAIN=\"evolution-shell\"                      \
        $(EVOLUTION_DATA_SERVER_CFLAGS)                         \
        $(GNOME_PLATFORM_CFLAGS)                                \
-       $(GTKHTML_CFLAGS)                                       \
        $(CLUTTER_GTK_CFLAGS)
 
 libeshell_la_SOURCES =                         \
@@ -121,7 +120,6 @@ evolution_CPPFLAGS =                                                \
        -DLIBDIR=\""$(datadir)"\"                               \
        $(EVOLUTION_DATA_SERVER_CFLAGS)                         \
        $(GNOME_PLATFORM_CFLAGS)                                \
-       $(GTKHTML_CFLAGS)                                       \
        $(CLUTTER_GTK_CFLAGS)
 
 evolution_SOURCES =                            \


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