Re: Identifying drives/volumes



On Tue, 2004-10-19 at 09:52 -0500, Federico Mena Quintero wrote:
> 
> Hmm, I see.
> 
> The problem is this:  right now GtkFileSystemVolume and friends are
> private structures, exposed only to file system implementations, and I
> would prefer not to expose them to file chooser extensions --- ideally
> extensions would deal with just URIs.
> 
> However, using the activation_uri to identify volumes would still work,
> right?  The code path I'm envisioning is this:
> 
>   gboolean
>   lockdown_extension_is_volume_visible (LockdownExt *ext, const char *base_uri)
>   {
>      GnomeVFSVolume *vol;
>      char *path;
>      gboolean visible;
> 
>      if (is_remote (base_uri))
>        return can_user_see_remote_volume (base_uri);
> 
>      path = uri_to_path (base_uri);
>      vol = gnome_vfs_volume_monitor_get_volume_for_path (vm, path);
>      g_free (path);
> 
>      if (vol) {
>        visible = can_user_see_volume (vol);
>        gnome_vfs_volume_unref (vol);
>      } else
>        visible = FALSE;
> 
>      return visible;
>   }
> 
> Even if the file chooser were using the GtkFileSystemUnix backend, the
> only base_uri that would ever be fed into the lockdown extension would
> be "file:///", for the file system's root.  If you were using
> GtkFileSystemGnomeVFS, the extension would get fed "file:///",
> "file:///mnt/cdrom", etc.

This should basically work, even if it perhaps doesn't do exactly what
you think it does.

Say you have a GnomeVFSVolume that is really a "connected server" that
points to file:///mnt/cdrom. When you do
gnome_vfs_volume_monitor_get_volume_for_path(/mnt/cdrom) you will get
the actual volume for the cdrom, not the connected server volume.

However, in practice this just means that if you don't allow access to
the cdrom volume you also don't allow other volumes that point to it,
which is basically what you want.

I have a question though. How do you propose can_user_see_volume(vol)
will work? I mean, how would the user specify which volumes are ok and
which are not?

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
 Alexander Larsson                                            Red Hat, Inc 
                   alexl redhat com    alla lysator liu se 
He's a fast talking dishevelled dog-catcher with no name. She's a 
transdimensional hypochondriac museum curator on her way to prison for a 
murder she didn't commit. They fight crime! 




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