Blob Blame History Raw
Not all gphoto drivers implement get storage info (drivers for proprietary
protocols often don't). This patch fixes the gphoto2volumemonitor to still
recognize cams which gphoto driver does not implement get storage info.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
diff -up gvfs-1.5.1/monitor/gphoto2/ggphoto2volumemonitor.c~ gvfs-1.5.1/monitor/gphoto2/ggphoto2volumemonitor.c
--- gvfs-1.5.1/monitor/gphoto2/ggphoto2volumemonitor.c~	2009-11-18 13:14:51.000000000 +0100
+++ gvfs-1.5.1/monitor/gphoto2/ggphoto2volumemonitor.c	2010-01-06 11:46:16.000000000 +0100
@@ -605,7 +605,7 @@ get_stores_for_camera (int bus_num, int 
   GPContext *context;
   GPPortInfo info;
   GPPortInfoList *il;
-  int num_storage_info, n;
+  int num_storage_info, n, rc;
   Camera *camera;
   char *port;
   guint i;
@@ -637,8 +637,14 @@ get_stores_for_camera (int bus_num, int 
     goto out;
 
   /* Get information about the storage heads */
-  if (gp_camera_get_storageinfo (camera, &storage_info, &num_storage_info, context) != 0)
+  rc = gp_camera_get_storageinfo (camera, &storage_info, &num_storage_info, context);
+  if (rc != 0) {
+    /* Not all gphoto drivers implement get storage info (drivers for proprietary
+       protocols often don't) */
+    if (rc == GP_ERROR_NOT_SUPPORTED)
+      l = g_list_prepend (l, g_strdup ("/"));
     goto out;
+  }
 
   /* Append the data to the list */
   for (i = 0; i < num_storage_info; i++)