[latexila/wip/gspell] spell: add a gsetting for the default language
- From: Sébastien Wilmet <swilmet src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [latexila/wip/gspell] spell: add a gsetting for the default language
- Date: Tue, 15 Sep 2015 13:05:43 +0000 (UTC)
commit 23957d81d6f9795a9d2dda2b3435f3fd1812c359
Author: Sébastien Wilmet <swilmet gnome org>
Date: Tue Sep 15 14:52:29 2015 +0200
spell: add a gsetting for the default language
The two gsettings will be added to the preferences dialog in a later
commit.
data/org.gnome.latexila.gschema.xml.in | 6 ++++++
src/document_view.vala | 7 ++++++-
2 files changed, 12 insertions(+), 1 deletions(-)
---
diff --git a/data/org.gnome.latexila.gschema.xml.in b/data/org.gnome.latexila.gschema.xml.in
index 068e130..cf2c0ff 100644
--- a/data/org.gnome.latexila.gschema.xml.in
+++ b/data/org.gnome.latexila.gschema.xml.in
@@ -82,6 +82,12 @@
<key name="highlight-misspelled-words" type="b">
<default>false</default>
<summary>Highlight Misspelled Words</summary>
+ <description>Whether misspelled words are highlighted by default.</description>
+ </key>
+ <key name="spell-checking-language" type="s">
+ <default>''</default>
+ <summary>Spell Checking Language</summary>
+ <description>The default language used for the spell checking. Set to the empty string to take the
best language available based on the environment.</description>
</key>
</schema>
diff --git a/src/document_view.vala b/src/document_view.vala
index 63b6fe9..4785de0 100644
--- a/src/document_view.vala
+++ b/src/document_view.vala
@@ -96,7 +96,12 @@ public class DocumentView : Gtk.SourceView
}
// spell checking
- _spell_checker = new Gspell.Checker (null);
+ unowned Gspell.Language? lang = null;
+ string lang_key = _editor_settings.get_string ("spell-checking-language");
+ if (lang_key[0] != '\0')
+ lang = Gspell.Language.from_key (lang_key);
+
+ _spell_checker = new Gspell.Checker (lang);
if (_editor_settings.get_boolean ("highlight-misspelled-words"))
activate_inline_spell_checker ();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]