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 recently noticed that in ubuntu unity the top menu of my apps does not show the (custom) icons I added to the gtk stock, but only the basic gtk stock icons.

This happens only since the top menu is displayed in the unity top panel (appmenu) and not in the application window. In place of the correct custom icons I see "gtk-missing-image". On my apps toolbars and other menus those icons are displayed properly, the problem is only with the top menu.

This happens either with pygtk2 (e.g. http://www.giuspen.com/cherrytree/) and gobject introspection (e.g. http://www.giuspen.com/nautilus-pyextensions/). I use gtk ui manager after integrating the stock icons this way:

factory = gtk.IconFactory()
pixbuf = gtk.gdk.pixbuf_new_from_file(filepath)
iconset = gtk.IconSet(pixbuf)
factory.add(stock_name, iconset)
factory.add_default()

If anybody solved this problem please help. Cheers, Giuseppe.

share|improve this question
1  
I noticed that inkscape has the same problem –  giuspen Dec 22 '11 at 11:12
1  
I edited from unity-2d to unity since I noticed the problem exists also there, do I have to create a new question or this is enough? –  giuspen Mar 20 '12 at 20:43
add comment

1 Answer 1

The AppIndicator framework needs to know about the icons. To do this they need to be in a theme directory, or part of the custom theme for the application. You can add a theme directory using app_indicator_set_icon_theme_path(). This allows the application indicator service to know where to look for your custom icons. You can also install the icons in the default icon theme which is located in /usr/share/themes/hicolor.

Lastly, as a total hack, you can generate them on the fly. This is what is done by indicator-multiload. It is not recommended, so I won't link to it, but if it is something you need look there.

share|improve this answer
    
Thanks. I had been wondering about this, since it seems to me to "sometimes" honor icons loaded explicitly from other absolute locations with no rhyme or reason to when it no longer remembers the icon. –  hbdgaf Sep 10 '12 at 21:27
    
OK I can use set_icon_theme_path() for appindicator but what about the appmenu (the top menu that is embedded in the top panel when the app is maximized) –  giuspen Sep 11 '12 at 14:05
    
For that you need to add a theme directory in GTK+. That's done with gtk_icon_theme_append_search_path(). –  Ted Gould Sep 12 '12 at 3:15
    
I made gtk.icon_theme_get_default().append_search_path() but it doesn't work. The icons are visible only after I enable the appindicator and so set the appindicator.set_icon_theme_path() –  giuspen Sep 14 '12 at 22:37
    
After I set appindicator status to set_status(appindicator.STATUS_PASSIVE) the icons are not visible anymore in unity top panel appmenu. The only solution is to completely disable appmenu using os.environ['UBUNTU_MENUPROXY'] = '0' and keep the menu inside my application. –  giuspen Sep 17 '12 at 7:04
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.