Репозитории ALT
S: | 3.7.0-alt0.6 |
4.1: | 2.2.9-alt1.1 |
4.0: | 2.2.9-alt1.1 |
3.0: | 1.0.4-alt1 |
Группа :: Сети/Почта
Пакет: sylpheed
Главная Изменения Спек Патчи Sources Загрузить Gear Bugs and FR Repocop
Патч: sylpheed-2.2.5-alt-gtkspell-enchant.patch
Скачать
Скачать
--- sylpheed-2.2.5/src/compose.c.alt-gtkspell-enchant 2006-06-08 15:39:28 +0400
+++ sylpheed-2.2.5/src/compose.c 2006-06-08 15:39:33 +0400
@@ -64,7 +64,11 @@
#if USE_GTKSPELL
# include <gtk/gtkradiomenuitem.h>
# include <gtkspell/gtkspell.h>
-# include <aspell.h>
+# if USE_ENCHANT
+# include <enchant.h>
+# else
+# include <aspell.h>
+# endif
#endif
#include <stdio.h>
@@ -4934,15 +4938,40 @@ static void compose_set_out_encoding(Com
}
#if USE_GTKSPELL
-static void compose_set_spell_lang_menu(Compose *compose)
+#if USE_ENCHANT
+
+static void compose_append_dict(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 = user_data;
+ *dict_list = g_slist_append(*dict_list, g_strdup(lang_tag));
+}
+
+static GSList *compose_get_spell_dict_list(void)
+{
+ EnchantBroker *broker;
+ GSList *dict_list = NULL;
+
+ broker = enchant_broker_init();
+ if (!broker)
+ return NULL;
+ enchant_broker_list_dicts(broker, &compose_append_dict, &dict_list);
+ enchant_broker_free(broker);
+ return dict_list;
+}
+
+#else /* not USE_ENCHANT - using aspell directly */
+
+static GSList *compose_get_spell_dict_list(void)
{
AspellConfig *config;
AspellDictInfoList *dlist;
AspellDictInfoEnumeration *dels;
const AspellDictInfo *entry;
- GSList *dict_list = NULL, *menu_list = NULL, *cur;
- GtkWidget *menu;
- gboolean lang_set = FALSE;
+ GSList *dict_list = NULL;
config = new_aspell_config();
dlist = get_aspell_dict_info_list(config);
@@ -4950,16 +4979,32 @@ static void compose_set_spell_lang_menu(
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));
+ }
+ delete_aspell_dict_info_enumeration(dels);
+
+ return dict_list;
+}
+
+#endif /* not USE_ENCHANT */
+
+static void compose_set_spell_lang_menu(Compose *compose)
+{
+ GSList *menu_list = NULL, *cur;
+ GtkWidget *menu;
+ gboolean lang_set = FALSE;
+
+ compose->spell_dict_list = compose_get_spell_dict_list();
+ for (cur = compose->spell_dict_list; cur != NULL; cur = cur->next) {
+ gchar *dict = (gchar *)cur->data;
if (compose->spell_lang != NULL &&
- g_ascii_strcasecmp(compose->spell_lang, entry->name) == 0)
+ g_ascii_strcasecmp(compose->spell_lang, dict) == 0)
lang_set = TRUE;
}
- delete_aspell_dict_info_enumeration(dels);
menu = gtk_menu_new();
- for (cur = dict_list; cur != NULL; cur = cur->next) {
+ for (cur = compose->spell_dict_list; cur != NULL; cur = cur->next) {
gchar *dict = (gchar *)cur->data;
GtkWidget *item;
@@ -4987,7 +5032,8 @@ static void compose_set_spell_lang_menu(
gtk_widget_show(menu);
gtk_menu_item_set_submenu(GTK_MENU_ITEM(compose->spell_menu), menu);
}
-#endif
+
+#endif /* not USE_GTKSPELL */
static void compose_set_template_menu(Compose *compose)
{
@@ -5110,6 +5156,8 @@ static void compose_destroy(Compose *com
#if USE_GTKSPELL
g_free(compose->spell_lang);
+ slist_free_strings(compose->spell_dict_list);
+ g_slist_free(compose->spell_dict_list);
#endif
slist_free_strings(compose->to_list);
--- sylpheed-2.2.5/src/compose.h.alt-gtkspell-enchant 2006-06-08 15:39:28 +0400
+++ sylpheed-2.2.5/src/compose.h 2006-06-08 15:39:33 +0400
@@ -131,6 +131,7 @@ struct _Compose
GtkWidget *tmpl_menu;
#if USE_GTKSPELL
+ GSList *spell_dict_list;
GtkWidget *spell_menu;
gchar *spell_lang;
gboolean check_spell;
--- sylpheed-2.2.5/configure.in.alt-gtkspell-enchant 2006-06-08 15:39:28 +0400
+++ sylpheed-2.2.5/configure.in 2006-06-08 15:40:03 +0400
@@ -255,6 +255,21 @@ AC_ARG_ENABLE(gtkspell,
[ac_cv_enable_gtkspell=$enableval], [ac_cv_enable_gtkspell=yes])
if test "$ac_cv_enable_gtkspell" = yes; then
AC_MSG_RESULT(yes)
+
+ # FIXME: gtkspell uses libaspell by default, but may be patched to use
+ # libenchant, and there does not seem to be a good way to find out
+ # which one is used.
+ AC_MSG_CHECKING([whether enchant is available])
+ if $PKG_CONFIG enchant ; then
+ AC_MSG_RESULT(yes)
+ CFLAGS="$CFLAGS `$PKG_CONFIG --cflags enchant`"
+ LIBS="$LIBS `$PKG_CONFIG --libs enchant`"
+ AC_DEFINE(USE_ENCHANT, 1,
+ [Use enchant spell checking library])
+ else
+ AC_MSG_RESULT(no)
+ fi
+
AC_MSG_CHECKING([whether GtkSpell is available])
if $PKG_CONFIG gtkspell-2.0 ; then
AC_MSG_RESULT(yes)