[f-spot] Update and clean GPhoto2 bindings



commit 3743a4c50655233de848264d5cbdffa91726b989
Author: Stephane Delcroix <stephane delcroix org>
Date:   Tue Sep 29 11:27:51 2009 +0200

    Update and clean GPhoto2 bindings
    
    Drop the calls to gphoto2 internals, .NET-ify the lists, fix some of the P/Invokes...

 configure.ac                                       |   12 +-
 lib/libgphoto2-sharp/AUTHORS                       |    1 +
 lib/libgphoto2-sharp/AssemblyInfo.cs               |    9 +-
 lib/libgphoto2-sharp/Camera.cs                     |  350 +++++-------------
 lib/libgphoto2-sharp/CameraAbilities.cs            |  114 ++++++
 lib/libgphoto2-sharp/CameraAbilitiesList.cs        |  155 ++-------
 lib/libgphoto2-sharp/CameraCaptureType.cs          |   19 +
 lib/libgphoto2-sharp/CameraDriverStatus.cs         |   22 ++
 lib/libgphoto2-sharp/CameraEventType.cs            |   20 +
 lib/libgphoto2-sharp/CameraFile.cs                 |  185 +---------
 lib/libgphoto2-sharp/CameraFileOperation.cs        |   27 ++
 lib/libgphoto2-sharp/CameraFilePath.cs             |   35 ++
 lib/libgphoto2-sharp/CameraFilesystem.cs           |  280 +---------------
 lib/libgphoto2-sharp/CameraFolderOperation.cs      |   26 ++
 lib/libgphoto2-sharp/CameraList.cs                 |   88 ++----
 lib/libgphoto2-sharp/CameraOperation.cs            |   27 ++
 lib/libgphoto2-sharp/CameraText.cs                 |   27 ++
 lib/libgphoto2-sharp/CameraWidget.cs               |  373 --------------------
 lib/libgphoto2-sharp/Context.cs                    |  232 ++++++++++++-
 lib/libgphoto2-sharp/ContextFeedback.cs            |   21 ++
 lib/libgphoto2-sharp/DeviceType.cs                 |   22 ++
 lib/libgphoto2-sharp/ErrorCodes.cs                 |   87 +++---
 lib/libgphoto2-sharp/GPList.cs                     |   85 +++++
 lib/libgphoto2-sharp/GPObject.cs                   |   57 +++
 lib/libgphoto2-sharp/Makefile.am                   |   48 ++-
 lib/libgphoto2-sharp/Object.cs                     |   49 ---
 lib/libgphoto2-sharp/Port.cs                       |  107 +-----
 lib/libgphoto2-sharp/PortInfo.cs                   |   52 ++--
 lib/libgphoto2-sharp/PortInfoList.cs               |   63 ++---
 lib/libgphoto2-sharp/PortSerialParity.cs           |   22 ++
 lib/libgphoto2-sharp/PortType.cs                   |   27 ++
 lib/libgphoto2-sharp/glue/.gitignore               |    7 +
 lib/libgphoto2-sharp/glue/Makefile.am              |   15 +
 lib/libgphoto2-sharp/glue/context.c                |  151 ++++++++
 lib/libgphoto2-sharp/libgphoto2-sharp.dll.config   |    4 -
 .../libgphoto2-sharp.dll.config.in                 |    5 +
 src/CameraFileSelectionDialog.cs                   |    2 +-
 src/CameraSelectionDialog.cs                       |   20 +-
 src/GPhotoCamera.cs                                |   69 +---
 src/ImportCommand.cs                               |    2 +-
 src/MainWindow.cs                                  |    2 +-
 41 files changed, 1307 insertions(+), 1612 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 4be1bbf..f8a17b1 100644
--- a/configure.ac
+++ b/configure.ac
@@ -93,7 +93,7 @@ MONO_CAIRO_REQUIRED=1.2.4
 CAIRO_REQUIRED=1.4.0
 dnl -- this check is 	
 LCMS_REQUIRED=1.12
-dnl -- LIBGPHOTO2_REQUIRED=2.1.4
+LIBGPHOTO2_REQUIRED=2.4
 
 PKG_CHECK_MODULES(F, libgnome-2.0 >= $LIBGNOME_REQUIRED libgnomeui-2.0 >= $LIBGNOMEUI_REQUIRED libexif >= $LIBEXIF_REQUIRED_MIN libexif < $LIBEXIF_REQUIRED_MAX gtk-sharp-2.0 >= $GTKSHARP_REQUIRED glib-sharp-2.0 >= $GTKSHARP_REQUIRED glade-sharp-2.0 >= $GTKSHARP_REQUIRED gnome-vfs-sharp-2.0 >= $GTKSHARP_REQUIRED gtk+-2.0 >= $GTK_REQUIRED mono >= $MONO_REQUIRED mono-cairo >= $MONO_CAIRO_REQUIRED cairo >= $CAIRO_REQUIRED)
 AC_SUBST(F_CFLAGS)
@@ -202,13 +202,9 @@ PKG_CHECK_MODULES(LCMS, lcms >= $LCMS_REQUIRED, [],
 	LCMS_CFLAGS=''])
 
 
-dnl --- libgphoto2-sharp
+dnl --- libgphoto2
 
-PKG_CHECK_MODULES(LIBGPHOTO2, libgphoto2 >= 2.1.4)
-
-if pkg-config --atleast-version=2.4 libgphoto2; then
-	CSC_DEFINES="$CSC_DEFINES -d:GPHOTO2_2_4"
-fi
+PKG_CHECK_MODULES(LIBGPHOTO2, libgphoto2 >= $LIBGPHOTO2_REQUIRED)
 
 AC_SUBST(CSC_DEFINES)
 
@@ -302,6 +298,8 @@ lib/gnome-keyring-sharp/Makefile
 lib/gtk-sharp-beans/Makefile
 lib/libfspot/Makefile
 lib/libgphoto2-sharp/Makefile
+lib/libgphoto2-sharp/libgphoto2-sharp.dll.config
+lib/libgphoto2-sharp/glue/Makefile
 lib/libjpegtran/Makefile
 lib/Makefile
 lib/mono-addins/Makefile
diff --git a/lib/libgphoto2-sharp/AUTHORS b/lib/libgphoto2-sharp/AUTHORS
index c6172ff..b362af0 100644
--- a/lib/libgphoto2-sharp/AUTHORS
+++ b/lib/libgphoto2-sharp/AUTHORS
@@ -1,2 +1,3 @@
+Stephane Delcroix <stephane delcroix org>
 Ewen Cheslack-Postava <echeslack gmail com>
 Larry Ewing <lewing novell com>
diff --git a/lib/libgphoto2-sharp/AssemblyInfo.cs b/lib/libgphoto2-sharp/AssemblyInfo.cs
index 9e8d878..88ec37f 100644
--- a/lib/libgphoto2-sharp/AssemblyInfo.cs
+++ b/lib/libgphoto2-sharp/AssemblyInfo.cs
@@ -4,8 +4,9 @@
  * Author(s):
  *	Ewen Cheslack-Postava <echeslack gmail com>
  *	Larry Ewing <lewing novell com>
+ *	Stephane Delcroix <stephane delcroix org>
  *
- * This is free software. See COPYING for details.
+ * This is open source software. See COPYING for details.
  */
 using System.Reflection;
 using System.Runtime.CompilerServices;
@@ -16,8 +17,8 @@ using System.Runtime.CompilerServices;
 // change them to the information which is associated with the assembly
 // you compile.
 
-[assembly: AssemblyTitle("libgphoto2-sharp")]
-[assembly: AssemblyDescription(".NET Bindings for libgphoto2 in C#")]
+[assembly: AssemblyTitle("GPhoto2#")]
+[assembly: AssemblyDescription(".NET Bindings for libgphoto2 (f-spot version)")]
 [assembly: AssemblyConfiguration("")]
 [assembly: AssemblyCompany("")]
 [assembly: AssemblyProduct("")]
@@ -32,7 +33,7 @@ using System.Runtime.CompilerServices;
 // You can specify all values by your own or you can build default build and revision
 // numbers with the '*' character (the default):
 
-[assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("2.4.*")]
 
 // The following attributes specify the key for the sign of your assembly. See the
 // .NET Framework documentation for more information about signing.
diff --git a/lib/libgphoto2-sharp/Camera.cs b/lib/libgphoto2-sharp/Camera.cs
index 8cfb8ea..c448306 100644
--- a/lib/libgphoto2-sharp/Camera.cs
+++ b/lib/libgphoto2-sharp/Camera.cs
@@ -8,200 +8,80 @@
  *
  * Copyright (c) 2005-2009 Novell, Inc.
  *
- * This is free software. See COPYING for details.
+ * This is open source software. See COPYING for details.
  */
 using System;
 using System.Runtime.InteropServices;
 
-namespace LibGPhoto2
+namespace GPhoto2
 {
-	[StructLayout(LayoutKind.Sequential)]
-	public unsafe struct CameraText
-	{
-		[MarshalAs(UnmanagedType.ByValTStr, SizeConst=(32*1024))] string text;
-		
-		public string Text {
-			get {
-				return text;
-			}
-			set {
-				text = value;
-			}
-		}
-	}
-	
-#if false
-	[StructLayout(LayoutKind.Sequential)]
-	internal unsafe struct CameraFunctions
-	{
-		internal delegate ErrorCode _CameraExitFunc (_Camera *camera, HandleRef context);
-
-		internal delegate ErrorCode _CameraGetConfigFunc (_Camera *camera, out IntPtr widget, HandleRef context);
-
-		internal delegate ErrorCode _CameraSetConfigFunc (_Camera *camera, HandleRef widget, HandleRef context);
-
-		internal delegate ErrorCode _CameraCaptureFunc (_Camera *camera, CameraCaptureType type, IntPtr path, HandleRef context);
-
-		internal delegate ErrorCode _CameraCapturePreviewFunc (_Camera *camera, _CameraFile *file, HandleRef context);
-		
-		internal delegate ErrorCode _CameraSummaryFunc (_Camera *camera, IntPtr text, HandleRef context);
-		
-		internal delegate ErrorCode _CameraManualFunc (_Camera *camera, IntPtr text, HandleRef context);
-		
-		internal delegate ErrorCode _CameraAboutFunc (_Camera *camera, IntPtr text, HandleRef context);
-		
-		internal delegate ErrorCode _CameraPrePostFunc (_Camera *camera, HandleRef context);
-                                             
-		/* Those will be called before and after each operation */
-		_CameraPrePostFunc pre_func;
-		_CameraPrePostFunc post_func;
-
-		_CameraExitFunc exit;
-
-		/* Configuration */
-		_CameraGetConfigFunc       get_config;
-		_CameraSetConfigFunc       set_config;
-
-		/* Capturing */
-		_CameraCaptureFunc        capture;
-		_CameraCapturePreviewFunc capture_preview;
-
-		/* Textual information */
-		_CameraSummaryFunc summary;
-		_CameraManualFunc  manual;
-		_CameraAboutFunc   about;
-		
-		/* Reserved space to use in the future without changing the struct size */
-		IntPtr reserved1;
-		IntPtr reserved2;
-		IntPtr reserved3;
-		IntPtr reserved4;
-		IntPtr reserved5;
-		IntPtr reserved6;
-		IntPtr reserved7;
-		IntPtr reserved8;
-	}
-#endif
-
-	[StructLayout(LayoutKind.Sequential)]
-	public unsafe struct CameraFilePath
-	{
-		[MarshalAs(UnmanagedType.ByValTStr, SizeConst=128)] public string name;
-		[MarshalAs(UnmanagedType.ByValTStr, SizeConst=1024)] public string folder;
-	}
-
-	public enum CameraCaptureType
-	{
-		Image,
-		Movie,
-		Sound
-	}
-
-	[StructLayout(LayoutKind.Sequential)]
-	internal unsafe struct _Camera
-	{
-		public IntPtr port;
-		public IntPtr fs;
-		public IntPtr functions;
 
-		//CameraPrivateLibrary  *pl; /* Private data of camera libraries    */
-		//CameraPrivateCore     *pc; /* Private data of the core of gphoto2 */
-		public IntPtr p1;
-		public IntPtr pc;
-		
-		public IntPtr GetFS ()
-		{
-			return fs;
-		}
-	}
-	
-	public class Camera : Object 
+	public class Camera : GPObject 
 	{
 		[DllImport ("libgphoto2.so")]
 		internal static extern ErrorCode gp_camera_new (out IntPtr handle);
+		[DllImport ("libgphoto2.so")]
+		internal static extern ErrorCode gp_camera_unref (HandleRef camera);
 
-		public Camera()
+		public Camera () : base (gp_camera_unref)
 		{
 			IntPtr native;
-
 			Error.CheckError (gp_camera_new (out native));
-			
 			this.handle = new HandleRef (this, native);
 		}
 
-		[DllImport ("libgphoto2.so")]
-		internal static extern ErrorCode gp_camera_unref (HandleRef camera);
-
-		protected override void Cleanup ()
-		{
-			gp_camera_unref(this.Handle);
-		}
-		
+#region Preparing initilization
 		[DllImport ("libgphoto2.so")]
 		internal static extern ErrorCode gp_camera_set_abilities (HandleRef camera, CameraAbilities abilities);
 
-		public void SetAbilities (CameraAbilities abilities)
-		{
-		        Error.CheckError (gp_camera_set_abilities(this.Handle, abilities));
-		}
-		
 		[DllImport ("libgphoto2.so")]
 		internal unsafe static extern ErrorCode gp_camera_get_abilities (HandleRef camera, out CameraAbilities abilities);
 
-		public CameraAbilities GetAbilities ()
-		{
-			CameraAbilities abilities = new CameraAbilities ();
-			
-			Error.CheckError (gp_camera_get_abilities(this.Handle, out abilities));
-
-			return abilities;
+		public CameraAbilities Abilities {
+			get {
+				CameraAbilities abilities;
+				Error.CheckError (gp_camera_get_abilities(this.Handle, out abilities));
+				return abilities;
+			}
+			set { Error.CheckError (gp_camera_set_abilities(this.Handle, value)); }
 		}
-		
+
 		[DllImport ("libgphoto2.so")]
-		internal unsafe static extern ErrorCode gp_camera_set_port_info (HandleRef camera, _PortInfo info);
+		internal unsafe static extern ErrorCode gp_camera_set_port_info (HandleRef camera, PortInfo info);
 
-		public void SetPortInfo (PortInfo portinfo)
-		{
-			unsafe {
-				Error.CheckError (gp_camera_set_port_info (this.Handle, portinfo.Handle));
-			}
-		}
-		
 		[DllImport ("libgphoto2.so")]
-		internal static extern ErrorCode gp_camera_get_port_info (HandleRef camera, out _PortInfo info);
+		internal static extern ErrorCode gp_camera_get_port_info (HandleRef camera, out PortInfo info);
 
-		public PortInfo GetPortInfo ()
-		{
-			PortInfo portinfo = new PortInfo ();
-			unsafe { 
-				Error.CheckError (gp_camera_get_port_info (this.Handle, out portinfo.Handle));				
+		public PortInfo PortInfo {
+			get {
+				PortInfo portinfo;
+				Error.CheckError (gp_camera_get_port_info (this.Handle, out portinfo));
+				return portinfo;	
 			}
-			return portinfo;
+			set { Error.CheckError (gp_camera_set_port_info (this.Handle, value)); }
 		}
-		
+#endregion
 
+#region Speed, do not use, camera driver pick the optimal one
 		[DllImport ("libgphoto2.so")]
 		internal static extern ErrorCode gp_camera_get_port_speed (HandleRef camera);
 
-		public int GetPortSpeed ()
-		{
-			return (int) Error.CheckError (gp_camera_get_port_speed (this.Handle));
-		}
-		
 		[DllImport ("libgphoto2.so")]
 		internal static extern ErrorCode gp_camera_set_port_speed (HandleRef camera, int speed);
 
-		public void SetPortSpeed (int speed)
-		{
-			Error.CheckError (gp_camera_set_port_speed (this.Handle, speed));
+		public int PortSpeed {
+			get { return Error.CheckError (gp_camera_get_port_speed (this.Handle)); }
+			set { Error.CheckError (gp_camera_set_port_speed (this.Handle, value)); }
 		}
-		
+#endregion
+
+#region Initialization
 		[DllImport ("libgphoto2.so")]
 		internal static extern ErrorCode gp_camera_init (HandleRef camera, HandleRef context);
 
 		public void Init (Context context)
 		{
-			Error.CheckError (gp_camera_init (this.Handle, context.Handle));
+			Error.CheckError (gp_camera_init (Handle, context.Handle));
 		}
 		
 		[DllImport ("libgphoto2.so")]
@@ -209,16 +89,52 @@ namespace LibGPhoto2
 		
 		public void Exit (Context context)
 		{
-			Error.CheckError (gp_camera_init (this.Handle, context.Handle));
+			Error.CheckError (gp_camera_exit (Handle, context.Handle));
 		}
+#endregion
+
+#region Operations on camera
+		[DllImport ("libgphoto2.so")]
+		internal static extern ErrorCode gp_camera_get_summary (HandleRef camera, out CameraText summary, HandleRef context);
+		
+		public CameraText GetSummary (Context context)
+		{
+			CameraText summary;
+			Error.CheckError (Camera.gp_camera_get_summary(this.Handle, out summary, context.Handle));
+
+			return summary;
+		}
+		
+		[DllImport ("libgphoto2.so")]
+		internal static extern ErrorCode gp_camera_get_about (HandleRef camera, out CameraText about, HandleRef context);
+
+		public CameraText GetAbout (Context context)
+		{
+			CameraText about;
+			Error.CheckError (gp_camera_get_about(this.Handle, out about, context.Handle));
+
+			return about;
+		}
+
+		[DllImport ("libgphoto2.so")]
+		internal static extern ErrorCode gp_camera_get_manual (HandleRef camera, out CameraText manual, HandleRef context);
 		
+		public CameraText GetManual (Context context)
+		{
+			CameraText manual;
+			unsafe
+			{
+				Error.CheckError (gp_camera_get_manual(this.Handle, out manual, context.Handle));
+			}
+			return manual;
+		}
+
 		[DllImport ("libgphoto2.so")]
 		internal static extern ErrorCode gp_camera_capture (HandleRef camera, CameraCaptureType type, out CameraFilePath path, HandleRef context);
 		
 		public CameraFilePath Capture (CameraCaptureType type, Context context)
 		{
 			CameraFilePath path;
-
 			Error.CheckError (gp_camera_capture (this.Handle, type, out path, context.Handle));
 
 			return path;
@@ -227,57 +143,37 @@ namespace LibGPhoto2
 		[DllImport ("libgphoto2.so")]
 		internal unsafe static extern ErrorCode gp_camera_capture_preview (HandleRef camera, HandleRef file, HandleRef context);
 		
-		public CameraFile CapturePreview (Context context)
+		public void CapturePreview (CameraFile dest, Context context)
 		{
-			CameraFile file = new CameraFile();
-			
-			Error.CheckError (gp_camera_capture_preview (this.Handle, file.Handle, context.Handle));
-
-			return file;
+			Error.CheckError (gp_camera_capture_preview (this.Handle, dest.Handle, context.Handle));
 		}
-		
-#if UNUSED
-		[DllImport ("libgphoto2.so")]
-		internal static extern ErrorCode gp_camera_get_config (HandleRef camera, out IntPtr window, HandleRef context);
-		
-		[DllImport ("libgphoto2.so")]
-		internal static extern ErrorCode gp_camera_set_config (HandleRef camera, out IntPtr window, HandleRef context);
-#endif		
+#endregion
 
+#region Operations on folders
 		[DllImport ("libgphoto2.so")]
-		internal static extern ErrorCode gp_camera_folder_list_files (HandleRef camera, string folder, HandleRef list, HandleRef context);
+		internal static extern ErrorCode gp_camera_folder_list_files (HandleRef camera, [MarshalAs(UnmanagedType.LPTStr)] string folder, HandleRef list, HandleRef context);
 		
 		public CameraList ListFiles (string folder, Context context)
 		{
 			CameraList file_list = new CameraList ();
-			
 			Error.CheckError (gp_camera_folder_list_files(this.Handle, folder, file_list.Handle, context.Handle));
 
 			return file_list;
 		}
 		
 		[DllImport ("libgphoto2.so")]
-		internal static extern ErrorCode gp_camera_folder_list_folders (HandleRef camera, string folder, HandleRef list, HandleRef context);
+		internal static extern ErrorCode gp_camera_folder_list_folders (HandleRef camera, [MarshalAs(UnmanagedType.LPTStr)] string folder, HandleRef list, HandleRef context);
 
 		public CameraList ListFolders (string folder, Context context)
 		{
 			CameraList file_list = new CameraList();
-
 			Error.CheckError (gp_camera_folder_list_folders (this.Handle, folder, file_list.Handle, context.Handle));
 
 			return file_list;
 		}
 		
 		[DllImport ("libgphoto2.so")]
-		internal unsafe static extern ErrorCode gp_camera_folder_put_file (HandleRef camera, [MarshalAs(UnmanagedType.LPTStr)] string folder, HandleRef file, HandleRef context);
-		
-		public void PutFile (string folder, CameraFile file, Context context)
-		{
-			Error.CheckError (gp_camera_folder_put_file(this.Handle, folder, file.Handle, context.Handle));
-		}
-		
-		[DllImport ("libgphoto2.so")]
-		internal static extern ErrorCode gp_camera_folder_delete_all (HandleRef camera, string folder, HandleRef context);
+		internal static extern ErrorCode gp_camera_folder_delete_all (HandleRef camera, [MarshalAs(UnmanagedType.LPTStr)] string folder, HandleRef context);
 		
 		public void DeleteAll (string folder, Context context)
 		{
@@ -285,7 +181,7 @@ namespace LibGPhoto2
 		}
 		
 		[DllImport ("libgphoto2.so")]
-		internal static extern ErrorCode gp_camera_folder_make_dir (HandleRef camera, string folder,  string name, HandleRef context);
+		internal static extern ErrorCode gp_camera_folder_make_dir (HandleRef camera, [MarshalAs(UnmanagedType.LPTStr)] string folder, [MarshalAs(UnmanagedType.LPTStr)] string name, HandleRef context);
 		
 		public void MakeDirectory (string folder, string name, Context context)
 		{
@@ -293,54 +189,47 @@ namespace LibGPhoto2
 		}
 		
 		[DllImport ("libgphoto2.so")]
-		internal static extern ErrorCode gp_camera_folder_remove_dir (HandleRef camera, string folder, string name, HandleRef context);
+		internal static extern ErrorCode gp_camera_folder_remove_dir (HandleRef camera, [MarshalAs(UnmanagedType.LPTStr)] string folder, [MarshalAs(UnmanagedType.LPTStr)] string name, HandleRef context);
 		
 		public void RemoveDirectory (string folder, string name, Context context)
 		{
 			Error.CheckError (gp_camera_folder_remove_dir(this.Handle, folder, name, context.Handle));
 		}
-		
 
 		[DllImport ("libgphoto2.so")]
-		internal static extern ErrorCode gp_camera_file_get (HandleRef camera, [MarshalAs(UnmanagedType.LPTStr)] string folder, [MarshalAs(UnmanagedType.LPTStr)] string file, CameraFileType type, HandleRef camera_file, HandleRef context);
+		internal unsafe static extern ErrorCode gp_camera_folder_put_file (HandleRef camera, [MarshalAs(UnmanagedType.LPTStr)] string folder, HandleRef file, HandleRef context);
 		
-		public CameraFile GetFile (string folder, string name, CameraFileType type, Context context)
+		public void PutFile (string folder, CameraFile file, Context context)
 		{
-			CameraFile file = new CameraFile();
-			
-			Error.CheckError (gp_camera_file_get(this.Handle, folder, name, type, file.Handle, context.Handle));
-
-			return file;
+			Error.CheckError (gp_camera_folder_put_file(this.Handle, folder, file.Handle, context.Handle));
 		}
-
+#endregion		
+			
+#region Operations on files
+		[DllImport ("libgphoto2.so")]
+		internal static extern ErrorCode gp_camera_file_get (HandleRef camera, [MarshalAs(UnmanagedType.LPTStr)] string folder, [MarshalAs(UnmanagedType.LPTStr)] string file, CameraFileType type, HandleRef camera_file, HandleRef context);
+		
 		public void GetFile (string folder, string name, CameraFileType type, CameraFile camera_file, Context context)
 		{
-			Error.CheckError (gp_camera_file_get(this.Handle, folder, name, type, camera_file.Handle, context.Handle));
-			
+			Error.CheckError (gp_camera_file_get(this.Handle, folder, name, type, camera_file.Handle, context.Handle));	
 		}
 		
 		[DllImport ("libgphoto2.so")]
-		internal static extern ErrorCode gp_camera_file_delete (HandleRef camera, string folder, string file, HandleRef context);
+		internal static extern ErrorCode gp_camera_file_delete (HandleRef camera, [MarshalAs(UnmanagedType.LPTStr)] string folder, [MarshalAs(UnmanagedType.LPTStr)] string file, HandleRef context);
 
 		public void DeleteFile (string folder, string name, Context context)
 		{
-			unsafe
-			{
-				Error.CheckError (gp_camera_file_delete(this.Handle, folder, name, context.Handle));
-			}
+			Error.CheckError (gp_camera_file_delete(this.Handle, folder, name, context.Handle));
 		}
 		
 		
 		[DllImport ("libgphoto2.so")]
-		internal static extern ErrorCode gp_camera_file_get_info (HandleRef camera, string folder, string file, out CameraFileInfo info, HandleRef context);
+		internal static extern ErrorCode gp_camera_file_get_info (HandleRef camera, [MarshalAs(UnmanagedType.LPTStr)] string folder, [MarshalAs(UnmanagedType.LPTStr)] string file, out CameraFileInfo info, HandleRef context);
 		
 		public CameraFileInfo GetFileInfo (string folder, string name, Context context)
 		{
 			CameraFileInfo fileinfo;
-			unsafe
-			{
-				Error.CheckError (gp_camera_file_get_info(this.Handle, folder, name, out fileinfo, context.Handle));
-			}
+			Error.CheckError (gp_camera_file_get_info(this.Handle, folder, name, out fileinfo, context.Handle));
 
 			return fileinfo;
 		}
@@ -350,57 +239,8 @@ namespace LibGPhoto2
 		
 		public void SetFileInfo (string folder, string name, CameraFileInfo fileinfo, Context context)
 		{
-			unsafe
-			{
-				Error.CheckError (gp_camera_file_set_info(this.Handle, folder, name, fileinfo, context.Handle));
-			}
-		}
-		
-		[DllImport ("libgphoto2.so")]
-		internal static extern ErrorCode gp_camera_get_manual (HandleRef camera, out CameraText manual, HandleRef context);
-		
-		public CameraText GetManual (Context context)
-		{
-			CameraText manual;
-			unsafe
-			{
-				Error.CheckError (gp_camera_get_manual(this.Handle, out manual, context.Handle));
-			}
-			return manual;
-		}
-		
-		[DllImport ("libgphoto2.so")]
-		internal static extern ErrorCode gp_camera_get_summary (HandleRef camera, out CameraText summary, HandleRef context);
-		
-		public CameraText GetSummary (Context context)
-		{
-			CameraText summary;
-
-			Error.CheckError (Camera.gp_camera_get_summary(this.Handle, out summary, context.Handle));
-
-			return summary;
-		}
-		
-		[DllImport ("libgphoto2.so")]
-		internal static extern ErrorCode gp_camera_get_about (HandleRef camera, out CameraText about, HandleRef context);
-
-		public CameraText GetAbout (Context context)
-		{
-			CameraText about;
-			
-			Error.CheckError (gp_camera_get_about(this.Handle, out about, context.Handle));
-
-			return about;
-		}
-		
-		public CameraFilesystem GetFS()
-		{
-			CameraFilesystem fs;
-			unsafe {
-				_Camera *obj = (_Camera *)this.Handle.Handle;
-				fs = new CameraFilesystem((IntPtr)obj->GetFS ());
-			}
-			return fs;
+			Error.CheckError (gp_camera_file_set_info(this.Handle, folder, name, fileinfo, context.Handle));
 		}
+#endregion			
 	}
 }
diff --git a/lib/libgphoto2-sharp/CameraAbilities.cs b/lib/libgphoto2-sharp/CameraAbilities.cs
new file mode 100644
index 0000000..7039212
--- /dev/null
+++ b/lib/libgphoto2-sharp/CameraAbilities.cs
@@ -0,0 +1,114 @@
+/*
+ * CameraAbilities.cs
+ *
+ * Author(s):
+ *	Stephane Delcroix <stephane delcroix org>
+ *	Ewen Cheslack-Postava <echeslack gmail com>
+ *	Larry Ewing <lewing novell com>
+ *
+ * Copyright (c) 2005-2009 Novell, Inc.
+ *
+ * This is open source software. See COPYING for details.
+ */
+
+using System;
+using System.Runtime.InteropServices;
+
+namespace GPhoto2
+{
+	[StructLayout(LayoutKind.Sequential)]
+	public unsafe struct CameraAbilities
+	{
+		[MarshalAs(UnmanagedType.ByValTStr, SizeConst=128)] string model;
+		CameraDriverStatus status;
+		
+		PortType port;
+		[MarshalAs(UnmanagedType.ByValArray, SizeConst=64)] int[] speed;
+		
+		CameraOperation operations;
+		CameraFileOperation file_operations;
+		CameraFolderOperation folder_operations;
+		
+		int usb_vendor;
+		int usb_product;
+		int usb_class;
+		int usb_subclass;
+		int usb_protocol;
+		
+#pragma warning disable 169
+		[MarshalAs(UnmanagedType.ByValTStr, SizeConst=1024)] string library;
+		[MarshalAs(UnmanagedType.ByValTStr, SizeConst=1024)] string id;
+#pragma warning restore 169
+
+		DeviceType device_type;
+		
+#pragma warning disable 169
+		int reserved2;
+		int reserved3;
+		int reserved4;
+		int reserved5;
+		int reserved6;
+		int reserved7;
+		int reserved8;
+#pragma warning restore 169
+
+		public override string ToString ()
+		{
+			string ret = String.Format ("{0} ({1})", Model, PortType);
+			if (DriverStatus != CameraDriverStatus.Production)
+				ret += String.Format (" <{0}>", DriverStatus);
+			return ret;
+		}
+
+		public string Model {
+			get { return model; }
+		}
+
+		public CameraDriverStatus DriverStatus {
+			get { return status; }
+		}
+		public PortType PortType {
+			get { return port; }
+		}
+
+		public int[] Speeds {
+			get { return speed; } 
+		}
+
+		public CameraOperation CameraOperation {
+			get { return operations; }
+		}
+
+		public CameraFileOperation CameraFileOperation {
+			get { return file_operations; }
+		}
+
+		public CameraFolderOperation CameraFolderOperation {
+			get { return folder_operations; }
+		}
+
+		public int UsbVendor {
+			get { return usb_vendor; }
+		}
+
+		public int UsbProduct {
+			get { return usb_product; }
+		}
+
+		public int UsbClass {
+			get { return usb_class; }
+		}
+
+		public int UsbSubclass {
+			get { return usb_subclass; }
+		}
+
+		public int UsbProtocol {
+			get { return usb_protocol; }
+		}
+
+		public DeviceType DeviceType {
+			get { return device_type;}
+		}
+	}
+}
diff --git a/lib/libgphoto2-sharp/CameraAbilitiesList.cs b/lib/libgphoto2-sharp/CameraAbilitiesList.cs
index 1f0c97d..8c1ceb1 100644
--- a/lib/libgphoto2-sharp/CameraAbilitiesList.cs
+++ b/lib/libgphoto2-sharp/CameraAbilitiesList.cs
@@ -2,173 +2,80 @@
  * CameraAbilitiesList.cs
  *
  * Author(s):
+ *	Stephane Delcroix <stephane delcroix org>
  *	Ewen Cheslack-Postava <echeslack gmail com>
  *	Larry Ewing <lewing novell com>
  *
- * This is free software. See COPYING for details.
+ * Copyright (c) 2005-2009 Novell, Inc.
+ *
+ * This is open source software. See COPYING for details.
  */
+
 using System;
 using System.Runtime.InteropServices;
+using System.Collections.Generic;
+using System.Collections;
 
-namespace LibGPhoto2
+namespace GPhoto2
 {
-
-	public enum CameraDriverStatus
-	{
-		Production,
-		Testing,
-		Experimental
-	}
-	
-	public enum CameraOperation
-	{
-		None		= 0,
-		CaptureImage	= 1 << 0,
-		CaptureVideo	= 1 << 1,
-		CaptureAudio	= 1 << 2,
-		CapturePreview	= 1 << 3,
-		Config		= 1 << 4
-	}
-	
-	public enum CameraFileOperation
-	{
-		None		= 0,
-		Delete		= 1 << 1,
-		Preview		= 1 << 3,
-		Raw			= 1 << 4,
-		Audio		= 1 << 5,
-		Exif		= 1 << 6
-	}
-	
-	public enum CameraFolderOperation
-	{
-		None			= 0,
-		DeleteAll		= 1 << 0,
-		PutFile			= 1 << 1,
-		MakeDirectory		= 1 << 2,
-		RemoveDirectory		= 1 << 3
-	}
-	
-	[StructLayout(LayoutKind.Sequential)]
-	public unsafe struct CameraAbilities
-	{
-		[MarshalAs(UnmanagedType.ByValTStr, SizeConst=128)] public string model;
-		public CameraDriverStatus status;
-		
-		public PortType port;
-		[MarshalAs(UnmanagedType.ByValArray, SizeConst=64)] public int[] speed;
-		
-		public CameraOperation operations;
-		public CameraFileOperation file_operations;
-		public CameraFolderOperation folder_operations;
-		
-		public int usb_vendor;
-		public int usb_product;
-		public int usb_class;
-		public int usb_subclass;
-		public int usb_protocol;
-		
-		[MarshalAs(UnmanagedType.ByValTStr, SizeConst=1024)] public string library;
-		[MarshalAs(UnmanagedType.ByValTStr, SizeConst=1024)] public string id;
-		
-		public int reserved1;
-		public int reserved2;
-		public int reserved3;
-		public int reserved4;
-		public int reserved5;
-		public int reserved6;
-		public int reserved7;
-		public int reserved8;
-	}
-	
-	public class CameraAbilitiesList : Object
+	public class CameraAbilitiesList : GPList<CameraAbilities>
 	{
 		[DllImport ("libgphoto2.so")]
 		internal static extern ErrorCode gp_abilities_list_new (out IntPtr native);
+		[DllImport ("libgphoto2.so")]
+		internal static extern ErrorCode gp_abilities_list_free (HandleRef list);
 
-		public CameraAbilitiesList()
+		public CameraAbilitiesList () : base (gp_abilities_list_free)
 		{
 			IntPtr native;
-
 			Error.CheckError (gp_abilities_list_new (out native));
-
 			this.handle = new HandleRef (this, native);
 		}
 		
 		[DllImport ("libgphoto2.so")]
-		internal static extern ErrorCode gp_abilities_list_free (HandleRef list);
-		
-		protected override void Cleanup ()
-		{
-			gp_abilities_list_free(this.handle);
-		}
-		
-		[DllImport ("libgphoto2.so")]
 		internal unsafe static extern ErrorCode gp_abilities_list_load (HandleRef list, HandleRef context);
 
 		public void Load (Context context)
 		{
-			unsafe {
-				ErrorCode result = gp_abilities_list_load (this.Handle, context.Handle);
-				
-				if (Error.IsError (result))
-					throw Error.ErrorException(result);
-			}
+			Error.CheckError (gp_abilities_list_load (this.Handle, context.Handle));
 		}
 		
 		[DllImport ("libgphoto2.so")]
 		internal unsafe static extern ErrorCode gp_abilities_list_detect (HandleRef list, HandleRef info_list, HandleRef l, HandleRef context);
 
-		public void Detect (PortInfoList info_list, CameraList l, Context context)
+		public CameraList Detect (PortInfoList info_list, Context context)
 		{
-			Error.CheckError (gp_abilities_list_detect (this.handle, info_list.Handle, 
-								    l.Handle, context.Handle));
+			CameraList camera_list = new CameraList ();
+			Error.CheckError (gp_abilities_list_detect (Handle, info_list.Handle, 
+								    camera_list.Handle, context.Handle));
+			return camera_list;
 		}
 		
 		[DllImport ("libgphoto2.so")]
 		internal static extern ErrorCode gp_abilities_list_count (HandleRef list);
 
-		public int Count ()
-		{
-			ErrorCode result = gp_abilities_list_count (this.handle);
-
-			if (Error.IsError (result)) 
-				throw Error.ErrorException (result);
-
-			return (int)result;
-		}
-		
-		[DllImport ("libgphoto2.so")]
-		internal static extern ErrorCode gp_abilities_list_lookup_model (HandleRef list, string model);
-
-		public int LookupModel (string model)
-		{
-			ErrorCode result = gp_abilities_list_lookup_model(this.handle, model);
-
-			if (Error.IsError (result))
-				throw Error.ErrorException (result);
-	
-			return (int)result;
+		public override int Count {
+			get { return Error.CheckError (gp_abilities_list_count (this.handle)); }
 		}
 		
 		[DllImport ("libgphoto2.so")]
 		internal static extern ErrorCode gp_abilities_list_get_abilities (HandleRef list, int index, out CameraAbilities abilities);
 
-		public CameraAbilities GetAbilities (int index)
-		{
-			CameraAbilities abilities = new CameraAbilities ();
+		public override CameraAbilities this [int index] {
+			get {
+				CameraAbilities abilities;
+				Error.CheckError (gp_abilities_list_get_abilities(this.Handle, index, out abilities));
 
-			Error.CheckError (gp_abilities_list_get_abilities(this.Handle, index, out abilities));
-
-			return abilities;
+				return abilities;
+			}
 		}
-		
+
 		[DllImport ("libgphoto2.so")]
-		internal static extern ErrorCode gp_abilities_list_append (HandleRef list, ref CameraAbilities abilities);
+		internal static extern ErrorCode gp_abilities_list_lookup_model (HandleRef list, [MarshalAs (UnmanagedType.LPTStr)]string model);
 
-		public void Append (CameraAbilities abilities)
-		{
-			Error.CheckError (gp_abilities_list_append (this.Handle, ref abilities));
+		public CameraAbilities this [string model] {
+			get { return this [Error.CheckError (gp_abilities_list_lookup_model(this.handle, model))]; }
 		}
+			
 	}
 }
diff --git a/lib/libgphoto2-sharp/CameraCaptureType.cs b/lib/libgphoto2-sharp/CameraCaptureType.cs
new file mode 100644
index 0000000..c3fcdc1
--- /dev/null
+++ b/lib/libgphoto2-sharp/CameraCaptureType.cs
@@ -0,0 +1,19 @@
+/*
+ * CameraCaptureType.cs
+ *
+ * Author(s):
+ *	Stephane Delcroix <stephane delcroix org>
+ *
+ * Copyright (c) 2009 Novell, Inc.
+ *
+ * This is open source software. See COPYING for details.
+ */
+
+namespace GPhoto2
+{
+	public enum CameraCaptureType {
+		Image,
+		Movie,
+		Sound,
+	}
+}
diff --git a/lib/libgphoto2-sharp/CameraDriverStatus.cs b/lib/libgphoto2-sharp/CameraDriverStatus.cs
new file mode 100644
index 0000000..6eb710e
--- /dev/null
+++ b/lib/libgphoto2-sharp/CameraDriverStatus.cs
@@ -0,0 +1,22 @@
+/*
+ * CameraDriverStatus.cs
+ *
+ * Author(s):
+ *	Ewen Cheslack-Postava <echeslack gmail com>
+ *	Larry Ewing <lewing novell com>
+ *	Stephane Delcroix <stephane delcroix org>
+ *
+ * Copyright (c) 2005-2009 Novell, Inc.
+ *
+ * This is open source software. See COPYING for details.
+ */
+
+namespace GPhoto2
+{
+	public enum CameraDriverStatus {
+		Production,
+		Testing,
+		Experimental,
+		Deprecated,
+	}
+}
diff --git a/lib/libgphoto2-sharp/CameraEventType.cs b/lib/libgphoto2-sharp/CameraEventType.cs
new file mode 100644
index 0000000..03d155c
--- /dev/null
+++ b/lib/libgphoto2-sharp/CameraEventType.cs
@@ -0,0 +1,20 @@
+/*
+ * CameraEventType.cs
+ *
+ * Author(s):
+ *	Stephane Delcroix <stephane delcroix org>
+ *
+ * Copyright (c) 2009 Novell, Inc.
+ *
+ * This is open source software. See COPYING for details.
+ */
+
+namespace GPhoto2
+{
+	public enum CameraEventType {
+		Unknown,
+		Timeout,
+		FileAdded,
+		FolderAdded,
+	}
+}
diff --git a/lib/libgphoto2-sharp/CameraFile.cs b/lib/libgphoto2-sharp/CameraFile.cs
index eb8ca5f..a43d0b9 100644
--- a/lib/libgphoto2-sharp/CameraFile.cs
+++ b/lib/libgphoto2-sharp/CameraFile.cs
@@ -8,12 +8,12 @@
  *
  * Copyright (c) 2005-2009 Novell, Inc.
  *
- * This is free software. See COPYING for details.
+ * This is open source software. See COPYING for details.
  */
 using System;
 using System.Runtime.InteropServices;
 
-namespace LibGPhoto2
+namespace GPhoto2
 {
 	public enum CameraFileType
 	{
@@ -21,218 +21,71 @@ namespace LibGPhoto2
 		Normal,
 		Raw,
 		Audio,
-		Exif
+		Exif,
+		Metadata,
 	}
 	
 	public class MimeTypes
 	{
+		[MarshalAs(UnmanagedType.LPTStr)] public static string ASF = "audio/x-asf";
 		[MarshalAs(UnmanagedType.LPTStr)] public static string AVI = "video/x-msvideo";
 		[MarshalAs(UnmanagedType.LPTStr)] public static string BMP = "image/bmp";
 		[MarshalAs(UnmanagedType.LPTStr)] public static string CRW = "image/x-canon-raw";
+		[MarshalAs(UnmanagedType.LPTStr)] public static string CR2 = "image/x-canon-raw";
+		[MarshalAs(UnmanagedType.LPTStr)] public static string EXIF = "application/x-exif";
 		[MarshalAs(UnmanagedType.LPTStr)] public static string JPEG = "image/jpeg";
+		[MarshalAs(UnmanagedType.LPTStr)] public static string MP3 = "audio/mpeg";
+		[MarshalAs(UnmanagedType.LPTStr)] public static string MPEG = "video/mpeg";
+		[MarshalAs(UnmanagedType.LPTStr)] public static string OGG = "application/ogg";
 		[MarshalAs(UnmanagedType.LPTStr)] public static string PGM = "image/x-portable-graymap";
 		[MarshalAs(UnmanagedType.LPTStr)] public static string PNG = "image/png";
+		[MarshalAs(UnmanagedType.LPTStr)] public static string PNM = "image-x-portable-anymap";
 		[MarshalAs(UnmanagedType.LPTStr)] public static string PPM = "image-x-portable-pixmap";
 		[MarshalAs(UnmanagedType.LPTStr)] public static string QUICKTIME = "video/quicktime";
 		[MarshalAs(UnmanagedType.LPTStr)] public static string RAW = "image/x-raw";
 		[MarshalAs(UnmanagedType.LPTStr)] public static string TIFF = "image/tiff";
 		[MarshalAs(UnmanagedType.LPTStr)] public static string UNKNOWN = "application/octet-stream";
 		[MarshalAs(UnmanagedType.LPTStr)] public static string WAV = "audio/wav";
+		[MarshalAs(UnmanagedType.LPTStr)] public static string WMA = "audio/x-wma";
 	}
 
-	public class CameraFile : Object 
+	public class CameraFile : GPObject 
 	{
 		[DllImport ("libgphoto2.so")]
 		internal static extern ErrorCode gp_file_new (out IntPtr file);
+		[DllImport ("libgphoto2.so")]
+		internal static extern ErrorCode gp_file_unref (HandleRef file);
 
-		public CameraFile()
+		public CameraFile () : base (gp_file_unref)
 		{
 			IntPtr native;
-
 			Error.CheckError (gp_file_new (out native));
-
 			this.handle = new HandleRef (this, native);
 		}
 
-#if GPHOTO2_2_4
 		[DllImport ("libgphoto2.so")]
 		internal static extern ErrorCode gp_file_new_from_fd (out IntPtr file, int fd);
 
-		public CameraFile(int fd)
+		public CameraFile (int fd) : base (gp_file_unref)
 		{
 			IntPtr native;
-
 			Error.CheckError (gp_file_new_from_fd (out native, fd));
-
 			this.handle = new HandleRef (this, native);
 		}
-#endif
-
-		[DllImport ("libgphoto2.so")]
-		internal static extern ErrorCode gp_file_unref (HandleRef file);
-
-		protected override void Cleanup () {
-			gp_file_unref (this.Handle);
-		}
-		
-		[DllImport ("libgphoto2.so")]
-		internal static extern ErrorCode gp_file_append (HandleRef file, byte[] data, ulong size);
-
-		public void Append (byte[] data)
-		{
-			Error.CheckError (gp_file_append (this.Handle, data, (ulong)data.Length));
-		}
-		
-		[DllImport ("libgphoto2.so")]
-		internal static extern ErrorCode gp_file_open (HandleRef file, string filename);
-
-		public void Open (string filename)
-		{
-			Error.CheckError (gp_file_open (this.Handle, filename));
-		}
 
 		[DllImport ("libgphoto2.so")]
 		internal static extern ErrorCode gp_file_save (HandleRef file, string filename);
 
+		[Obsolete ("DO NOT USE")]
 		public void Save (string filename)
 		{
 			Error.CheckError (gp_file_save (this.Handle, filename));
 		}
 		
 		[DllImport ("libgphoto2.so")]
-		internal static extern ErrorCode gp_file_clean (HandleRef file);
-
-		public void Clean (string filename)
-		{
-			Error.CheckError (gp_file_clean (this.Handle));
-		}
-
-		[DllImport ("libgphoto2.so")]
-		internal static extern ErrorCode gp_file_get_name (HandleRef file, out string name);
-
-		public string GetName ()
-		{
-			string name;
-			
-			Error.CheckError (gp_file_get_name (this.Handle, out name));
-
-			return name;
-		}
-		
-
-		[DllImport ("libgphoto2.so")]
-		internal static extern ErrorCode gp_file_set_name (HandleRef file, string name);
-
-		public void SetName (string name)
-		{
-			Error.CheckError (gp_file_set_name (this.Handle, name));
-		}
-
-		[DllImport ("libgphoto2.so")]
-		internal static extern ErrorCode gp_file_get_type (HandleRef file, out CameraFileType type);
-
-		public CameraFileType GetFileType ()
-		{
-			CameraFileType type;
-
-			Error.CheckError (gp_file_get_type (this.Handle, out type));
-
-			return type;
-		}
-		
-
-		[DllImport ("libgphoto2.so")]
-		internal static extern ErrorCode gp_file_set_type (HandleRef file, CameraFileType type);
-
-		public void SetFileType (CameraFileType type)
-		{
-			Error.CheckError (gp_file_set_type (this.Handle, type));
-		}
-		
-		[DllImport ("libgphoto2.so")]
-		internal static extern ErrorCode gp_file_get_mime_type (HandleRef file, out string mime_type);
-
-		public string GetMimeType ()
-		{
-			string mime;
-			
-			Error.CheckError (gp_file_get_mime_type (this.Handle, out mime));
-
-			return mime;
-		}
-		
-
-		[DllImport ("libgphoto2.so")]
-		internal static extern ErrorCode gp_file_set_mime_type (HandleRef file, string mime_type);
-
-		public void SetMimeType (string mime_type)
-		{
-			Error.CheckError (gp_file_set_mime_type (this.Handle, mime_type));
-		}
-		
-		[DllImport ("libgphoto2.so")]
-		internal static extern ErrorCode gp_file_detect_mime_type (HandleRef file);
-
-		public void DetectMimeType ()
-		{
-			Error.CheckError (gp_file_detect_mime_type  (this.Handle));
-		}
-		
-		
-		[DllImport ("libgphoto2.so")]
-		internal static extern ErrorCode gp_file_adjust_name_for_mime_type (HandleRef file);
-
-		public void AdjustNameForMimeType ()
-		{
-			Error.CheckError (gp_file_adjust_name_for_mime_type (this.Handle));
-		}
-		
-		[DllImport ("libgphoto2.so")]
-		internal static extern ErrorCode gp_file_convert (HandleRef file, [MarshalAs(UnmanagedType.LPTStr)] string mime_type);
-
-		public void Convert (string mime_type)
-		{
-			Error.CheckError (CameraFile.gp_file_convert (this.Handle, mime_type));
-		}
-		
-		[DllImport ("libgphoto2.so")]
-		internal static extern ErrorCode gp_file_copy (HandleRef destination, HandleRef source);
-
-		public void Copy (CameraFile source)
-		{
-			Error.CheckError (gp_file_copy (this.Handle, source.Handle));
-		}
-		
-		//[DllImport ("libgphoto2.so")]
-		//internal static extern ErrorCode gp_file_set_color_table (HandleRef file, byte *red_table, int red_size, byte *green_table, int green_size, byte *blue_table, int blue_size);
-
-		[DllImport ("libgphoto2.so")]
-		internal static extern ErrorCode gp_file_set_header (HandleRef file, [MarshalAs(UnmanagedType.LPTStr)] byte[] header);
-
-		public void SetHeader (byte[] header)
-		{
-			Error.CheckError (gp_file_set_header(this.Handle, header));
-		}
-		
-		[DllImport ("libgphoto2.so")]
-		internal static extern ErrorCode gp_file_set_width_and_height (HandleRef file, int width, int height);
-
-		public void SetWidthHeight (int width, int height)
-		{
-			Error.CheckError (gp_file_set_width_and_height(this.Handle, width, height));
-		}
-		
-		[DllImport ("libgphoto2.so")]
-		internal static extern ErrorCode gp_file_set_data_and_size (HandleRef file, byte[] data, ulong size);
-
-		public void SetDataAndSize (byte[] data)
-		{
-			Error.CheckError (gp_file_set_data_and_size (this.Handle, data, (ulong)data.Length));
-		}
-		
-		[DllImport ("libgphoto2.so")]
 		internal static extern ErrorCode gp_file_get_data_and_size (HandleRef file, out IntPtr data, out IntPtr size);
 
+		[Obsolete ("DO NOT USE")]
 		public byte[] GetDataAndSize ()
 		{
 			IntPtr size;
diff --git a/lib/libgphoto2-sharp/CameraFileOperation.cs b/lib/libgphoto2-sharp/CameraFileOperation.cs
new file mode 100644
index 0000000..296db30
--- /dev/null
+++ b/lib/libgphoto2-sharp/CameraFileOperation.cs
@@ -0,0 +1,27 @@
+/*
+ * CameraFileOperation.cs
+ *
+ * Author(s):
+ *	Ewen Cheslack-Postava <echeslack gmail com>
+ *	Larry Ewing <lewing novell com>
+ *	Stephane Delcroix <stephane delcroix org>
+ *
+ * Copyright (c) 2005-2009 Novell, Inc.
+ *
+ * This is open source software. See COPYING for details.
+ */
+
+using System;
+
+namespace GPhoto2
+{
+	[Flags]
+	public enum CameraFileOperation {
+		None		= 0,
+		Delete		= 1 << 1,
+		Preview		= 1 << 3,
+		Raw		= 1 << 4,
+		Audio		= 1 << 5,
+		Exif		= 1 << 6,
+	}
+}		
diff --git a/lib/libgphoto2-sharp/CameraFilePath.cs b/lib/libgphoto2-sharp/CameraFilePath.cs
new file mode 100644
index 0000000..4ac2b2f
--- /dev/null
+++ b/lib/libgphoto2-sharp/CameraFilePath.cs
@@ -0,0 +1,35 @@
+/*
+ * xxx.cs
+ *
+ * Author(s):
+ *	Ewen Cheslack-Postava <echeslack gmail com>
+ *	Larry Ewing <lewing novell com>
+ *	Stephane Delcroix <stephane delcroix org>
+ *
+ * Copyright (c) 2005-2009 Novell, Inc.
+ *
+ * This is open source software. See COPYING for details.
+ */
+
+using System;
+using System.Runtime.InteropServices;
+
+namespace GPhoto2
+{
+	[StructLayout(LayoutKind.Sequential)]
+	public unsafe struct CameraFilePath
+	{
+		[MarshalAs(UnmanagedType.ByValTStr, SizeConst=128)] string name;
+		[MarshalAs(UnmanagedType.ByValTStr, SizeConst=1024)] string folder;
+
+		public string Name {
+			get { return name; }
+			set { name = value; }
+		}
+
+		public string Folder {
+			get { return folder; }
+			set { folder = value; }
+		}
+	}
+}
diff --git a/lib/libgphoto2-sharp/CameraFilesystem.cs b/lib/libgphoto2-sharp/CameraFilesystem.cs
index 150ac3b..1d94675 100644
--- a/lib/libgphoto2-sharp/CameraFilesystem.cs
+++ b/lib/libgphoto2-sharp/CameraFilesystem.cs
@@ -10,7 +10,7 @@
 using System;
 using System.Runtime.InteropServices;
 
-namespace LibGPhoto2
+namespace GPhoto2
 {
 	public enum CameraFilePermissions
 	{
@@ -81,282 +81,4 @@ namespace LibGPhoto2
 		public CameraFileInfoFile file;
 		public CameraFileInfoAudio audio;
 	}
-      
-#if false
-	[StructLayout(LayoutKind.Sequential)]
-	internal unsafe struct _CameraFilesystem
-	{
-		
-		internal delegate ErrorCode _CameraFilesystemGetFileFunc (HandleRef fs, char *folder, char *filename, CameraFileType type, HandleRef file, void *data, HandleRef context);
-
-		internal delegate ErrorCode _CameraFilesystemDeleteFileFunc (HandleRef fs, char *folder, char *filename, void *data, HandleRef context);
-
-		[DllImport ("libgphoto2.so")]
-		internal static extern ErrorCode gp_filesystem_set_file_funcs (HandleRef fs, _CameraFilesystemGetFileFunc get_file_func, _CameraFilesystemDeleteFileFunc del_file_func, void *data);
-		
-		internal delegate ErrorCode _CameraFilesystemGetInfoFunc (HandleRef fs, char *folder, char *filename, CameraFileInfo *info, void *data, HandleRef context);
-
-		internal delegate ErrorCode _CameraFilesystemSetInfoFunc (HandleRef fs, char *folder, char *filename, CameraFileInfo info, void *data, HandleRef context);
-
-		[DllImport ("libgphoto2.so")]
-		internal static extern ErrorCode gp_filesystem_set_info_funcs (HandleRef fs, _CameraFilesystemGetInfoFunc get_info_func, _CameraFilesystemSetInfoFunc set_info_func, void *data);
-
-		internal delegate ErrorCode _CameraFilesystemPutFileFunc (HandleRef fs, char *folder, HandleRef file, void *data, HandleRef context);
-
-		internal delegate ErrorCode _CameraFilesystemDeleteAllFunc (HandleRef fs, char *folder, void *data, HandleRef context);
-
-		internal delegate ErrorCode _CameraFilesystemDirFunc (HandleRef fs, char *folder, char *name, void *data, HandleRef context);
-
-		[DllImport ("libgphoto2.so")]
-		internal static extern ErrorCode gp_filesystem_set_folder_funcs (HandleRef fs, _CameraFilesystemPutFileFunc put_file_func, _CameraFilesystemDeleteAllFunc delete_all_func, _CameraFilesystemDirFunc make_dir_func, _CameraFilesystemDirFunc remove_dir_func, void *data);
-
-		internal delegate ErrorCode _CameraFilesystemListFunc (HandleRef fs, char *folder, HandleRef list, void *data, HandleRef context);
-
-		[DllImport ("libgphoto2.so")]
-		internal static extern ErrorCode gp_filesystem_set_list_funcs (HandleRef fs, _CameraFilesystemListFunc file_list_func, _CameraFilesystemListFunc folder_list_func, void *data);
-
-		[DllImport ("libgphoto2.so")]
-		internal static extern ErrorCode gp_filesystem_append (HandleRef fs, [MarshalAs(UnmanagedType.LPTStr)] string folder, [MarshalAs(UnmanagedType.LPTStr)] string filename, HandleRef context);
-
-		[DllImport ("libgphoto2.so")]
-		internal static extern ErrorCode gp_filesystem_set_file_noop (HandleRef fs, [MarshalAs(UnmanagedType.LPTStr)] string folder, HandleRef file, HandleRef context);
-
-		[DllImport ("libgphoto2.so")]
-		internal static extern ErrorCode gp_filesystem_dump (HandleRef fs);
-	}
-#endif
-
-	public class CameraFilesystem : Object
-	{
-		bool need_dispose;
-		
-		[DllImport ("libgphoto2.so")]
-		internal static extern ErrorCode gp_filesystem_new (out IntPtr fs);
-		
-		public CameraFilesystem()
-		{
-			IntPtr native;
-			
-			Error.CheckError (gp_filesystem_new(out native));
-			
-			this.handle = new HandleRef (this, native);
-			need_dispose = true;
-		}
-		
-		unsafe internal CameraFilesystem(IntPtr fs)
-		{
-			this.handle = new HandleRef (this, fs);
-			need_dispose = false;
-		}
-		
-		[DllImport ("libgphoto2.so")]
-		internal static extern ErrorCode gp_filesystem_free (HandleRef fs);
-
-		protected override void Cleanup ()
-		{
-			if (need_dispose)
-				Error.CheckError (gp_filesystem_free(this.Handle));
-		}
-		
-		[DllImport ("libgphoto2.so")]
-		internal static extern ErrorCode gp_filesystem_list_files (HandleRef fs, [MarshalAs(UnmanagedType.LPTStr)] string folder, HandleRef list, HandleRef context);
-
-		public CameraList ListFiles (string folder, Context context)
-		{
-			ErrorCode result;
-			CameraList list = new CameraList();
-			unsafe
-			{
-				result = gp_filesystem_list_files (this.Handle, folder, list.Handle, context.Handle);
-			}
-			if (Error.IsError(result)) throw Error.ErrorException(result);
-			return list;
-		}
-		
-		[DllImport ("libgphoto2.so")]
-		internal static extern ErrorCode gp_filesystem_list_folders (HandleRef fs, [MarshalAs(UnmanagedType.LPTStr)] string folder, HandleRef list, HandleRef context);
-
-		public CameraList ListFolders (string folder, Context context)
-		{
-			ErrorCode result;
-			CameraList list = new CameraList();
-			unsafe
-			{
-				result = gp_filesystem_list_folders (this.Handle, folder, list.Handle, context.Handle);
-			}
-			if (Error.IsError(result)) throw Error.ErrorException(result);
-			return list;
-		}
-		
-		[DllImport ("libgphoto2.so")]
-		internal static extern ErrorCode gp_filesystem_get_file (HandleRef fs, [MarshalAs(UnmanagedType.LPTStr)] string folder, [MarshalAs(UnmanagedType.LPTStr)] string filename, CameraFileType type, HandleRef file, HandleRef context);
-
-
-		public CameraFile GetFile (string folder, string filename, CameraFileType type, Context context)
-		{
-			ErrorCode result;
-			CameraFile file = new CameraFile();
-			unsafe
-			{
-				result = gp_filesystem_get_file (this.Handle, folder, filename, type, file.Handle, context.Handle);
-			}
-			if (Error.IsError(result)) throw Error.ErrorException(result);
-			return file;
-		}
-		
-		[DllImport ("libgphoto2.so")]
-		internal static extern ErrorCode gp_filesystem_put_file (HandleRef fs, [MarshalAs(UnmanagedType.LPTStr)] string folder, HandleRef file, HandleRef context);
-
-		public void PutFile (string folder, CameraFile file, Context context)
-		{
-			ErrorCode result;
-			unsafe
-			{
-				result = gp_filesystem_put_file (this.Handle, folder, file.Handle, context.Handle);
-			}
-			if (Error.IsError(result)) throw Error.ErrorException(result);
-		}
-		
-		[DllImport ("libgphoto2.so")]
-		internal static extern ErrorCode gp_filesystem_delete_file (HandleRef fs, [MarshalAs(UnmanagedType.LPTStr)] string folder, [MarshalAs(UnmanagedType.LPTStr)] string filename, HandleRef context);
-
-		public void DeleteFile (string folder, string filename, Context context)
-		{
-			ErrorCode result;
-			unsafe
-			{
-				result = gp_filesystem_delete_file (this.Handle, folder, filename, context.Handle);
-			}
-			if (Error.IsError(result)) throw Error.ErrorException(result);
-		}
-		
-		[DllImport ("libgphoto2.so")]
-		internal static extern ErrorCode gp_filesystem_delete_all (HandleRef fs, [MarshalAs(UnmanagedType.LPTStr)] string folder, HandleRef context);
-
-		public void DeleteAll (string folder, Context context)
-		{
-			ErrorCode result;
-			unsafe
-			{
-				result = gp_filesystem_delete_all (this.Handle, folder, context.Handle);
-			}
-			if (Error.IsError(result)) throw Error.ErrorException(result);
-		}
-		
-		[DllImport ("libgphoto2.so")]
-		internal static extern ErrorCode gp_filesystem_make_dir (HandleRef fs, [MarshalAs(UnmanagedType.LPTStr)] string folder, [MarshalAs(UnmanagedType.LPTStr)] string name, HandleRef context);
-
-		public void MakeDirectory (string folder, string name, Context context)
-		{
-			ErrorCode result;
-			unsafe
-			{
-				result = gp_filesystem_make_dir (this.Handle, folder, name, context.Handle);
-			}
-			if (Error.IsError(result)) throw Error.ErrorException(result);
-		}
-		
-		[DllImport ("libgphoto2.so")]
-		internal static extern ErrorCode gp_filesystem_remove_dir (HandleRef fs, [MarshalAs(UnmanagedType.LPTStr)] string folder, [MarshalAs(UnmanagedType.LPTStr)] string name, HandleRef context);
-
-		public void RemoveDirectory (string folder, string name, Context context)
-		{
-			ErrorCode result;
-			unsafe
-			{
-				result = gp_filesystem_remove_dir (this.Handle, folder, name, context.Handle);
-			}
-			if (Error.IsError(result)) throw Error.ErrorException(result);
-		}
-		
-		[DllImport ("libgphoto2.so")]
-		internal static extern ErrorCode gp_filesystem_get_info (HandleRef fs, [MarshalAs(UnmanagedType.LPTStr)] string folder, [MarshalAs(UnmanagedType.LPTStr)] string filename, out CameraFileInfo info, HandleRef context);
-
-		public CameraFileInfo GetInfo (string folder, string filename, Context context)
-		{
-			ErrorCode result;
-			CameraFileInfo fileinfo = new CameraFileInfo();
-			unsafe
-			{
-				result = gp_filesystem_get_info  (this.Handle, folder, filename, out fileinfo, context.Handle);
-			}
-			if (Error.IsError(result)) throw Error.ErrorException(result);
-			return fileinfo;
-		}
-		
-		[DllImport ("libgphoto2.so")]
-		internal static extern ErrorCode gp_filesystem_set_info (HandleRef fs, [MarshalAs(UnmanagedType.LPTStr)] string folder, [MarshalAs(UnmanagedType.LPTStr)] string filename, CameraFileInfo info, HandleRef context);
-
-		[DllImport ("libgphoto2.so")]
-		internal static extern ErrorCode gp_filesystem_set_info_noop (HandleRef fs, [MarshalAs(UnmanagedType.LPTStr)] string folder, CameraFileInfo info, HandleRef context);
-
-		public void SetInfo (string folder, string filename, CameraFileInfo fileinfo, Context context)
-		{
-			ErrorCode result;
-			unsafe
-			{
-				result = gp_filesystem_set_info (this.Handle, folder, filename, fileinfo, context.Handle);
-			}
-			if (Error.IsError(result)) throw Error.ErrorException(result);
-		}
-		
-		[DllImport ("libgphoto2.so")]
-		internal static extern ErrorCode gp_filesystem_number (HandleRef fs, [MarshalAs(UnmanagedType.LPTStr)] string folder, [MarshalAs(UnmanagedType.LPTStr)] string filename, HandleRef context);
-		
-		public int GetNumber (string folder, string filename, Context context)
-		{
-			ErrorCode result;
-			unsafe
-			{
-				result = gp_filesystem_number (this.Handle, folder, filename, context.Handle);
-			}
-			if (Error.IsError(result)) throw Error.ErrorException(result);
-			return (int)result;
-		}
-		
-		[DllImport ("libgphoto2.so")]
-		internal static extern ErrorCode gp_filesystem_name (HandleRef fs, [MarshalAs(UnmanagedType.LPTStr)] string folder, int filenumber, out string filename, HandleRef context);
-
-		public string GetName (string folder, int number, Context context)
-		{
-			ErrorCode result;
-			string name;
-			unsafe
-			{
-				result = gp_filesystem_name (this.Handle, folder, number, out name, context.Handle);
-			}
-			if (Error.IsError(result)) throw Error.ErrorException(result);
-			return name;
-		}
-		
-		//[DllImport ("libgphoto2.so")]
-		//internal static extern ErrorCode gp_filesystem_get_folder (HandleRef fs, [MarshalAs(UnmanagedType.LPTStr)] string filename, IntPtr folder, HandleRef context);
-
-		[DllImport ("libgphoto2.so")]
-		internal static extern ErrorCode gp_filesystem_count (HandleRef fs, [MarshalAs(UnmanagedType.LPTStr)] string folder, HandleRef context);
-		
-		public int Count (string folder, Context context)
-		{
-			ErrorCode result;
-			unsafe
-			{
-				result = gp_filesystem_count (this.Handle, folder, context.Handle);
-			}
-			if (Error.IsError(result)) throw Error.ErrorException(result);
-			return (int)result;
-		}
-		
-		[DllImport ("libgphoto2.so")]
-		internal static extern ErrorCode gp_filesystem_reset (HandleRef fs);
-
-		public void Reset ()
-		{
-			ErrorCode result;
-			unsafe
-			{
-				result = gp_filesystem_reset (this.Handle);
-			}
-			if (Error.IsError(result)) throw Error.ErrorException(result);
-		}
-	}
 }
diff --git a/lib/libgphoto2-sharp/CameraFolderOperation.cs b/lib/libgphoto2-sharp/CameraFolderOperation.cs
new file mode 100644
index 0000000..c8144fc
--- /dev/null
+++ b/lib/libgphoto2-sharp/CameraFolderOperation.cs
@@ -0,0 +1,26 @@
+/*
+ * CameraFolderOperation.cs
+ *
+ * Author(s):
+ *	Ewen Cheslack-Postava <echeslack gmail com>
+ *	Larry Ewing <lewing novell com>
+ *	Stephane Delcroix <stephane delcroix org>
+ *
+ * Copyright (c) 2005-2009 Novell, Inc.
+ *
+ * This is open source software. See COPYING for details.
+ */
+
+using System;
+
+namespace GPhoto2
+{
+	[Flags]
+	public enum CameraFolderOperation {
+		None			= 0,
+		DeleteAll		= 1 << 0,
+		PutFile			= 1 << 1,
+		MakeDirectory		= 1 << 2,
+		RemoveDirectory		= 1 << 3,
+	}
+}	
diff --git a/lib/libgphoto2-sharp/CameraList.cs b/lib/libgphoto2-sharp/CameraList.cs
index 24e2a6c..8d1fa5b 100644
--- a/lib/libgphoto2-sharp/CameraList.cs
+++ b/lib/libgphoto2-sharp/CameraList.cs
@@ -2,22 +2,28 @@
  * CameraList.cs
  *
  * Author(s):
+ *	Stephane Delcroix <stephane delcroix org
  *	Ewen Cheslack-Postava <echeslack gmail com>
  *	Larry Ewing <lewing novell com>
  *
- * This is free software. See COPYING for details.
+ * Copyright (c) 2005-2009 Novell, Inc.
+ *
+ * This is open source software. See COPYING for details.
  */
+
 using System;
 using System.Runtime.InteropServices;
 
-namespace LibGPhoto2
+namespace GPhoto2
 {
-	public class CameraList : Object 
+	public class CameraList : GPObject 
 	{
 		[DllImport ("libgphoto2.so")]
 		internal static extern ErrorCode gp_list_new (out IntPtr list);
+		[DllImport ("libgphoto2.so")]
+		internal static extern ErrorCode gp_list_unref (HandleRef list);
 
-		public CameraList ()
+		public CameraList () : base (gp_list_unref)
 		{
 			IntPtr native;
 			Error.CheckError (gp_list_new (out native));
@@ -26,86 +32,49 @@ namespace LibGPhoto2
 		}
 		
 		[DllImport ("libgphoto2.so")]
-		internal static extern ErrorCode gp_list_unref (HandleRef list);
-
-		protected override void Cleanup ()
-		{
-			gp_list_unref (handle);
-		}
-		
-		[DllImport ("libgphoto2.so")]
 		internal static extern ErrorCode gp_list_count (HandleRef list);
 		
-		public int Count ()
-		{
-			ErrorCode result = gp_list_count (handle);
-
-			if (Error.IsError (result))
-				throw Error.ErrorException (result);
-
-			return (int)result;
+		public int Count {
+			get { return Error.CheckError (gp_list_count (handle)); }
 		}
 		
 		[DllImport ("libgphoto2.so")]
-		internal static extern ErrorCode gp_list_set_name (HandleRef list, int index, string name);
+		internal static extern ErrorCode gp_list_set_name (HandleRef list, int index, [MarshalAs(UnmanagedType.LPTStr)] string name);
 
 		public void SetName (int n, string name)
 		{
-			ErrorCode result = gp_list_set_name(this.Handle, n, name);
-
-			if (Error.IsError (result))
-				throw Error.ErrorException (result);
+			Error.CheckError (gp_list_set_name(this.Handle, n, name));
 		}
-		
-		[DllImport ("libgphoto2.so")]
-		internal static extern ErrorCode gp_list_set_value (HandleRef list, int index, string value);
 
-		public void SetValue (int n, string value)
-		{
-			ErrorCode result = gp_list_set_value (this.Handle, n, value);
-
-			if (Error.IsError (result))
-				throw Error.ErrorException (result);
-		}
-		
 		[DllImport ("libgphoto2.so")]
 		internal static extern ErrorCode gp_list_get_name (HandleRef list, int index, out IntPtr name);
 
 		public string GetName (int index)
 		{
 			IntPtr name;
-
 			Error.CheckError (gp_list_get_name(this.Handle, index, out name));
 
 			return Marshal.PtrToStringAnsi (name);
 		}
 		
 		[DllImport ("libgphoto2.so")]
-		internal static extern ErrorCode gp_list_get_value (HandleRef list, int index, out IntPtr value);
+		internal static extern ErrorCode gp_list_set_value (HandleRef list, int index, [MarshalAs (UnmanagedType.LPTStr)] string value);
 
-		public string GetValue (int index)
+		public void SetValue (int n, string value)
 		{
-			IntPtr value;
-
-			Error.CheckError (gp_list_get_value(this.Handle, index, out value));
-
-			return Marshal.PtrToStringAnsi (value);
+			Error.CheckError (gp_list_set_value (this.Handle, n, value));
 		}
 		
-		[DllImport ("libgphoto2.so")]
-		internal static extern ErrorCode gp_list_append (HandleRef list, string name, string value);
-
-		public void Append (string name, string value)
-		{
-			Error.CheckError (gp_list_append(this.Handle, name, value));
-		}
 		
 		[DllImport ("libgphoto2.so")]
-		internal static extern ErrorCode gp_list_populate (HandleRef list, string format, int count);
+		internal static extern ErrorCode gp_list_get_value (HandleRef list, int index, out IntPtr value);
 
-		public void Populate (string format, int count)
+		public string GetValue (int index)
 		{
-			Error.CheckError (gp_list_populate(this.Handle, format, count));
+			IntPtr value;
+			Error.CheckError (gp_list_get_value(this.Handle, index, out value));
+
+			return Marshal.PtrToStringAnsi (value);
 		}
 		
 		[DllImport ("libgphoto2.so")]
@@ -123,16 +92,5 @@ namespace LibGPhoto2
 		{
 			Error.CheckError (gp_list_sort(this.Handle));
 		}
-		
-		public int GetPosition(string name, string value)
-		{
-			for (int index = 0; index < Count(); index++)
-			{
-				if (GetName(index) == name && GetValue(index) == value)
-					return index;
-			}
-			
-			return -1;
-		}
 	}
 }
diff --git a/lib/libgphoto2-sharp/CameraOperation.cs b/lib/libgphoto2-sharp/CameraOperation.cs
new file mode 100644
index 0000000..11a7c3d
--- /dev/null
+++ b/lib/libgphoto2-sharp/CameraOperation.cs
@@ -0,0 +1,27 @@
+/*
+ * CameraOperation.cs
+ *
+ * Author(s):
+ *	Ewen Cheslack-Postava <echeslack gmail com>
+ *	Larry Ewing <lewing novell com>
+ *	Stephane Delcroix <stephane delcroix org>
+ *
+ * Copyright (c) 2005-2009 Novell, Inc.
+ *
+ * This is open source software. See COPYING for details.
+ */
+
+using System;
+
+namespace GPhoto2
+{
+	[Flags]
+	public enum CameraOperation {
+		None		= 0,
+		CaptureImage	= 1 << 0,
+		CaptureVideo	= 1 << 1,
+		CaptureAudio	= 1 << 2,
+		CapturePreview	= 1 << 3,
+		Config		= 1 << 4,
+	}
+}
diff --git a/lib/libgphoto2-sharp/CameraText.cs b/lib/libgphoto2-sharp/CameraText.cs
new file mode 100644
index 0000000..3e82814
--- /dev/null
+++ b/lib/libgphoto2-sharp/CameraText.cs
@@ -0,0 +1,27 @@
+/*
+ * CameraText.cs
+ *
+ * Author(s):
+ *	Stephane Delcroix <stephane delcroix org>
+ *
+ * Copyright (c) 2009 Novell, Inc.
+ *
+ * This is open source software. See COPYING for details.
+ */
+
+using System;
+using System.Runtime.InteropServices;
+
+namespace GPhoto2
+{
+	[StructLayout(LayoutKind.Sequential)]
+	public unsafe struct CameraText
+	{
+		[MarshalAs(UnmanagedType.ByValTStr, SizeConst=(32*1024))] string text;
+		
+		public string Text {
+			get { return text; }
+			set { text = value; }
+		}
+	}
+}	
diff --git a/lib/libgphoto2-sharp/Context.cs b/lib/libgphoto2-sharp/Context.cs
index 53d3595..53c6728 100644
--- a/lib/libgphoto2-sharp/Context.cs
+++ b/lib/libgphoto2-sharp/Context.cs
@@ -2,33 +2,251 @@
  * Context.cs
  *
  * Author(s):
+ *	Stephane Delcroix <stephan @delcroix.org>
  *	Ewen Cheslack-Postava <echeslack gmail com>
  *	Larry Ewing <lewing novell com>
  *
- * This is free software. See COPYING for details.
+ * Copyright (c) 2005-2009 Novell, Inc.
+ *
+ * This is open source software. See COPYING for details.
  */
 using System;
 using System.Runtime.InteropServices;
 
-namespace LibGPhoto2
+namespace GPhoto2
 {
-	public class Context : Object
+	public delegate void IdleFunc ();
+	public delegate void ErrorFunc (string error);
+	public delegate void StatusFunc (string status);
+	public delegate void MessageFunc (string message);
+	public delegate ContextFeedback QuestionFunc (string message);
+	public delegate ContextFeedback CancelFunc (string message);
+	public delegate uint ProgressStartFunc (float target, string message);
+	public delegate void ProgressUpdateFunc (uint id, float progress);
+	public delegate void ProgressStopFunc (uint id);
+
+	public class Context : GPObject
 	{
 		[DllImport ("libgphoto2.so")]
 		internal static extern IntPtr gp_context_new ();
 
+		[DllImport ("libgphoto2glue.so")]
+		internal static extern IntPtr gp_glue_context_new (HandleRef context);
+
+		[DllImport ("libgphoto2.so")]
+		internal static extern void gp_context_unref (HandleRef context);
+		
+		HandleRef gluecontext;
 		public Context ()
 		{
 			this.handle = new HandleRef (this, gp_context_new ());
+			gluecontext = new HandleRef (this, gp_glue_context_new (Handle));
 		}
 		
-		[DllImport ("libgphoto2.so")]
-		internal static extern void gp_context_unref   (HandleRef context);
+
+		[DllImport ("libgphoto2glue.so")]
+		internal static extern void gp_glue_context_free (HandleRef context);
 
 		protected override void Cleanup ()
 		{
-			System.Console.WriteLine ("cleanup context");
-			gp_context_unref(handle);
+			gp_glue_context_free (gluecontext);
+			gp_context_unref (handle);
+		}
+
+#region callbacks
+		[DllImport ("libgphoto2.so")]
+		internal static extern void gp_context_set_idle_func (HandleRef context, IdleFuncNative func, IntPtr data);
+
+		IdleFuncWrapper idle_func_wrapper;
+		public void SetIdleFunc (IdleFunc func)
+		{
+			idle_func_wrapper = new IdleFuncWrapper (func);
+			IntPtr data = IntPtr.Zero;
+			if (func != null)
+				data = (IntPtr) GCHandle.Alloc (idle_func_wrapper);
+			gp_context_set_idle_func (Handle, idle_func_wrapper.NativeDelegate, data);
+		}
+
+		[DllImport ("libgphoto2glue.so")]
+		internal static extern void gp_glue_context_set_progress_funcs (HandleRef context, ProgressStartFuncNative start_func, ProgressUpdateFuncNative update_func, ProgressStopFuncNative stop_func, IntPtr data);
+
+		ProgressFuncsWrapper progress_funcs_wrapper;
+		public void SetProgressFuncs (ProgressStartFunc start_func, ProgressUpdateFunc update_func, ProgressStopFunc stop_func)
+		{
+			progress_funcs_wrapper = new ProgressFuncsWrapper (start_func, update_func, stop_func);
+			IntPtr data = IntPtr.Zero;
+			if (start_func != null || update_func != null || stop_func != null)
+				data = (IntPtr) GCHandle.Alloc (progress_funcs_wrapper);
+			gp_glue_context_set_progress_funcs (gluecontext,
+							    progress_funcs_wrapper.NativeStartDelegate,
+							    progress_funcs_wrapper.NativeUpdateDelegate,
+							    progress_funcs_wrapper.NativeStopDelegate,
+							    data);
+		}
+
+		[DllImport ("libgphoto2glue.so")]
+		internal static extern void gp_glue_context_set_error_func (HandleRef context, ErrorFuncNative func, IntPtr data);
+
+		ErrorFuncWrapper error_func_wrapper;
+		public void SetErrorFunc (ErrorFunc func)
+		{
+			error_func_wrapper = new ErrorFuncWrapper (func);
+			IntPtr data = IntPtr.Zero;
+			if (func != null)
+				data = (IntPtr) GCHandle.Alloc (error_func_wrapper);
+			gp_glue_context_set_error_func (gluecontext, error_func_wrapper.NativeDelegate, data);
+		}
+
+		[DllImport ("libgphoto2glue.so")]
+		internal static extern void gp_glue_context_set_status_func (HandleRef context, StatusFuncNative func, IntPtr data);
+
+		StatusFuncWrapper status_func_wrapper;
+		public void SetStatusFunc (StatusFunc func)
+		{
+			status_func_wrapper = new StatusFuncWrapper (func);
+			IntPtr data = IntPtr.Zero;
+			if (func != null)
+				data = (IntPtr) GCHandle.Alloc (status_func_wrapper);
+			gp_glue_context_set_status_func (gluecontext, status_func_wrapper.NativeDelegate, data);
+		}
+
+		[DllImport ("libgphoto2.so")]
+		internal static extern void gp_context_set_message_func (HandleRef context, MessageFuncNative func, IntPtr data);
+
+		MessageFuncWrapper message_func_wrapper;
+		public void SetMessageFunc (MessageFunc func)
+		{
+			message_func_wrapper = new MessageFuncWrapper (func);
+			IntPtr data = IntPtr.Zero;
+			if (func != null)
+				data = (IntPtr) GCHandle.Alloc (message_func_wrapper);
+			gp_context_set_message_func (gluecontext, message_func_wrapper.NativeDelegate, data);
+		}
+
+#endregion
+
+#region wrappers for callbacks
+		internal delegate void IdleFuncNative (HandleRef context, IntPtr data);
+		class IdleFuncWrapper
+		{
+			public void NativeCallback (HandleRef context, IntPtr data)
+			{
+				managed ();
+			}
+
+			public IdleFuncNative NativeDelegate;
+			IdleFunc managed;
+
+			public IdleFuncWrapper (IdleFunc managed)
+			{
+				this.managed = managed;
+				if (managed != null)
+					NativeDelegate = NativeCallback;
+			}
+		}
+
+		internal delegate uint ProgressStartFuncNative (HandleRef context, float target, string message, IntPtr data);
+		internal delegate void ProgressUpdateFuncNative (HandleRef context, uint id, float current, IntPtr data);
+		internal delegate void ProgressStopFuncNative (HandleRef context, uint id, IntPtr data);
+		class ProgressFuncsWrapper
+		{
+			public void NativeUpdateCallback (HandleRef context, uint id, float current, IntPtr data)
+			{
+				managed_update (id, current);
+			}
+			public uint NativeStartCallback (HandleRef context, float target, string message, IntPtr data)
+			{
+				return managed_start (target, message);
+			}
+
+
+			public void NativeStopCallback (HandleRef context, uint id, IntPtr data)
+			{
+				managed_stop (id);
+			}
+
+			public ProgressStartFuncNative NativeStartDelegate;
+			public ProgressUpdateFuncNative NativeUpdateDelegate;
+			public ProgressStopFuncNative NativeStopDelegate;
+
+			ProgressStartFunc managed_start;
+			ProgressUpdateFunc managed_update;
+			ProgressStopFunc managed_stop;
+
+			public ProgressFuncsWrapper (ProgressStartFunc start, ProgressUpdateFunc update, ProgressStopFunc stop)
+			{
+				managed_start = start;
+				if (managed_start != null)
+					NativeStartDelegate = new ProgressStartFuncNative (NativeStartCallback);
+
+				managed_update = update;
+				if (managed_update != null)
+					NativeUpdateDelegate = new ProgressUpdateFuncNative (NativeUpdateCallback);
+
+				managed_stop = stop;
+				if (managed_stop != null)
+					NativeStopDelegate = new ProgressStopFuncNative (NativeStopCallback);
+			}
 		}
+
+		internal delegate void ErrorFuncNative (HandleRef context, string error, IntPtr data);
+		class ErrorFuncWrapper
+		{
+			public void NativeCallback (HandleRef context, string error, IntPtr data)
+			{
+				managed (error);
+			}
+
+			public ErrorFuncNative NativeDelegate;
+			ErrorFunc managed;
+
+			public ErrorFuncWrapper (ErrorFunc managed)
+			{
+				this.managed = managed;
+				if (managed != null)
+					NativeDelegate = NativeCallback;
+			}
+		}
+
+		internal delegate void StatusFuncNative (HandleRef context, string status, IntPtr data);
+		class StatusFuncWrapper
+		{
+			public void NativeCallback (HandleRef context, string status, IntPtr data)
+			{
+				managed (status);
+			}
+
+			public StatusFuncNative NativeDelegate;
+			StatusFunc managed;
+
+			public StatusFuncWrapper (StatusFunc managed)
+			{
+				this.managed = managed;
+				if (managed != null)
+					NativeDelegate = NativeCallback;
+			}
+		}
+
+		internal delegate void MessageFuncNative (HandleRef context, string message, IntPtr data);
+		class MessageFuncWrapper
+		{
+			public void NativeCallback (HandleRef context, string message, IntPtr data)
+			{
+				managed (message);
+			}
+
+			public MessageFuncNative NativeDelegate;
+			MessageFunc managed;
+
+			public MessageFuncWrapper (MessageFunc managed)
+			{
+				this.managed = managed;
+				if (managed != null)
+					NativeDelegate = NativeCallback;
+			}
+		}
+
+
+#endregion
 	}
 }
diff --git a/lib/libgphoto2-sharp/ContextFeedback.cs b/lib/libgphoto2-sharp/ContextFeedback.cs
new file mode 100644
index 0000000..dc864ec
--- /dev/null
+++ b/lib/libgphoto2-sharp/ContextFeedback.cs
@@ -0,0 +1,21 @@
+/*
+ * ContextFeedback.cs
+ *
+ * Author(s):
+ *	Stephane Delcroix <stephane delcroix org>
+ *
+ * Copyright (c) 2009 Novell, Inc.
+ *
+ * This is open source software. See COPYING for details.
+ */
+
+using System;
+using System.Runtime.InteropServices;
+
+namespace GPhoto2
+{
+	public enum ContextFeedback {
+		OK,
+		Cancel,
+	}
+}
diff --git a/lib/libgphoto2-sharp/DeviceType.cs b/lib/libgphoto2-sharp/DeviceType.cs
new file mode 100644
index 0000000..b921058
--- /dev/null
+++ b/lib/libgphoto2-sharp/DeviceType.cs
@@ -0,0 +1,22 @@
+/*
+ * DeviceType.cs
+ *
+ * Author(s):
+ *	Stephane Delcroix <stephane delcroix org>
+ *
+ * Copyright (c) 2009 Novell, Inc.
+ *
+ * This is open source software. See COPYING for details.
+ */
+
+
+using System;
+
+namespace GPhoto2
+{
+	[Flags]
+	public enum DeviceType {
+		StillCamera 		= 0,
+		AudioPlayer		= 1 << 0,
+	}
+}		
diff --git a/lib/libgphoto2-sharp/ErrorCodes.cs b/lib/libgphoto2-sharp/ErrorCodes.cs
index 2582fb9..4a89bb7 100644
--- a/lib/libgphoto2-sharp/ErrorCodes.cs
+++ b/lib/libgphoto2-sharp/ErrorCodes.cs
@@ -4,13 +4,16 @@
  * Author(s):
  *	Ewen Cheslack-Postava <echeslack gmail com>
  *	Larry Ewing <lewing novell com>
+ *	Stephane Delcroix <stephane delcroix org>
  *
- * This is free software. See COPYING for details.
+ * Copyright (c) 2005-2009 Novel, Inc.
+ *
+ * This is open source software. See COPYING for details.
  */
 using System;
 using System.Runtime.InteropServices;
 
-namespace LibGPhoto2
+namespace GPhoto2
 {
 	public enum ErrorCode
 	{
@@ -22,6 +25,7 @@ namespace LibGPhoto2
 		UnknownPort		= -5,
 		NotSupported		= -6,
 		IO			= -7,
+		FixedLimitExceeded	= -8,
 		Timout			= -10,
 		SupportedSerial		= -20,
 		SupportedUSB		= -21,
@@ -34,76 +38,75 @@ namespace LibGPhoto2
 		USBFind			= -52,
 		USBClaim		= -53,
 		Lock			= -60,
+		Hal			= -70,
 
 		/* Other Errors*/
 		CorruptedData		= -102,
-		PathNotAbsolute		= -111,
-		DirectoryExists		= -109,
 		FileExists		= -103,
-		FileNotFound		= -108,
+		ModelNotFound		= -105,
 		DirectoryNotFound	= -107,
-		ModelNotFound		= -105
+		FileNotFound		= -108,
+		DirectoryExists		= -109,
+		CameraBusy		= -110,
+		PathNotAbsolute		= -111,
+		Cancel			= -112,
+		CameraError		= -113,
+		OsFailure		= -114,
 	}
 
-	public class Error
+	public static class Error
 	{
-		private static string GetErrorAsString(ErrorCode e)
-		{
-			IntPtr raw_message = gp_result_as_string(e);
-			return Marshal.PtrToStringAnsi(raw_message);
-		}
-
-		private static string GetIOErrorAsString(ErrorCode e)
-		{
-			IntPtr raw_message = gp_port_result_as_string(e);
-			return Marshal.PtrToStringAnsi(raw_message);
-		}
-		
 		public static bool IsError (ErrorCode error_code)
 		{
 			return (error_code < 0);
 		}
 		
-		public static GPhotoException ErrorException (ErrorCode error_code)
-		{
-			string message = "Unknown Error";
-			int error_code_int = (int)error_code;
-			
-			if (error_code_int <= -102 && error_code_int >= -111)
-				message = GetErrorAsString(error_code);
-			else if (error_code_int <= -1 && error_code_int >= -60)
-				message = GetIOErrorAsString(error_code);
-
-			return new GPhotoException(error_code, message);
-		}
-		
-		public static ErrorCode CheckError (ErrorCode error)
+		public static int CheckError (ErrorCode error)
 		{
-			if (IsError (error))
-				throw ErrorException (error);
+			if (IsError (error)) {
+				string message = "Unknown Error";
+				
+				if ((int)error <= -100)
+					message = GetErrorAsString (error);
+				else if ((int)error <= -1 && (int)error >= -99)
+					message = GetIOErrorAsString (error);
+	
+				throw new GPhotoException (error, message);
+			}
 			
-			return error;
+			return (int)error;
 		}
 		
 		[DllImport ("libgphoto2.so")]
 		internal static extern IntPtr gp_result_as_string (ErrorCode result);
 		
+		static string GetErrorAsString (ErrorCode e)
+		{
+			IntPtr raw_message = gp_result_as_string(e);
+			return Marshal.PtrToStringAnsi(raw_message);
+		}
+
 		[DllImport ("libgphoto2_port.so")]
 		internal static extern IntPtr gp_port_result_as_string (ErrorCode result);
+
+		static string GetIOErrorAsString(ErrorCode e)
+		{
+			IntPtr raw_message = gp_port_result_as_string(e);
+			return Marshal.PtrToStringAnsi(raw_message);
+		}
+		
 	}
 	
 	public class GPhotoException : Exception
 	{
 		private ErrorCode error;
 		
-		public GPhotoException(ErrorCode error_code)
-		: base ("Unknown Error.")
+		public GPhotoException(ErrorCode error_code) : base ("Unknown Error.")
 		{
 			error = error_code;
 		}
 		
-		public GPhotoException (ErrorCode error_code, string message)
-		: base (message)
+		public GPhotoException (ErrorCode error_code, string message) : base (message)
 		{
 			error = error_code;
 		}
@@ -114,9 +117,7 @@ namespace LibGPhoto2
 		}
 
 		public ErrorCode Error {
-			get {
-				return error;
-			}
+			get { return error; }
 		}
 	}
 }
diff --git a/lib/libgphoto2-sharp/GPList.cs b/lib/libgphoto2-sharp/GPList.cs
new file mode 100644
index 0000000..613813d
--- /dev/null
+++ b/lib/libgphoto2-sharp/GPList.cs
@@ -0,0 +1,85 @@
+/*
+ * GPList.cs
+ *
+ * Author(s):
+ *	Stephane Delcroix <stephane delcroix org>
+ *
+ * Copyright (c) 2009 Novell, Inc.
+ *
+ * This is open source software. See COPYING for details.
+ */
+
+using System;
+using System.Runtime.InteropServices;
+using System.Collections.Generic;
+using System.Collections;
+
+namespace GPhoto2
+{
+	public abstract class GPList<T> : GPObject, IEnumerable<T>
+	{
+		IEnumerator<T> IEnumerable<T>.GetEnumerator ()
+		{
+			return new Enumerator<T> (this);
+		}
+
+		IEnumerator IEnumerable.GetEnumerator ()
+		{
+			return new Enumerator<T> (this);
+		}
+
+		public abstract int Count {get; }
+		public abstract T this [int index] { get; }
+
+		public GPList (Func<HandleRef, ErrorCode> cleaner) : base (cleaner)
+		{
+		}
+
+		class Enumerator<U> : IEnumerator<U>, IEnumerator
+		{
+			int current;
+			int count;
+			GPList<U> list;
+
+			public Enumerator (GPList<U> list)
+			{
+				this.list = list;
+				Reset ();
+			}
+
+			public void Reset ()
+			{
+				current = -1;
+				count = list.Count;
+			}
+
+			U IEnumerator<U>.Current {
+				get {
+					if (current < 0 || current >= count)
+						throw new InvalidOperationException ();
+					return list[current];
+				}
+			}
+
+			object IEnumerator.Current {
+				get {
+					if (current < 0 || current >= count)
+						throw new InvalidOperationException ();
+					return list[current];
+				}
+			}
+
+			public bool MoveNext ()
+			{
+				current ++;
+				if (current >= count)
+					return false;
+				return true;
+			}
+
+			public void Dispose ()
+			{
+			}
+		}
+	}
+}
diff --git a/lib/libgphoto2-sharp/GPObject.cs b/lib/libgphoto2-sharp/GPObject.cs
new file mode 100644
index 0000000..768010d
--- /dev/null
+++ b/lib/libgphoto2-sharp/GPObject.cs
@@ -0,0 +1,57 @@
+/*
+ * GPObject.cs
+ *
+ * Author(s):
+ *	Ewen Cheslack-Postava <echeslack gmail com>
+ *	Larry Ewing <lewing novell com>
+ *	Stephane Delcroix <stephane delcroix org>
+ *
+ * Copyright (c) 2005-2009 Novelll, Inc.
+ *
+ * This is open source software. See COPYING for details.
+ */
+using System;
+using System.Runtime.InteropServices;
+
+namespace GPhoto2 {
+	public abstract class GPObject : System.IDisposable {
+		protected HandleRef handle;
+		Func<HandleRef, ErrorCode> gp_object_cleaner;
+
+		public HandleRef Handle
+		{
+			get { return handle; }
+		}
+		
+		public GPObject () 
+		{
+		}
+
+		public GPObject (Func<HandleRef, ErrorCode> gp_object_cleaner)
+		{
+			this.gp_object_cleaner = gp_object_cleaner;
+		}
+
+		protected virtual void Cleanup ()
+		{
+			if (gp_object_cleaner != null)
+				gp_object_cleaner (handle);
+		}
+		
+		bool is_disposed = false;
+		public void Dispose () {
+			lock (this) {
+				if (is_disposed)
+					return;
+				is_disposed = true;
+				Cleanup ();
+				System.GC.SuppressFinalize (this);
+			}
+		}
+		
+		~GPObject ()
+		{
+			Cleanup ();
+		}
+	}
+}
diff --git a/lib/libgphoto2-sharp/Makefile.am b/lib/libgphoto2-sharp/Makefile.am
index bd920e5..0e649a2 100644
--- a/lib/libgphoto2-sharp/Makefile.am
+++ b/lib/libgphoto2-sharp/Makefile.am
@@ -1,21 +1,36 @@
+SUBDIRS = glue
+
 include $(top_srcdir)/Makefile.include
 
 ASSEMBLY_NAME = libgphoto2-sharp
 
-ASSEMBLY_SOURCES =			\
-	$(srcdir)/AssemblyInfo.cs	\
-	$(srcdir)/Camera.cs		\
-	$(srcdir)/CameraAbilitiesList.cs\
-	$(srcdir)/CameraFile.cs		\
-	$(srcdir)/CameraFilesystem.cs	\
-	$(srcdir)/CameraList.cs		\
-	$(srcdir)/CameraWidget.cs	\
-	$(srcdir)/Context.cs		\
-	$(srcdir)/ErrorCodes.cs		\
-	$(srcdir)/Object.cs		\
-	$(srcdir)/Port.cs		\
-	$(srcdir)/PortInfo.cs		\
-	$(srcdir)/PortInfoList.cs
+ASSEMBLY_SOURCES =				\
+	$(srcdir)/AssemblyInfo.cs		\
+	$(srcdir)/Camera.cs			\
+	$(srcdir)/CameraAbilities.cs		\
+	$(srcdir)/CameraAbilitiesList.cs	\
+	$(srcdir)/CameraCaptureType.cs		\
+	$(srcdir)/CameraDriverStatus.cs		\
+	$(srcdir)/CameraEventType.cs		\
+	$(srcdir)/CameraFile.cs			\
+	$(srcdir)/CameraFilePath.cs		\
+	$(srcdir)/CameraFilesystem.cs		\
+	$(srcdir)/CameraFileOperation.cs	\
+	$(srcdir)/CameraFolderOperation.cs	\
+	$(srcdir)/CameraList.cs			\
+	$(srcdir)/CameraOperation.cs		\
+	$(srcdir)/CameraText.cs			\
+	$(srcdir)/Context.cs			\
+	$(srcdir)/ContextFeedback.cs		\
+	$(srcdir)/DeviceType.cs			\
+	$(srcdir)/ErrorCodes.cs			\
+	$(srcdir)/GPList.cs			\
+	$(srcdir)/GPObject.cs			\
+	$(srcdir)/Port.cs			\
+	$(srcdir)/PortInfo.cs			\
+	$(srcdir)/PortInfoList.cs		\
+	$(srcdir)/PortSerialParity.cs		\
+	$(srcdir)/PortType.cs
 
 REFS =	-r:Mono.Posix
 
@@ -35,10 +50,11 @@ assembly_DATA =			\
 
 EXTRA_DIST =				\
 	$(ASSEMBLY_SOURCES)		\
-	$(ASSEMBLY).config		\
+	$(ASSEMBLY).config.in		\
 	AUTHORS				\
 	COPYING
 
 CLEANFILES =			\
 	$(ASSEMBLY)		\
-	$(ASSEMBLY).mdb
+	$(ASSEMBLY).mdb		\
+	$(ASSEMBLY).config
diff --git a/lib/libgphoto2-sharp/Port.cs b/lib/libgphoto2-sharp/Port.cs
index cae8bc4..970024d 100644
--- a/lib/libgphoto2-sharp/Port.cs
+++ b/lib/libgphoto2-sharp/Port.cs
@@ -13,24 +13,9 @@
 using System;
 using System.Runtime.InteropServices;
 
-namespace LibGPhoto2
+namespace GPhoto2
 {
-	public enum PortType
-	{
-		None = 0,
-		Serial = 1 << 0,
-		USB = 1 << 2,
-		Disk = 1 << 3,
-		
-	}
 
-	public enum PortSerialParity
-	{
-		Off = 0,
-		Even,
-		Odd
-	}
-	
 	public enum Pin
 	{
 		RTS,
@@ -83,108 +68,37 @@ namespace LibGPhoto2
 		[FieldOffset(0)] public PortSettingsUSB usb;
 	}
 
-#if false
-	[StructLayout(LayoutKind.Sequential)]
-	internal unsafe struct _Port
-	{
-		PortType type;
-
-		PortSettings settings;
-		PortSettings settings_pending;
-
-		int timout;
-
-		PortPrivateLibrary *pl;
-		PortPrivateCore *pc;
-
-		[DllImport ("libgphoto2_port.so")]
-		internal static extern ErrorCode gp_port_new (out _Port *port);
-
-		[DllImport ("libgphoto2_port.so")]
-		internal static extern ErrorCode gp_port_free (_Port *port);
-
-		[DllImport ("libgphoto2_port.so")]
-		internal static extern ErrorCode gp_port_set_info (_Port *port, ref _PortInfo info);
-
-		[DllImport ("libgphoto2_port.so")]
-		internal static extern ErrorCode gp_port_get_info (_Port *port, out _PortInfo info);
-
-		[DllImport ("libgphoto2_port.so")]
-		internal static extern ErrorCode gp_port_open (_Port *port);
-
-		[DllImport ("libgphoto2_port.so")]
-		internal static extern ErrorCode gp_port_close (_Port *port);
-
-		[DllImport ("libgphoto2_port.so")]
-		internal static extern ErrorCode gp_port_read (_Port *port, [MarshalAs(UnmanagedType.LPTStr)] byte[] data, int size);
-
-		[DllImport ("libgphoto2_port.so")]
-		internal static extern ErrorCode gp_port_write (_Port *port, [MarshalAs(UnmanagedType.LPTStr)] byte[] data, int size);
-
-		[DllImport ("libgphoto2_port.so")]
-		internal static extern ErrorCode gp_port_get_settings (_Port *port, out PortSettings settings);
-
-		[DllImport ("libgphoto2_port.so")]
-		internal static extern ErrorCode gp_port_set_settings (_Port *port, PortSettings settings);
-
-		[DllImport ("libgphoto2_port.so")]
-		internal static extern ErrorCode gp_port_get_timeout (_Port *port, int *timeout);
-
-		[DllImport ("libgphoto2_port.so")]
-		internal static extern ErrorCode gp_port_set_timeout (_Port *port, int timeout);
-
-		[DllImport ("libgphoto2_port.so")]
-		internal static extern ErrorCode gp_port_get_pin (_Port *port, Pin pin, Level *level);
-
-		[DllImport ("libgphoto2_port.so")]
-		internal static extern ErrorCode gp_port_set_pin (_Port *port, Pin pin, Level level);
-
-		[DllImport ("libgphoto2_port.so")]
-		internal static extern char* gp_port_get_error (_Port *port);
-
-		//[DllImport ("libgphoto2.so")]
-		//internal static extern int gp_port_set_error (_Port *port, const char *format, ...);
-	}
-#endif
-
-	public class Port : Object
+	public class Port : GPObject
 	{
 		[DllImport ("libgphoto2_port.so")]
 		internal static extern ErrorCode gp_port_new (out IntPtr port);
+		[DllImport ("libgphoto2_port.so")]
+		internal static extern ErrorCode gp_port_free (HandleRef port);
 
-		public Port()
+		public Port() : base (gp_port_free)
 		{
 			IntPtr native;
-
 			Error.CheckError (gp_port_new (out native));
 
 			this.handle = new HandleRef (this, native);
 		}
 		
 		[DllImport ("libgphoto2_port.so")]
-		internal static extern ErrorCode gp_port_free (HandleRef port);
-		
-		protected override void Cleanup ()
-		{
-			Error.CheckError (gp_port_free (this.handle));
-		}
-
-		[DllImport ("libgphoto2_port.so")]
-		internal static extern ErrorCode gp_port_set_info (HandleRef port, ref _PortInfo info);
+		internal static extern ErrorCode gp_port_set_info (HandleRef port, ref PortInfo info);
 
 		public void SetInfo (PortInfo info)
 		{
-		Error.CheckError (gp_port_set_info (this.Handle, ref info.Handle));
+		Error.CheckError (gp_port_set_info (this.Handle, ref info));
 		}
 		
 		[DllImport ("libgphoto2_port.so")]
-		internal static extern ErrorCode gp_port_get_info (HandleRef port, out _PortInfo info);
+		internal static extern ErrorCode gp_port_get_info (HandleRef port, out PortInfo info);
 
 		public PortInfo GetInfo ()
 		{
 			PortInfo info = new PortInfo (); 
 
-			Error.CheckError (gp_port_get_info (this.Handle, out info.Handle));
+			Error.CheckError (gp_port_get_info (this.Handle, out info));
 
 			return info;
 		}
@@ -271,8 +185,5 @@ namespace LibGPhoto2
 
 		[DllImport ("libgphoto2_port.so")]
 		internal static extern ErrorCode gp_port_set_pin (HandleRef port, Pin pin, Level level);
-
-		[DllImport ("libgphoto2_port.so")]
-		internal static extern string gp_port_get_error (HandleRef port);
 	}
 }
diff --git a/lib/libgphoto2-sharp/PortInfo.cs b/lib/libgphoto2-sharp/PortInfo.cs
index 6d5c54c..228564b 100644
--- a/lib/libgphoto2-sharp/PortInfo.cs
+++ b/lib/libgphoto2-sharp/PortInfo.cs
@@ -2,48 +2,46 @@
  * PortInfo.cs
  *
  * Author(s):
- *	Ewen Cheslack-Postava <echeslack gmail com>
- *	Larry Ewing <lewing novell com>
+ *	Stephane Delcroix <stephane delcroix org>
  *
- * This is free software. See COPYING for details.
+ * Copyright (c) 2005-2009 Novell, Inc.
+ *
+ * This is open source software. See COPYING for details.
  */
+
 using System;
 using System.Runtime.InteropServices;
 
-namespace LibGPhoto2
+namespace GPhoto2
 {
 	[StructLayout(LayoutKind.Sequential)]
-	internal unsafe struct _PortInfo
+	public unsafe struct PortInfo
 	{
-		internal PortType type;
-		[MarshalAs(UnmanagedType.ByValTStr, SizeConst=64)] internal string name;
-		[MarshalAs(UnmanagedType.ByValTStr, SizeConst=64)] internal string path;
+		PortType type;
+		[MarshalAs(UnmanagedType.ByValTStr, SizeConst=64)] string name;
+		[MarshalAs(UnmanagedType.ByValTStr, SizeConst=64)] string path;
 
 		/* Private */
-		[MarshalAs(UnmanagedType.ByValTStr, SizeConst=1024)] internal string library_filename;
-	}
-	
-	public class PortInfo 
-	{
-		internal _PortInfo Handle;
+#pragma warning disable 169
+		[MarshalAs(UnmanagedType.ByValTStr, SizeConst=1024)] string library_filename;
+#pragma warning restore 169
+
 
-		internal PortInfo () {
+		public PortType Type {
+			get { return type; }
 		}
-		
+
 		public string Name {
-			get {
-				unsafe {
-					return Handle.name;
-				}
-			}
+			get { return name; }
 		}
-		
+
 		public string Path {
-			get {
-				unsafe {
-					return Handle.path;
-				}
-			}
+			get { return path; }
+		}
+
+		public override string ToString ()
+		{
+			return String.Format ("PortInfo: {0}\t{1} ({2})", Name, Path, Type);
 		}
 	}
 }
diff --git a/lib/libgphoto2-sharp/PortInfoList.cs b/lib/libgphoto2-sharp/PortInfoList.cs
index f827fba..db19324 100644
--- a/lib/libgphoto2-sharp/PortInfoList.cs
+++ b/lib/libgphoto2-sharp/PortInfoList.cs
@@ -2,93 +2,74 @@
  * PortInfoList.cs
  *
  * Author(s):
+ *	Stephane Delcroix <stephane delcroix org>
  *	Ewen Cheslack-Postava <echeslack gmail com>
  *	Larry Ewing <lewing novell com>
  *
- * This is free software. See COPYING for details.
+ * Copyright (c) 2005-2009 Novell, Inc.
+ *
+ * This is open source software. See COPYING for details.
  */
 using System;
 using System.Runtime.InteropServices;
 
-namespace LibGPhoto2
+namespace GPhoto2
 {
-	public class PortInfoList : Object 
+	public class PortInfoList : GPList<PortInfo> 
 	{
 		[DllImport ("libgphoto2_port.so")]
 		internal static extern ErrorCode gp_port_info_list_new (out IntPtr handle);
+		[DllImport ("libgphoto2_port.so")]
+		internal static extern ErrorCode gp_port_info_list_free (HandleRef handle);
 		
-		public PortInfoList()
+		public PortInfoList () : base (gp_port_info_list_free)
 		{
 			IntPtr native;
-
 			Error.CheckError (gp_port_info_list_new (out native));
 
 			this.handle = new HandleRef (this, native);
 		}
 		
 		[DllImport ("libgphoto2_port.so")]
-		internal static extern ErrorCode gp_port_info_list_free (HandleRef handle);
-		
-		protected override void Cleanup ()
-		{
-			Error.CheckError (gp_port_info_list_free (this.Handle));
-		}
-		
-		[DllImport ("libgphoto2_port.so")]
 		internal static extern ErrorCode gp_port_info_list_load (HandleRef handle);
 
 		public void Load ()
 		{
-			ErrorCode result = gp_port_info_list_load (this.Handle);
-
-			if (Error.IsError (result))
-				throw Error.ErrorException (result);
+			Error.CheckError (gp_port_info_list_load (this.Handle));
 		}
 		
 		[DllImport ("libgphoto2_port.so")]
 		internal static extern ErrorCode gp_port_info_list_count (HandleRef handle);
 
-		public int Count()
-		{
-			return (int) Error.CheckError (gp_port_info_list_count (this.Handle));
+		public override int Count {
+			get { return Error.CheckError (gp_port_info_list_count (this.Handle)); }
 		}
 		
 		[DllImport ("libgphoto2_port.so")]
-		internal unsafe static extern ErrorCode gp_port_info_list_get_info (HandleRef handle, int n, out _PortInfo info);
+		internal unsafe static extern ErrorCode gp_port_info_list_get_info (HandleRef handle, int n, out PortInfo info);
 
-		public PortInfo GetInfo (int n)
-		{
-			PortInfo info = new PortInfo ();
-			unsafe {
-				Error.CheckError (gp_port_info_list_get_info (this.handle, n,  out info.Handle));
+		public override PortInfo this [int n] {
+			get {
+				PortInfo info;
+				Error.CheckError (gp_port_info_list_get_info (this.handle, n,  out info));
+				return info;
 			}
-			return info;
 		}
 		
 		[DllImport ("libgphoto2_port.so")]
 		internal static extern ErrorCode gp_port_info_list_lookup_path (HandleRef handle, [MarshalAs(UnmanagedType.LPTStr)]string path);
 
-		public int LookupPath (string path)
+		public PortInfo LookupPath (string path)
 		{
-			return (int) Error.CheckError (gp_port_info_list_lookup_path(this.handle, path));
+			return this [Error.CheckError (gp_port_info_list_lookup_path(this.handle, path))];
 		}
 		
 		[DllImport ("libgphoto2_port.so")]
 		internal static extern ErrorCode gp_port_info_list_lookup_name (HandleRef handle, string name);
 
-		public int LookupName(string name)
+		public PortInfo LookupName (string name)
 		{
-			return (int) Error.CheckError (gp_port_info_list_lookup_name (this.Handle, name));
-		}
-		
-		[DllImport ("libgphoto2_port.so")]
-		internal unsafe static extern ErrorCode gp_port_info_list_append (HandleRef handle, _PortInfo info);
-
-		public int Append (PortInfo info)
-		{
-			unsafe {
-				return (int) Error.CheckError (gp_port_info_list_append (this.Handle, info.Handle));
-			}
+			return this [Error.CheckError (gp_port_info_list_lookup_name (this.Handle, name))];
 		}
 	}
 }
diff --git a/lib/libgphoto2-sharp/PortSerialParity.cs b/lib/libgphoto2-sharp/PortSerialParity.cs
new file mode 100644
index 0000000..e0d976a
--- /dev/null
+++ b/lib/libgphoto2-sharp/PortSerialParity.cs
@@ -0,0 +1,22 @@
+/*
+ * PortSerialParity.cs
+ *
+ * Author(s):
+ *	Ewen Cheslack-Postava <echeslack gmail com>
+ *	Larry Ewing <lewing novell com>
+ *	Stephane Delcroix <stephane delcroix org>
+ *
+ * Copyright (c) 2005-2009 Novell, Inc.
+ *
+ * This is open source software. See COPYING for details.
+ */
+
+namespace GPhoto2
+{
+	public enum PortSerialParity
+	{
+		Off = 0,
+		Even,
+		Odd
+	}	
+}
diff --git a/lib/libgphoto2-sharp/PortType.cs b/lib/libgphoto2-sharp/PortType.cs
new file mode 100644
index 0000000..17fc163
--- /dev/null
+++ b/lib/libgphoto2-sharp/PortType.cs
@@ -0,0 +1,27 @@
+/*
+ * xxx.cs
+ *
+ * Author(s):
+ *	Ewen Cheslack-Postava <echeslack gmail com>
+ *	Larry Ewing <lewing novell com>
+ *	Stephane Delcroix <stephane delcroix org>
+ *
+ * Copyright (c) 2005-2009 Novell, Inc.
+ *
+ * This is open source software. See COPYING for details.
+ */
+
+using System;
+
+namespace GPhoto2
+{
+	[Flags]
+	public enum PortType
+	{
+		None 	= 0,
+		Serial 	= 1 << 0,
+		USB 	= 1 << 2,
+		Disk 	= 1 << 3,
+		PtpIP	= 1 << 4,
+	}
+}	
diff --git a/lib/libgphoto2-sharp/glue/.gitignore b/lib/libgphoto2-sharp/glue/.gitignore
new file mode 100644
index 0000000..589b664
--- /dev/null
+++ b/lib/libgphoto2-sharp/glue/.gitignore
@@ -0,0 +1,7 @@
+Makefile
+Makefile.in
+.deps
+.libs
+*.la
+*.lo
+*.o
diff --git a/lib/libgphoto2-sharp/glue/Makefile.am b/lib/libgphoto2-sharp/glue/Makefile.am
new file mode 100644
index 0000000..566eae6
--- /dev/null
+++ b/lib/libgphoto2-sharp/glue/Makefile.am
@@ -0,0 +1,15 @@
+INCLUDES =					\
+	$(LIBGPHOTO2_CFLAGS)
+
+gphoto2gluelibdir = $(libdir)/f-spot
+gphoto2gluelib_LTLIBRARIES = libgphoto2glue.la
+
+libgphoto2glue_files =				\
+	context.c
+
+libgphoto2glue_la_SOURCES =			\
+	$(libgphoto2glue_files)
+
+libgphoto2glue_la_LIBADD = 			\
+	$(LIBGPHOTO2_LIBS)
+
diff --git a/lib/libgphoto2-sharp/glue/context.c b/lib/libgphoto2-sharp/glue/context.c
new file mode 100644
index 0000000..2d85b20
--- /dev/null
+++ b/lib/libgphoto2-sharp/glue/context.c
@@ -0,0 +1,151 @@
+/*
+ * context.c
+ *
+ * Author(s):
+ *	Stephane Delcroix <stephan @delcroix.org>
+ *
+ * Copyright (c) 2009 Novell, Inc.
+ *
+ * This is open source software. See COPYING for details.
+ */
+
+#include <stdlib.h>
+#include <gphoto2-context.h>
+#include <stdarg.h>
+
+struct _GPGlueContext;
+typedef struct _GPGlueContext GPGlueContext;
+
+typedef unsigned int (*GPGlueContextProgressStartFunc) (GPGlueContext *gluecontext, float target, const char *message, void *data);
+typedef void (*GPGlueContextProgressUpdateFunc) (GPGlueContext *gluecontext, unsigned int id, float current, void *data);
+typedef void (*GPGlueContextProgressStopFunc) (GPGlueContext *gluecontext, unsigned int id, void *data);
+
+typedef void (*GPGlueContextErrorFunc) (GPGlueContext *gluecontext, const char *message, void *data);
+typedef void (*GPGlueContextStatusFunc) (GPGlueContext *gluecontext, const char *message, void *data);
+typedef void (*GPGlueContextMessageFunc) (GPGlueContext *gluecontext, const char *message, void *data);
+
+struct _GPGlueContext {
+	GPContext *context;
+	GPGlueContextProgressStartFunc start_func;
+	GPGlueContextProgressUpdateFunc update_func;
+	GPGlueContextProgressStopFunc stop_func;
+	void *progress_data;
+	GPGlueContextErrorFunc error_func;
+	void *error_data;
+	GPGlueContextStatusFunc status_func;
+	void *status_data;
+	GPGlueContextMessageFunc message_func;
+	void *message_data;
+};
+
+GPGlueContext *
+gp_glue_context_new (GPContext *context)
+{
+	GPGlueContext *gluecontext = malloc (sizeof (GPGlueContext));
+	gluecontext->context = context;
+	return gluecontext;
+}
+
+void
+gp_glue_context_free (GPGlueContext *gluecontext)
+{
+	free (gluecontext);
+}
+
+unsigned int
+gp_glue_start_func_wrapper (GPContext *context, float target, const char *format, va_list args, void *data)
+{
+	GPGlueContext *gluecontext = (GPGlueContext *)data;
+	unsigned int ret;
+	char buf[256];
+	vsnprintf (buf, 256, format, args);
+	ret = gluecontext->start_func (gluecontext, target, buf, gluecontext->progress_data);
+
+	return ret;
+}
+
+void
+gp_glue_update_func_wrapper (GPContext *context, unsigned int id, float current, void *data)
+{
+	GPGlueContext *gluecontext = (GPGlueContext *)data;
+	gluecontext->update_func (gluecontext, id, current, gluecontext->progress_data);
+}
+
+void
+gp_glue_stop_func_wrapper (GPContext *context, unsigned int id, void *data)
+{
+	GPGlueContext *gluecontext = (GPGlueContext *)data;
+	gluecontext->stop_func (gluecontext, id, gluecontext->progress_data);
+}
+
+void
+gp_glue_context_set_progress_funcs (GPGlueContext *gluecontext, GPGlueContextProgressStartFunc start_func, GPGlueContextProgressUpdateFunc update_func, GPGlueContextProgressStopFunc stop_func, void *data)
+{
+	gluecontext->start_func = start_func;
+	gluecontext->update_func = update_func;
+	gluecontext->stop_func = stop_func;
+	gluecontext->progress_data = data;
+
+	gp_context_set_progress_funcs (gluecontext->context,
+				       gp_glue_start_func_wrapper,
+				       gp_glue_update_func_wrapper,
+				       gp_glue_stop_func_wrapper,
+				       gluecontext);
+}
+
+void
+gp_glue_error_func_wrapper (GPContext *context, const char *format, va_list args, void *data)
+{
+	GPGlueContext *gluecontext = (GPGlueContext *)data;
+	char buf[256];
+	vsnprintf (buf, 256, format, args);
+	gluecontext->error_func (gluecontext, buf, gluecontext->error_data);
+	
+}
+
+void
+gp_glue_context_set_error_func (GPGlueContext *gluecontext, GPGlueContextErrorFunc error_func, void *data)
+{
+	gluecontext->error_func = error_func;
+	gluecontext->error_data = data;
+
+	gp_context_set_error_func (gluecontext->context, gp_glue_error_func_wrapper, gluecontext);
+}
+
+void
+gp_glue_status_func_wrapper (GPContext *context, const char *format, va_list args, void *data)
+{
+	GPGlueContext *gluecontext = (GPGlueContext *)data;
+	char buf[256];
+	vsnprintf (buf, 256, format, args);
+	gluecontext->status_func (gluecontext, buf, gluecontext->status_data);
+	
+}
+
+void
+gp_glue_context_set_status_func (GPGlueContext *gluecontext, GPGlueContextStatusFunc status_func, void *data)
+{
+	gluecontext->status_func = status_func;
+	gluecontext->status_data = data;
+
+	gp_context_set_status_func (gluecontext->context, gp_glue_status_func_wrapper, gluecontext);
+}
+
+void
+gp_glue_message_func_wrapper (GPContext *context, const char *format, va_list args, void *data)
+{
+	GPGlueContext *gluecontext = (GPGlueContext *)data;
+	char buf[256];
+	vsnprintf (buf, 256, format, args);
+	gluecontext->message_func (gluecontext, buf, gluecontext->message_data);
+	
+}
+
+void
+gp_glue_context_set_message_func (GPGlueContext *gluecontext, GPGlueContextMessageFunc message_func, void *data)
+{
+	gluecontext->message_func = message_func;
+	gluecontext->message_data = data;
+
+	gp_context_set_message_func (gluecontext->context, gp_glue_message_func_wrapper, gluecontext);
+}
diff --git a/lib/libgphoto2-sharp/libgphoto2-sharp.dll.config.in b/lib/libgphoto2-sharp/libgphoto2-sharp.dll.config.in
new file mode 100644
index 0000000..de0c1b0
--- /dev/null
+++ b/lib/libgphoto2-sharp/libgphoto2-sharp.dll.config.in
@@ -0,0 +1,5 @@
+<configuration>
+  <dllmap dll="libgphoto2.so" target="libgphoto2.so.2"/>
+  <dllmap dll="libgphoto2glue.so" target="@expanded_libdir@/f-spot/libgphoto2glue.so.0"/>
+  <dllmap dll="libgphoto2_port.so" target="libgphoto2_port.so.0"/>
+</configuration>
diff --git a/src/CameraFileSelectionDialog.cs b/src/CameraFileSelectionDialog.cs
index b60fe55..491f0cc 100644
--- a/src/CameraFileSelectionDialog.cs
+++ b/src/CameraFileSelectionDialog.cs
@@ -13,7 +13,7 @@ using System.IO;
 using Gdk;
 using Gtk;
 using Glade;
-using LibGPhoto2;
+using GPhoto2;
 using Mono.Unix;
 using FSpot.Utils;
 using FSpot.UI.Dialog;
diff --git a/src/CameraSelectionDialog.cs b/src/CameraSelectionDialog.cs
index ed727c5..d8f2ec1 100644
--- a/src/CameraSelectionDialog.cs
+++ b/src/CameraSelectionDialog.cs
@@ -1,7 +1,7 @@
 using System;
 using Gtk;
 using Glade;
-using LibGPhoto2;
+using GPhoto2;
 using Mono.Unix;
 using FSpot.UI.Dialog;
 
@@ -30,7 +30,7 @@ namespace FSpot {
 			cameraList.AppendColumn (Catalog.GetString ("Port"), new CellRendererText (), "text", 1);
 			
 			ListStore tstore = new ListStore (typeof (string), typeof (string));
-			for (int i = 0; i < camlist.Count (); i++) {
+			for (int i = 0; i < camlist.Count; i++) {
 				tstore.AppendValues (camlist.GetName (i), camlist.GetValue (i));
 			}
 			
@@ -50,5 +50,21 @@ namespace FSpot {
 			
 			return return_value;
 		}
+
+	}
+
+	internal static class CameraListExtensions
+	{
+		public static int GetPosition(this CameraList list, string name, string value)
+		{
+			for (int index = 0; index < list.Count; index++)
+			{
+				if (list.GetName(index) == name && list.GetValue(index) == value)
+					return index;
+			}
+			
+			return -1;
+		}
+	
 	}
 }
diff --git a/src/GPhotoCamera.cs b/src/GPhotoCamera.cs
index 776cc82..07e9a66 100644
--- a/src/GPhotoCamera.cs
+++ b/src/GPhotoCamera.cs
@@ -1,13 +1,12 @@
 using System;
 using System.IO;
 using System.Collections;
-using LibGPhoto2;
+using GPhoto2;
 using Gdk;
 using FSpot.Utils;
 using FSpot;
-#if GPHOTO2_2_4
 using Mono.Unix.Native;
-#endif
+
 public class GPhotoCamera
 {
 	Context context;
@@ -17,11 +16,9 @@ public class GPhotoCamera
 	CameraAbilities camera_abilities;
 	Camera camera;
 	PortInfo port_info;
-	CameraFilesystem camera_fs;
 	ArrayList files;
 	
 	int selected_camera__camera_list_index;
-	int selected_camera__abilities_list_index;
 	int selected_camera__port_info_list_index;
 		
 	public GPhotoCamera()
@@ -34,52 +31,35 @@ public class GPhotoCamera
 		abilities_list = new CameraAbilitiesList ();
 		abilities_list.Load (context);
 			
-		camera_list = new CameraList();
-			
 		selected_camera__camera_list_index = -1;
 
 		camera = null;
-		port_info = null;
-		camera_fs = null;
 	}
 		
 	public int DetectCameras ()
 	{
-		abilities_list.Detect (port_info_list, camera_list, context);
+		camera_list = abilities_list.Detect (port_info_list, context);
 		return CameraCount;
 	}
 		
 	public int CameraCount {
-		get {
-			return camera_list.Count();
-		}
+		get { return camera_list.Count; }
 	}
 	
 	public CameraList CameraList {
-		get {
-			return camera_list;
-		}
+		get { return camera_list; }
 	}
 		
 	public void SelectCamera (int index)
 	{
 		selected_camera__camera_list_index = index;
 
-		selected_camera__abilities_list_index = abilities_list.LookupModel (camera_list.GetName (selected_camera__camera_list_index));			
-		camera_abilities = abilities_list.GetAbilities (selected_camera__abilities_list_index);
-
-		camera = new Camera ();
-		camera.SetAbilities (camera_abilities);
+		camera_abilities = abilities_list [camera_list.GetName (selected_camera__camera_list_index)];
+		port_info = port_info_list.LookupPath (camera_list.GetValue (selected_camera__camera_list_index));
 
-		
-		string path  = camera_list.GetValue (selected_camera__camera_list_index);
-		Log.Debug ("Testing gphoto path = {0}", path);
-		selected_camera__port_info_list_index = port_info_list.LookupPath (path);
-
-		port_info = port_info_list.GetInfo (selected_camera__port_info_list_index);
 		Log.Debug ("PortInfo {0}, {1}", port_info.Name, port_info.Path);
 
-		camera.SetPortInfo (port_info);
+		camera = new Camera () { Abilities = camera_abilities, PortInfo = port_info };
 	}
 		
 	public void InitializeCamera ()
@@ -88,7 +68,6 @@ public class GPhotoCamera
 			throw new InvalidOperationException();
 
 		camera.Init (context);
-		camera_fs = camera.GetFS ();
 
 		files = new ArrayList ();
 		GetFileList ();
@@ -101,7 +80,7 @@ public class GPhotoCamera
 		
 	private void GetFileList (string dir)
 	{
-		if (camera_fs == null) 
+		if (camera == null) 
 			throw new InvalidOperationException ();
 
 		//workaround for nikon dslr in ptp mode
@@ -109,14 +88,14 @@ public class GPhotoCamera
 			return;
 		
 		//files
-		CameraList filelist = camera_fs.ListFiles(dir, context);
-		for (int i = 0; i < filelist.Count(); i++) {
+		CameraList filelist = camera.ListFiles(dir, context);
+		for (int i = 0; i < filelist.Count; i++) {
 			files.Add(new GPhotoCameraFile(dir, filelist.GetName(i)));
 		}
 	
 		//subdirectories
-		CameraList folderlist = camera_fs.ListFolders(dir, context);
-		for (int i = 0; i < folderlist.Count(); i++) {
+		CameraList folderlist = camera.ListFolders(dir, context);
+		for (int i = 0; i < folderlist.Count; i++) {
 			GetFileList(dir + folderlist.GetName(i) + "/");
 		}
 	}
@@ -136,16 +115,14 @@ public class GPhotoCamera
 	
 	public CameraFile GetFile (int index)
 	{
-		if (camera_fs == null || files == null || index < 0 || index >= files.Count) 
+		if (camera == null || files == null || index < 0 || index >= files.Count) 
 			return null;
 
 		GPhotoCameraFile selected_file = (GPhotoCameraFile)files [index];		
 		if (selected_file.NormalFile == null)
 		{
-			selected_file.NormalFile = camera_fs.GetFile (selected_file.Directory, 
-								      selected_file.FileName, 
-								      CameraFileType.Normal,
-								      context);
+			selected_file.NormalFile = new CameraFile ();
+			camera.GetFile (selected_file.Directory, selected_file.FileName, CameraFileType.Normal, selected_file.NormalFile, context);
 		}
 		
 		return selected_file.NormalFile;
@@ -159,17 +136,15 @@ public class GPhotoCamera
 	
 	public CameraFile GetPreview (int index)
 	{      
-		if (camera_fs == null || files == null || index < 0 || index >= files.Count) 
+		if (camera == null || files == null || index < 0 || index >= files.Count) 
 			return null;
 
 		GPhotoCameraFile selected_file = (GPhotoCameraFile) files [index];		
 
 		if (selected_file.PreviewFile == null) {
 			try {
-				selected_file.PreviewFile = camera_fs.GetFile (selected_file.Directory,
-									       selected_file.FileName,
-									       CameraFileType.Preview,
-									       context);
+				selected_file.PreviewFile = new CameraFile ();
+				camera.GetFile (selected_file.Directory, selected_file.FileName, CameraFileType.Preview, selected_file.PreviewFile, context);
 			} catch (System.Exception e) {
 				Log.Exception (e);
 				selected_file.PreviewFile = null;
@@ -212,17 +187,15 @@ public class GPhotoCamera
 		//check if the directory exists
 		if (!Directory.Exists (Path.GetDirectoryName (filename))) 
 			throw new Exception (String.Format ("Directory \"{0}\"does not exist", filename)); //FIXME
-#if GPHOTO2_2_4
 		//gp_file_new_from_fd is broken on the directory driver
 		//but using gp_file_new_from_fd doesn't move the files to memory
-		if (camera_abilities.port != PortType.Disk) {
+		if (camera_abilities.PortType != PortType.Disk) {
 			GPhotoCameraFile selected_file = (GPhotoCameraFile) files [index];		
 			using (var f = new CameraFile (Syscall.open (filename, OpenFlags.O_CREAT|OpenFlags.O_RDWR, FilePermissions.DEFFILEMODE))) {
 				camera.GetFile (selected_file.Directory, selected_file.FileName, CameraFileType.Normal, f, context);
 			}
 			return;
 		}
-#endif
 	
 		using (CameraFile camfile = GetFile (index)) {
 			if (camfile == null) 
@@ -252,8 +225,6 @@ public class GPhotoCamera
 			foreach (GPhotoCameraFile curcamfile in files)
 				curcamfile.ReleaseGPhotoResources ();
 
-		if (camera_fs != null) 
-			camera_fs.Dispose ();
 		if (camera != null) 
 			camera.Dispose ();
 
diff --git a/src/ImportCommand.cs b/src/ImportCommand.cs
index 47f84a6..ee6bb85 100644
--- a/src/ImportCommand.cs
+++ b/src/ImportCommand.cs
@@ -235,7 +235,7 @@ public class ImportCommand : GladeDialog
 
 			GPhotoCamera cam = new GPhotoCamera ();
 			cam.DetectCameras ();
-			int camera_count = cam.CameraList.Count ();
+			int camera_count = cam.CameraList.Count;
 
 			if (camera_count > 0) {
 				source_count += camera_count;
diff --git a/src/MainWindow.cs b/src/MainWindow.cs
index 528106c..92ba798 100644
--- a/src/MainWindow.cs
+++ b/src/MainWindow.cs
@@ -27,7 +27,7 @@ using FSpot.Utils;
 using FSpot.UI.Dialog;
 using FSpot.Platform;
 
-using LibGPhoto2;
+using GPhoto2;
 
 namespace FSpot
 {



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