Putting any gtk.Widget inside a gtk.Menu works, somewhat, by putting an empty gtk.MenuItem in first. It doesn't seem to be reliable – but it basically works. With an appindicator.Indicator, it doesn't work. The entry just stays empty. Even if you set the child[border_size] to 32, for example.
The only widget that works is a gtk.Label (plus the MenuItem, ImageMenuItem and so on of course).
Now the Me Menu has got a gtk.Entry in it, so it must surely be possible to do this Properly. How do I do it?
Here's some example code to explain what I'm on about:
self.item = gtk.MenuItem() self.item.add(gtk.Label("hello world!")) self.menu.append(self.item)
The above code works, this however doesn't:
self.item = gtk.MenuItem() self.item.add(gtk.Entry()) self.menu.append(self.item)
Where self.menu is an appindicator.Indicator, if it were a gtk.Menu, the Entry would be at least displayed.
Here's some working code:
import gtk import appindicator class AppIndicator (object): def __init__(self): self.ind = appindicator.Indicator("hello world client", "distributor-logo", appindicator.CATEGORY_APPLICATION_STATUS) self.ind.set_status (appindicator.STATUS_ACTIVE) self.menu = gtk.Menu() item = gtk.MenuItem() item.add(gtk.Label("hello world")) # item.add(gtk.Entry()) self.menu.append(item) self.menu.show_all() self.ind.set_menu(self.menu) indicator = AppIndicator() gtk.main()