Comment 15 for bug 522152

Revision history for this message
David Lechner (dlech) wrote :

I have found out how to get the "about-to-show" signal from an application indicator. I'm not sure which version of Ubuntu that this became available in (I'm using trusty), but I think we can call this fixed.

I didn't do this in C originally, so sorry if this sample is not quite right.

AppIndicator *indicator;
GtkMenu *menu;
DbusmenuServer *menuServer;
DbusmenuMenuitem *rootMenuItem;

indicator = app_indicator_new(0, "sample", APP_INDICATOR_CATEGORY_APPLICATION_STATUS);
menu = gtk_menu_new();
// must set menu before getting dbus-menu-server property
app_indicator_set_menu(indicator, menu);
g_object_get(indicator, "dbus-menu-server", &menuServer, NULL);
g_object_get(menuServer, "root-node", &rootMenuItem, NULL);
g_signal_connect(rootMenuItem, "about-to-show", G_CALLBACK(sample_cb), NULL);