Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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;
}
share|improve this question
add comment

1 Answer 1

up vote 0 down vote accepted

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).

share|improve this answer
    
Thanks for the quick reply...I tried using gtk_widget_show (not gtk_widget_show_all) –  kicsyromy Jun 15 '11 at 21:42
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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