Detecting GVfs metadata support through C API



Hello,

I am currently implementing a feature in a file browser to allow users to store viewing settings for each directory (e.g. sort order for displaying files). I am using GFile attributes to store this metadata, using methods like g_file_set_attributes_async to store key-value pairs. As I understand it, being able to write such metadata relies on the GVfs metadata service being available.

I would like to detect when support for GVfs metadata is available using the C API. By "GVfs metadata support is available" I mean essentially "functions like g_file_set_attributes_async can successfully save metadata so that it will be available in future". My current method for doing this is to query DBus to see if the service name org.gtk.vfs.Metadata is available, and this method seems to function OK. However, I would like to know if there is a better way of doing this check (by "better" I mean roughly "more robust and accurate"), and in particular if it can be done without a DBus query.

One method I have considered is looking at the list of running processes for the name "gvfsd-metadata", but that seems a bit kludgy to me, and perhaps unreliable (though I am not too sure about this).

I have asked a question about this on Stack Overflow which gives some more details, see https://stackoverflow.com/questions/62715510/testing-for-gvfs-metadata-support-in-c

I would be very grateful for any help with this.

Many thanks,

Reuben Green



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]