Re: Can't make a popup menu popup from a GtkStatusIcon
- From: Bill Farmer <williamjfarmer tiscali co uk>
- To: gtk-app-devel-list gnome org
- Subject: Re: Can't make a popup menu popup from a GtkStatusIcon
- Date: Fri, 19 Jun 2009 17:01:18 +0100
Thanks, I thought it was something simple like that.
Bill
Mike Massonnet wrote:
After building the menu, and before poping it up, call
gtk_widget_show_all() on the menu.
2009/6/19 Bill Farmer <williamjfarmer tiscali co uk>:
I'm using GtkStatusIcon, GtkMenu, and GtkCheckMenuItem to create a status
icon with a popup menu. The code appears to be working in that a small
rectangular empty box pops up in exactly the right place under the status
icon, but I can't get any content in the menu. I've tried adding extra menu
items which makes no difference. Am I missing something? The relevant code
is below:
// Create a menu
GtkWidget *menu = gtk_menu_new();
GtkWidget *item = gtk_check_menu_item_new_with_label("Don't show this
again");
gtk_menu_shell_append(GTK_MENU_SHELL(menu), item);
Somewhere like here for instance:
gtk_widget_show_all (menu);
g_signal_connect(item, "activate", G_CALLBACK(menu_item_activate), NULL);
// Create a status icon
GtkStatusIcon *icon = gtk_status_icon_new_from_icon_name("application");
gtk_status_icon_set_tooltip_text(icon,
"Keyboard auto repeat temporarily disabled");
g_signal_connect(icon, "popup-menu",
G_CALLBACK(icon_popup_menu), menu);
// Show the status icon
gtk_status_icon_set_visible(icon, TRUE);
...
// Icon popup menu
int icon_popup_menu(GtkStatusIcon *icon, uint button, uint time, GtkMenu
*menu)
{
gtk_menu_popup(menu, NULL, NULL,
gtk_status_icon_position_menu,
icon, button, time);
}
Bill
Mike
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]