diff --git a/src/client/geary-config.vala b/src/client/geary-config.vala index ec15ed26..71cb756e 100644 --- a/src/client/geary-config.vala +++ b/src/client/geary-config.vala @@ -6,6 +6,9 @@ // Wrapper class for GSettings. public class Configuration { + public signal void display_preview_changed(); + public signal void spell_check_changed(); + private Settings settings; private Settings gnome_interface; private Settings? indicator_datetime; @@ -49,10 +52,21 @@ public class Configuration { private const string DISPLAY_PREVIEW_NAME = "display-preview"; public bool display_preview { get { return settings.get_boolean(DISPLAY_PREVIEW_NAME); } - set { settings.set_boolean(DISPLAY_PREVIEW_NAME, value); display_preview_changed(); } + set { + settings.set_boolean(DISPLAY_PREVIEW_NAME, value); + display_preview_changed(); + } } - public signal void display_preview_changed(); - + + private const string SPELL_CHECK_NAME = "spell-check"; + public bool spell_check { + get { return settings.get_boolean(SPELL_CHECK_NAME); } + set { + settings.set_boolean(SPELL_CHECK_NAME, value); + spell_check_changed(); + } + } + private const string CLOCK_FORMAT_NAME = "clock-format"; private const string TIME_FORMAT_NAME = "time-format"; public Date.ClockFormat clock_format { diff --git a/src/client/org.yorba.geary.gschema.xml b/src/client/org.yorba.geary.gschema.xml index e2e40700..f1e8573c 100644 --- a/src/client/org.yorba.geary.gschema.xml +++ b/src/client/org.yorba.geary.gschema.xml @@ -44,6 +44,12 @@ True if we should display a short preview of each message. + + true + enable inline spell checking + True to spell check while typing. + + diff --git a/src/client/ui/composer-window.vala b/src/client/ui/composer-window.vala index 5cd538cc..b67879b1 100644 --- a/src/client/ui/composer-window.vala +++ b/src/client/ui/composer-window.vala @@ -180,8 +180,10 @@ public class ComposerWindow : Gtk.Window { editor.navigation_policy_decision_requested.connect(on_navigation_policy_decision_requested); editor.new_window_policy_decision_requested.connect(on_navigation_policy_decision_requested); + GearyApplication.instance.config.spell_check_changed.connect(on_spell_check_changed); + WebKit.WebSettings s = new WebKit.WebSettings(); - s.enable_spell_checking = true; + s.enable_spell_checking = GearyApplication.instance.config.spell_check; s.auto_load_images = false; s.enable_default_context_menu = true; s.enable_scripts = false; @@ -380,6 +382,10 @@ public class ComposerWindow : Gtk.Window { message_overlay_label.label = url; } + private void on_spell_check_changed() { + editor.settings.enable_spell_checking = GearyApplication.instance.config.spell_check; + } + public override bool key_press_event(Gdk.EventKey event) { bool handled = true; diff --git a/src/client/ui/preferences-dialog.vala b/src/client/ui/preferences-dialog.vala index e9c071da..67115014 100644 --- a/src/client/ui/preferences-dialog.vala +++ b/src/client/ui/preferences-dialog.vala @@ -8,6 +8,7 @@ public class PreferencesDialog : Object { private Gtk.Dialog dialog; private Gtk.CheckButton autoselect; private Gtk.CheckButton display_preview; + private Gtk.CheckButton spell_check; private Gtk.Button close_button; private Configuration config; @@ -19,15 +20,18 @@ public class PreferencesDialog : Object { dialog = builder.get_object("dialog") as Gtk.Dialog; autoselect = builder.get_object("autoselect") as Gtk.CheckButton; display_preview = builder.get_object("display_preview") as Gtk.CheckButton; + spell_check = builder.get_object("spell_check") as Gtk.CheckButton; close_button = builder.get_object("close_button") as Gtk.Button; // Populate the dialog with our current settings. autoselect.active = config.autoselect; display_preview.active = config.display_preview; + spell_check.active = config.spell_check; // Connect to element signals. autoselect.toggled.connect(on_autoselect_toggled); display_preview.toggled.connect(on_display_preview_toggled); + spell_check.toggled.connect(on_spell_check_toggled); GearyApplication.instance.exiting.connect(on_exit); } @@ -49,4 +53,9 @@ public class PreferencesDialog : Object { private void on_display_preview_toggled() { config.display_preview = display_preview.active; } + + private void on_spell_check_toggled() { + config.spell_check = spell_check.active; + } } + diff --git a/ui/preferences.glade b/ui/preferences.glade index 392da691..5aee5ef9 100644 --- a/ui/preferences.glade +++ b/ui/preferences.glade @@ -4,7 +4,6 @@ False 5 - False center-on-parent dialog False @@ -105,7 +104,7 @@ 0 - 3 + 2 1 1 @@ -126,6 +125,26 @@ 0 True + + 0 + 3 + 1 + 1 + + + + + True + False + 5 + 5 + 5 + 0 + Composer + + + + 0 4 @@ -134,7 +153,27 @@ - + + _Spell check while typing + False + True + True + False + 12 + 5 + 5 + 5 + False + True + 0 + True + + + 0 + 5 + 1 + 1 +