>From 74bfbdd37a51c1ec1a9fa6540cb5bfcb07dc69c7 Mon Sep 17 00:00:00 2001 From: Leonardo Robol Date: Wed, 24 Sep 2014 10:33:06 +0200 Subject: [PATCH] Added the possibility to configure the languages used by the spell checker. --- desktop/org.yorba.geary.gschema.xml | 5 +++ src/client/application/geary-config.vala | 12 +++++++ src/client/composer/webview-edit-fixer.vala | 2 ++ src/client/dialogs/preferences-dialog.vala | 1 + ui/preferences.glade | 52 +++++++++++++++++++++++++---- 5 files changed, 66 insertions(+), 6 deletions(-) diff --git a/desktop/org.yorba.geary.gschema.xml b/desktop/org.yorba.geary.gschema.xml index b619d13..8992cf1 100644 --- a/desktop/org.yorba.geary.gschema.xml +++ b/desktop/org.yorba.geary.gschema.xml @@ -49,6 +49,11 @@ enable inline spell checking True to spell check while typing. + + "en_US" + Languages that shall be used in the spell checker + A comma separated list of the languages to use in the spell checker + true enable notification sounds diff --git a/src/client/application/geary-config.vala b/src/client/application/geary-config.vala index 2e84304..45b4cc6 100644 --- a/src/client/application/geary-config.vala +++ b/src/client/application/geary-config.vala @@ -19,11 +19,14 @@ public class Configuration { public const string STARTUP_NOTIFICATIONS_KEY = "startup-notifications"; public const string ASK_OPEN_ATTACHMENT_KEY = "ask-open-attachment"; public const string COMPOSE_AS_HTML_KEY = "compose-as-html"; + public const string SPELL_CHECK_LANGUAGES = "spell-check-languages"; public Settings settings { get; private set; } public Settings gnome_interface; private Settings? indicator_datetime; + + private string? _spell_check_languages = null; public int window_width { get { return settings.get_int(WINDOW_WIDTH_KEY); } @@ -57,6 +60,15 @@ public class Configuration { get { return settings.get_boolean(SPELL_CHECK_KEY); } } + private weak string _get_spell_check_languages() { + _spell_check_languages = settings.get_string(SPELL_CHECK_LANGUAGES); + return _spell_check_languages; + } + + public string spell_check_languages { + get { return _get_spell_check_languages(); } + } + public bool play_sounds { get { return settings.get_boolean(PLAY_SOUNDS_KEY); } } diff --git a/src/client/composer/webview-edit-fixer.vala b/src/client/composer/webview-edit-fixer.vala index ba1476f..afd2f52 100644 --- a/src/client/composer/webview-edit-fixer.vala +++ b/src/client/composer/webview-edit-fixer.vala @@ -27,6 +27,8 @@ public class WebViewEditFixer { this.web_view = web_view; this.web_view.should_insert_text.connect(on_should_insert_text); this.web_view.key_press_event.connect(on_key_press_event); + this.web_view.settings.set_property("spell-checking-languages", + GearyApplication.instance.config.spell_check_languages); } ~WebViewEditFixer() { diff --git a/src/client/dialogs/preferences-dialog.vala b/src/client/dialogs/preferences-dialog.vala index 30fb0d7..bd27c03 100644 --- a/src/client/dialogs/preferences-dialog.vala +++ b/src/client/dialogs/preferences-dialog.vala @@ -22,6 +22,7 @@ public class PreferencesDialog : Object { config.bind(Configuration.PLAY_SOUNDS_KEY, builder.get_object("play_sounds"), "active"); config.bind(Configuration.SHOW_NOTIFICATIONS_KEY, builder.get_object("show_notifications"), "active"); config.bind(Configuration.STARTUP_NOTIFICATIONS_KEY, builder.get_object("startup_notifications"), "active"); + config.bind(Configuration.SPELL_CHECK_LANGUAGES, builder.get_object("spell_check_languages"), "text"); } public void run() { diff --git a/ui/preferences.glade b/ui/preferences.glade index 2342747..5963a79 100644 --- a/ui/preferences.glade +++ b/ui/preferences.glade @@ -1,13 +1,14 @@ + - + False 5 + Preferences center-on-parent dialog False - Preferences False @@ -163,7 +164,7 @@ 0 - 6 + 7 1 1 @@ -184,7 +185,7 @@ 0 - 7 + 8 1 1 @@ -205,7 +206,7 @@ 0 - 8 + 9 1 1 @@ -226,7 +227,46 @@ 0 - 9 + 10 + 1 + 1 + + + + + True + False + + + True + False + 12 + 5 + 5 + 5 + Spell checking languages + + + False + True + 0 + + + + + True + True + + + False + True + 1 + + + + + 0 + 6 1 1 -- 1.9.1