GNOME Bugzilla – Bug 543711
Migrate Disk Mounter from GnomeVFS to GIO
Last modified: 2008-10-05 08:52:35 UTC
See http://live.gnome.org/GioPort for more information. $:andre\> cd gnome-applets/ $:andre\> grep -r vfs . ./drivemount/drive-button.c: gnome_vfs_drive_unref (self->drive); ./drivemount/drive-button.c: gnome_vfs_volume_unref (self->volume); ./drivemount/drive-button.c: self->drive = gnome_vfs_drive_ref (drive); ./drivemount/drive-button.c: gnome_vfs_drive_unref (self->drive); ./drivemount/drive-button.c: gnome_vfs_volume_unref (self->volume); ./drivemount/drive-button.c: self->volume = gnome_vfs_volume_ref (volume); ./drivemount/drive-button.c: display_name = gnome_vfs_drive_get_display_name (self->drive); ./drivemount/drive-button.c: if (gnome_vfs_drive_is_mounted (self->drive)) ./drivemount/drive-button.c: else if (gnome_vfs_drive_is_connected (self->drive)) ./drivemount/drive-button.c: display_name = gnome_vfs_volume_get_display_name (self->volume); ./drivemount/drive-button.c: if (gnome_vfs_volume_is_mounted (self->volume)) ./drivemount/drive-button.c: if (gnome_vfs_drive_is_mounted (self->drive)) { ./drivemount/drive-button.c: volumes = gnome_vfs_drive_get_mounted_volumes (self->drive); ./drivemount/drive-button.c: icon_name = gnome_vfs_volume_get_icon (volume); ./drivemount/drive-button.c: g_list_foreach (volumes, (GFunc)gnome_vfs_volume_unref, NULL); ./drivemount/drive-button.c: icon_name = gnome_vfs_drive_get_icon (self->drive); ./drivemount/drive-button.c: icon_name = gnome_vfs_volume_get_icon (self->volume); ./drivemount/drive-button.c: return gnome_vfs_drive_compare (button->drive, other_button->drive); ./drivemount/drive-button.c: return gnome_vfs_volume_compare (button->volume, other_button->volume); ./drivemount/drive-button.c: argv[1] = gnome_vfs_drive_get_activation_uri (self->drive); ./drivemount/drive-button.c: volumes = gnome_vfs_drive_get_mounted_volumes (self->drive); ./drivemount/drive-button.c: argv[1] = gnome_vfs_volume_get_activation_uri (volume); ./drivemount/drive-button.c: g_list_foreach (volumes, (GFunc)gnome_vfs_volume_unref, NULL); ./drivemount/drive-button.c: argv[1] = gnome_vfs_volume_get_activation_uri (self->volume); ./drivemount/drive-button.c: char *device_path = gnome_vfs_volume_get_device_path (volume); ./drivemount/drive-button.c: char *uri = gnome_vfs_volume_get_activation_uri (volume); ./drivemount/drive-button.c: char *mount_path = gnome_vfs_get_local_path_from_uri (uri); ./drivemount/drive-button.c: char *udi = gnome_vfs_volume_get_hal_udi (volume); ./drivemount/drive-button.c: char *activation_uri = gnome_vfs_volume_get_activation_uri (volume); ./drivemount/drive-button.c: char *device_path = gnome_vfs_drive_get_device_path (self->drive); ./drivemount/drive-button.c: volumes = gnome_vfs_drive_get_mounted_volumes (self->drive); ./drivemount/drive-button.c: uri = gnome_vfs_volume_get_activation_uri (volume); ./drivemount/drive-button.c: mount_path = gnome_vfs_get_local_path_from_uri (uri); ./drivemount/drive-button.c: gnome_vfs_drive_get_display_name (self->drive); ./drivemount/drive-button.c: g_list_foreach (volumes, (GFunc)gnome_vfs_volume_unref, NULL); ./drivemount/drive-button.c: gnome_vfs_drive_mount (self->drive, mount_result, ./drivemount/drive-button.c: gnome_vfs_drive_unmount (self->drive, mount_result, ./drivemount/drive-button.c: gnome_vfs_volume_unmount (self->volume, mount_result, ./drivemount/drive-button.c: gnome_vfs_drive_eject (self->drive, mount_result, ./drivemount/drive-button.c: gnome_vfs_volume_eject (self->volume, mount_result, ./drivemount/drive-button.c: if (!gnome_vfs_drive_is_connected (self->drive)) return; ./drivemount/drive-button.c: device_type = gnome_vfs_drive_get_device_type (self->drive); ./drivemount/drive-button.c: display_name = gnome_vfs_drive_get_display_name (self->drive); ./drivemount/drive-button.c: ejectable = gnome_vfs_drive_needs_eject (self->drive); ./drivemount/drive-button.c: if (gnome_vfs_drive_is_mounted (self->drive)) { ./drivemount/drive-button.c: volumes = gnome_vfs_drive_get_mounted_volumes (self->drive); ./drivemount/drive-button.c: device_type = gnome_vfs_volume_get_device_type (volume); ./drivemount/drive-button.c: g_list_foreach (volumes, (GFunc)gnome_vfs_volume_unref, NULL); ./drivemount/drive-button.c: GnomeVFSDrive* drive = gnome_vfs_volume_get_drive (self->volume); ./drivemount/drive-button.c: if (!gnome_vfs_volume_is_mounted (self->volume)) return; ./drivemount/drive-button.c: device_type = gnome_vfs_volume_get_device_type (self->volume); ./drivemount/drive-button.c: display_name = gnome_vfs_volume_get_display_name (self->volume); ./drivemount/drive-button.c: ejectable = gnome_vfs_drive_needs_eject (drive); ./drivemount/drive-list.c: volume_monitor = gnome_vfs_get_volume_monitor (); ./drivemount/drive-list.c: connected_drives = gnome_vfs_volume_monitor_get_connected_drives (volume_monitor); ./drivemount/drive-list.c: gnome_vfs_drive_unref (drive); ./drivemount/drive-list.c: mounted_volumes = gnome_vfs_volume_monitor_get_mounted_volumes (volume_monitor); ./drivemount/drive-list.c: gnome_vfs_volume_unref (volume); ./drivemount/drive-list.c: drive = gnome_vfs_volume_get_drive (volume); ./drivemount/drive-list.c: gnome_vfs_drive_unref (drive); ./drivemount/drive-list.c: drive = gnome_vfs_volume_get_drive (volume); ./drivemount/drive-list.c: gnome_vfs_drive_unref (drive); ./drivemount/drive-list.c: if (!gnome_vfs_drive_is_user_visible (drive)) ./drivemount/drive-list.c: if (!gnome_vfs_volume_is_user_visible (volume)) ./drivemount/drive-list.c: if (gnome_vfs_volume_get_volume_type (volume) ./drivemount/drive-list.c: drive = gnome_vfs_volume_get_drive (volume); ./drivemount/drive-list.c: gnome_vfs_drive_unref (drive); ./drivemount/drivemount.c:#include <libgnomevfs/gnome-vfs.h> ./drivemount/drive-button.h:#include <libgnomevfs/gnome-vfs.h> ./drivemount/drive-list.h:#include <libgnomevfs/gnome-vfs.h>
I have started working on this. Patch later today or tomorrow.
Great, looking forward to it.
How fond are people of the "Play DVD" and "Play Audio CD" menu entries? They're a bit of a pain to convert (and has some nasty copypasta from g-v-m). I'd like to take them out back...
Created attachment 117596 [details] [review] conversion patch This converts the drivemount applet to use GIO. As part of this, some things were changed: - It no longer has any special handling for DVDs and audio CDs. - It does not report any errors for mount/unmount requests. gnome-mount does this by itself and GIO said something about not presenting its error messages in a gui, afterwhich it proceeded to insult my mother. - It uses standard icon names for the menu images I've noticed two side effects from the conversion: - Drives retain their name even when unmounted. The old code got different names because gnome-vfs' "drive" maps better to GDrive than GVolume when it comes to naming. Personally, I think the new behaviour is more sane. - Drives are not sorted by type. The old code organised the icons based on type (actually gnome-vfs did), but there is no type information in GIO so it is now a strictly name based ordering.
Someone with an account on live.gnome.org is welcome to update the status on the GioPort page. :)
done
I'm generally happy with the patch, but I'm not happy about the regression with respect to CD and DVD playback. What exactly is the problem with the DVD/CD stuff (aside from the usual problems all copy.pasted code has)? The DVD stuff is simple to fix since two of the arguments aren't used and the third comes from g_mount_get_root (). The CD stuff doesn't look like it will translate directly. What are the other issues?
The problem was that it was far from obvious what to do in all cases, at least with my very shallow knowledge of GIO and gnome-vfs. E.g. it could trigger the "play dvd" command on a volume, where it isn't guaranteed that you have a mount object and hence no known mount point. I can have another stab at it if you like, but someone else needs to test it as I have neither CDs nor DVDs (hey, this is the 21st century!).
Btw, I don't think you meant to mark the entire bug as obsolete ;)
Yeah, I beg to differ with closing this ticket. :-)
Pierre, I can test the code and fix it, so thats not a problem. As for marking the bug obsolete, my apologies, that wasn't deliberate.
Created attachment 117861 [details] [review] conversion patch with DVD/CDA Here's a patch with the DVD and CDA stuff restored. I do think having them in is a bad idea though as g-v-m and this code will constantly get out of sync. Right now they support different launch commands for example.
I'm not sure about the long-term viability of the CD/DVD stuff either, but I don't want to remove anything at this point of the release cycle. Thanks for the effort, I've been delaying the 2.23.91 release in the hope this would come through. I'll try and get this committed later today.
Finally committed. The build requirements for gtk+ and glib have also been updated.
the new version seems to crash when ejecting a cd or dvd
Yes, see bug 551669. It's being worked on.
After changing to GIO drivemount no longer displays entries in fstab for cifs mount system as before. Since nautilus doesn't do that either since version 2.22 because of GIO, in order to overcome this limitation I have used until now the drivemount applet. Now this is gone too. Any suggestion?
Filesystems like CIFS are handled by gio using gvfs. gvfs handles cifs (and many others) via a plugin. You may not have the required plugins installed. If you installed from source the backend should have been installed, if you are using a distribution you may need to look for a separate package on top of gvfs (for Ubuntu the extra package is gvfs-backends).
Thanks for the answer but this doesn't seem to be the case. In fedora 10 this package is gvfs-smb-1.0.1-4.fc10.i386 and is installed but again diskmounter doesn't show the cifs entries in fstab. I've tested with an Ubuntu virtual machine with gvfs-backends installed and its the same, cifs entries in fstab don't show up in diskmounter with gio backend.
gbil, could you please open a new bug for this problem. Put a reference to this bug (specifically mentioning comment 17) and include a copy of your fstab file (or at least the relevant lines). Thanks.
OK, opened bug 555067 http://bugzilla.gnome.org/show_bug.cgi?id=555067