GFileInfo to GFile

Once you create a GtkDirectoryList from a gfile, the gtk list items are pointers to GFileInfo’s, but the original GFile’s might be useful.

Is it possible to get the original GFile from the GFileInfo, i.e., is there an inverse function of

g_file_query_info()

or is the mapping only in one direction?

Hi,

According to the docs:

The GFileInfos returned from a GtkDirectoryList have the “standard::file” attribute set to the GFile they refer to.

So I suppose something like this should work (untested):

GFile *file = g_file_info_get_attribute_object (info, "standard::file");

Thank you. I must have looked at the docs over and over again, my bad.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.