[gvfs] Bug 597585 – 2.28 lists mtp devices as being cameras with gudev backend



commit a8cfac72e68eca250799065c59e3722fc88c5b87
Author: Martin Pitt <martin pitt ubuntu com>
Date:   Mon Oct 12 16:31:58 2009 +0200

    Bug 597585 â?? 2.28 lists mtp devices as being cameras with gudev backend
    
    Set correct MIME type for MTP music players based on whether it's a camera or a
    music player.
    
    Signed-off-by: David Zeuthen <davidz redhat com>

 daemon/gvfsbackendgphoto2.c |   13 ++++++++++++-
 1 files changed, 12 insertions(+), 1 deletions(-)
---
diff --git a/daemon/gvfsbackendgphoto2.c b/daemon/gvfsbackendgphoto2.c
index 3edd26f..45d030a 100644
--- a/daemon/gvfsbackendgphoto2.c
+++ b/daemon/gvfsbackendgphoto2.c
@@ -740,7 +740,9 @@ setup_for_device (GVfsBackendGphoto2 *gphoto2_backend)
 {
   gchar *devname;
   char *comma;
+  gboolean is_media_player = FALSE;
   char *camera_x_content_types[] = {"x-content/image-dcf", NULL};
+  char *media_player_x_content_types[] = {"x-content/audio-player", NULL};
 
   /* turn usb:001,041 string into an udev device name */
   if (!g_str_has_prefix (gphoto2_backend->gphoto2_port, "usb:"))
@@ -763,16 +765,25 @@ setup_for_device (GVfsBackendGphoto2 *gphoto2_backend)
 
       /* determine icon name */
       if (g_udev_device_has_property (gphoto2_backend->udev_device, "ID_MEDIA_PLAYER_ICON_NAME"))
+	{
           gphoto2_backend->icon_name = g_strdup (g_udev_device_get_property (gphoto2_backend->udev_device, "ID_MEDIA_PLAYER_ICON_NAME"));
+	  is_media_player = TRUE;
+	}
       else if (g_udev_device_has_property (gphoto2_backend->udev_device, "ID_MEDIA_PLAYER"))
+	{
           gphoto2_backend->icon_name = g_strdup ("multimedia-player");
+	  is_media_player = TRUE;
+	}
       else
           gphoto2_backend->icon_name = g_strdup ("camera-photo");
     }
   else
       DEBUG ("-> did not find matching udev device");
 
-  g_vfs_backend_set_x_content_types (G_VFS_BACKEND (gphoto2_backend), camera_x_content_types);
+  if (is_media_player)
+      g_vfs_backend_set_x_content_types (G_VFS_BACKEND (gphoto2_backend), media_player_x_content_types);
+  else
+      g_vfs_backend_set_x_content_types (G_VFS_BACKEND (gphoto2_backend), camera_x_content_types);
 }
 
 static void



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