1

I am trying to get a menu to show in a custom application written in C. I create the GtkMenu, populate it with GtkMenuItem(s) and add it to the indicator, which shows up in the indicator list, but the menu doesn't. I feel kinda silly asking this since I'm sure I'm just overlooking something but I'll use as an excuse the fact that I'm tired since it's kinda late here. Thanks in advance for any help.

int main(int argc, char *argv[])
{
    AppIndicator *indicator;
    GtkWidget *indicator_menu;
    GtkWidget *quitMenuItem;

    gtk_init(&argc, &argv);

    indicator_menu = gtk_menu_new();

    quitMenuItem = gtk_menu_item_new_with_label("Exit");
    g_signal_connect(G_OBJECT(quitMenuItem), "activate",
                                           G_CALLBACK(gtk_main_quit), NULL);

    gtk_menu_append(indicator_menu, gtk_menu_item_new_with_label("entry1"));
    gtk_menu_append(indicator_menu, gtk_menu_item_new_with_label("entry2"));
    gtk_menu_append(indicator_menu, gtk_separator_menu_item_new());
    gtk_menu_append(indicator_menu, quitMenuItem);

    indicator = app_indicator_new("test-client", "user-offline", 
                            APP_INDICATOR_CATEGORY_APPLICATION_STATUS);

    app_indicator_set_status(indicator, APP_INDICATOR_STATUS_ACTIVE);
    app_indicator_set_attention_icon(indicator, "indicator-messages-new");

    app_indicator_set_menu(indicator, GTK_MENU(indicator_menu));

    //gtk_widget_show(indicator_menu);

    gtk_main();

    return 0;
}
0

You should call gtk_widget_show_all(indicator_menu) (at least I guess that's the way doing it in C, I'm using Python).

1
  • Thanks for the quick reply...I tried using gtk_widget_show (not gtk_widget_show_all)
    – kicsyromy
    Jun 15 '11 at 21:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.