Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 158663 | Differences between
and this patch

Collapse All | Expand All

(-)sylpheed-2.3.0.orig/src/compose.c (-23 / +33 lines)
Lines 64-70 Link Here
64
#if USE_GTKSPELL
64
#if USE_GTKSPELL
65
#  include <gtk/gtkradiomenuitem.h>
65
#  include <gtk/gtkradiomenuitem.h>
66
#  include <gtkspell/gtkspell.h>
66
#  include <gtkspell/gtkspell.h>
67
#  include <aspell.h>
67
#  include <enchant/enchant.h>
68
#endif
68
#endif
69
69
70
#include <stdio.h>
70
#include <stdio.h>
Lines 463-468 Link Here
463
					 GtkWidget	*widget);
463
					 GtkWidget	*widget);
464
static void compose_set_spell_lang_cb	(GtkWidget	*widget,
464
static void compose_set_spell_lang_cb	(GtkWidget	*widget,
465
					 gpointer	 data);
465
					 gpointer	 data);
466
static void compose_list_dicts_cb	(const char *lang_tag,
467
                     const char *provider_name, const char *provider_desc,
468
                     const char *provider_file, void *user_data);
466
#endif
469
#endif
467
470
468
static void compose_attach_drag_received_cb (GtkWidget		*widget,
471
static void compose_attach_drag_received_cb (GtkWidget		*widget,
Lines 5036-5068 Link Here
5036
}
5039
}
5037
5040
5038
#if USE_GTKSPELL
5041
#if USE_GTKSPELL
5042
static void compose_list_dicts_cb(const char *lang_tag,
5043
                const char *provider_name, const char *provider_desc,
5044
                const char *provider_file, void *user_data)
5045
{
5046
    GQueue *queue = (GQueue *)user_data;
5047
    
5048
    if (g_queue_index(queue, (gconstpointer)lang_tag) == -1) {
5049
        g_queue_push_tail(queue, g_strdup(lang_tag));
5050
5051
    }
5052
}
5053
5039
static void compose_set_spell_lang_menu(Compose *compose)
5054
static void compose_set_spell_lang_menu(Compose *compose)
5040
{
5055
{
5041
	AspellConfig *config;
5056
    EnchantBroker *broker;
5042
	AspellDictInfoList *dlist;
5057
    GQueue *langs;
5043
	AspellDictInfoEnumeration *dels;
5044
	const AspellDictInfo *entry;
5045
	GSList *dict_list = NULL, *menu_list = NULL, *cur;
5058
	GSList *dict_list = NULL, *menu_list = NULL, *cur;
5046
	GtkWidget *menu;
5059
	GtkWidget *menu;
5047
	gboolean lang_set = FALSE;
5060
	gboolean lang_set = FALSE;
5048
5061
5049
	config = new_aspell_config();
5062
    broker = enchant_broker_init();
5050
	dlist = get_aspell_dict_info_list(config);
5063
    langs = g_queue_new();
5051
	delete_aspell_config(config);
5064
    enchant_broker_list_dicts(broker, compose_list_dicts_cb, langs);
5052
5065
    enchant_broker_free(broker);
5053
	dels = aspell_dict_info_list_elements(dlist);
5054
	while ((entry = aspell_dict_info_enumeration_next(dels)) != 0) {
5055
		dict_list = g_slist_append(dict_list, (gchar *)entry->name);
5056
		if (compose->spell_lang != NULL &&
5057
		    g_ascii_strcasecmp(compose->spell_lang, entry->name) == 0)
5058
			lang_set = TRUE;
5059
	}
5060
	delete_aspell_dict_info_enumeration(dels);
5061
5066
5062
	menu = gtk_menu_new();
5067
	menu = gtk_menu_new();
5063
5068
    
5064
	for (cur = dict_list; cur != NULL; cur = cur->next) {
5069
    while (g_queue_get_length(langs) > 0) {
5065
		gchar *dict = (gchar *)cur->data;
5070
        gchar *dict = g_queue_pop_head(langs);
5066
		GtkWidget *item;
5071
		GtkWidget *item;
5067
5072
5068
		if (dict == NULL) continue;
5073
		if (dict == NULL) continue;
Lines 5072-5084 Link Here
5072
			(GTK_RADIO_MENU_ITEM(item));
5077
			(GTK_RADIO_MENU_ITEM(item));
5073
		if (compose->spell_lang != NULL &&
5078
		if (compose->spell_lang != NULL &&
5074
		    g_ascii_strcasecmp(compose->spell_lang, dict) == 0)
5079
		    g_ascii_strcasecmp(compose->spell_lang, dict) == 0)
5075
			gtk_check_menu_item_set_active
5080
		{
5081
            gtk_check_menu_item_set_active
5076
				(GTK_CHECK_MENU_ITEM(item), TRUE);
5082
				(GTK_CHECK_MENU_ITEM(item), TRUE);
5077
		gtk_menu_shell_append(GTK_MENU_SHELL(menu), item);
5083
		    lang_set = TRUE;
5084
        }
5085
        gtk_menu_shell_append(GTK_MENU_SHELL(menu), item);
5078
		g_signal_connect(G_OBJECT(item), "activate",
5086
		g_signal_connect(G_OBJECT(item), "activate",
5079
				 G_CALLBACK(compose_set_spell_lang_cb),
5087
				 G_CALLBACK(compose_set_spell_lang_cb),
5080
				 compose);     
5088
				 compose);     
5081
		g_object_set_data(G_OBJECT(item), "spell-lang", dict);
5089
		g_object_set_data_full(G_OBJECT(item), "spell-lang", dict, g_free);
5082
		gtk_widget_show(item);
5090
		gtk_widget_show(item);
5083
5091
5084
		if (!lang_set && g_ascii_strcasecmp("en", dict) == 0)
5092
		if (!lang_set && g_ascii_strcasecmp("en", dict) == 0)
Lines 5086-5091 Link Here
5086
				(GTK_CHECK_MENU_ITEM(item), TRUE);
5094
				(GTK_CHECK_MENU_ITEM(item), TRUE);
5087
	}
5095
	}
5088
5096
5097
    g_queue_free(langs);
5098
5089
	gtk_widget_show(menu);
5099
	gtk_widget_show(menu);
5090
	gtk_menu_item_set_submenu(GTK_MENU_ITEM(compose->spell_menu), menu);
5100
	gtk_menu_item_set_submenu(GTK_MENU_ITEM(compose->spell_menu), menu);
5091
}
5101
}

Return to bug 158663