1

According to the GIO Documentation, it is possible to get the Icon of a file through g_file_info_get_icon () http://developer.gnome.org/gio/stable/GFileInfo.html#g-file-info-get-icon

But this doesnt work, take a look at this sample:

print(somefile) # <FileInfo object at 0x17bf820 (GFileInfo at 0x1b15d00)> 
icon = somefile.get_icon()
print(icon) # always None
if icon is Gio.Icon: 
    print("isicon") # never happens

I've testet it with my whole home folder, get_icon() does ALWAYS return None. Did i made any mistakes or is this function simply not working with python / pygobject?

jgillich
  • 71,459
  • 6
  • 57
  • 85

1 Answers1

2

Did you query_info the standard::icon attribute? For example,

f = File.new_for_commandline_arg('...')
info = f.query_info('standard::icon')
print(info.get_icon())
Johannes Sasongko
  • 4,178
  • 23
  • 34