Commit 45662cb0 authored by alex@webkit.org's avatar alex@webkit.org

2010-12-10 Alejandro G. Castro <alex@igalia.com>

        Reviewed by Martin Robinson.

        [GTK] Choose a dictionary in case there is no one defined or the
        env LANG does not propose one
        https://bugs.webkit.org/show_bug.cgi?id=50738

        In case no dict is set and we can not find one using the
        environment just get the first dictionary installed in the list.

        * webkit/webkitwebsettings.cpp:
        (getAvilableDictionariesCallback):
        (webkit_web_settings_set_property):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@73737 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent fbb324b3
2010-12-10 Alejandro G. Castro <alex@igalia.com>
Reviewed by Martin Robinson.
[GTK] Choose a dictionary in case there is no one defined or the
env LANG does not propose one
https://bugs.webkit.org/show_bug.cgi?id=50738
In case no dict is set and we can not find one using the
environment just get the first dictionary installed in the list.
* webkit/webkitwebsettings.cpp:
(getAvilableDictionariesCallback):
(webkit_web_settings_set_property):
2010-12-10 Martin Robinson <mrobinson@igalia.com>
Reviewed by Gustavo Noronha Silva.
......
......@@ -961,6 +961,13 @@ static void webkit_web_settings_finalize(GObject* object)
G_OBJECT_CLASS(webkit_web_settings_parent_class)->finalize(object);
}
static void getAvilableDictionariesCallback(const char* const languageTag, const char* const, const char* const, const char* const, void* data)
{
Vector<CString>* dicts = static_cast<Vector<CString>*>(data);
dicts->append(languageTag);
}
static void webkit_web_settings_set_property(GObject* object, guint prop_id, const GValue* value, GParamSpec* pspec)
{
WebKitWebSettings* web_settings = WEBKIT_WEB_SETTINGS(object);
......@@ -1075,6 +1082,14 @@ static void webkit_web_settings_set_property(GObject* object, guint prop_id, con
if (enchant_broker_dict_exists(broker, language)) {
dict = enchant_broker_request_dict(broker, language);
spellDictionaries = g_slist_append(spellDictionaries, dict);
} else {
// No dictionaries selected, we get one from the list
Vector<CString> allDictionaries;
enchant_broker_list_dicts(broker, getAvilableDictionariesCallback, &allDictionaries);
if (!allDictionaries.isEmpty()) {
dict = enchant_broker_request_dict(broker, allDictionaries[0].data());
spellDictionaries = g_slist_append(spellDictionaries, dict);
}
}
}
g_slist_foreach(priv->enchant_dicts, free_spell_checking_language, 0);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment