uimanager popup problem...
- From: Enrico <enricoss tiscali it>
- To: gtk-app-devel-list gnome org
- Subject: uimanager popup problem...
- Date: Thu, 03 Aug 2006 00:10:23 +0200
Hi at all!
I've tried to make a popup menu with uimanager but it doesn't show
nothing...where is the mistake? This is part of the code...
static const char *ui_description =
"<ui>"
" <popmenu name='MainMenu'>"
" <menuitem action='Open'/>"
" <menuitem action='Exit'/>"
" </popmenu>"
"</ui>";
static const GtkActionEntry entries[] = {
{ "MainMenu", NULL, "_File" },
{ "Open", GTK_STOCK_OPEN, "_Open", "<control>O", "Open a file", NULL },
{ "Exit", GTK_STOCK_QUIT, "E_xit", "<control>Q", "Exit the program",
NULL }
};
void get_menu_contestuale2 (void)
{
GtkWidget *popup;
GtkActionGroup *action_group;
GtkUIManager *ui_manager;
action_group = gtk_action_group_new ("MenuActions");
gtk_action_group_add_actions (action_group, entries, G_N_ELEMENTS
(entries), NULL);
ui_manager = gtk_ui_manager_new ();
gtk_ui_manager_insert_action_group (ui_manager, action_group, 0);
if (!gtk_ui_manager_add_ui_from_string (ui_manager, ui_description,
-1, NULL))
{
g_print ("building menus failed");
exit (1);
}
popup = gtk_ui_manager_get_widget (ui_manager, "/MainMenu");
gtk_widget_show_all(popup);
}
----------
Many thanks at all!
Enrico
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]