Re: Test whether a GFile is already mounted?



On Mon, 2009-04-06 at 17:35 +0200, Enrico Tröger wrote:
> Hey,
> 
> let's say I want to browse for available hosts in a workgroup (smb), I
> create a GFile and list its children, like:
> 
> file = g_file_new_for_uri("smb://workgroup");
> 
> enumeration = g_file_enumerate_children(file,
> G_FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME, G_FILE_QUERY_INFO_NONE, NULL,
> &error);
> ...
> 
> To get this working, "smb://workgroup" must be mounted before.
> So, I have to call g_file_mount_enclosing_volume() before enumerating
> the children.
> 
> Is there any way to determine whether "smb://workgroup" was already
> mounted before to save the attempt to mount it.
> Or is just not necessary because g_file_mount_enclosing_volume() does
> this implicitly without big performance loss?
> 
> Or am I doing something completely wrong?

Just do the operation and mount it if you get a NOT_MOUNTED error.



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