[maemo-developers] Empty menu with GtkMenuToolButton
From: Konrad Anton konrad at minus1.deDate: Wed Jul 8 15:38:43 EEST 2009
- Previous message: extras-assistant trouble
- Next message: Empty menu with GtkMenuToolButton
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Hello all,
I'm trying to use a GtkToolButton to get a pop-up menu popping up from
the toolbar.
The following example shows the problem I'm experiencing: the toolbar is
correctly populated with one toolbutton and one arrow to the right of
it, but when I click the arrow, an empty menu pops up (a square of
roughly 30 pixels, surrounded by a menuish frame). The size of the
square seems not to be influenced by how many menu entries I create.
//------------------------------------
#include <gtk/gtk.h>
#include <hildon/hildon-program.h>
#include <hildon/hildon-banner.h>
int main(int argc, char** argv) {
gtk_init(&argc, &argv);
HildonProgram* program = HILDON_PROGRAM(hildon_program_get_instance());
HildonWindow* main_window = HILDON_WINDOW(hildon_window_new());
hildon_program_add_window(program, main_window);
GtkToolbar* toolbar = GTK_TOOLBAR(gtk_toolbar_new());
GtkMenu* toolbar_popup_menu = GTK_MENU(gtk_menu_new());
GtkWidget* menu_item = gtk_menu_item_new_with_label("Sausage");
gtk_menu_shell_append(GTK_MENU_SHELL(toolbar_popup_menu), menu_item);
// same effect with:
// gtk_container_add(GTK_CONTAINER(toolbar_popup_menu), menu_item);
GtkToolItem* popup_toolbutton =
gtk_menu_tool_button_new_from_stock(GTK_STOCK_COPY);
gtk_menu_tool_button_set_menu(GTK_MENU_TOOL_BUTTON(popup_toolbutton),
GTK_WIDGET(toolbar_popup_menu));
gtk_toolbar_insert(toolbar, popup_toolbutton, -1);
hildon_window_add_toolbar(main_window, GTK_TOOLBAR(toolbar));
gtk_widget_show_all(GTK_WIDGET(main_window));
// gtk_widget_show_all(GTK_WIDGET(toolbar)); -- no improvement
gtk_main();
return 0;
}
//-------------------------
I probably just missed a call to gtk_bla_set_blub() somewhere, but I
can't figure out correct values for bla and blub. Any help would be
appreciated.
--Konrad
--
Konrad Anton <konrad at minus1.de>
Tel. +49-761-21429279
Web http://www.pechfunk.de/
- Previous message: extras-assistant trouble
- Next message: Empty menu with GtkMenuToolButton
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
