[geany/geany-plugins] aaac91: Merge pull request #1161 from eht16/issue1158_sync_toggle_via_keybinding_and_button
Enrico Tröger
git-noreply at geany.org
Sun Apr 3 12:10:44 UTC 2022
Branch: refs/heads/master
Author: Enrico Tröger <enrico.troeger at uvena.de>
Committer: GitHub <noreply at github.com>
Date: Sun, 03 Apr 2022 12:10:44 UTC
Commit: aaac91d54eaed154899daba3f259b0196529dadf
https://github.com/geany/geany-plugins/commit/aaac91d54eaed154899daba3f259b0196529dadf
Log Message:
-----------
Merge pull request #1161 from eht16/issue1158_sync_toggle_via_keybinding_and_button
SpellCheck: Sync toggle via keybinding and button
Modified Paths:
--------------
spellcheck/src/gui.c
spellcheck/src/scplugin.c
Modified: spellcheck/src/gui.c
37 lines changed, 17 insertions(+), 20 deletions(-)
===================================================================
@@ -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();
}
Modified: spellcheck/src/scplugin.c
6 lines changed, 3 insertions(+), 3 deletions(-)
===================================================================
@@ -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"));
--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).
More information about the Plugins-Commits
mailing list