On Wed, 12 Nov 2008, J.C. Roberts wrote:

> 
> The attached patch fixes the missing spell checking support in Sylpheed.
> 
> Sylpheed tries to use the gtkspell wrapper, but instead of using the 
> gtkspell API, Sylpheed mistakenly calls aspell directly to get info on
> the dictionary to use. There are a few ways this could be fixed. I think
> the "best way" would be patching the crap out of Sylpheed to force it to
> use gtkspell/enchant. --I saw this mentioned on the fedora devel list:
> 
> https://fcp.surfsite.org/modules/newbb/viewtopic.php?viewmode=flat&order=DESC&topic_id=49689&forum=11
> 
> The other, far less invasive,  answer is just let Sylpheed link against
> aspell directly for it's dictionary calls.
> 
> 
> Comments?


What about this instead.
I added a patch from sylpheed svn via Fedora to make use of 
gtkspell/enchant.

It seems to work fine here.


Index: Makefile
===================================================================
RCS file: /cvs/ports/mail/sylpheed/Makefile,v
retrieving revision 1.81
diff -u -r1.81 Makefile
--- Makefile    30 Oct 2008 18:23:50 -0000      1.81
+++ Makefile    13 Nov 2008 17:57:11 -0000
@@ -5,25 +5,27 @@
 MAJOR=         2.5
 VERSION=       ${MAJOR}.0
 DISTNAME=      sylpheed-${VERSION}
-PKGNAME=       ${DISTNAME}p0
+PKGNAME=       ${DISTNAME}p1
 CATEGORIES=    mail news x11
 HOMEPAGE=      http://sylpheed.sraoss.jp/en
 
-# GPL
+# GPLv2 - LGPLv2
 PERMIT_PACKAGE_CDROM=  Yes
 PERMIT_PACKAGE_FTP=    Yes
 PERMIT_DISTFILES_CDROM=        Yes
 PERMIT_DISTFILES_FTP=  Yes
 
 MODULES=       devel/gettext
-LIB_DEPENDS=   
gtk-x11-2.0.>=0.9,gdk_pixbuf-2.0.>=0.9,gdk-x11-2.0.>=0.9::x11/gtk+2
+LIB_DEPENDS=   
gtk-x11-2.0.>=0.9,gdk_pixbuf-2.0.>=0.9,gdk-x11-2.0.>=0.9::x11/gtk+2 \
+               gtkspell.>=1::textproc/gtkspell
+
 WANTLIB=       X11 Xau Xcomposite Xdamage Xdmcp Xrender \
                Xcursor Xext Xfixes Xi Xinerama Xrandr \
                atk-1.0 c cairo crypto expat fontconfig \
                freetype glib-2.0 glitz gdk-x11-2.0 gdk_pixbuf-2.0 \
                gmodule-2.0 gobject-2.0 gtk-x11-2.0 m pcre \
                pthread pango-1.0 pangocairo-1.0 pangoft2-1.0 \
-               pixman-1 png ssl z
+               pixman-1 png ssl z enchant stdc++
 
 RUN_DEPENDS=   ::devel/desktop-file-utils
 MASTER_SITES=  http://sylpheed.sraoss.jp/sylpheed/v${MAJOR}/
@@ -32,8 +34,11 @@
 USE_X11=               Yes
 USE_LIBTOOL=           Yes
 CONFIGURE_STYLE=       gnu
-CONFIGURE_ARGS=                --enable-ssl --enable-ipv6 \
-                       --disable-gtkspell --disable-imlib
+CONFIGURE_ARGS=                ${CONFIGURE_SHARED} \
+                       --enable-ssl \
+                       --enable-ipv6 \
+                       --enable-gtkspell \
+                       --disable-imlib
 CONFIGURE_ENV=         CPPFLAGS="-I${LOCALBASE}/include" \
                        LDFLAGS="-L${LOCALBASE}/lib -pthread"
 
@@ -55,5 +60,8 @@
 .else
 CONFIGURE_ARGS+=       --disable-gpgme
 .endif
+
+post-configure:
+       echo "#define USE_ENCHANT 1" >> ${WRKBUILD}/config.h
 
 .include <bsd.port.mk>
Index: patches/patch-src_compose_c
===================================================================
RCS file: patches/patch-src_compose_c
diff -N patches/patch-src_compose_c
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-src_compose_c 13 Nov 2008 17:57:11 -0000
@@ -0,0 +1,120 @@
+$OpenBSD$
+--- src/compose.c.orig Fri May 16 11:23:12 2008
++++ src/compose.c      Thu Nov 13 18:35:10 2008
+@@ -69,8 +69,12 @@
+ #if USE_GTKSPELL
+ #  include <gtk/gtkradiomenuitem.h>
+ #  include <gtkspell/gtkspell.h>
++#if USE_ENCHANT
++#  include <enchant/enchant.h>
++#else
+ #  include <aspell.h>
+ #endif
++#endif
+ 
+ #include <stdio.h>
+ #include <stdlib.h>
+@@ -5296,6 +5300,7 @@ static Compose *compose_create(PrefsAccount *account, 
+       compose->check_spell = prefs_common.check_spell;
+       compose->spell_lang  = g_strdup(prefs_common.spell_lang);
+       compose->spell_menu  = spell_menu;
++      compose->dict_list   = NULL;
+ #endif /* USE_GTKSPELL */
+ 
+       compose->focused_editable = NULL;
+@@ -5732,8 +5737,37 @@ static void compose_set_out_encoding(Compose *compose)
+ }
+ 
+ #if USE_GTKSPELL
++#if USE_ENCHANT
++static void ench_dict_desc_cb(const char *const lang_tag,
++                            const char *const provider_name,
++                            const char *const provider_desc,
++                            const char *const provider_file,
++                            void *user_data)
++{
++      GSList **dict_list = (GSList **)user_data;
++      *dict_list = g_slist_append(*dict_list, g_strdup((gchar*)lang_tag));
++}
++
+ static void compose_set_spell_lang_menu(Compose *compose)
+ {
++      EnchantBroker *eb;
++      GSList *dict_list = NULL, *menu_list = NULL, *cur;
++      GtkWidget *menu;
++      gboolean lang_set = FALSE;
++
++      eb = enchant_broker_init();
++      enchant_broker_list_dicts(eb, ench_dict_desc_cb, &dict_list);
++      enchant_broker_free(eb);
++
++      for (cur = dict_list; cur != NULL; cur = cur->next) {
++              if (compose->spell_lang != NULL &&
++                  g_ascii_strcasecmp(compose->spell_lang,
++                                     (gchar *)cur->data) == 0)
++                      lang_set = TRUE;
++      }
++#else  /* !USE_ENCHANT */
++static void compose_set_spell_lang_menu(Compose *compose)
++{
+       AspellConfig *config;
+       AspellDictInfoList *dlist;
+       AspellDictInfoEnumeration *dels;
+@@ -5748,13 +5782,16 @@ static void compose_set_spell_lang_menu(Compose *compo
+ 
+       dels = aspell_dict_info_list_elements(dlist);
+       while ((entry = aspell_dict_info_enumeration_next(dels)) != 0) {
+-              dict_list = g_slist_append(dict_list, (gchar *)entry->name);
++              dict_list = g_slist_append(dict_list, g_strdup(entry->name));
+               if (compose->spell_lang != NULL &&
+                   g_ascii_strcasecmp(compose->spell_lang, entry->name) == 0)
+                       lang_set = TRUE;
+       }
+       delete_aspell_dict_info_enumeration(dels);
++#endif /* USE_ENCHANT */
+ 
++      compose->dict_list = dict_list;
++
+       menu = gtk_menu_new();
+ 
+       for (cur = dict_list; cur != NULL; cur = cur->next) {
+@@ -5777,15 +5814,18 @@ static void compose_set_spell_lang_menu(Compose *compo
+               g_object_set_data(G_OBJECT(item), "spell-lang", dict);
+               gtk_widget_show(item);
+ 
+-              if (!lang_set && g_ascii_strcasecmp("en", dict) == 0)
++              if (!lang_set && g_ascii_strcasecmp("en", dict) == 0) {
++                      g_free(compose->spell_lang);
++                      compose->spell_lang = g_strdup("en");
+                       gtk_check_menu_item_set_active
+                               (GTK_CHECK_MENU_ITEM(item), TRUE);
++              }
+       }
+ 
+       gtk_widget_show(menu);
+       gtk_menu_item_set_submenu(GTK_MENU_ITEM(compose->spell_menu), menu);
+ }
+-#endif
++#endif /* USE_GTKSPELL */
+ 
+ static void compose_set_template_menu(Compose *compose)
+ {
+@@ -5924,6 +5964,8 @@ static void compose_destroy(Compose *compose)
+       address_completion_end(compose->window);
+ 
+ #if USE_GTKSPELL
++      slist_free_strings(compose->dict_list);
++      g_slist_free(compose->dict_list);
+       g_free(compose->spell_lang);
+ #endif
+ 
+@@ -7505,7 +7547,8 @@ static void compose_toggle_spell_cb(gpointer data, gui
+       GtkSpell *speller;
+ 
+       if (GTK_CHECK_MENU_ITEM(widget)->active) {
+-              debug_print("Spell checking enabled\n");
++              debug_print("Spell checking enabled: %s\n",
++                          compose->spell_lang ? compose->spell_lang : 
"(none)");
+               speller = gtkspell_new_attach(GTK_TEXT_VIEW(compose->text),
+                                             compose->spell_lang, NULL);
+               compose->check_spell = TRUE;
Index: patches/patch-src_compose_h
===================================================================
RCS file: patches/patch-src_compose_h
diff -N patches/patch-src_compose_h
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-src_compose_h 13 Nov 2008 17:57:11 -0000
@@ -0,0 +1,25 @@
+$OpenBSD$
+--- src/compose.h.orig Thu May  8 10:37:28 2008
++++ src/compose.h      Thu Nov 13 18:35:10 2008
+@@ -1,6 +1,6 @@
+ /*
+  * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
+- * Copyright (C) 1999-2007 Hiroyuki Yamamoto
++ * Copyright (C) 1999-2008 Hiroyuki Yamamoto
+  *
+  * This program is free software; you can redistribute it and/or modify
+  * it under the terms of the GNU General Public License as published by
+@@ -133,9 +133,10 @@ struct _Compose
+       GtkWidget *tmpl_menu;
+ 
+ #if USE_GTKSPELL
+-        GtkWidget *spell_menu;
+-        gchar     *spell_lang;
+-        gboolean   check_spell;
++      GtkWidget *spell_menu;
++      gchar     *spell_lang;
++      gboolean   check_spell;
++      GSList    *dict_list;
+ #endif
+ 
+       ComposeMode mode;



-- 
Antoine

Reply via email to