$NetBSD: patch-aa,v 1.5 2008/06/29 11:38:32 tnn Exp $ --- src/compose.c.orig 2008-05-16 11:23:12.000000000 +0200 +++ src/compose.c @@ -69,7 +69,7 @@ #if USE_GTKSPELL # include # include -# include +# include #endif #include @@ -5295,6 +5295,7 @@ static Compose *compose_create(PrefsAcco #ifdef USE_GTKSPELL compose->check_spell = prefs_common.check_spell; compose->spell_lang = g_strdup(prefs_common.spell_lang); + compose->spell_dict_list = NULL; compose->spell_menu = spell_menu; #endif /* USE_GTKSPELL */ @@ -5734,26 +5735,30 @@ static void compose_set_out_encoding(Com #if USE_GTKSPELL static void compose_set_spell_lang_menu(Compose *compose) { - AspellConfig *config; - AspellDictInfoList *dlist; - AspellDictInfoEnumeration *dels; - const AspellDictInfo *entry; + EnchantBroker* eb; GSList *dict_list = NULL, *menu_list = NULL, *cur; GtkWidget *menu; gboolean lang_set = FALSE; - config = new_aspell_config(); - dlist = get_aspell_dict_info_list(config); - delete_aspell_config(config); - - 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); - if (compose->spell_lang != NULL && - g_ascii_strcasecmp(compose->spell_lang, entry->name) == 0) - lang_set = TRUE; + void enchDictDescCb (const char * const lang_tag, + const char * const provider_name, + const char * const provider_desc, + const char * const provider_file, + void * user_data) + { + dict_list = g_slist_append(dict_list, g_strdup((gchar*)lang_tag)); + } + + eb = enchant_broker_init(); + enchant_broker_list_dicts (eb, enchDictDescCb, &dict_list); + compose->spell_dict_list = 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; } - delete_aspell_dict_info_enumeration(dels); menu = gtk_menu_new(); @@ -5913,6 +5918,7 @@ static void compose_destroy(Compose *com AttachInfo *ainfo; GtkTextBuffer *buffer; GtkClipboard *clipboard; + GSList *cur; compose_list = g_list_remove(compose_list, compose); @@ -5924,6 +5930,9 @@ static void compose_destroy(Compose *com address_completion_end(compose->window); #if USE_GTKSPELL + for (cur = compose->spell_dict_list; cur!=NULL; cur = cur->next) { + g_free((gchar*)cur->data); + } g_free(compose->spell_lang); #endif