Am Samstag, den 16.06.2007, 01:58 -0400 schrieb Andrew Joyce: > Can someone please advise me as to how I can automate setting custom > icons for a series of folders? I would like to do this from a > shell/python/perl/etc script. I have about 200 folders all with images > in them named as "Folder Name.jpg". I have tried to explore Bonobo as > it appears this is how Nautilus manages the metadata, but I am having > trouble finding documentation on Bonobo, as well as an API reference for > the methods I need to use once I actually make contact with the Bonobo > control. I am hoping someone here can help me get started on the > correct path because I feel utterly lost at the moment.
As of today, no public interface is available for modifying metadata. I suggest to shut down Nautilus, and use libxml and your favorite scripting language with libxml bindings to modify ~/.nautilus/metadata directly [don't forget to backup!]. For all "confirmed" folders (i.e. URIs where Nautilus already saw folders), ~/.nautilus/metadata stores an ASCII-encoded URI. Each of these files will contain metadata for the files stored in the respective folder. So for modifying the metadata for /foo/bar, you'll have to look in ~/.nautilus/metadata/file%2F%2F%2Ffoo.xml . It will contain a toplevel <directory> entry, which contains <file> entries. For each of the folders, you'll have to set the custom_icon attribute to the unencoded image target URI - if the node doesn't exist yet, you'll have to create it of course. It's really unfortunate that you have to go through so much hazzle, a proper metadata storing system that is independent of the file browser, and uses both extended attributes where available and a fallback database where it is not available would be way more cleaner and save us broken XDG specs [1]. [1] http://lists.freedesktop.org/archives/xdg/2007-May/008324.html -- Christian Neumair <[EMAIL PROTECTED]> -- nautilus-list mailing list [email protected] http://mail.gnome.org/mailman/listinfo/nautilus-list
