File camera_detect.patch of Package f-spot
From dcdad6c6ac8a039c0d3e19d968e583604bfc8d7a Mon Sep 17 00:00:00 2001
From: sdelcroix <sdelcroix@772769d8-d925-0410-89eb-a6ffa0d40526>
Date: Fri, 24 Oct 2008 09:29:27 +0000
Subject: [PATCH] 2008-10-23 Stephane Delcroix <sdelcroix@novell.com>
* src/MainWindow.cs:
* tools/f-spot-import: fix the import uri to match the nautilus one,
avoid popping the multiple camera detection dialog.
git-svn-id: svn+ssh://svn.gnome.org/svn/f-spot/branches/FSPOT_0_5_0_STABLE@4534 772769d8-d925-0410-89eb-a6ffa0d40526
---
ChangeLog | 6 ++++++
src/MainWindow.cs | 8 ++++----
tools/f-spot-import | 27 +++++++++++++++------------
3 files changed, 25 insertions(+), 16 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 2b5b733..8a44ce1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2008-10-23 Stephane Delcroix <sdelcroix@novell.com>
+
+ * src/MainWindow.cs:
+ * tools/f-spot-import: fix the import uri to match the nautilus one,
+ avoid popping the multiple camera detection dialog.
+
2008-10-17 Stephane Delcroix <sdelcroix@novell.com>
* src/PhotoStore.cs: fix the subselect column names to work on both
diff --git a/src/MainWindow.cs b/src/MainWindow.cs
index e86538e..8f94f57 100644
--- a/src/MainWindow.cs
+++ b/src/MainWindow.cs
@@ -1659,6 +1659,7 @@ public class MainWindow {
public void ImportCamera (string camera_device)
{
+ Log.DebugFormat ("ImportCamera {0}", camera_device);
GPhotoCamera cam = new GPhotoCamera();
try {
@@ -1679,10 +1680,9 @@ public class MainWindow {
selected_cam = 0;
} else {
bool found = false;
- if (camera_device != null) {
- string port = camera_device.Remove (0, "gphoto2:".Length);
- for (int i = 0; i < num_cameras; i++)
- if (cam.CameraList.GetValue (i) == port) {
+ if (camera_device != null)
+ for (int i = 0; i < num_cameras; i++) {
+ if (camera_device.IndexOf (cam.CameraList.GetValue(i)) != 0) {
selected_cam = i;
found = true;
break;
diff --git a/tools/f-spot-import b/tools/f-spot-import
index 520aa43..da4e81b 100755
--- a/tools/f-spot-import
+++ b/tools/f-spot-import
@@ -1,20 +1,23 @@
-#!/bin/bash
+#!/bin/bash -x
udi="$1"
#xmessage $udi
-mount_point=`hal-get-property --udi="$udi" --key=volume.mount_point`
-if [ -n "$mount_point" ]; then
- # USB Mass Storage camera: need to pass f-spot a mount point
- f-spot --import "$mount_point"
+if [ "$udi" != "${udi#gphoto2:}" ]; then
+ # gphoto2, as passed by nautilus.
+ f-spot --import "$udi"
+ exit
+fi
+mount_point=`hal-get-property --udi="$udi" --key=volume.mount_point` || true
+if [ -n "$mount_point" ]; then
+ # USB Mass Storage camera: need to pass f-spot a mount point
+ f-spot --import "$mount_point"
else
- # Some other camera try GPhoto2
-
- bus=`hal-get-property --udi="$udi" --key=usb.bus_number`
- dev=`hal-get-property --udi="$udi" --key=usb.linux.device_number`
- uri=`printf gphoto2:usb:%.3d,%.3d $bus $dev`
+ # Some other camera try GPhoto2
- echo $uri
+ bus=`hal-get-property --udi="$udi" --key=usb.bus_number`
+ dev=`hal-get-property --udi="$udi" --key=usb.linux.device_number`
+ uri=`printf gphoto2:[usb:%.3d,%.3d] $bus $dev`
- f-spot --import "$uri"
+ f-spot --import "$uri"
fi
--
1.6.0.2