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

eht16 at users.sourceforge.net eht16 at xxxxx
Fri Apr 17 13:28:06 UTC 2009


Revision: 592
          http://geany-plugins.svn.sourceforge.net/geany-plugins/?rev=592&view=rev
Author:   eht16
Date:     2009-04-17 13:28:06 +0000 (Fri, 17 Apr 2009)

Log Message:
-----------
Show the currently used language in the toolbutton tooltip.

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	2009-04-17 13:16:02 UTC (rev 591)
+++ trunk/spellcheck/ChangeLog	2009-04-17 13:28:06 UTC (rev 592)
@@ -4,6 +4,7 @@
    List the available languages in the Tools menu as radio items
    to easily indicate which language is currently in use.
    Show the default language also next to the 'Default' menu item.
+   Show the currently used language in the toolbutton tooltip.
 
 
 2009-03-05  Enrico Tröger  <enrico(dot)troeger(at)uvena(dot)de>

Modified: trunk/spellcheck/src/gui.c
===================================================================
--- trunk/spellcheck/src/gui.c	2009-04-17 13:16:02 UTC (rev 591)
+++ trunk/spellcheck/src/gui.c	2009-04-17 13:28:06 UTC (rev 592)
@@ -81,6 +81,21 @@
 }
 
 
+void sc_gui_update_tooltip(void)
+{
+#if GTK_CHECK_VERSION(2, 12, 0)
+	if (sc_info->toolbar_button != NULL)
+	{
+		gchar *text = g_strdup_printf(
+			_("Toggle spell check while typing (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);
+	}
+#endif
+}
+
+
 void sc_gui_toolbar_update(void)
 {
 	/* toolbar item is not requested, so remove the item if it exists */
@@ -96,10 +111,8 @@
 		if (sc_info->toolbar_button == NULL)
 		{
 			sc_info->toolbar_button = gtk_toggle_tool_button_new_from_stock(GTK_STOCK_SPELL_CHECK);
-#if GTK_CHECK_VERSION(2, 12, 0)
-			gtk_tool_item_set_tooltip_text(GTK_TOOL_ITEM(sc_info->toolbar_button),
-				_("Toggle spell check while typing"));
-#endif
+			sc_gui_update_tooltip();
+
 			plugin_add_toolbar_item(geany_plugin, sc_info->toolbar_button);
 			ui_add_document_sensitive(GTK_WIDGET(sc_info->toolbar_button));
 
@@ -415,6 +428,7 @@
 	{
 		setptr(sc_info->default_language, g_strdup(gdata));
 		sc_speller_reinit_enchant_dict();
+		sc_gui_update_tooltip();
 	}
 
 	editor_indicator_clear(doc->editor, GEANY_INDICATOR_ERROR);

Modified: trunk/spellcheck/src/gui.h
===================================================================
--- trunk/spellcheck/src/gui.h	2009-04-17 13:16:02 UTC (rev 591)
+++ trunk/spellcheck/src/gui.h	2009-04-17 13:28:06 UTC (rev 592)
@@ -50,6 +50,8 @@
 
 void sc_gui_update_menu(void);
 
+void sc_gui_update_tooltip(void);
+
 void sc_gui_init(void);
 
 void sc_gui_free(void);

Modified: trunk/spellcheck/src/scplugin.c
===================================================================
--- trunk/spellcheck/src/scplugin.c	2009-04-17 13:16:02 UTC (rev 591)
+++ trunk/spellcheck/src/scplugin.c	2009-04-17 13:28:06 UTC (rev 592)
@@ -117,6 +117,7 @@
 		setptr(sc_info->default_language, gtk_combo_box_get_active_text(GTK_COMBO_BOX(
 			g_object_get_data(G_OBJECT(dialog), "combo"))));
 		sc_speller_reinit_enchant_dict();
+		sc_gui_update_tooltip();
 
 		sc_info->check_while_typing = (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(
 			g_object_get_data(G_OBJECT(dialog), "check_type"))));


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