diff options
author | hiro <hiro@ee746299-78ed-0310-b773-934348b2243d> | 2008-06-27 07:03:11 +0000 |
---|---|---|
committer | hiro <hiro@ee746299-78ed-0310-b773-934348b2243d> | 2008-06-27 07:03:11 +0000 |
commit | e4fa47016f53e76df6d0ef387d41270b98e5578c (patch) | |
tree | 062fcb7f9fd84afbaad4be66325ecb9655798989 /src/compose.c | |
parent | 059a6333c75b6d60aeeb3d541590d62607e42ff5 (diff) |
supported GtkSpell 2.0.13 (with Enchant).
git-svn-id: svn://sylpheed.sraoss.jp/sylpheed/trunk@2022 ee746299-78ed-0310-b773-934348b2243d
Diffstat (limited to 'src/compose.c')
-rw-r--r-- | src/compose.c | 40 |
1 files changed, 39 insertions, 1 deletions
diff --git a/src/compose.c b/src/compose.c index 83dded09..43cf2ecc 100644 --- a/src/compose.c +++ b/src/compose.c @@ -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> @@ -5732,6 +5736,34 @@ 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, cur->data) == 0) + lang_set = TRUE; + } +#else /* !USE_ENCHANT */ static void compose_set_spell_lang_menu(Compose *compose) { AspellConfig *config; @@ -5754,6 +5786,7 @@ static void compose_set_spell_lang_menu(Compose *compose) lang_set = TRUE; } delete_aspell_dict_info_enumeration(dels); +#endif /* USE_ENCHANT */ menu = gtk_menu_new(); @@ -5782,10 +5815,15 @@ static void compose_set_spell_lang_menu(Compose *compose) (GTK_CHECK_MENU_ITEM(item), TRUE); } +#if USE_ENCHANT + slist_free_strings(dict_list); +#endif + g_slist_free(dict_list); + 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) { |