Re: File copying




On 6 Feb 2011, at 19:05, Nader Morshed wrote:

You need to call g_file_set_attributes_from_info() to apply your
changes to the file info (See: The Description section in the GFileInfo
gtk-docs)

I might also suggest filtering results on your query of
g_file_query_info


Thanks Nader.  Is this the document you mean:-

http://library.gnome.org/devel//gio/2.26/GFileInfo.html

If so, there's something I'm still not understanding.  I've cut my example down to some code that should set 
the 'hidden' attribute on a pre-existing file.  I obtain a GFile* and GFileInfo* like this:-

GFile*       pDestObject       = g_file_new_for_path ("path_to_my_existing_file");
GFileInfo* pDestObjectInfo = g_file_query_info (pDestObject, 
                         G_FILE_ATTRIBUTE_STANDARD_IS_HIDDEN,
                         G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS,
                         false, &error);


The above calls appear to succeed.  I then pass the pointers to this function:-

void SetHiddenAttribute (GFile* pFile, GFileInfo* pInfo, GError** ppError)
{
GError* error = NULL;

      g_file_info_set_is_hidden (pinfo,  true);

      g_file_set_attributes_from_info (pFile,  pInfo,
                         G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS,  NULL, &error);

      if (error)
            g_propagate_error (ppError, error);
}


However, the call to g_file_set_attributes_from_info() fails with this error:-

error code 15  :  message=0x02894d80  "Setting attribute standard::is-hidden not supported"

I'd be happy to look at an example if you know where I can find one.  Otherwise, can you see where I'm going 
wrong?

Thanks,

John


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