使用gtk_menu_item_new_with_label生成的menuitem里面都有一个Label,直接取得其child设置即可
{
GtkMenuShell *menu;
GtkWidget *menuitem;
menuitem=gtk_menu_item_new_with_label("hello");
gtk_container_foreach (GTK_CONTAINER(menuitem), menu_set_text, NULL);
gtk_menu_shell_append(menu,menuitem);
gtk_widget_set_size_request (menuitem, 120, 35);
gtk_widget_show(menuitem);
gtk_menu_popup(GTK_MENU(menu), NULL, NULL, popmenu_set_position, NULL, ev->button, ev->time);
}
void menu_set_text(GtkWidget * w)
{
g_return_if_fail(w != NULL);
char *bold_text=NULL;
GtkLabel* label = GTK_LABEL(w);
g_return_if_fail(label != NULL);
bold_text = g_markup_printf_escaped ("<span weight=/"bold/">%s</span>", gtk_label_get_text (GTK_LABEL (w)));
gtk_label_set_markup (label, bold_text);
}