On Thu, 2009-07-23 at 22:27 +1200, Richard Schwarting wrote: > Hello. > > I feel like I'm missing something obvious here. I've an application > that uploads photos and I have been trying to get it to add an emblem > to files it has uploaded so I know they're done. I've tried doing > something like this (not sure if this is remotely right, the docs for > GEmblem and friends aren't the most thorough): > > GFileIcon *emblem_icon = g_file_icon_new (...); > GEmblem *emblem = g_emblem_new (emblem_icon); > > /* I have a GFileInfo* image_info from earlier */ > GIcon *old_icon = g_file_info_get_icon (image_info); > GIcon *new_icon = g_emblemed_icon_new (image_info, emblem); > g_file_set_icon (new_icon); > > Sadly, this has no impact on the .nautilus/metadata/ files for the > relevant locations and no emblems appear as intended. I noticed that > NautilusFileInfo also has an emblem add API, but thought that GEmblem > might be more appropriate since it's all Flashy and stuff. > > I hope this is the right list, even though it concerns gio APIs, since > it concerns emblems, but I'll happily be redirected if I'm wrong :)
Just looking at the commits Alex did, this worked for me $ touch Desktop/foo.txt $ gvfs-set-attribute ~/Desktop/foo.txt -t stringv \ metadata::keyword new urgent and hitting ctrl+r in Nautilus makes this stuff appear (this is probably supposed to be happening automatically). $ gvfs-info ~/Desktop/foo.txt |grep metadata metadata::icon_position: 64,422 metadata::icon_scale: 1 metadata::icon_position_timestamp: 1248385424 metadata::keyword: [new, urgent] My installed copy of Nautilus may be out of date since http://git.gnome.org/cgit/nautilus/tree/libnautilus-private/nautilus-metadata.h suggests the metadata key is 'emblems', not 'keyword'. Anyway, you can do this programatically via g_file_info_set_attribute() using G_FILE_ATTRIBUTE_TYPE_STRINGV for @type and "metadata::keyword" for @attribute (see programs/gvfs-set-attribute.c in the gvfs sources for details). (Hmm, it would probably be nice with a g_file_info_set_attribute_strv() convenience function. And also nice to have #defines for things like "metadata::keyword" or whatever it ends up being called.) Hope this helps. David -- nautilus-list mailing list nautilus-list@gnome.org http://mail.gnome.org/mailman/listinfo/nautilus-list