[balsa/gtk3] Support Gspell as an alternative to GtkSpell



commit fbb50d6820f2b279f032c048467ffba24be2c874
Author: Peter Bloomfield <PeterBloomfield bellsouth net>
Date:   Tue Jun 28 20:16:46 2016 -0400

    Support Gspell as an alternative to GtkSpell
    
        * configure.ac: replace --with-gtkspell with
        --with-spell-checker = (no|gtkspell|gspell) and change the
        AM_CONDITIONAL BUILD_WITH_GTK_SPELL to BUILD_WITH_SPELL_CHECKER.
        * src/Makefile.am: use the new AM_CONDITIONAL.
        * src/balsa-app.c (balsa_app_init): support Gspell.
        * src/balsa-app.h: ditto.
        * src/pref-manager.c (apply_prefs), (set_prefs): ditto.
        * src/save-restore.c (config_global_load), (config_save): ditto.
        * src/sendmsg-window.c (balsa_sendmsg_destroy_handler),
        (create_text_area), (create_lang_menu), (message_postpone),
        (set_locale), (sw_spell_check_change_state), (lang_set_cb),
        (sendmsg_window_new): Gspell has a different API from GtkSpell.

 ChangeLog            |   17 +++++++++
 configure.ac         |   32 ++++++++++++-----
 doc/ChangeLog        |    6 +++
 doc/Makefile.am      |   14 ++++----
 src/Makefile.am      |   14 ++++----
 src/balsa-app.c      |    6 ++--
 src/balsa-app.h      |    6 ++--
 src/pref-manager.c   |    4 +-
 src/save-restore.c   |    4 +-
 src/sendmsg-window.c |   92 +++++++++++++++++++++++++++++++++++++++++---------
 10 files changed, 145 insertions(+), 50 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 81a4f3b..910e8fe 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,20 @@
+2016-06-28  Peter Bloomfield  <pbloomfield bellsouth net>
+
+       Support Gspell as an alternative to GtkSpell
+
+       * configure.ac: replace --with-gtkspell with
+       --with-spell-checker = (no|gtkspell|gspell) and change the
+       AM_CONDITIONAL BUILD_WITH_GTK_SPELL to BUILD_WITH_SPELL_CHECKER.
+       * src/Makefile.am: use the new AM_CONDITIONAL.
+       * src/balsa-app.c (balsa_app_init): support Gspell.
+       * src/balsa-app.h: ditto.
+       * src/pref-manager.c (apply_prefs), (set_prefs): ditto.
+       * src/save-restore.c (config_global_load), (config_save): ditto.
+       * src/sendmsg-window.c (balsa_sendmsg_destroy_handler),
+       (create_text_area), (create_lang_menu), (message_postpone),
+       (set_locale), (sw_spell_check_change_state), (lang_set_cb),
+       (sendmsg_window_new): Gspell has a different API from GtkSpell.
+
 2016-06-25  Peter Bloomfield  <pbloomfield bellsouth net>
 
        Symbolic icon names like pan-down-symbolic now contain hyphens
diff --git a/configure.ac b/configure.ac
index d7a3a12..4712bdb 100644
--- a/configure.ac
+++ b/configure.ac
@@ -131,10 +131,11 @@ AC_ARG_WITH([gtksourceview],
                   [Use GtkSourceView-3 if available (default=no)]),
                  [with_gtksourceview=$withval],[with_gtksourceview=no])
 
-AC_ARG_WITH([gtkspell],
-   AC_HELP_STRING([--with-gtkspell],
-                  [Use GtkSpell/enchant if available (default=no)]),
-                 [with_gtkspell=$withval],[with_gtkspell=no])
+AC_ARG_WITH([spell-checker],
+            AC_HELP_STRING([--with-spell-checker=(no|gtkspell|gspell)],
+                           [select the external spell checker (default no)]),
+            [use_spell_checker=$withval],
+            [use_spell_checker=no])
 
 AC_ARG_WITH(iconv,      
    AC_HELP_STRING([--with-iconv=DIR],
@@ -698,8 +699,14 @@ dnl #####################################################################
 
 # Spell check detection.
 #
-AC_MSG_CHECKING([whether to configure for gtkspell/enchant])
-if test x$with_gtkspell != xno; then
+AC_MSG_CHECKING(whether to use an external spell checker)
+case "$use_spell_checker" in
+    gspell)
+    AC_MSG_RESULT([configure gspell])
+    PKG_CHECK_MODULES(SPELL, [ gspell-1 ])
+    AC_DEFINE(HAVE_GSPELL,1,[Defined when Gspell can be used.])
+    ;;
+    gtkspell)
     if $PKG_CONFIG --atleast-version=3.0.3 gtkspell3-3.0; then
         AC_MSG_RESULT([gtkspell version >= 3.0.3])
         PKG_CHECK_MODULES(SPELL, [ gtkspell3-3.0 ])
@@ -710,13 +717,18 @@ if test x$with_gtkspell != xno; then
         PKG_CHECK_MODULES(SPELL, [ gtkspell3-3.0 enchant ])
     fi
     AC_DEFINE(HAVE_GTKSPELL,1,[Defined when GtkSpell can be used.])
-else
+    ;;
+    no)
     AC_MSG_RESULT([configure enchant])
     PKG_CHECK_MODULES(SPELL, [ enchant ])
-fi
+    ;;
+    *)
+    AC_MSG_ERROR([bad option $use_spell_checker])
+    ;;
+esac
 BALSA_CFLAGS="$BALSA_CFLAGS $SPELL_CFLAGS"
 BALSA_LIBS="$BALSA_LIBS $SPELL_LIBS"
-AM_CONDITIONAL([BUILD_WITH_GTKSPELL], [test $with_gtkspell = "yes"])
+AM_CONDITIONAL([BUILD_WITH_SPELL_CHECKER], [test $use_spell_checker != "no"])
 
 dnl #####################################################################
 dnl 6. Typedefs, structures and compiler characteristics.
@@ -884,7 +896,7 @@ echo "                 Use GPGME: $gpgmecfg"
 echo "                  Use LDAP: $with_ldap"
 echo "                   Use GSS: $with_gss"
 echo "                Use SQLite: $with_sqlite"
-echo "              Use GtkSpell: $with_gtkspell"
+echo "    External spell checker: $use_spell_checker"
 echo "             Use Libnotify: $with_libnotify"
 echo "         Use GtkSourceView: $with_gtksourceview"
 echo "              Use Compface: $with_compface"
diff --git a/doc/ChangeLog b/doc/ChangeLog
index 1da8769..b833815 100644
--- a/doc/ChangeLog
+++ b/doc/ChangeLog
@@ -1,3 +1,9 @@
+2016-06-28  Peter Bloomfield  <pbloomfield bellsouth net>
+
+       reviewed by: <delete if not using a buddy>
+
+       * Makefile.am:
+
 2015-01-27  Peter Bloomfield  <pbloomfield bellsouth net>
 
        reviewed by: <delete if not using a buddy>
diff --git a/doc/Makefile.am b/doc/Makefile.am
index 8d86977..f86171f 100644
--- a/doc/Makefile.am
+++ b/doc/Makefile.am
@@ -32,17 +32,17 @@ balsa_help_files =                                          \
 
 HELP_LINGUAS = de es fr sl
 
-if BUILD_WITH_GTKSPELL
-balsa_gtkspell_extra =
+if BUILD_WITH_SPELL_CHECKER
+balsa_spell_extra =
 helpdirs = C $(HELP_LINGUAS)
-balsa_gtkspell_extra_dist = $(foreach lc,$(helpdirs),$(lc)/preferences-spelling.page) #
+balsa_spell_extra_dist = $(foreach lc,$(helpdirs),$(lc)/preferences-spelling.page) #
 else
-balsa_gtkspell_extra_dist =
-balsa_gtkspell_extra = preferences-spelling.page
+balsa_spell_extra_dist =
+balsa_spell_extra = preferences-spelling.page
 endif
 
-HELP_FILES   = $(balsa_help_files) $(balsa_gtkspell_extra)
-EXTRA_DIST   = $(balsa_gtkspell_extra_dist)
+HELP_FILES   = $(balsa_help_files) $(balsa_spell_extra)
+EXTRA_DIST   = $(balsa_spell_extra_dist)
 
 HELP_EXTRA   = balsa.entities
 
diff --git a/src/Makefile.am b/src/Makefile.am
index 90a148c..a4390cf 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -86,27 +86,27 @@ balsa_print_source = print-gtk.c    \
        balsa-print-object-text.c       \
        balsa-print-object-text.h
 
-if BUILD_WITH_GTKSPELL
-balsa_gtkspell_extra =
-balsa_gtkspell_extra_dist =    \
+if BUILD_WITH_SPELL_CHECKER
+balsa_spell_extra =
+balsa_spell_extra_dist =       \
                spell-check.c           \
                spell-check.h
 else
-balsa_gtkspell_extra_dist =
-balsa_gtkspell_extra =         \
+balsa_spell_extra_dist =
+balsa_spell_extra =            \
                spell-check.c           \
                spell-check.h
 endif
 
 balsa_SOURCES =                        \
        $(balsa_BASE_SRCLIST)   \
-       $(balsa_gtkspell_extra) \
+       $(balsa_spell_extra) \
        $(balsa_print_source)
 
 
 DISTCLEANFILES = $(balsa_IDL_SRCLIST)
 
-EXTRA_DIST = $(balsa_gtkspell_extra_dist)
+EXTRA_DIST = $(balsa_spell_extra_dist)
 
 AM_CPPFLAGS = \
        -DGNOMELOCALEDIR=\""$(datadir)/locale"\" \
diff --git a/src/balsa-app.c b/src/balsa-app.c
index 32841de..7603af0 100644
--- a/src/balsa-app.c
+++ b/src/balsa-app.c
@@ -390,13 +390,13 @@ balsa_app_init(void)
     balsa_app.filters=NULL;
 
     /* spell check */
-#if HAVE_GTKSPELL
+#if HAVE_GSPELL || HAVE_GTKSPELL
     balsa_app.spell_check_lang = NULL;
     balsa_app.spell_check_active = FALSE;
-#else                           /* HAVE_GTKSPELL */
+#else                           /* HAVE_GSPELL */
     balsa_app.check_sig = DEFAULT_CHECK_SIG;
     balsa_app.check_quoted = DEFAULT_CHECK_QUOTED;
-#endif                          /* HAVE_GTKSPELL */
+#endif                          /* HAVE_GSPELL */
 
     /* Information messages */
     balsa_app.information_message = 0;
diff --git a/src/balsa-app.h b/src/balsa-app.h
index 7038b73..e2b4bdb 100644
--- a/src/balsa-app.h
+++ b/src/balsa-app.h
@@ -345,13 +345,13 @@ extern struct BalsaApplication {
     LibBalsaAddressBook *default_address_book;
 
     /* spell checking */
-#if HAVE_GTKSPELL
+#if HAVE_GSPELL || HAVE_GTKSPELL
     gchar   *spell_check_lang;
     gboolean spell_check_active;
-#else                           /* HAVE_GTKSPELL */
+#else                           /* HAVE_GSPELL */
     gboolean check_sig;
     gboolean check_quoted;
-#endif                          /* HAVE_GTKSPELL */
+#endif                          /* HAVE_GSPELL */
 
     /* Information messages */
     BalsaInformationShow information_message;
diff --git a/src/pref-manager.c b/src/pref-manager.c
index 42474b2..1eabfc0 100644
--- a/src/pref-manager.c
+++ b/src/pref-manager.c
@@ -1040,7 +1040,7 @@ apply_prefs(GtkDialog * pbox)
     balsa_app.empty_trash_on_exit =
         gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(pui->empty_trash));
 
-#if !HAVE_GTKSPELL
+#if !HAVE_GSPELL && !HAVE_GTKSPELL
     /* spell checking */
     balsa_app.check_sig =
         gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON
@@ -1282,7 +1282,7 @@ set_prefs(void)
     pm_combo_box_set_level(pui->default_threading_type,
                            pui->threading_type_index);
 
-#if !HAVE_GTKSPELL
+#if !HAVE_GSPELL && !HAVE_GTKSPELL
     /* spelling */
     gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(pui->spell_check_sig),
                                  balsa_app.check_sig);
diff --git a/src/save-restore.c b/src/save-restore.c
index 3c0d4e0..51c374d 100644
--- a/src/save-restore.c
+++ b/src/save-restore.c
@@ -883,7 +883,7 @@ config_global_load(void)
     /* Spelling options ... */
     libbalsa_conf_push_group("Spelling");
 
-#if HAVE_GTKSPELL
+#if HAVE_GSPELL || HAVE_GTKSPELL
     balsa_app.spell_check_lang =
         libbalsa_conf_get_string("SpellCheckLanguage");
     balsa_app.spell_check_active =
@@ -1362,7 +1362,7 @@ config_save(void)
     libbalsa_conf_remove_group("Spelling");
     libbalsa_conf_push_group("Spelling");
 
-#if HAVE_GTKSPELL
+#if HAVE_GSPELL || HAVE_GTKSPELL
     libbalsa_conf_set_string("SpellCheckLanguage",
                              balsa_app.spell_check_lang);
     libbalsa_conf_set_bool("SpellCheckActive", 
diff --git a/src/sendmsg-window.c b/src/sendmsg-window.c
index 14e80b4..a32dc14 100644
--- a/src/sendmsg-window.c
+++ b/src/sendmsg-window.c
@@ -71,11 +71,13 @@
 #include "print.h"
 #include "macosx-helpers.h"
 
-#ifndef HAVE_GTKSPELL_3_0_3
+#if !HAVE_GSPELL && !HAVE_GTKSPELL_3_0_3
 #include <enchant/enchant.h>
 #endif                          /* HAVE_GTKSPELL_3_0_3 */
 #if HAVE_GTKSPELL
 #include "gtkspell/gtkspell.h"
+#elif HAVE_GSPELL
+#include "gspell/gspell.h"
 #else                           /* HAVE_GTKSPELL */
 #include "spell-check.h"
 #endif                          /* HAVE_GTKSPELL */
@@ -104,7 +106,7 @@ static void bsmsg_update_gpg_ui_on_ident_change(BalsaSendmsg *bsmsg,
 static void bsmsg_setup_gpg_ui_by_mode(BalsaSendmsg *bsmsg, gint mode);
 #endif
 
-#if !HAVE_GTKSPELL
+#if !HAVE_GSPELL && !HAVE_GTKSPELL_3_0_3
 static void sw_spell_check_weak_notify(BalsaSendmsg * bsmsg);
 #endif                          /* HAVE_GTKSPELL */
 
@@ -139,7 +141,7 @@ static void sw_buffer_save(BalsaSendmsg * bsmsg);
 static void sw_buffer_swap(BalsaSendmsg * bsmsg, gboolean undo);
 #endif                          /* HAVE_GTKSOURCEVIEW */
 static void sw_buffer_signals_connect(BalsaSendmsg * bsmsg);
-#if !HAVE_GTKSOURCEVIEW || !HAVE_GTKSPELL
+#if !HAVE_GTKSOURCEVIEW || !(HAVE_GSPELL || HAVE_GTKSPELL)
 static void sw_buffer_signals_disconnect(BalsaSendmsg * bsmsg);
 #endif                          /* !HAVE_GTKSOURCEVIEW || !HAVE_GTKSPELL */
 #if !HAVE_GTKSOURCEVIEW
@@ -638,7 +640,7 @@ balsa_sendmsg_destroy_handler(BalsaSendmsg * bsmsg)
         bsmsg->references = NULL;
     }
 
-#if !HAVE_GTKSPELL
+#if !(HAVE_GSPELL || HAVE_GTKSPELL)
     if (bsmsg->spell_checker)
         gtk_widget_destroy(bsmsg->spell_checker);
 #endif                          /* HAVE_GTKSPELL */
@@ -2882,6 +2884,10 @@ create_text_area(BalsaSendmsg * bsmsg)
 {
     GtkTextView *text_view;
     GtkTextBuffer *buffer;
+#if HAVE_GSPELL
+    GspellTextBuffer *gspell_buffer;
+    GspellChecker *checker;
+#endif                          /* HAVE_GSPELL */
     GtkWidget *scroll;
 
 #if HAVE_GTKSOURCEVIEW
@@ -2927,6 +2933,13 @@ create_text_area(BalsaSendmsg * bsmsg)
     gtk_text_view_set_editable(text_view, TRUE);
     gtk_text_view_set_wrap_mode(text_view, GTK_WRAP_WORD_CHAR);
 
+#if HAVE_GSPELL
+    gspell_buffer = gspell_text_buffer_get_from_gtk_text_buffer(buffer);
+    checker = gspell_checker_new(NULL);
+    gspell_text_buffer_set_spell_checker(gspell_buffer, checker);
+    g_object_unref(checker);
+#endif                          /* HAVE_GSPELL */
+
     scroll = gtk_scrolled_window_new(NULL, NULL);
     gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scroll),
                                   GTK_POLICY_NEVER, GTK_POLICY_ALWAYS);
@@ -4016,7 +4029,7 @@ comp_send_locales(const void* a, const void* b)
    hardcoded because it depends on the current locale.
 */
 #define BALSA_LANGUAGE_MENU_LANG "balsa-language-menu-lang"
-#if !HAVE_GTKSPELL_3_0_3
+#if !HAVE_GSPELL && !HAVE_GTKSPELL_3_0_3
 static void
 sw_broker_cb(const gchar * lang_tag,
              const gchar * provider_name,
@@ -4038,8 +4051,12 @@ create_lang_menu(GtkWidget * parent, BalsaSendmsg * bsmsg)
     GtkWidget *langs = gtk_menu_new();
     static gboolean locales_sorted = FALSE;
     GSList *group = NULL;
+#if HAVE_GSPELL
+    const GList *lang_list, *l;
+#else
     GList *lang_list, *l;
-#if !HAVE_GTKSPELL_3_0_3
+#endif                          /* HAVE_GSPELL */
+#if !HAVE_GSPELL && !HAVE_GTKSPELL_3_0_3
     EnchantBroker *broker;
 #endif                          /* HAVE_GTKSPELL_3_0_3 */
     const gchar *preferred_lang;
@@ -4057,7 +4074,7 @@ create_lang_menu(GtkWidget * parent, BalsaSendmsg * bsmsg)
     }
 
     /* find the preferred charset... */
-#if HAVE_GTKSPELL
+#if HAVE_GSPELL || HAVE_GTKSPELL
     preferred_lang = balsa_app.spell_check_lang ?
         balsa_app.spell_check_lang : setlocale(LC_CTYPE, NULL);
 #else                           /* HAVE_GTKSPELL */
@@ -4066,6 +4083,8 @@ create_lang_menu(GtkWidget * parent, BalsaSendmsg * bsmsg)
 
 #if HAVE_GTKSPELL_3_0_3
     lang_list = gtk_spell_checker_get_language_list();
+#elif HAVE_GSPELL
+    lang_list = gspell_language_get_available();
 #else                           /* HAVE_GTKSPELL_3_0_3 */
     broker = enchant_broker_init();
     lang_list = NULL;
@@ -4073,13 +4092,20 @@ create_lang_menu(GtkWidget * parent, BalsaSendmsg * bsmsg)
 #endif                          /* HAVE_GTKSPELL_3_0_3 */
 
     for (i = 0; i < ELEMENTS(locales); i++) {
+        gconstpointer found;
+
         if (locales[i].locale == NULL || locales[i].locale[0] == '\0')
             /* GtkSpell handles NULL lang, but complains about empty
              * lang; in either case, it does not go in the langs menu. */
             continue;
 
-        if (g_list_find_custom(lang_list, locales[i].locale,
-                               (GCompareFunc) strcmp)) {
+#if HAVE_GSPELL
+        found = gspell_language_lookup(locales[i].locale);
+#else                           /* HAVE_GSPELL */
+        found = g_list_find_custom(lang_list, locales[i].locale,
+                                   (GCompareFunc) strcmp);
+#endif                          /* HAVE_GSPELL */
+        if (found != NULL) {
             GtkWidget *w;
 
             w = gtk_radio_menu_item_new_with_mnemonic(group,
@@ -4101,7 +4127,12 @@ create_lang_menu(GtkWidget * parent, BalsaSendmsg * bsmsg)
     /* Add to the langs menu any available languages that are
      * not listed in locales[] */
     for (l = lang_list; l; l = l->next) {
+#if HAVE_GSPELL
+        const GspellLanguage *language = l->data;
+        const gchar *lang = gspell_language_get_code(language);
+#else                           /* HAVE_GSPELL */
         const gchar *lang = l->data;
+#endif                          /* HAVE_GSPELL */
         gint i;
 
         i = find_locale_index_by_locale(lang);
@@ -4129,10 +4160,12 @@ create_lang_menu(GtkWidget * parent, BalsaSendmsg * bsmsg)
                 active_item = w;
         }
     }
+#if !HAVE_GSPELL
     g_list_free_full(lang_list, (GDestroyNotify) g_free);
 #if !HAVE_GTKSPELL_3_0_3
     enchant_broker_free(broker);
 #endif                          /* HAVE_GTKSPELL_3_0_3 */
+#endif                          /* HAVE_GSPELL */
 
     g_signal_handlers_block_by_func(active_item, lang_set_cb, bsmsg);
     gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(active_item), TRUE);
@@ -5356,7 +5389,7 @@ message_postpone(BalsaSendmsg * bsmsg)
     g_ptr_array_add(headers, g_strdup_printf("%d", bsmsg->gpg_mode));
 #endif
 
-#if HAVE_GTKSPELL
+#if HAVE_GSPELL || HAVE_GTKSPELL
     if (sw_action_get_active(bsmsg, "spell-check")) {
         g_ptr_array_add(headers, g_strdup("X-Balsa-Lang"));
         g_ptr_array_add(headers, g_strdup(bsmsg->spell_check_lang));
@@ -5535,7 +5568,7 @@ sw_buffer_signals_connect(BalsaSendmsg * bsmsg)
 #endif                          /* HAVE_GTKSOURCEVIEW */
 }
 
-#if !HAVE_GTKSOURCEVIEW || !HAVE_GTKSPELL
+#if !HAVE_GTKSOURCEVIEW || !(HAVE_GSPELL || HAVE_GTKSPELL)
 static void
 sw_buffer_signals_disconnect(BalsaSendmsg * bsmsg)
 {
@@ -6078,6 +6111,22 @@ init_menus(BalsaSendmsg * bsmsg)
 static void
 set_locale(BalsaSendmsg * bsmsg, const gchar * locale)
 {
+#if HAVE_GSPELL
+    const GspellLanguage *language;
+
+    language = gspell_language_lookup(locale);
+    if (language != NULL) {
+        GtkTextBuffer *buffer;
+        GspellTextBuffer *gspell_buffer;
+        GspellChecker *checker;
+
+        buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(bsmsg->text));
+        gspell_buffer = gspell_text_buffer_get_from_gtk_text_buffer(buffer);
+        checker = gspell_text_buffer_get_spell_checker(gspell_buffer);
+        gspell_checker_set_language(checker, language);
+    }
+
+#endif                          /* HAVE_GSPELL */
     g_free(bsmsg->spell_check_lang);
     bsmsg->spell_check_lang = g_strdup(locale);
 
@@ -6087,7 +6136,7 @@ set_locale(BalsaSendmsg * bsmsg, const gchar * locale)
 #endif                          /* HAVE_GTKSPELL */
 }
 
-#if HAVE_GTKSPELL
+#if HAVE_GSPELL || HAVE_GTKSPELL
 /* spell_check_menu_cb
  *
  * Toggle the spell checker
@@ -6098,11 +6147,22 @@ sw_spell_check_change_state(GSimpleAction * action,
                             gpointer        data)
 {
     BalsaSendmsg *bsmsg = data;
+#if HAVE_GSPELL
+    GtkTextView *text_view;
+    GspellTextView *gspell_view;
+
+    balsa_app.spell_check_active = g_variant_get_boolean(state);
+    text_view = GTK_TEXT_VIEW(bsmsg->text);
+    gspell_view = gspell_text_view_get_from_gtk_text_view(text_view);
+    gspell_text_view_set_inline_spell_checking(gspell_view,
+                                               balsa_app.spell_check_active);
+#elif HAVE_GTKSPELL
 
     if ((balsa_app.spell_check_active = g_variant_get_boolean(state)))
         sw_spell_attach(bsmsg);
     else
         sw_spell_detach(bsmsg);
+#endif                          /* HAVE_GSPELL */
 
     g_simple_action_set_state(action, state);
 }
@@ -6164,7 +6224,7 @@ lang_set_cb(GtkWidget * w, BalsaSendmsg * bsmsg)
 
         lang = g_object_get_data(G_OBJECT(w), BALSA_LANGUAGE_MENU_LANG);
         set_locale(bsmsg, lang);
-#if HAVE_GTKSPELL
+#if HAVE_GSPELL || HAVE_GTKSPELL
         g_free(balsa_app.spell_check_lang);
         balsa_app.spell_check_lang = g_strdup(lang);
         sw_action_set_active(bsmsg, "spell-check", TRUE);
@@ -6478,7 +6538,7 @@ static GActionEntry win_entries[] = {
     {"reflow",           sw_reflow_activated            },
     {"insert-sig",       sw_insert_sig_activated        },
     {"quote",            sw_quote_activated             },
-#if HAVE_GTKSPELL
+#if HAVE_GSPELL || HAVE_GTKSPELL
     {"spell-check",      libbalsa_toggle_activated, NULL, "false",
                          sw_spell_check_change_state    },
 #else                           /* HAVE_GTKSPELL */
@@ -6582,7 +6642,7 @@ sendmsg_window_new()
 
     bsmsg->type = SEND_NORMAL;
     bsmsg->is_continue = FALSE;
-#if !HAVE_GTKSPELL
+#if !HAVE_GTKSPELL && !HAVE_GSPELL
     bsmsg->spell_checker = NULL;
 #endif                          /* HAVE_GTKSPELL */
 #ifdef HAVE_GPGME
@@ -6697,7 +6757,7 @@ sendmsg_window_new()
                           &bsmsg->current_language_menu);
     create_lang_menu(bsmsg->current_language_menu, bsmsg);
 
-#if HAVE_GTKSPELL
+#if HAVE_GSPELL || HAVE_GTKSPELL
     sw_action_set_active(bsmsg, "spell-check", balsa_app.spell_check_active);
 #endif
     setup_headers_from_identity(bsmsg, bsmsg->ident);


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