diff options
Diffstat (limited to 'monitor/hal/ghalvolumemonitor.c')
-rw-r--r-- | monitor/hal/ghalvolumemonitor.c | 163 |
1 files changed, 1 insertions, 162 deletions
diff --git a/monitor/hal/ghalvolumemonitor.c b/monitor/hal/ghalvolumemonitor.c index 76b88bde..1313e6b4 100644 --- a/monitor/hal/ghalvolumemonitor.c +++ b/monitor/hal/ghalvolumemonitor.c @@ -57,7 +57,6 @@ struct _GHalVolumeMonitor { HalPool *pool; - GList *last_camera_devices; GList *last_optical_disc_devices; GList *last_drive_devices; GList *last_volume_devices; @@ -72,8 +71,6 @@ struct _GHalVolumeMonitor { GList *disc_volumes; GList *disc_mounts; - /* Digital cameras (e.g. gphoto2) are kept here */ - GList *camera_volumes; }; static void mountpoints_changed (GUnixMountMonitor *mount_monitor, @@ -99,9 +96,6 @@ static void update_discs (GHalVolumeMonitor *monitor, GList **removed_volumes, GList **added_mounts, GList **removed_mounts); -static void update_cameras (GHalVolumeMonitor *monitor, - GList **added_volumes, - GList **removed_volumes); G_DEFINE_TYPE (GHalVolumeMonitor, g_hal_volume_monitor, G_TYPE_NATIVE_VOLUME_MONITOR) @@ -116,7 +110,7 @@ list_free (GList *objects) static HalPool * get_hal_pool (void) { - char *cap_only[] = {"block", "camera", "portable_audio_player", "usb_device", NULL}; + char *cap_only[] = {"block", NULL}; if (pool == NULL) pool = hal_pool_new (cap_only); @@ -153,7 +147,6 @@ g_hal_volume_monitor_finalize (GObject *object) g_object_unref (monitor->mount_monitor); g_object_unref (monitor->pool); - list_free (monitor->last_camera_devices); list_free (monitor->last_optical_disc_devices); list_free (monitor->last_drive_devices); list_free (monitor->last_volume_devices); @@ -168,7 +161,6 @@ g_hal_volume_monitor_finalize (GObject *object) list_free (monitor->disc_volumes); list_free (monitor->disc_mounts); - list_free (monitor->camera_volumes); if (G_OBJECT_CLASS (g_hal_volume_monitor_parent_class)->finalize) (*G_OBJECT_CLASS (g_hal_volume_monitor_parent_class)->finalize) (object); @@ -208,8 +200,6 @@ get_volumes (GVolumeMonitor *volume_monitor) l = g_list_copy (monitor->volumes); ll = g_list_copy (monitor->disc_volumes); l = g_list_concat (l, ll); - ll = g_list_copy (monitor->camera_volumes); - l = g_list_concat (l, ll); g_list_foreach (l, (GFunc)g_object_ref, NULL); @@ -512,19 +502,6 @@ adopt_orphan_mount (GMount *mount, GVolumeMonitor *monitor) } } - /* gphoto2:// as foreign mounts */ - for (l = the_volume_monitor->camera_volumes; l != NULL; l = l->next) - { - GHalVolume *volume = l->data; - - if (g_hal_volume_has_foreign_mount_root (volume, mount_root)) - { - g_hal_volume_adopt_foreign_mount (volume, mount); - ret = g_object_ref (volume); - goto found; - } - } - found: g_object_unref (mount_root); @@ -736,24 +713,6 @@ find_disc_volume_by_udi (GHalVolumeMonitor *monitor, const char *udi) return NULL; } -#ifdef HAVE_GPHOTO2 -static GHalVolume * -find_camera_volume_by_udi (GHalVolumeMonitor *monitor, const char *udi) -{ - GList *l; - - for (l = monitor->camera_volumes; l != NULL; l = l->next) - { - GHalVolume *volume = l->data; - - if (g_hal_volume_has_udi (volume, udi)) - return volume; - } - - return NULL; -} -#endif - static gint hal_device_compare (HalDevice *a, HalDevice *b) { @@ -1034,7 +993,6 @@ update_all (GHalVolumeMonitor *monitor, update_discs (monitor, &added_volumes, &removed_volumes, &added_mounts, &removed_mounts); - update_cameras (monitor, &added_volumes, &removed_volumes); G_UNLOCK (hal_vm); if (emit_changes) @@ -1438,122 +1396,3 @@ update_discs (GHalVolumeMonitor *monitor, list_free (monitor->last_optical_disc_devices); monitor->last_optical_disc_devices = new_optical_disc_devices; } - -static void -update_cameras (GHalVolumeMonitor *monitor, - GList **added_volumes, - GList **removed_volumes) -{ -#ifdef HAVE_GPHOTO2 - GList *new_camera_devices; - GList *new_mpt_devices; - GList *removed, *added; - GList *l, *ll; - GHalVolume *volume; - const char *udi; - - new_mpt_devices = hal_pool_find_by_capability (monitor->pool, "portable_audio_player"); - for (l = new_mpt_devices; l != NULL; l = ll) - { - HalDevice *d = l->data; - ll = l->next; - if (! hal_device_get_property_bool (d, "camera.libgphoto2.support")) - { - /*g_warning ("ignoring %s", hal_device_get_udi (d));*/ - /* filter out everything that isn't supported by libgphoto2 */ - new_mpt_devices = g_list_delete_link (new_mpt_devices, l); - } - } - - new_camera_devices = hal_pool_find_by_capability (monitor->pool, "camera"); - new_camera_devices = g_list_concat (new_camera_devices, new_mpt_devices); - for (l = new_camera_devices; l != NULL; l = ll) - { - HalDevice *d = l->data; - ll = l->next; - /*g_warning ("got %s", hal_device_get_udi (d));*/ - if (! hal_device_get_property_bool (d, "camera.libgphoto2.support")) - { - /*g_warning ("ignoring %s", hal_device_get_udi (d));*/ - /* filter out everything that isn't supported by libgphoto2 */ - new_camera_devices = g_list_delete_link (new_camera_devices, l); - } - } - g_list_foreach (new_camera_devices, (GFunc) g_object_ref, NULL); - - new_camera_devices = g_list_sort (new_camera_devices, (GCompareFunc) hal_device_compare); - diff_sorted_lists (monitor->last_camera_devices, - new_camera_devices, (GCompareFunc) hal_device_compare, - &added, &removed); - - for (l = removed; l != NULL; l = l->next) - { - HalDevice *d = l->data; - - udi = hal_device_get_udi (d); - /*g_warning ("camera removing %s", udi);*/ - - volume = find_camera_volume_by_udi (monitor, udi); - if (volume != NULL) - { - g_hal_volume_removed (volume); - monitor->camera_volumes = g_list_remove (monitor->camera_volumes, volume); - *removed_volumes = g_list_prepend (*removed_volumes, volume); - } - } - - for (l = added; l != NULL; l = l->next) - { - HalDevice *d = l->data; - char *uri; - GFile *foreign_mount_root; - int usb_bus_num; - int usb_device_num; - gboolean found; - - /* Look for the device in the added volumes, so as - * not to add devices that are both audio players, and cameras */ - found = FALSE; - for (ll = *added_volumes; ll; ll = ll->next) - { - if (g_hal_volume_has_udi (ll->data, hal_device_get_udi (d)) != FALSE) - { - found = TRUE; - break; - } - } - - if (found) - continue; - - usb_bus_num = hal_device_get_property_int (d, "usb.bus_number"); - usb_device_num = hal_device_get_property_int (d, "usb.linux.device_number"); - - uri = g_strdup_printf ("gphoto2://[usb:%03d,%03d]", usb_bus_num, usb_device_num); - /*g_warning ("uri is '%s'", uri);*/ - foreign_mount_root = g_file_new_for_uri (uri); - g_free (uri); - - udi = hal_device_get_udi (d); - /*g_warning ("camera adding %s", udi);*/ - - volume = g_hal_volume_new (G_VOLUME_MONITOR (monitor), - d, - monitor->pool, - foreign_mount_root, - TRUE, - NULL); - g_object_unref (foreign_mount_root); - if (volume != NULL) - { - monitor->camera_volumes = g_list_prepend (monitor->camera_volumes, volume); - *added_volumes = g_list_prepend (*added_volumes, g_object_ref (volume)); - } - } - - g_list_free (added); - g_list_free (removed); - list_free (monitor->last_camera_devices); - monitor->last_camera_devices = new_camera_devices; -#endif -} |