在gtk 2.0教程中有一个制作菜单的例子,菜单如下:
static GtkItemFactoryEntry menu_items[] = {
{ "/_File", NULL, NULL, 0, "<Branch>" },
{ "/File/_New", "<control>N", print_hello, 0, NULL },
{ "/File/_Open", "<control>O", print_hello, 0, NULL },
{ "/File/_Save", "<control>S", print_hello, 0, NULL },
{ "/File/Save _As", NULL, NULL, 0, NULL },
{ "/File/FANRJ", NULL, NULL, 0, NULL },
{ "/File/sep1", NULL, NULL, 0, "<Separator>" },
{ "/File/Quit", "<control>Q", gtk_main_quit, 0, NULL },
{ "/_Options", NULL, NULL, 0, "<Branch>" },
{ "/Options/Test", NULL, NULL, 0, NULL },
{"/姓名", NULL, NULL, 0, "<Branch>" },
{ "/_Help", NULL, NULL, 0, "<LastBranch>" },
{ "/_Help/About", NULL, NULL, 0, NULL },
};
我想让菜单以中文的形式显示(如下),但是中文不能显示,我用
{strcat("/",g_locale_to_utf8("姓名",4,NULL,NULL,NULL)) NULL, NULL, 0, "<Branch>" },代替 {"/姓名", NULL, NULL, 0, "<Branch>" },
还是有错,请各位有经验的朋友帮忙看看!谢谢! |