From e4fa47016f53e76df6d0ef387d41270b98e5578c Mon Sep 17 00:00:00 2001 From: hiro Date: Fri, 27 Jun 2008 07:03:11 +0000 Subject: supported GtkSpell 2.0.13 (with Enchant). git-svn-id: svn://sylpheed.sraoss.jp/sylpheed/trunk@2022 ee746299-78ed-0310-b773-934348b2243d --- src/compose.c | 40 +++++++++++++++++++++++++++++++++++++++- src/compose.h | 2 +- 2 files changed, 40 insertions(+), 2 deletions(-) (limited to 'src') 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 # include +#if USE_ENCHANT +# include +#else # include #endif +#endif #include #include @@ -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) { diff --git a/src/compose.h b/src/compose.h index f805b834..fa37cf8f 100644 --- a/src/compose.h +++ b/src/compose.h @@ -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 -- cgit v1.2.3