Re: Trouble with gnome_vfs_volume_manager_get_volume_for_path()
- From: Alexander Larsson <alexl redhat com>
- To: Federico Mena Quintero <federico ximian com>
- Cc: "desktop-devel-list gnome org" <desktop-devel-list gnome org>
- Subject: Re: Trouble with gnome_vfs_volume_manager_get_volume_for_path()
- Date: 16 Jan 2004 08:34:04 +0100
On Fri, 2004-01-16 at 07:29, Federico Mena Quintero wrote:
> Hi, Alex,
>
> I have an interesting problem with gnome-vfs-volume-monitor. When
> GtkFileChooser is set to folder mode, it displays a folder tree
> constrained to the volume of the currently selected folder. For
> example, say you mount a Red Hat distribution CD. Then, if the current
> folder is /mnt/cdrom/RedHat/RPMS, the tree in the file chooser would
> show this:
>
> + dosutils
> + images
> + isolinux
> + RedHat
> + base
> + RPMS <-- selected folder
>
> This is quite nice, because showing the whole filesystem would look like
>
> + bin
> + boot
> + dev
> + etc
> + home
> + lib
> + ... etc ...
> + mnt
> + flash
> + floppy
> + cdrom
> + dosutils
> + images
> + isolinux
> + RedHat
> + base
> + RPMS <-- selected folder
>
> which is plain ugly.
>
> To do the constrained view, the code looks something like this:
>
> current_folder_changed_callback ()
> {
> vol = gnome_vfs_volume_manager_get_volume_for_path (current_folder);
> base = gnome_vfs_volume_get_activation_uri (vol);
>
> show_tree_starting_at (base);
> }
>
> However, something interesting happens with my /home partition.
> Gnome-vfs-volume-monitor sees it as a volume on its own which is not
> user visible. Therefore, the volume list in the file chooser does not
> pay attention to it. However, when I do
>
> gnome_vfs_volume_manager_get_volume_for_path ("/home/federico/foo");
>
> I get the /home volume, which of course has "/home" as the base path or
> activation URI. From the user's viewpoint, it doesn't make sense to
> constrain the folder tree to the stuff inside /home, as *that* is not
> one of the available volumes --- the user would access that from the /
> volume, which *is* user-visible.
>
> So my question is, how do I get a user-visible volume that corresponds
> to a given path? Or should I just do this:
>
> tmp_path = current_folder_path;
>
> do {
> vol = gnome_vfs_volume_manager_get_volume_for_path (tmp_path);
> tmp_path = get_parent_path (tmp_path);
> } while (!gnome_vfs_volume_is_user_visible());
>
> base = gnome_vfs_volume_get_activation_uri (vol);
> ... etc ...
At the moment there is no other way, and in fact the implementation in
gnome-vfs would be pretty much what you wrote, so I'm not sure an API
addition is needed.
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Alexander Larsson Red Hat, Inc
alexl redhat com alla lysator liu se
He's a fiendish ninja farmboy on the hunt for the last specimen of a great and
near-mythical creature. She's a brilliant out-of-work fairy princess looking
for love in all the wrong places. They fight crime!
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]