3

When writing a lens for Unity in python I got stuck at replacing "import gtk" with "from gi.repository import Gtk" because I can't find the equivalence for the funcion: gtk.icon_theme_get_default().

for example:

import gtk, gio

if __name__ == "__main__":
  mimetype= "text/x-c"
  print "MIME=", mimetype
  iconName = gio.content_type_get_icon( mimetype )
  theme = gtk.icon_theme_get_default()
  print "ICO names=", iconName.get_names()
  icon = theme.choose_icon(iconName.get_names(), 48, 0)
  print "ICO=", icon.get_filename()

------- prints ------

MIME= text/x-c
ICO names= ['text-x-c', 'gnome-mime-text-x-c', 'text-x-generic']
ICO= /usr/share/icons/Humanity/mimes/48/text-x-c.svg

I have replaced with success the following 2 lines:

 from gi.repository import Gio, Gtk
   iconName = Gio.content_type_get_icon( mimetype )

But I can't find a way to translate:

theme = gtk.icon_theme_get_default()

Any help will be appreciated.

0

1 Answer 1

8

It is Gtk.IconTheme.get_default() in the gobject-introspection bindings.

2
  • @gabdub, if dobey's answer worked for you please click on the check to let others know at a glance. Thanks. Aug 13, 2012 at 0:25
  • Done, I'm sorry for the delay.
    – gabdub
    Aug 17, 2012 at 16:43

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .