GNOME Bugzilla – Bug 736285
Improve display name for root
Last modified: 2014-10-17 11:59:35 UTC
The display name for the root dir comes from LIBMTP_GetFriendlyname or shows "Unnamed Device" if there is no friendly name. In this situation, the MTP volume still has a name (which comes from udev). The result is that the folder name showed by Nautilus is "Unnamed Device", yet the device is called "Ascend G300" in the sidebar. I think we should fallback to the udev-derived name.
Created attachment 285673 [details] [review] mtp: Improve root dir name handling If the device has no friendly name, set the display name of the device from the udev info to match the name shown by the volume monitor. This is visible when opening the device in Nautilus (or using gvfs-info).
All the name processing logic is copied verbatim from the monitor. Any chance we can share it? and I think it was originally copied from gphoto2's backend, so another de-dup opportunity. Even simple .c file re-use would be a big step up.
(In reply to comment #2) > All the name processing logic is copied verbatim from the monitor. Any chance > we can share it? and I think it was originally copied from gphoto2's backend, > so another de-dup opportunity. Even simple .c file re-use would be a big step > up. Yeah, that is a good idea. There doesn't seem to be any shared code between the daemons and the monitors other than libgvfscommon and we probably shouldn't be sticking mtp (or gphoto2) specific code in there so I'll try some C code re-use.
Created attachment 285763 [details] [review] Build shared code for gphoto2 and mtp as a convenience lib Deduplicate code between gphoto2 and mtp by creating a convenience library call libgvfscommon-gphoto2 which is only built if either libmtp is used or gphoto2 with gudev is used.
Created attachment 285764 [details] [review] mtp: Improve root dir name and icon handling If the device has no friendly name, set the display name of the device from the udev info to match the name shown by the volume monitor. This is visible as the folder title when the root dir of the device is open in Nautilus (or using gvfs-info).
Created attachment 285765 [details] [review] gphoto2: Improve root dir name and icon handling Set the name of the root dir and the icon to match the way that the volume monitor sets them. This is visible as the folder title when the root dir of the device is open in Nautilus (or using gvfs-info).
Right, the attached series de-duplicates the code and uses it for both daemons and both monitors.
Review of attachment 285763 [details] [review]: Looks fine, but presumably you want to set the symbolic icon for gphoto2 as well while you're there?
(In reply to comment #8) > Review of attachment 285763 [details] [review]: > > Looks fine, but presumably you want to set the symbolic icon for gphoto2 as > well while you're there? Yeah, will do. I'll commit these after the freeze since they're a bit invasive and change strings.
Pushed to master as 9ac1c5c. Thanks for the review!
The commit 60f96c8 added #include "gvfsgphoto2utils.h" to daemon/gvfsbackendgphoto2.c, which causes build failure on FreeBSD because gudev/gudev.h cannot be found.
Created attachment 288721 [details] [review] gphoto2: include gvfsgphoto2utils.h conditionally Does the attached patch fix it for you?
Yes, it can be fixed using the patch.
Review of attachment 288721 [details] [review]: Looks good, thanks for this.
Comment on attachment 288721 [details] [review] gphoto2: include gvfsgphoto2utils.h conditionally Thanks for reporting this and thanks for reviews! Fix has been committed to master as: commit e3fab1313117d8fefc98976b8c97d0f98cbb1819