Revision: 646 http://geany-plugins.svn.sourceforge.net/geany-plugins/?rev=646&view=rev Author: eht16 Date: 2009-05-14 19:55:43 +0000 (Thu, 14 May 2009)
Log Message: ----------- Update the label of the "Default" menu item if the default language has been changed.
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-05-13 22:30:50 UTC (rev 645) +++ trunk/spellcheck/ChangeLog 2009-05-14 19:55:43 UTC (rev 646) @@ -1,3 +1,10 @@ +2009-05-14 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de> + + * src/gui.c, src/scplugin.c, src/gui.h: + Update the label of the "Default" menu item if the default language + has been changed. + + 2009-05-02 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de>
* src/gui.c:
Modified: trunk/spellcheck/src/gui.c =================================================================== --- trunk/spellcheck/src/gui.c 2009-05-13 22:30:50 UTC (rev 645) +++ trunk/spellcheck/src/gui.c 2009-05-14 19:55:43 UTC (rev 646) @@ -83,16 +83,6 @@
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 }
@@ -411,6 +401,30 @@ }
+static void update_labels(void) +{ + gchar *label; + + label = g_strdup_printf(_("Default (%s)"), + (sc_info->default_language != NULL) ? sc_info->default_language : _("unknown")); + + gtk_menu_item_set_label(GTK_MENU_ITEM(sc_info->submenu_item_default), label); + + g_free(label); + +#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 +} + + static void menu_item_toggled_cb(GtkCheckMenuItem *menuitem, gpointer gdata) { GeanyDocument *doc; @@ -431,7 +445,7 @@ { setptr(sc_info->default_language, g_strdup(gdata)); sc_speller_reinit_enchant_dict(); - sc_gui_update_tooltip(); + update_labels(); }
editor_indicator_clear(doc->editor, GEANY_INDICATOR_ERROR); @@ -493,6 +507,8 @@ } } sc_ignore_callback = FALSE; + + update_labels(); }
@@ -508,13 +524,13 @@ menu = gtk_menu_new(); gtk_menu_item_set_submenu(GTK_MENU_ITEM(sp_item), menu);
- label = g_strdup_printf(_("Default (%s)"), - (sc_info->default_language != NULL) ? sc_info->default_language : _("unknown")); - sc_info->submenu_item_default = gtk_menu_item_new_with_label(label); + sc_info->submenu_item_default = gtk_menu_item_new(); gtk_container_add(GTK_CONTAINER(menu), sc_info->submenu_item_default); - g_signal_connect(sc_info->submenu_item_default, "activate", G_CALLBACK(menu_item_toggled_cb), NULL); - g_free(label); + g_signal_connect(sc_info->submenu_item_default, "activate", + G_CALLBACK(menu_item_toggled_cb), NULL);
+ update_labels(); + menu_item = gtk_separator_menu_item_new(); gtk_container_add(GTK_CONTAINER(menu), menu_item);
Modified: trunk/spellcheck/src/gui.h =================================================================== --- trunk/spellcheck/src/gui.h 2009-05-13 22:30:50 UTC (rev 645) +++ trunk/spellcheck/src/gui.h 2009-05-14 19:55:43 UTC (rev 646) @@ -47,8 +47,6 @@
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-05-13 22:30:50 UTC (rev 645) +++ trunk/spellcheck/src/scplugin.c 2009-05-14 19:55:43 UTC (rev 646) @@ -117,7 +117,6 @@ 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.