[gvfs] gphoto2: Handle removal of camera with multiple storage heads



commit 1d28269cc6d9151786ea8d0d1790f48ab138ba34
Author: David Zeuthen <davidz redhat com>
Date:   Fri Aug 14 10:19:18 2009 -0400

    gphoto2: Handle removal of camera with multiple storage heads

 monitor/gphoto2/ggphoto2volumemonitor.c |   38 +++++++++++++++++-------------
 1 files changed, 21 insertions(+), 17 deletions(-)
---
diff --git a/monitor/gphoto2/ggphoto2volumemonitor.c b/monitor/gphoto2/ggphoto2volumemonitor.c
index a51674c..1fe2b37 100644
--- a/monitor/gphoto2/ggphoto2volumemonitor.c
+++ b/monitor/gphoto2/ggphoto2volumemonitor.c
@@ -264,25 +264,29 @@ gudev_add_camera (GGPhoto2VolumeMonitor *monitor, GUdevDevice *device, gboolean
 static void
 gudev_remove_camera (GGPhoto2VolumeMonitor *monitor, GUdevDevice *device)
 {
-    /* g_debug ("gudev_remove_camera: %s", g_udev_device_get_device_file (device)); */
+  GList *l, *ll;
+  const gchar* sysfs_path;
 
-    GList *l;
-    const gchar* sysfs_path = g_udev_device_get_sysfs_path (device);
-  
-    for (l = monitor->camera_volumes; l != NULL; l = l->next)
-      {
-        GGPhoto2Volume *volume = G_GPHOTO2_VOLUME (l->data);
+  sysfs_path = g_udev_device_get_sysfs_path (device);
 
-        if (g_gphoto2_volume_has_path (volume, sysfs_path))
-          {
-            /* g_debug ("gudev_remove_camera: found volume %s, deleting", sysfs_path); */
-            g_signal_emit_by_name (monitor, "volume_removed", volume);
-            g_signal_emit_by_name (volume, "removed");
-            g_gphoto2_volume_removed (volume);
-            monitor->camera_volumes = g_list_remove (monitor->camera_volumes, volume);
-            g_object_unref (volume);
-          }
-      }
+  /* g_debug ("gudev_remove_camera: %s", g_udev_device_get_device_file (device)); */
+
+  for (l = monitor->camera_volumes; l != NULL; l = ll)
+    {
+      GGPhoto2Volume *volume = G_GPHOTO2_VOLUME (l->data);
+
+      ll = l->next;
+
+      if (g_gphoto2_volume_has_path (volume, sysfs_path))
+        {
+          /* g_debug ("gudev_remove_camera: found volume %s, deleting", sysfs_path); */
+          g_signal_emit_by_name (monitor, "volume_removed", volume);
+          g_signal_emit_by_name (volume, "removed");
+          g_gphoto2_volume_removed (volume);
+          monitor->camera_volumes = g_list_remove (monitor->camera_volumes, volume);
+          g_object_unref (volume);
+        }
+    }
 }
 
 static void



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