diff --git a/spellcheck/src/gui.c b/spellcheck/src/gui.c index 2e249bbb6..3379ea582 100644 --- a/spellcheck/src/gui.c +++ b/spellcheck/src/gui.c @@ -70,8 +70,20 @@ static void clear_spellcheck_error_markers(GeanyDocument *doc) } -static void print_typing_changed_message(void) +static void perform_spell_check_toggle(void) { + /* force a rescan of the document if 'check while typing' has been turned on and clean + * errors if it has been turned off */ + GeanyDocument *doc = document_get_current(); + if (sc_info->check_while_typing) + { + perform_check(doc); + } + else + { + clear_spellcheck_error_markers(doc); + } + if (sc_info->check_while_typing) ui_set_statusbar(FALSE, _("Spell checking while typing is now enabled")); else @@ -81,27 +93,12 @@ static void print_typing_changed_message(void) static void toolbar_item_toggled_cb(GtkToggleToolButton *button, gpointer user_data) { - gboolean check_while_typing_changed, check_while_typing; - if (sc_ignore_callback) return; - check_while_typing = gtk_toggle_tool_button_get_active(button); - check_while_typing_changed = check_while_typing != sc_info->check_while_typing; - sc_info->check_while_typing = check_while_typing; + sc_info->check_while_typing = gtk_toggle_tool_button_get_active(button); - print_typing_changed_message(); - - /* force a rescan of the document if 'check while typing' has been turned on and clean - * errors if it has been turned off */ - if (check_while_typing_changed) - { - GeanyDocument *doc = document_get_current(); - if (sc_info->check_while_typing) - perform_check(doc); - else - clear_spellcheck_error_markers(doc); - } + perform_spell_check_toggle(); } @@ -617,7 +614,7 @@ static void update_labels(void) if (sc_info->toolbar_button != NULL) { gchar *text = g_strdup_printf( - _("Toggle spell check while typing (current language: %s)"), + _("Toggle spell check (current language: %s)"), (sc_info->default_language != NULL) ? sc_info->default_language : _("unknown")); gtk_tool_item_set_tooltip_text(GTK_TOOL_ITEM(sc_info->toolbar_button), text); g_free(text); @@ -664,7 +661,7 @@ void sc_gui_kb_toggle_typing_activate_cb(guint key_id) { sc_info->check_while_typing = ! sc_info->check_while_typing; - print_typing_changed_message(); + perform_spell_check_toggle(); sc_gui_update_toolbar(); } diff --git a/spellcheck/src/scplugin.c b/spellcheck/src/scplugin.c index 690557b19..33e0b6beb 100644 --- a/spellcheck/src/scplugin.c +++ b/spellcheck/src/scplugin.c @@ -222,10 +222,10 @@ void plugin_init(GeanyData *data) /* setup keybindings */ key_group = plugin_set_key_group(geany_plugin, "spellcheck", KB_COUNT, NULL); keybindings_set_item(key_group, KB_SPELL_CHECK, sc_gui_kb_run_activate_cb, - 0, 0, "spell_check", _("Run Spell Check"), sc_info->submenu_item_default); + 0, 0, "spell_check", _("Run spell check once"), sc_info->submenu_item_default); keybindings_set_item(key_group, KB_SPELL_TOOGLE_TYPING, sc_gui_kb_toggle_typing_activate_cb, 0, 0, "spell_toggle_typing", - _("Toggle Check While Typing"), NULL); + _("Toggle spell check"), NULL); } @@ -330,7 +330,7 @@ GtkWidget *plugin_configure(GtkDialog *dialog) gtk_box_pack_start(GTK_BOX(vbox), frame_interface, FALSE, FALSE, 3); - check_type = gtk_check_button_new_with_label(_("Check spelling while typing")); + check_type = gtk_check_button_new_with_label(_("Toggle spell check")); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(check_type), sc_info->check_while_typing); check_on_open = gtk_check_button_new_with_label(_("Check spelling when opening a document"));