SF.net SVN: geany-plugins:[254] trunk/spellcheck

eht16 at users.sourceforge.net eht16 at xxxxx
Sat Oct 25 16:29:33 UTC 2008


Revision: 254
          http://geany-plugins.svn.sourceforge.net/geany-plugins/?rev=254&view=rev
Author:   eht16
Date:     2008-10-25 16:29:33 +0000 (Sat, 25 Oct 2008)

Log Message:
-----------
Add keybinding to toggle the 'Check while typing' setting.

Modified Paths:
--------------
    trunk/spellcheck/ChangeLog
    trunk/spellcheck/src/gui.c
    trunk/spellcheck/src/gui.h
    trunk/spellcheck/src/scplugin.c

Modified: trunk/spellcheck/ChangeLog
===================================================================
--- trunk/spellcheck/ChangeLog	2008-10-25 16:10:46 UTC (rev 253)
+++ trunk/spellcheck/ChangeLog	2008-10-25 16:29:33 UTC (rev 254)
@@ -12,6 +12,8 @@
    Rename the editor menu item to 'Spelling Suggestions'.
    When adding words to the dictionary, remove all indicators on
    these words.
+ * src/gui.c, src/gui.h, src/scplugin.c:
+   Add keybinding to toggle the 'Check while typing' setting.
 
 
 2008-10-17  Enrico Tröger  <enrico(dot)troeger(at)uvena(dot)de>

Modified: trunk/spellcheck/src/gui.c
===================================================================
--- trunk/spellcheck/src/gui.c	2008-10-25 16:10:46 UTC (rev 253)
+++ trunk/spellcheck/src/gui.c	2008-10-25 16:29:33 UTC (rev 254)
@@ -64,6 +64,15 @@
 }
 
 
+static void print_typing_changed_message(void)
+{
+	if (sc->check_while_typing)
+		p_ui->set_statusbar(FALSE, _("Spell checking while typing is now enabled"));
+	else
+		p_ui->set_statusbar(FALSE, _("Spell checking while typing is now disabled"));
+}
+
+
 static void toolbar_item_toggled_cb(GtkToggleToolButton *button, gpointer user_data)
 {
 	if (ignore_sc_callback)
@@ -71,8 +80,8 @@
 
 	sc->check_while_typing = gtk_toggle_tool_button_get_active(button);
 
-	p_ui->set_statusbar(FALSE, _("Spell checking while typing is now %s"),
-		(sc->check_while_typing) ? _("enabled") : _("disabled"));
+	print_typing_changed_message();
+
 }
 
 
@@ -334,12 +343,22 @@
 }
 
 
-void gui_kb_activate_cb(guint key_id)
+void gui_kb_run_activate_cb(guint key_id)
 {
 	menu_item_activate_cb(NULL, NULL);
 }
 
 
+void gui_kb_toggle_typing_activate_cb(guint key_id)
+{
+	sc->check_while_typing = ! sc->check_while_typing;
+
+	print_typing_changed_message();
+
+	gui_toolbar_update();
+}
+
+
 void gui_create_edit_menu(void)
 {
 	GtkWidget *image;

Modified: trunk/spellcheck/src/gui.h
===================================================================
--- trunk/spellcheck/src/gui.h	2008-10-25 16:10:46 UTC (rev 253)
+++ trunk/spellcheck/src/gui.h	2008-10-25 16:29:33 UTC (rev 254)
@@ -33,8 +33,9 @@
 
 gboolean gui_key_release_cb(GtkWidget *widget, GdkEventKey *ev, gpointer user_data);
 
-void gui_kb_activate_cb(guint key_id);
+void gui_kb_run_activate_cb(guint key_id);
 
+void gui_kb_toggle_typing_activate_cb(guint key_id);
 
 void gui_create_edit_menu(void);
 

Modified: trunk/spellcheck/src/scplugin.c
===================================================================
--- trunk/spellcheck/src/scplugin.c	2008-10-25 16:10:46 UTC (rev 253)
+++ trunk/spellcheck/src/scplugin.c	2008-10-25 16:29:33 UTC (rev 254)
@@ -68,6 +68,7 @@
 enum
 {
 	KB_SPELL_CHECK,
+	KB_SPELL_TOOGLE_TYPING,
 	KB_COUNT
 };
 PLUGIN_KEY_GROUP(spellcheck, KB_COUNT)
@@ -222,8 +223,11 @@
 		"key-release-event", G_CALLBACK(gui_key_release_cb), NULL);
 
 	/* setup keybindings */
-	p_keybindings->set_item(plugin_key_group, KB_SPELL_CHECK, gui_kb_activate_cb,
+	p_keybindings->set_item(plugin_key_group, KB_SPELL_CHECK, gui_kb_run_activate_cb,
 		0, 0, "spell_check", _("Run Spell Check"), NULL);
+	p_keybindings->set_item(plugin_key_group, KB_SPELL_TOOGLE_TYPING,
+		gui_kb_toggle_typing_activate_cb, 0, 0, "spell_toggle_typing",
+		_("Toggle Check While Typing"), NULL);
 }
 
 


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.



More information about the Plugins-Commits mailing list