Revision 2022 src/compose.c
| compose.c (revision 2022) | ||
|---|---|---|
| 69 | 69 |
#if USE_GTKSPELL |
| 70 | 70 |
# include <gtk/gtkradiomenuitem.h> |
| 71 | 71 |
# include <gtkspell/gtkspell.h> |
| 72 |
#if USE_ENCHANT |
|
| 73 |
# include <enchant/enchant.h> |
|
| 74 |
#else |
|
| 72 | 75 |
# include <aspell.h> |
| 73 | 76 |
#endif |
| 77 |
#endif |
|
| 74 | 78 |
|
| 75 | 79 |
#include <stdio.h> |
| 76 | 80 |
#include <stdlib.h> |
| ... | ... | |
| 5732 | 5736 |
} |
| 5733 | 5737 |
|
| 5734 | 5738 |
#if USE_GTKSPELL |
| 5739 |
#if USE_ENCHANT |
|
| 5740 |
static void ench_dict_desc_cb(const char *const lang_tag, |
|
| 5741 |
const char *const provider_name, |
|
| 5742 |
const char *const provider_desc, |
|
| 5743 |
const char *const provider_file, |
|
| 5744 |
void *user_data) |
|
| 5745 |
{
|
|
| 5746 |
GSList **dict_list = (GSList **)user_data; |
|
| 5747 |
*dict_list = g_slist_append(*dict_list, g_strdup((gchar*)lang_tag)); |
|
| 5748 |
} |
|
| 5749 |
|
|
| 5735 | 5750 |
static void compose_set_spell_lang_menu(Compose *compose) |
| 5736 | 5751 |
{
|
| 5752 |
EnchantBroker *eb; |
|
| 5753 |
GSList *dict_list = NULL, *menu_list = NULL, *cur; |
|
| 5754 |
GtkWidget *menu; |
|
| 5755 |
gboolean lang_set = FALSE; |
|
| 5756 |
|
|
| 5757 |
eb = enchant_broker_init(); |
|
| 5758 |
enchant_broker_list_dicts(eb, ench_dict_desc_cb, &dict_list); |
|
| 5759 |
enchant_broker_free(eb); |
|
| 5760 |
|
|
| 5761 |
for (cur = dict_list; cur != NULL; cur = cur->next) {
|
|
| 5762 |
if (compose->spell_lang != NULL && |
|
| 5763 |
g_ascii_strcasecmp(compose->spell_lang, cur->data) == 0) |
|
| 5764 |
lang_set = TRUE; |
|
| 5765 |
} |
|
| 5766 |
#else /* !USE_ENCHANT */ |
|
| 5767 |
static void compose_set_spell_lang_menu(Compose *compose) |
|
| 5768 |
{
|
|
| 5737 | 5769 |
AspellConfig *config; |
| 5738 | 5770 |
AspellDictInfoList *dlist; |
| 5739 | 5771 |
AspellDictInfoEnumeration *dels; |
| ... | ... | |
| 5754 | 5786 |
lang_set = TRUE; |
| 5755 | 5787 |
} |
| 5756 | 5788 |
delete_aspell_dict_info_enumeration(dels); |
| 5789 |
#endif /* USE_ENCHANT */ |
|
| 5757 | 5790 |
|
| 5758 | 5791 |
menu = gtk_menu_new(); |
| 5759 | 5792 |
|
| ... | ... | |
| 5782 | 5815 |
(GTK_CHECK_MENU_ITEM(item), TRUE); |
| 5783 | 5816 |
} |
| 5784 | 5817 |
|
| 5818 |
#if USE_ENCHANT |
|
| 5819 |
slist_free_strings(dict_list); |
|
| 5820 |
#endif |
|
| 5821 |
g_slist_free(dict_list); |
|
| 5822 |
|
|
| 5785 | 5823 |
gtk_widget_show(menu); |
| 5786 | 5824 |
gtk_menu_item_set_submenu(GTK_MENU_ITEM(compose->spell_menu), menu); |
| 5787 | 5825 |
} |
| 5788 |
#endif |
|
| 5826 |
#endif /* USE_GTKSPELL */
|
|
| 5789 | 5827 |
|
| 5790 | 5828 |
static void compose_set_template_menu(Compose *compose) |
| 5791 | 5829 |
{
|
Also available in: Unified diff