tgtk_menu_item_set_text now works properly if called after the menu item has been realized (i.e. the Spy, Tipoff and Sack Bitch menu items are now updated properly). - vaccinewars - be a doctor and try to vaccinate the world
(HTM) git clone git://src.adamsgaard.dk/vaccinewars
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) README
(DIR) LICENSE
---
(DIR) commit 4687e3b7de9fb80a030de1ba1144530b4a95454f
(DIR) parent c244c6f39dd6bd1f95524e613dcaa8a46831a2f3
(HTM) Author: Ben Webb <ben@salilab.org>
Date: Fri, 5 Apr 2002 13:44:24 +0000
gtk_menu_item_set_text now works properly if called after the menu item
has been realized (i.e. the Spy, Tipoff and Sack Bitch menu items are now
updated properly).
Diffstat:
M src/gtkport/gtkport.c | 14 ++++++++++++++
1 file changed, 14 insertions(+), 0 deletions(-)
---
(DIR) diff --git a/src/gtkport/gtkport.c b/src/gtkport/gtkport.c
t@@ -4711,6 +4711,7 @@ void gtk_button_set_text(GtkButton *button, gchar *text)
static void gtk_menu_item_set_text(GtkMenuItem *menuitem, gchar *text)
{
gint i;
+ GtkWidget *widget = GTK_WIDGET(menuitem);
g_free(menuitem->text);
menuitem->text = g_strdup(text ? text : "");
t@@ -4718,6 +4719,19 @@ static void gtk_menu_item_set_text(GtkMenuItem *menuitem, gchar *text)
if (menuitem->text[i] == '_')
menuitem->text[i] = '&';
}
+
+ if (GTK_WIDGET_REALIZED(widget)) {
+ MENUITEMINFO mii;
+ HMENU parent_menu;
+
+ parent_menu = GTK_MENU_SHELL(widget->parent)->menu;
+ mii.cbSize = sizeof(MENUITEMINFO);
+ mii.fMask = MIIM_TYPE;
+ mii.fType = MFT_STRING;
+ mii.dwTypeData = (LPTSTR)menuitem->text;
+ mii.cch = strlen(menuitem->text);
+ SetMenuItemInfo(parent_menu, menuitem->ID, FALSE, &mii);
+ }
}
guint gtk_label_parse_uline(GtkLabel *label, const gchar *str)