summaryrefslogtreecommitdiff
path: root/src/camera/CameraTable.vala
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff.email>2018-09-30 14:09:32 +0200
committerJörg Frings-Fürst <debian@jff.email>2018-09-30 14:09:32 +0200
commit0537caaf4af94a9ead8b292679f6b34c90b55e06 (patch)
tree6761cfdf959926be7af3147cf770e7f253390fe8 /src/camera/CameraTable.vala
parenteca5837e235a356c8db9416bbbc13577db3e6f76 (diff)
parent5e9f4eea451a77ba3b93db3747841ed2bd969e9f (diff)
Update upstream source from tag 'upstream/0.30.1'
Update to upstream version '0.30.1' with Debian dir dc242531effff8d9c6fab093414edee28b403c6a
Diffstat (limited to 'src/camera/CameraTable.vala')
-rw-r--r--src/camera/CameraTable.vala20
1 files changed, 16 insertions, 4 deletions
diff --git a/src/camera/CameraTable.vala b/src/camera/CameraTable.vala
index 3df4ad6..5f888ac 100644
--- a/src/camera/CameraTable.vala
+++ b/src/camera/CameraTable.vala
@@ -26,7 +26,9 @@ public class CameraTable {
private static CameraTable instance = null;
+#if HAVE_UDEV
private GUdev.Client client = new GUdev.Client(SUBSYSTEMS);
+#endif
private OneShotScheduler camera_update_scheduler = null;
private GPhoto.Context null_context = new GPhoto.Context();
private GPhoto.CameraAbilitiesList abilities_list;
@@ -43,7 +45,12 @@ public class CameraTable {
on_update_cameras);
// listen for interesting events on the specified subsystems
+
+#if HAVE_UDEV
client.uevent.connect(on_udev_event);
+#else
+ Timeout.add_seconds(10, () => { camera_update_scheduler.after_timeout(UPDATE_DELAY_MSEC, true); return true; });
+#endif
volume_monitor = VolumeMonitor.get();
volume_monitor.volume_changed.connect(on_volume_changed);
volume_monitor.volume_added.connect(on_volume_changed);
@@ -118,6 +125,7 @@ public class CameraTable {
"/dev/bus/usb/%s".printf(port.substring(4).replace(",", "/")) : null;
}
+#if HAVE_UDEV
private string? get_name_for_uuid(string uuid) {
foreach (Volume volume in volume_monitor.get_volumes()) {
if (volume.get_identifier(VolumeIdentifier.UUID) == uuid) {
@@ -130,11 +138,12 @@ public class CameraTable {
private string? get_icon_for_uuid(string uuid) {
foreach (Volume volume in volume_monitor.get_volumes()) {
if (volume.get_identifier(VolumeIdentifier.UUID) == uuid) {
- return volume.get_icon().to_string();
+ return volume.get_symbolic_icon().to_string();
}
}
return null;
}
+#endif
private void update_camera_table() throws GPhotoError {
// need to do this because virtual ports come and go in the USB world (and probably others)
@@ -147,7 +156,7 @@ public class CameraTable {
do_op(abilities_list.detect(port_info_list, camera_list, null_context), "detect cameras");
Gee.HashMap<string, string> detected_map = new Gee.HashMap<string, string>();
-
+
// go through the detected camera list and glean their ports
for (int ctr = 0; ctr < camera_list.count(); ctr++) {
string name;
@@ -158,7 +167,6 @@ public class CameraTable {
debug("Detected %d/%d %s @ %s", ctr + 1, camera_list.count(), name, port);
-
detected_map.set(port, name);
}
@@ -220,6 +228,7 @@ public class CameraTable {
continue;
}
+#if HAVE_UDEV
// Get display name for camera.
string path = get_port_path(port);
if (null != path) {
@@ -237,6 +246,7 @@ public class CameraTable {
display_name = device.get_property("ID_MODEL");
}
}
+#endif
if (port.has_prefix("disk:")) {
try {
@@ -244,7 +254,7 @@ public class CameraTable {
var volume = mount.get_volume();
// Translators: First %s is the name of camera as gotten from GPhoto, second is the GVolume name, e.g. Mass storage camera (510MB volume)
display_name = _("%s (%s)").printf (name, volume.get_name ());
- icon = volume.get_icon().to_string();
+ icon = volume.get_symbolic_icon().to_string();
} catch (Error e) { }
}
@@ -287,6 +297,7 @@ public class CameraTable {
}
}
+#if HAVE_UDEV
private void on_udev_event(string action, GUdev.Device device) {
debug("udev event: %s on %s", action, device.get_name());
@@ -294,6 +305,7 @@ public class CameraTable {
// update to occur when they come in all at once
camera_update_scheduler.after_timeout(UPDATE_DELAY_MSEC, true);
}
+#endif
public void on_volume_changed(Volume volume) {
camera_update_scheduler.after_timeout(UPDATE_DELAY_MSEC, true);