From 1d413a799e15611c3d3f80a37df0a1d3d5b416ea Mon Sep 17 00:00:00 2001
From: Clint Rogers <clinton@yorba.org>
Date: Mon, 20 Aug 2012 14:46:51 -0700
Subject: [PATCH] Proposed patch would  close #5553 by adding the capability
 to build against  GPhoto 2.4 -or- 2.5.

---
 Makefile                        |   20 +-
 configure                       |   10 +
 src/camera/CameraTable.vala     |   34 ++-
 src/camera/GPhoto.vala          |   89 +++++--
 vapi/gphoto-2.4/libgphoto2.vapi |  487 ++++++++++++++++++++++++++++++++++++++
 vapi/gphoto-2.5/libgphoto2.vapi |  495 +++++++++++++++++++++++++++++++++++++++
 vapi/libgphoto2.vapi            |  487 --------------------------------------
 7 files changed, 1114 insertions(+), 508 deletions(-)
 create mode 100644 vapi/gphoto-2.4/libgphoto2.vapi
 create mode 100644 vapi/gphoto-2.5/libgphoto2.vapi
 delete mode 100644 vapi/libgphoto2.vapi

diff --git a/Makefile b/Makefile
index 0c49d00..468b98f 100644
--- a/Makefile
+++ b/Makefile
@@ -41,6 +41,10 @@ ifdef UNITY_SUPPORT
 VALAFLAGS := $(VALAFLAGS) --define UNITY_SUPPORT
 endif
 
+ifdef WITH_GPHOTO_25
+VALAFLAGS := $(VALAFLAGS) --define WITH_GPHOTO_25
+endif
+
 DEFINES := _PREFIX='"$(PREFIX)"' _VERSION='"$(VERSION)"' GETTEXT_PACKAGE='"$(GETTEXT_PACKAGE)"' \
 	_LANG_SUPPORT_DIR='"$(SYSTEM_LANG_DIR)"' _LIB='"${LIB}"'
 
@@ -111,11 +115,16 @@ VAPI_FILES = \
 	ExtendedPosix.vapi \
 	LConv.vapi \
 	libexif.vapi \
-	libgphoto2.vapi \
 	libraw.vapi \
 	unique-3.0.vapi \
 	webkitgtk-3.0.vapi
 
+ifdef WITH_GPHOTO_25
+VAPI_FILES +=gphoto-2.5/libgphoto2.vapi
+else
+VAPI_FILES +=gphoto-2.4/libgphoto2.vapi
+endif
+
 RESOURCE_FILES = \
 	collection.ui \
 	direct.ui \
@@ -259,6 +268,13 @@ HELP_IMAGES = \
 VAPI_DIRS = \
 	./vapi
 
+ifdef WITH_GPHOTO_25
+VAPI_DIRS += ./vapi/gphoto-2.5
+else
+VAPI_DIRS += ./vapi/gphoto-2.4
+endif
+
+
 HEADER_DIRS = \
 	./vapi
 
@@ -706,6 +722,8 @@ lib$(PROGRAM).so: $(EXPANDED_OBJ_FILES) $(RESOURCES) $(LANG_STAMP)
 
 .PHONY: pkgcheck
 pkgcheck:
+	@if ! test -f configure.mk; then echo "Please run ./configure first."; exit 2; fi 
+
 ifndef ASSUME_PKGS
 ifdef EXT_PKG_VERSIONS
 	@pkg-config --print-errors --exists '$(EXT_PKG_VERSIONS) $(DIRECT_LIBS_VERSIONS)'
diff --git a/configure b/configure
index b2ffac5..e142ef7 100755
--- a/configure
+++ b/configure
@@ -139,6 +139,16 @@ do
     shift
 done
 
+# detect version of libgphoto2 the compilation host has installed
+pkg-config --atleast-version 2.5 libgphoto2
+if [ $? == 1 ]
+then 
+    printf "Detected libGPhoto 2.4.x - using default code path.\n";
+else
+    printf "Detected libGPhoto 2.5.x - using 2.5-aware code path.\n";
+    variables="${variables}WITH_GPHOTO_25=1\n"
+fi
+
 rm -f $CONFIG_IN
 if [ $variables ]
 then
diff --git a/src/camera/CameraTable.vala b/src/camera/CameraTable.vala
index 09ef0e2..4b58ca1 100644
--- a/src/camera/CameraTable.vala
+++ b/src/camera/CameraTable.vala
@@ -266,19 +266,27 @@ public class CameraTable {
         DiscoveredCamera[] missing = new DiscoveredCamera[0];
         foreach (DiscoveredCamera camera in camera_map.values) {
             GPhoto.PortInfo port_info;
+            string tmp_path;
+            
             do_op(camera.gcamera.get_port_info(out port_info), 
                 "retrieve missing camera port information");
             
+#if WITH_GPHOTO_25
+            port_info.get_path(out tmp_path);
+#else
+            tmp_path = port_info.path;
+#endif
+            
             GPhoto.CameraAbilities abilities;
             do_op(camera.gcamera.get_abilities(out abilities), "retrieve camera abilities");
             
-            if (detected_map.has_key(port_info.path)) {
-                debug("Found camera for %s @ %s in detected map", abilities.model, port_info.path);
+            if (detected_map.has_key(tmp_path)) {
+                debug("Found camera for %s @ %s in detected map", abilities.model, tmp_path);
                 
                 continue;
             }
             
-            debug("%s @ %s missing", abilities.model, port_info.path);
+            debug("%s @ %s missing", abilities.model, tmp_path);
             
             missing += camera;
         }
@@ -286,15 +294,22 @@ public class CameraTable {
         // have to remove from hash map outside of iterator
         foreach (DiscoveredCamera camera in missing) {
             GPhoto.PortInfo port_info;
+            string tmp_path;
+            
             do_op(camera.gcamera.get_port_info(out port_info),
                 "retrieve missing camera port information");
+#if WITH_GPHOTO_25
+            port_info.get_path(out tmp_path);
+#else
+            tmp_path = port_info.path;
+#endif
             
             GPhoto.CameraAbilities abilities;
             do_op(camera.gcamera.get_abilities(out abilities), "retrieve missing camera abilities");
 
-            debug("Removing from camera table: %s @ %s", abilities.model, port_info.path);
+            debug("Removing from camera table: %s @ %s", abilities.model, tmp_path);
 
-            camera_map.unset(get_port_uri(port_info.path));
+            camera_map.unset(get_port_uri(tmp_path));
             
             camera_removed(camera);
         }
@@ -340,10 +355,17 @@ public class CameraTable {
                 do_op((GPhoto.Result) index, "lookup port %s".printf(port));
             
             GPhoto.PortInfo port_info;
+            string tmp_path;
+            
             do_op(port_info_list.get_info(index, out port_info), "get port info for %s".printf(port));
+#if WITH_GPHOTO_25
+            port_info.get_path(out tmp_path);
+#else
+            tmp_path = port_info.path;
+#endif            
             
             // this should match, every time
-            assert(port == port_info.path);
+            assert(port == tmp_path);
             
             index = abilities_list.lookup_model(name);
             if (index < 0)
diff --git a/src/camera/GPhoto.vala b/src/camera/GPhoto.vala
index 9b1dc4b..432dbbc 100644
--- a/src/camera/GPhoto.vala
+++ b/src/camera/GPhoto.vala
@@ -24,25 +24,77 @@ namespace GPhoto {
         
         public virtual void idle() {
         }
+
+#if WITH_GPHOTO_25
+
+        public virtual void error(string text, void *data) {
+        }
+
+        public virtual void status(string text, void *data) {
+        }
+
+        public virtual void message(string text, void *data) {
+        }
         
-        public virtual void error(string format, void *va_list) {
+        public virtual void progress_start(float current, string text, void *data) {
         }
         
-        public virtual void status(string format, void *va_list) {
+        public virtual void progress_update(float current, void *data) {
         }
         
-        public virtual void message(string format, void *va_list) {
+        public virtual void progress_stop() {
         }
         
-        public virtual void progress_start(float target, string format, void *va_list) {
+        private void on_idle(Context context) {
+            idle();
+        }
+
+        private void on_error(Context context, string text) {
+            error(text, null);
         }
         
-        public virtual void progress_update(float current) {
+        private void on_status(Context context, string text) {
+            status(text, null);
         }
         
-        public virtual void progress_stop() {
+        private void on_message(Context context, string text) {
+            message(text, null);
+        }
+        
+        private uint on_progress_start(Context context, float target, string text) {
+            progress_start(target, text, null);
+            
+            return 0;
         }
         
+        private void on_progress_update(Context context, uint id, float current) {
+            progress_update(current, null);
+        }
+        
+        private void on_progress_stop(Context context, uint id) {
+            progress_stop();
+        }
+
+#else
+
+        public virtual void error(string format, void *va_list) {
+        }
+
+        public virtual void status(string format, void *va_list) {
+        }
+
+        public virtual void message(string format, void *va_list) {
+        }
+
+        public virtual void progress_start(float target, string format, void *va_list) {
+        }
+
+        public virtual void progress_update(float current) {
+        }
+
+        public virtual void progress_stop() {
+        }
+
         private void on_idle(Context context) {
             idle();
         }
@@ -50,28 +102,30 @@ namespace GPhoto {
         private void on_error(Context context, string format, void *va_list) {
             error(format, va_list);
         }
-        
+
         private void on_status(Context context, string format, void *va_list) {
             status(format, va_list);
         }
-        
+
         private void on_message(Context context, string format, void *va_list) {
             message(format, va_list);
         }
-        
+
         private uint on_progress_start(Context context, float target, string format, void *va_list) {
             progress_start(target, format, va_list);
             
             return 0;
         }
-        
+
         private void on_progress_update(Context context, uint id, float current) {
             progress_update(current);
         }
-        
+
         private void on_progress_stop(Context context, uint id) {
             progress_stop();
         }
+
+#endif
     }
     
     public class SpinIdleWrapper : ContextWrapper {
@@ -83,14 +137,21 @@ namespace GPhoto {
             
             spin_event_loop();
         }
-        
+#if WITH_GPHOTO_25  
+        public override void progress_update(float current, void *data) {
+            base.progress_update(current, data);
+
+            spin_event_loop();
+        }
+#else
         public override void progress_update(float current) {
             base.progress_update(current);
-            
+
             spin_event_loop();
         }
+#endif
     }
-    
+
     // For CameraFileInfoFile, CameraFileInfoPreview, and CameraStorageInformation.  See:
     // http://trac.yorba.org/ticket/1851
     // https://bugzilla.redhat.com/show_bug.cgi?id=585676
diff --git a/vapi/gphoto-2.4/libgphoto2.vapi b/vapi/gphoto-2.4/libgphoto2.vapi
new file mode 100644
index 0000000..19e7ec2
--- /dev/null
+++ b/vapi/gphoto-2.4/libgphoto2.vapi
@@ -0,0 +1,487 @@
+/* Copyright 2009-2012 Yorba Foundation
+ *
+ * This software is licensed under the GNU LGPL (version 2.1 or later).
+ * See the COPYING file in this distribution. 
+ */
+
+[CCode (
+    cprefix="GP",
+    lower_case_cprefix="gp_"
+)]
+namespace GPhoto {
+    [SimpleType]
+    [CCode (
+        cname="CameraAbilities",
+        destroy_function="",
+        cheader_filename="gphoto2/gphoto2-abilities-list.h"
+    )]
+    public struct CameraAbilities {
+        public string model;
+        public int status;
+        public PortType port;
+        public string 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_protocol;
+    }
+    
+    [Compact]
+    [CCode (
+        cname="CameraAbilitiesList",
+        cprefix="gp_abilities_list_",
+        free_function="gp_abilities_list_free",
+        cheader_filename="gphoto2/gphoto2-abilities-list.h"
+    )]
+    public class CameraAbilitiesList {
+        [CCode (cname="gp_abilities_list_new")]
+        public static Result create(out CameraAbilitiesList abilitiesList);
+        public Result load(Context context);
+        public Result reset();
+        public Result detect(PortInfoList portList, CameraList cameraList, Context context);
+        public int count();
+        public int lookup_model(string model);
+        public Result get_abilities(int index, out CameraAbilities abilities);
+    }
+    
+    [Compact]
+    [CCode (
+        cname="Camera",
+        ref_function="GPHOTO_REF_CAMERA",
+        unref_function="gp_camera_unref",
+        free_function="gp_camera_free",
+        cheader_filename="gphoto2/gphoto2-camera.h,gphoto.h"
+    )]
+    public class Camera {
+        [CCode (cname="gp_camera_new")]
+        public static Result create(out Camera camera);
+        public Result init(Context context);
+        public Result exit(Context context);
+        public Result get_port_info(out PortInfo info);
+        public Result set_port_info(PortInfo info);
+        public Result get_abilities(out CameraAbilities abilities);
+        public Result set_abilities(CameraAbilities abilities);
+        public Result get_storageinfo(CameraStorageInformation **sifs, out int count, Context context);
+        
+        // Folders
+        [CCode (cname="gp_camera_folder_list_folders")]
+        public Result list_folders(string folder, CameraList list, Context context);
+        [CCode (cname="gp_camera_folder_list_files")]
+        public Result list_files(string folder, CameraList list, Context context);
+        [CCode (cname="gp_camera_folder_delete_all")]
+        public Result delete_all_files(string folder, Context context);
+        [CCode (cname="gp_camera_folder_put_file")]
+        public Result put_file(string folder, CameraFile file, Context context);
+        [CCode (cname="gp_camera_folder_make_dir")]
+        public Result make_dir(string folder, string name, Context context);
+        [CCode (cname="gp_camera_folder_remove_dir")]
+        public Result remove_dir(string folder, string name, Context context);
+        
+        // Files
+        [CCode (cname="gp_camera_file_get_info")]
+        public Result get_file_info(string folder, string file, out CameraFileInfo info, Context context);
+        [CCode (cname="gp_camera_file_set_info")]
+        public Result set_file_info(string folder, string file, CameraFileInfo info, Context context);
+        [CCode (cname="gp_camera_file_get")]
+        public Result get_file(string folder, string filename, CameraFileType type, CameraFile file,
+            Context context);
+        [CCode (cname="gp_camera_file_delete")]
+        public Result delete_file(string folder, string filename, Context context);
+    }
+    
+    [Compact]
+    [CCode (
+        cname="CameraFile",
+        cprefix="gp_file_",
+        ref_function="GPHOTO_REF_FILE",
+        unref_function="gp_file_unref",
+        free_function="gp_file_free",
+        cheader_filename="gphoto2/gphoto2-file.h,gphoto.h"
+    )]
+    public class CameraFile {
+        [CCode (cname="gp_file_new")]
+        public static Result create(out CameraFile file);
+        public Result get_data_and_size(out uint8 *data, out ulong data_len);
+        public Result save(string filename);
+        public Result slurp(uint8[] data, out size_t readlen);
+    }
+    
+    [SimpleType]
+    [CCode (
+        cname="CameraFileInfo",
+        destroy_function="",
+        cheader_filename="gphoto2/gphoto2-filesys.h"
+    )]
+    public struct CameraFileInfo {
+        public CameraFileInfoPreview preview;
+        public CameraFileInfoFile file;
+        public CameraFileInfoAudio audio;
+    }
+    
+    [SimpleType]
+    [CCode (
+        cname="CameraFileInfoAudio",
+        cheader_filename="gphoto2/gphoto2-filesys.h"
+    )]
+    public struct CameraFileInfoAudio {
+    }
+    
+    [CCode (
+        cname="CameraFileInfoFields",
+        cheader_filename="gphoto2/gphoto2-filesys.h",
+        cprefix="GP_FILE_INFO_"
+    )]
+    [Flags]
+    public enum CameraFileInfoFields {
+        NONE,
+        TYPE,
+        NAME,
+        SIZE,
+        WIDTH,
+        HEIGHT,
+        PERMISSIONS,
+        STATUS,
+        MTIME,
+        ALL
+    }
+    
+    [SimpleType]
+    [CCode (
+        cname="CameraFileInfoFile",
+        cheader_filename="gphoto2/gphoto2-filesys.h"
+    )]
+    public struct CameraFileInfoFile {
+        public CameraFileInfoFields fields;
+        public CameraFileStatus status;
+        public ulong size;
+        public string type;
+        public uint width;
+        public uint height;
+        public string name;
+        public CameraFilePermissions permissions;
+        public time_t mtime;
+    }
+    
+    [SimpleType]
+    [CCode (
+        cname="CameraFileInfoPreview",
+        cheader_filename="gphoto2/gphoto2-filesys.h"
+    )]
+    public struct CameraFileInfoPreview {
+        public CameraFileInfoFields fields;
+        public CameraFileStatus status;
+        public ulong size;
+        public string type;
+        public uint width;
+        public uint height;
+        public string name;
+        public CameraFilePermissions permissions;
+        public time_t mtime;
+    }
+    
+    [CCode (
+        cname="CameraFileOperation",
+        cheader_filename="gphoto2/gphoto2-abilities-list.h",
+        cprefix="GP_FILE_OPERATION_"
+    )]
+    [Flags]
+    public enum CameraFileOperation {
+        NONE,
+        DELETE,
+        PREVIEW,
+        RAW,
+        AUDIO,
+        EXIF
+    }
+    
+    [CCode (
+        cname="CameraFilePermissions",
+        cheader_filename="gphoto2/gphoto2-filesys.h",
+        cprefix="GP_FILE_PERM_"
+    )]
+    [Flags]
+    public enum CameraFilePermissions {
+        NONE,
+        READ,
+        DELETE,
+        ALL
+    }
+    
+    [CCode (
+        cname="CameraFileStatus",
+        cheader_filename="gphoto2/gphoto2-filesys.h",
+        cprefix="GP_FILE_STATUS_"
+    )]
+    public enum CameraFileStatus {
+        NOT_DOWNLOADED,
+        DOWNLOADED
+    }
+    
+    [CCode (
+        cname="CameraFileType",
+        cheader_filename="gphoto2/gphoto2-file.h",
+        cprefix="GP_FILE_TYPE_"
+    )]
+    public enum CameraFileType {
+        PREVIEW,
+        NORMAL,
+        RAW,
+        AUDIO,
+        EXIF,
+        METADATA
+    }
+    
+    [CCode (
+        cname="CameraFolderOperation",
+        cheader_filename="gphoto2/gphoto2-abilities-list.h",
+        cprefix="GP_FOLDER_OPERATION_"
+    )]
+    [Flags]
+    public enum CameraFolderOperation {
+        NONE,
+        DELETE_ALL,
+        PUT_FILE,
+        MAKE_DIR,
+        REMOVE_DIR
+    }
+    
+    [Compact]
+    [CCode (
+        cname="CameraList",
+        cprefix="gp_list_",
+        ref_function="GPHOTO_REF_LIST",
+        unref_function="gp_list_unref",
+        free_function="gp_list_free",
+        cheader_filename="gphoto2/gphoto2-list.h,gphoto.h"
+    )]
+    public class CameraList {
+        [CCode (cname="gp_list_new")]
+        public static Result create(out CameraList list);
+        public int count();
+        public Result append(string name, string value);
+        public Result reset();
+        public Result sort();
+        public Result find_by_name(out int? index, string name);
+        public Result get_name(int index, out unowned string name);
+        public Result get_value(int index, out unowned string value);
+        public Result set_name(int index, string name);
+        public Result set_value(int index, string value);
+        public Result populate(string format, int count);
+    }
+    
+    [CCode (
+        cname="CameraOperation",
+        cheader_filename="gphoto2/gphoto2-abilities-list.h",
+        cprefix="GP_OPERATION_"
+    )]
+    [Flags]
+    public enum CameraOperation {
+        NONE,
+        CAPTURE_IMAGE,
+        CAPTURE_VIDEO,
+        CAPTURE_AUDIO,
+        CAPTURE_PREVIEW,
+        CONFIG
+    }
+    
+    [CCode (
+        cname="CameraStorageInfoFields",
+        cheader_filename="gphoto2/gphoto2-filesys.h",
+        cprefix="GP_STORAGEINFO_"
+    )]
+    [Flags]
+    public enum CameraStorageInfoFields {
+        BASE,
+        LABEL,
+        DESCRIPTION,
+        ACCESS,
+        STORAGETYPE,
+        FILESYSTEMTYPE,
+        MAXCAPACITY,
+        FREESPACEKBYTES,
+        FREESPACEIMAGES
+    }
+    
+    [SimpleType]
+    [CCode (
+        cname="CameraStorageInformation",
+        cheader_filename="gphoto2/gphoto2-filesys.h"
+    )]
+    public struct CameraStorageInformation {
+        public CameraStorageInfoFields fields;
+        public string basedir;
+        public string label;
+        public string description;
+        public int type;
+        public int fstype;
+        public int access;
+        public ulong capacitykbytes;
+        public ulong freekbytes;
+        public ulong freeimages;
+    }
+    
+    [Compact]
+    [CCode (
+        ref_function="GPHOTO_REF_CONTEXT",
+        unref_function="gp_context_unref",
+        cheader_filename="gphoto2/gphoto2-context.h,gphoto.h"
+    )]
+    public class Context {
+        [CCode (cname="gp_context_new")]
+        public Context();
+        public void set_idle_func(ContextIdleFunc func);
+        public void set_progress_funcs(
+            [CCode (delegate_target_pos=3.1)] ContextProgressStartFunc startFunc, 
+            [CCode (delegate_target_pos=3.1)] ContextProgressUpdateFunc updateFunc, 
+            [CCode (delegate_target_pos=3.1)] ContextProgressStopFunc stopFunc);
+        public void set_error_func([CCode (delegate_target_pos=3.1)] ContextErrorFunc errorFunc);
+        public void set_status_func([CCode (delegate_target_pos=3.1)] ContextStatusFunc statusFunc);
+        public void set_message_func([CCode (delegate_target_pos=3.1)] ContextMessageFunc messageFunc);
+    }
+    
+    public delegate void ContextIdleFunc(Context context);
+    
+    public delegate void ContextErrorFunc(Context context, string format, void *va_list);
+    
+    public delegate void ContextStatusFunc(Context context, string format, void *va_list);
+    
+    public delegate void ContextMessageFunc(Context context, string format, void *va_list);
+    
+    // TODO: Support for va_args in Vala, esp. for delegates?
+    public delegate uint ContextProgressStartFunc(Context context, float target, string format, void *va_list);
+    
+    public delegate void ContextProgressUpdateFunc(Context context, uint id, float current);
+    
+    public delegate void ContextProgressStopFunc(Context context, uint id);
+    
+    [CCode (
+        cheader_filename="gphoto2/gphoto2-file.h",
+        cprefix="GP_MIME_"
+    )]
+    namespace MIME {
+        public const string WAV;
+        public const string RAW;
+        public const string PNG;
+        public const string PGM;
+        public const string PPM;
+        public const string PNM;
+        public const string JPEG;
+        public const string TIFF;
+        public const string BMP;
+        public const string QUICKTIME;
+        public const string AVI;
+        public const string CRW;
+        public const string UNKNOWN;
+        public const string EXIF;
+        public const string MP3;
+        public const string OGG;
+        public const string WMA;
+        public const string ASF;
+        public const string MPEG;
+    }
+    
+    [SimpleType]
+    [CCode (
+        destroy_function="",
+        cheader_filename="gphoto2/gphoto2-port-info-list.h"
+    )]
+    public struct PortInfo {
+        public PortType type;
+        public string name;
+        public string path;
+        public string library_filename;
+    }
+    
+    [Compact]
+    [CCode (
+        free_function="gp_port_info_list_free",
+        cheader_filename="gphoto2/gphoto2-port-info-list.h"
+    )]
+    public class PortInfoList {
+        [CCode (cname="gp_port_info_list_new")]
+        public static Result create(out PortInfoList list);
+        public Result load();
+        public int count();
+        public int lookup_name(string name);
+        public int lookup_path(string name);
+        public Result get_info(int index, out PortInfo info);
+    }
+    
+    [CCode (
+        cheader_filename="gphoto2/gphoto2-port-info-list.h",
+        cprefix="GP_PORT_"
+    )]
+    [Flags]
+    public enum PortType {
+        NONE,
+        SERIAL,
+        USB,
+        DISK,
+        PTPIP
+    }
+    
+    [CCode (
+        cname="int",
+        cheader_filename="gphoto2/gphoto2-result.h,gphoto2/gphoto2-port-result.h",
+        cprefix="GP_ERROR_"
+    )]
+    public enum Result {
+        [CCode (cname="GP_OK")]
+        OK,
+        [CCode (cname="GP_ERROR")]
+        ERROR,
+        BAD_PARAMETERS,
+        NO_MEMORY,
+        LIBRARY,
+        UNKNOWN_PORT,
+        NOT_SUPPORTED,
+        IO,
+        FIXED_LIMIT_EXCEEDED,
+        TIMEOUT,
+        IO_SUPPORTED_SERIAL,
+        IO_SUPPORTED_USB,
+        IO_INIT,
+        IO_READ,
+        IO_WRITE,
+        IO_UPDATE,
+        IO_SERIAL_SPEED,
+        IO_USB_CLEAR_HALT,
+        IO_USB_FIND,
+        IO_USB_CLAIM,
+        IO_LOCK,
+        HAL,
+        CORRUPTED_DATA,
+        FILE_EXISTS,
+        MODEL_NOT_FOUND,
+        DIRECTORY_NOT_FOUND,
+        FILE_NOT_FOUND,
+        DIRECTORY_EXISTS,
+        CAMERA_BUSY,
+        PATH_NOT_ABSOLUTE,
+        CANCEL,
+        CAMERA_ERROR,
+        OS_FAILURE;
+        
+        [CCode (cname="gp_port_result_as_string")]
+        public unowned string as_string();
+        
+        public string to_full_string() {
+            return "%s (%d)".printf(as_string(), this);
+        }
+    }
+    
+    [CCode (
+        cheader_filename="gphoto2/gphoto2-version.h",
+        cprefix="GP_VERSION"
+    )]
+    public enum VersionVerbosity {
+        SHORT,
+        VERBOSE
+    }
+    
+    public unowned string library_version(VersionVerbosity verbosity);
+}
+
diff --git a/vapi/gphoto-2.5/libgphoto2.vapi b/vapi/gphoto-2.5/libgphoto2.vapi
new file mode 100644
index 0000000..5bd101d
--- /dev/null
+++ b/vapi/gphoto-2.5/libgphoto2.vapi
@@ -0,0 +1,495 @@
+/* Copyright 2009-2012 Yorba Foundation
+ *
+ * This software is licensed under the GNU LGPL (version 2.1 or later).
+ * See the COPYING file in this distribution. 
+ */
+
+[CCode (
+    cprefix="GP",
+    lower_case_cprefix="gp_"
+)]
+namespace GPhoto {
+    [SimpleType]
+    [CCode (
+        cname="CameraAbilities",
+        destroy_function="",
+        cheader_filename="gphoto2/gphoto2-abilities-list.h"
+    )]
+    public struct CameraAbilities {
+        public string model;
+        public int status;
+        public PortType port;
+        public string 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_protocol;
+    }
+    
+    [Compact]
+    [CCode (
+        cname="CameraAbilitiesList",
+        cprefix="gp_abilities_list_",
+        free_function="gp_abilities_list_free",
+        cheader_filename="gphoto2/gphoto2-abilities-list.h"
+    )]
+    public class CameraAbilitiesList {
+        [CCode (cname="gp_abilities_list_new")]
+        public static Result create(out CameraAbilitiesList abilitiesList);
+        public Result load(Context context);
+        public Result reset();
+        public Result detect(PortInfoList portList, CameraList cameraList, Context context);
+        public int count();
+        public int lookup_model(string model);
+        public Result get_abilities(int index, out CameraAbilities abilities);
+    }
+    
+    [Compact]
+    [CCode (
+        cname="Camera",
+        ref_function="GPHOTO_REF_CAMERA",
+        unref_function="gp_camera_unref",
+        free_function="gp_camera_free",
+        cheader_filename="gphoto2/gphoto2-camera.h,gphoto.h"
+    )]
+    public class Camera {
+        [CCode (cname="gp_camera_new")]
+        public static Result create(out Camera camera);
+        public Result init(Context context);
+        public Result exit(Context context);
+        public Result get_port_info(out PortInfo info);
+        public Result set_port_info(PortInfo info);
+        public Result get_abilities(out CameraAbilities abilities);
+        public Result set_abilities(CameraAbilities abilities);
+        public Result get_storageinfo(CameraStorageInformation **sifs, out int count, Context context);
+        
+        // Folders
+        [CCode (cname="gp_camera_folder_list_folders")]
+        public Result list_folders(string folder, CameraList list, Context context);
+        [CCode (cname="gp_camera_folder_list_files")]
+        public Result list_files(string folder, CameraList list, Context context);
+        [CCode (cname="gp_camera_folder_delete_all")]
+        public Result delete_all_files(string folder, Context context);
+        [CCode (cname="gp_camera_folder_put_file")]
+        public Result put_file(string folder, CameraFile file, Context context);
+        [CCode (cname="gp_camera_folder_make_dir")]
+        public Result make_dir(string folder, string name, Context context);
+        [CCode (cname="gp_camera_folder_remove_dir")]
+        public Result remove_dir(string folder, string name, Context context);
+        
+        // Files
+        [CCode (cname="gp_camera_file_get_info")]
+        public Result get_file_info(string folder, string file, out CameraFileInfo info, Context context);
+        [CCode (cname="gp_camera_file_set_info")]
+        public Result set_file_info(string folder, string file, CameraFileInfo info, Context context);
+        [CCode (cname="gp_camera_file_get")]
+        public Result get_file(string folder, string filename, CameraFileType type, CameraFile file,
+            Context context);
+        [CCode (cname="gp_camera_file_delete")]
+        public Result delete_file(string folder, string filename, Context context);
+    }
+    
+    [Compact]
+    [CCode (
+        cname="CameraFile",
+        cprefix="gp_file_",
+        ref_function="GPHOTO_REF_FILE",
+        unref_function="gp_file_unref",
+        free_function="gp_file_free",
+        cheader_filename="gphoto2/gphoto2-file.h,gphoto.h"
+    )]
+    public class CameraFile {
+        [CCode (cname="gp_file_new")]
+        public static Result create(out CameraFile file);
+        public Result get_data_and_size(out uint8 *data, out ulong data_len);
+        public Result save(string filename);
+        public Result slurp(uint8[] data, out size_t readlen);
+    }
+    
+    [SimpleType]
+    [CCode (
+        cname="CameraFileInfo",
+        destroy_function="",
+        cheader_filename="gphoto2/gphoto2-filesys.h"
+    )]
+    public struct CameraFileInfo {
+        public CameraFileInfoPreview preview;
+        public CameraFileInfoFile file;
+        public CameraFileInfoAudio audio;
+    }
+    
+    [SimpleType]
+    [CCode (
+        cname="CameraFileInfoAudio",
+        cheader_filename="gphoto2/gphoto2-filesys.h"
+    )]
+    public struct CameraFileInfoAudio {
+    }
+    
+    [CCode (
+        cname="CameraFileInfoFields",
+        cheader_filename="gphoto2/gphoto2-filesys.h",
+        cprefix="GP_FILE_INFO_"
+    )]
+    [Flags]
+    public enum CameraFileInfoFields {
+        NONE,
+        TYPE,
+        NAME,
+        SIZE,
+        WIDTH,
+        HEIGHT,
+        PERMISSIONS,
+        STATUS,
+        MTIME,
+        ALL
+    }
+    
+    [SimpleType]
+    [CCode (
+        cname="CameraFileInfoFile",
+        cheader_filename="gphoto2/gphoto2-filesys.h"
+    )]
+    public struct CameraFileInfoFile {
+        public CameraFileInfoFields fields;
+        public CameraFileStatus status;
+        public ulong size;
+        public string type;
+        public uint width;
+        public uint height;
+        public string name;
+        public CameraFilePermissions permissions;
+        public time_t mtime;
+    }
+    
+    [SimpleType]
+    [CCode (
+        cname="CameraFileInfoPreview",
+        cheader_filename="gphoto2/gphoto2-filesys.h"
+    )]
+    public struct CameraFileInfoPreview {
+        public CameraFileInfoFields fields;
+        public CameraFileStatus status;
+        public ulong size;
+        public string type;
+        public uint width;
+        public uint height;
+        public string name;
+        public CameraFilePermissions permissions;
+        public time_t mtime;
+    }
+    
+    [CCode (
+        cname="CameraFileOperation",
+        cheader_filename="gphoto2/gphoto2-abilities-list.h",
+        cprefix="GP_FILE_OPERATION_"
+    )]
+    [Flags]
+    public enum CameraFileOperation {
+        NONE,
+        DELETE,
+        PREVIEW,
+        RAW,
+        AUDIO,
+        EXIF
+    }
+    
+    [CCode (
+        cname="CameraFilePermissions",
+        cheader_filename="gphoto2/gphoto2-filesys.h",
+        cprefix="GP_FILE_PERM_"
+    )]
+    [Flags]
+    public enum CameraFilePermissions {
+        NONE,
+        READ,
+        DELETE,
+        ALL
+    }
+    
+    [CCode (
+        cname="CameraFileStatus",
+        cheader_filename="gphoto2/gphoto2-filesys.h",
+        cprefix="GP_FILE_STATUS_"
+    )]
+    public enum CameraFileStatus {
+        NOT_DOWNLOADED,
+        DOWNLOADED
+    }
+    
+    [CCode (
+        cname="CameraFileType",
+        cheader_filename="gphoto2/gphoto2-file.h",
+        cprefix="GP_FILE_TYPE_"
+    )]
+    public enum CameraFileType {
+        PREVIEW,
+        NORMAL,
+        RAW,
+        AUDIO,
+        EXIF,
+        METADATA
+    }
+    
+    [CCode (
+        cname="CameraFolderOperation",
+        cheader_filename="gphoto2/gphoto2-abilities-list.h",
+        cprefix="GP_FOLDER_OPERATION_"
+    )]
+    [Flags]
+    public enum CameraFolderOperation {
+        NONE,
+        DELETE_ALL,
+        PUT_FILE,
+        MAKE_DIR,
+        REMOVE_DIR
+    }
+    
+    [Compact]
+    [CCode (
+        cname="CameraList",
+        cprefix="gp_list_",
+        ref_function="GPHOTO_REF_LIST",
+        unref_function="gp_list_unref",
+        free_function="gp_list_free",
+        cheader_filename="gphoto2/gphoto2-list.h,gphoto.h"
+    )]
+    public class CameraList {
+        [CCode (cname="gp_list_new")]
+        public static Result create(out CameraList list);
+        public int count();
+        public Result append(string name, string value);
+        public Result reset();
+        public Result sort();
+        public Result find_by_name(out int? index, string name);
+        public Result get_name(int index, out unowned string name);
+        public Result get_value(int index, out unowned string value);
+        public Result set_name(int index, string name);
+        public Result set_value(int index, string value);
+        public Result populate(string format, int count);
+    }
+    
+    [CCode (
+        cname="CameraOperation",
+        cheader_filename="gphoto2/gphoto2-abilities-list.h",
+        cprefix="GP_OPERATION_"
+    )]
+    [Flags]
+    public enum CameraOperation {
+        NONE,
+        CAPTURE_IMAGE,
+        CAPTURE_VIDEO,
+        CAPTURE_AUDIO,
+        CAPTURE_PREVIEW,
+        CONFIG
+    }
+    
+    [CCode (
+        cname="CameraStorageInfoFields",
+        cheader_filename="gphoto2/gphoto2-filesys.h",
+        cprefix="GP_STORAGEINFO_"
+    )]
+    [Flags]
+    public enum CameraStorageInfoFields {
+        BASE,
+        LABEL,
+        DESCRIPTION,
+        ACCESS,
+        STORAGETYPE,
+        FILESYSTEMTYPE,
+        MAXCAPACITY,
+        FREESPACEKBYTES,
+        FREESPACEIMAGES
+    }
+    
+    [SimpleType]
+    [CCode (
+        cname="CameraStorageInformation",
+        cheader_filename="gphoto2/gphoto2-filesys.h"
+    )]
+    public struct CameraStorageInformation {
+        public CameraStorageInfoFields fields;
+        public string basedir;
+        public string label;
+        public string description;
+        public int type;
+        public int fstype;
+        public int access;
+        public ulong capacitykbytes;
+        public ulong freekbytes;
+        public ulong freeimages;
+    }
+    
+    [Compact]
+    [CCode (
+        ref_function="GPHOTO_REF_CONTEXT",
+        unref_function="gp_context_unref",
+        cheader_filename="gphoto2/gphoto2-context.h,gphoto.h"
+    )]
+    public class Context {
+        [CCode (cname="gp_context_new")]
+        public Context();
+        public void set_idle_func(ContextIdleFunc func);
+        public void set_progress_funcs(
+            [CCode (delegate_target_pos=3.1)] ContextProgressStartFunc startFunc, 
+            [CCode (delegate_target_pos=3.1)] ContextProgressUpdateFunc updateFunc, 
+            [CCode (delegate_target_pos=3.1)] ContextProgressStopFunc stopFunc);
+        public void set_error_func([CCode (delegate_target_pos=3.1)] ContextErrorFunc errorFunc);
+        public void set_status_func([CCode (delegate_target_pos=3.1)] ContextStatusFunc statusFunc);
+        public void set_message_func([CCode (delegate_target_pos=3.1)] ContextMessageFunc messageFunc);
+    }
+    
+    public delegate void ContextIdleFunc(Context context);
+    
+    public delegate void ContextErrorFunc(Context context, string text);
+    
+    public delegate void ContextStatusFunc(Context context, string text);
+    
+    public delegate void ContextMessageFunc(Context context, string text);
+    
+    // TODO: Support for va_args in Vala, esp. for delegates?
+    public delegate uint ContextProgressStartFunc(Context context, float target, string text);
+    
+    public delegate void ContextProgressUpdateFunc(Context context, uint id, float current);
+    
+    public delegate void ContextProgressStopFunc(Context context, uint id);
+    
+    [CCode (
+        cheader_filename="gphoto2/gphoto2-file.h",
+        cprefix="GP_MIME_"
+    )]
+    namespace MIME {
+        public const string WAV;
+        public const string RAW;
+        public const string PNG;
+        public const string PGM;
+        public const string PPM;
+        public const string PNM;
+        public const string JPEG;
+        public const string TIFF;
+        public const string BMP;
+        public const string QUICKTIME;
+        public const string AVI;
+        public const string CRW;
+        public const string UNKNOWN;
+        public const string EXIF;
+        public const string MP3;
+        public const string OGG;
+        public const string WMA;
+        public const string ASF;
+        public const string MPEG;
+    }
+    
+    [SimpleType]
+    [CCode (
+        destroy_function="",
+        cheader_filename="gphoto2/gphoto2-port-info-list.h"
+    )]
+    public struct PortInfo {
+        [CCode (cname="gp_port_info_get_path")]
+        public int get_path(out unowned string path);
+        [CCode (cname="gp_port_info_set_path")]
+        public int set_path(string path);
+        [CCode (cname="gp_port_info_get_name")]
+        public int get_name(out unowned string name);
+        [CCode (cname="gp_port_info_set_name")]
+        public int set_name(string path);
+        [CCode (cname="gp_port_info_get_library_filename")]
+        public int get_library_filename(out unowned string lib);
+        [CCode (cname="gp_port_info_set_library_filename")]
+        public int set_library_filename(string lib);
+    }
+    
+    [Compact]
+    [CCode (
+        free_function="gp_port_info_list_free",
+        cheader_filename="gphoto2/gphoto2-port-info-list.h"
+    )]
+    public class PortInfoList {
+        [CCode (cname="gp_port_info_list_new")]
+        public static Result create(out PortInfoList list);
+        public Result load();
+        public int count();
+        public int lookup_name(string name);
+        public int lookup_path(string name);
+        public Result get_info(int index, out PortInfo info);
+    }
+    
+    [CCode (
+        cheader_filename="gphoto2/gphoto2-port-info-list.h",
+        cprefix="GP_PORT_"
+    )]
+    [Flags]
+    public enum PortType {
+        NONE,
+        SERIAL,
+        USB,
+        DISK,
+        PTPIP
+    }
+    
+    [CCode (
+        cname="int",
+        cheader_filename="gphoto2/gphoto2-result.h,gphoto2/gphoto2-port-result.h",
+        cprefix="GP_ERROR_"
+    )]
+    public enum Result {
+        [CCode (cname="GP_OK")]
+        OK,
+        [CCode (cname="GP_ERROR")]
+        ERROR,
+        BAD_PARAMETERS,
+        NO_MEMORY,
+        LIBRARY,
+        UNKNOWN_PORT,
+        NOT_SUPPORTED,
+        IO,
+        FIXED_LIMIT_EXCEEDED,
+        TIMEOUT,
+        IO_SUPPORTED_SERIAL,
+        IO_SUPPORTED_USB,
+        IO_INIT,
+        IO_READ,
+        IO_WRITE,
+        IO_UPDATE,
+        IO_SERIAL_SPEED,
+        IO_USB_CLEAR_HALT,
+        IO_USB_FIND,
+        IO_USB_CLAIM,
+        IO_LOCK,
+        HAL,
+        CORRUPTED_DATA,
+        FILE_EXISTS,
+        MODEL_NOT_FOUND,
+        DIRECTORY_NOT_FOUND,
+        FILE_NOT_FOUND,
+        DIRECTORY_EXISTS,
+        CAMERA_BUSY,
+        PATH_NOT_ABSOLUTE,
+        CANCEL,
+        CAMERA_ERROR,
+        OS_FAILURE;
+        
+        [CCode (cname="gp_port_result_as_string")]
+        public unowned string as_string();
+        
+        public string to_full_string() {
+            return "%s (%d)".printf(as_string(), this);
+        }
+    }
+    
+    [CCode (
+        cheader_filename="gphoto2/gphoto2-version.h",
+        cprefix="GP_VERSION"
+    )]
+    public enum VersionVerbosity {
+        SHORT,
+        VERBOSE
+    }
+    
+    public unowned string library_version(VersionVerbosity verbosity);
+}
+
diff --git a/vapi/libgphoto2.vapi b/vapi/libgphoto2.vapi
deleted file mode 100644
index 19e7ec2..0000000
--- a/vapi/libgphoto2.vapi
+++ /dev/null
@@ -1,487 +0,0 @@
-/* Copyright 2009-2012 Yorba Foundation
- *
- * This software is licensed under the GNU LGPL (version 2.1 or later).
- * See the COPYING file in this distribution. 
- */
-
-[CCode (
-    cprefix="GP",
-    lower_case_cprefix="gp_"
-)]
-namespace GPhoto {
-    [SimpleType]
-    [CCode (
-        cname="CameraAbilities",
-        destroy_function="",
-        cheader_filename="gphoto2/gphoto2-abilities-list.h"
-    )]
-    public struct CameraAbilities {
-        public string model;
-        public int status;
-        public PortType port;
-        public string 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_protocol;
-    }
-    
-    [Compact]
-    [CCode (
-        cname="CameraAbilitiesList",
-        cprefix="gp_abilities_list_",
-        free_function="gp_abilities_list_free",
-        cheader_filename="gphoto2/gphoto2-abilities-list.h"
-    )]
-    public class CameraAbilitiesList {
-        [CCode (cname="gp_abilities_list_new")]
-        public static Result create(out CameraAbilitiesList abilitiesList);
-        public Result load(Context context);
-        public Result reset();
-        public Result detect(PortInfoList portList, CameraList cameraList, Context context);
-        public int count();
-        public int lookup_model(string model);
-        public Result get_abilities(int index, out CameraAbilities abilities);
-    }
-    
-    [Compact]
-    [CCode (
-        cname="Camera",
-        ref_function="GPHOTO_REF_CAMERA",
-        unref_function="gp_camera_unref",
-        free_function="gp_camera_free",
-        cheader_filename="gphoto2/gphoto2-camera.h,gphoto.h"
-    )]
-    public class Camera {
-        [CCode (cname="gp_camera_new")]
-        public static Result create(out Camera camera);
-        public Result init(Context context);
-        public Result exit(Context context);
-        public Result get_port_info(out PortInfo info);
-        public Result set_port_info(PortInfo info);
-        public Result get_abilities(out CameraAbilities abilities);
-        public Result set_abilities(CameraAbilities abilities);
-        public Result get_storageinfo(CameraStorageInformation **sifs, out int count, Context context);
-        
-        // Folders
-        [CCode (cname="gp_camera_folder_list_folders")]
-        public Result list_folders(string folder, CameraList list, Context context);
-        [CCode (cname="gp_camera_folder_list_files")]
-        public Result list_files(string folder, CameraList list, Context context);
-        [CCode (cname="gp_camera_folder_delete_all")]
-        public Result delete_all_files(string folder, Context context);
-        [CCode (cname="gp_camera_folder_put_file")]
-        public Result put_file(string folder, CameraFile file, Context context);
-        [CCode (cname="gp_camera_folder_make_dir")]
-        public Result make_dir(string folder, string name, Context context);
-        [CCode (cname="gp_camera_folder_remove_dir")]
-        public Result remove_dir(string folder, string name, Context context);
-        
-        // Files
-        [CCode (cname="gp_camera_file_get_info")]
-        public Result get_file_info(string folder, string file, out CameraFileInfo info, Context context);
-        [CCode (cname="gp_camera_file_set_info")]
-        public Result set_file_info(string folder, string file, CameraFileInfo info, Context context);
-        [CCode (cname="gp_camera_file_get")]
-        public Result get_file(string folder, string filename, CameraFileType type, CameraFile file,
-            Context context);
-        [CCode (cname="gp_camera_file_delete")]
-        public Result delete_file(string folder, string filename, Context context);
-    }
-    
-    [Compact]
-    [CCode (
-        cname="CameraFile",
-        cprefix="gp_file_",
-        ref_function="GPHOTO_REF_FILE",
-        unref_function="gp_file_unref",
-        free_function="gp_file_free",
-        cheader_filename="gphoto2/gphoto2-file.h,gphoto.h"
-    )]
-    public class CameraFile {
-        [CCode (cname="gp_file_new")]
-        public static Result create(out CameraFile file);
-        public Result get_data_and_size(out uint8 *data, out ulong data_len);
-        public Result save(string filename);
-        public Result slurp(uint8[] data, out size_t readlen);
-    }
-    
-    [SimpleType]
-    [CCode (
-        cname="CameraFileInfo",
-        destroy_function="",
-        cheader_filename="gphoto2/gphoto2-filesys.h"
-    )]
-    public struct CameraFileInfo {
-        public CameraFileInfoPreview preview;
-        public CameraFileInfoFile file;
-        public CameraFileInfoAudio audio;
-    }
-    
-    [SimpleType]
-    [CCode (
-        cname="CameraFileInfoAudio",
-        cheader_filename="gphoto2/gphoto2-filesys.h"
-    )]
-    public struct CameraFileInfoAudio {
-    }
-    
-    [CCode (
-        cname="CameraFileInfoFields",
-        cheader_filename="gphoto2/gphoto2-filesys.h",
-        cprefix="GP_FILE_INFO_"
-    )]
-    [Flags]
-    public enum CameraFileInfoFields {
-        NONE,
-        TYPE,
-        NAME,
-        SIZE,
-        WIDTH,
-        HEIGHT,
-        PERMISSIONS,
-        STATUS,
-        MTIME,
-        ALL
-    }
-    
-    [SimpleType]
-    [CCode (
-        cname="CameraFileInfoFile",
-        cheader_filename="gphoto2/gphoto2-filesys.h"
-    )]
-    public struct CameraFileInfoFile {
-        public CameraFileInfoFields fields;
-        public CameraFileStatus status;
-        public ulong size;
-        public string type;
-        public uint width;
-        public uint height;
-        public string name;
-        public CameraFilePermissions permissions;
-        public time_t mtime;
-    }
-    
-    [SimpleType]
-    [CCode (
-        cname="CameraFileInfoPreview",
-        cheader_filename="gphoto2/gphoto2-filesys.h"
-    )]
-    public struct CameraFileInfoPreview {
-        public CameraFileInfoFields fields;
-        public CameraFileStatus status;
-        public ulong size;
-        public string type;
-        public uint width;
-        public uint height;
-        public string name;
-        public CameraFilePermissions permissions;
-        public time_t mtime;
-    }
-    
-    [CCode (
-        cname="CameraFileOperation",
-        cheader_filename="gphoto2/gphoto2-abilities-list.h",
-        cprefix="GP_FILE_OPERATION_"
-    )]
-    [Flags]
-    public enum CameraFileOperation {
-        NONE,
-        DELETE,
-        PREVIEW,
-        RAW,
-        AUDIO,
-        EXIF
-    }
-    
-    [CCode (
-        cname="CameraFilePermissions",
-        cheader_filename="gphoto2/gphoto2-filesys.h",
-        cprefix="GP_FILE_PERM_"
-    )]
-    [Flags]
-    public enum CameraFilePermissions {
-        NONE,
-        READ,
-        DELETE,
-        ALL
-    }
-    
-    [CCode (
-        cname="CameraFileStatus",
-        cheader_filename="gphoto2/gphoto2-filesys.h",
-        cprefix="GP_FILE_STATUS_"
-    )]
-    public enum CameraFileStatus {
-        NOT_DOWNLOADED,
-        DOWNLOADED
-    }
-    
-    [CCode (
-        cname="CameraFileType",
-        cheader_filename="gphoto2/gphoto2-file.h",
-        cprefix="GP_FILE_TYPE_"
-    )]
-    public enum CameraFileType {
-        PREVIEW,
-        NORMAL,
-        RAW,
-        AUDIO,
-        EXIF,
-        METADATA
-    }
-    
-    [CCode (
-        cname="CameraFolderOperation",
-        cheader_filename="gphoto2/gphoto2-abilities-list.h",
-        cprefix="GP_FOLDER_OPERATION_"
-    )]
-    [Flags]
-    public enum CameraFolderOperation {
-        NONE,
-        DELETE_ALL,
-        PUT_FILE,
-        MAKE_DIR,
-        REMOVE_DIR
-    }
-    
-    [Compact]
-    [CCode (
-        cname="CameraList",
-        cprefix="gp_list_",
-        ref_function="GPHOTO_REF_LIST",
-        unref_function="gp_list_unref",
-        free_function="gp_list_free",
-        cheader_filename="gphoto2/gphoto2-list.h,gphoto.h"
-    )]
-    public class CameraList {
-        [CCode (cname="gp_list_new")]
-        public static Result create(out CameraList list);
-        public int count();
-        public Result append(string name, string value);
-        public Result reset();
-        public Result sort();
-        public Result find_by_name(out int? index, string name);
-        public Result get_name(int index, out unowned string name);
-        public Result get_value(int index, out unowned string value);
-        public Result set_name(int index, string name);
-        public Result set_value(int index, string value);
-        public Result populate(string format, int count);
-    }
-    
-    [CCode (
-        cname="CameraOperation",
-        cheader_filename="gphoto2/gphoto2-abilities-list.h",
-        cprefix="GP_OPERATION_"
-    )]
-    [Flags]
-    public enum CameraOperation {
-        NONE,
-        CAPTURE_IMAGE,
-        CAPTURE_VIDEO,
-        CAPTURE_AUDIO,
-        CAPTURE_PREVIEW,
-        CONFIG
-    }
-    
-    [CCode (
-        cname="CameraStorageInfoFields",
-        cheader_filename="gphoto2/gphoto2-filesys.h",
-        cprefix="GP_STORAGEINFO_"
-    )]
-    [Flags]
-    public enum CameraStorageInfoFields {
-        BASE,
-        LABEL,
-        DESCRIPTION,
-        ACCESS,
-        STORAGETYPE,
-        FILESYSTEMTYPE,
-        MAXCAPACITY,
-        FREESPACEKBYTES,
-        FREESPACEIMAGES
-    }
-    
-    [SimpleType]
-    [CCode (
-        cname="CameraStorageInformation",
-        cheader_filename="gphoto2/gphoto2-filesys.h"
-    )]
-    public struct CameraStorageInformation {
-        public CameraStorageInfoFields fields;
-        public string basedir;
-        public string label;
-        public string description;
-        public int type;
-        public int fstype;
-        public int access;
-        public ulong capacitykbytes;
-        public ulong freekbytes;
-        public ulong freeimages;
-    }
-    
-    [Compact]
-    [CCode (
-        ref_function="GPHOTO_REF_CONTEXT",
-        unref_function="gp_context_unref",
-        cheader_filename="gphoto2/gphoto2-context.h,gphoto.h"
-    )]
-    public class Context {
-        [CCode (cname="gp_context_new")]
-        public Context();
-        public void set_idle_func(ContextIdleFunc func);
-        public void set_progress_funcs(
-            [CCode (delegate_target_pos=3.1)] ContextProgressStartFunc startFunc, 
-            [CCode (delegate_target_pos=3.1)] ContextProgressUpdateFunc updateFunc, 
-            [CCode (delegate_target_pos=3.1)] ContextProgressStopFunc stopFunc);
-        public void set_error_func([CCode (delegate_target_pos=3.1)] ContextErrorFunc errorFunc);
-        public void set_status_func([CCode (delegate_target_pos=3.1)] ContextStatusFunc statusFunc);
-        public void set_message_func([CCode (delegate_target_pos=3.1)] ContextMessageFunc messageFunc);
-    }
-    
-    public delegate void ContextIdleFunc(Context context);
-    
-    public delegate void ContextErrorFunc(Context context, string format, void *va_list);
-    
-    public delegate void ContextStatusFunc(Context context, string format, void *va_list);
-    
-    public delegate void ContextMessageFunc(Context context, string format, void *va_list);
-    
-    // TODO: Support for va_args in Vala, esp. for delegates?
-    public delegate uint ContextProgressStartFunc(Context context, float target, string format, void *va_list);
-    
-    public delegate void ContextProgressUpdateFunc(Context context, uint id, float current);
-    
-    public delegate void ContextProgressStopFunc(Context context, uint id);
-    
-    [CCode (
-        cheader_filename="gphoto2/gphoto2-file.h",
-        cprefix="GP_MIME_"
-    )]
-    namespace MIME {
-        public const string WAV;
-        public const string RAW;
-        public const string PNG;
-        public const string PGM;
-        public const string PPM;
-        public const string PNM;
-        public const string JPEG;
-        public const string TIFF;
-        public const string BMP;
-        public const string QUICKTIME;
-        public const string AVI;
-        public const string CRW;
-        public const string UNKNOWN;
-        public const string EXIF;
-        public const string MP3;
-        public const string OGG;
-        public const string WMA;
-        public const string ASF;
-        public const string MPEG;
-    }
-    
-    [SimpleType]
-    [CCode (
-        destroy_function="",
-        cheader_filename="gphoto2/gphoto2-port-info-list.h"
-    )]
-    public struct PortInfo {
-        public PortType type;
-        public string name;
-        public string path;
-        public string library_filename;
-    }
-    
-    [Compact]
-    [CCode (
-        free_function="gp_port_info_list_free",
-        cheader_filename="gphoto2/gphoto2-port-info-list.h"
-    )]
-    public class PortInfoList {
-        [CCode (cname="gp_port_info_list_new")]
-        public static Result create(out PortInfoList list);
-        public Result load();
-        public int count();
-        public int lookup_name(string name);
-        public int lookup_path(string name);
-        public Result get_info(int index, out PortInfo info);
-    }
-    
-    [CCode (
-        cheader_filename="gphoto2/gphoto2-port-info-list.h",
-        cprefix="GP_PORT_"
-    )]
-    [Flags]
-    public enum PortType {
-        NONE,
-        SERIAL,
-        USB,
-        DISK,
-        PTPIP
-    }
-    
-    [CCode (
-        cname="int",
-        cheader_filename="gphoto2/gphoto2-result.h,gphoto2/gphoto2-port-result.h",
-        cprefix="GP_ERROR_"
-    )]
-    public enum Result {
-        [CCode (cname="GP_OK")]
-        OK,
-        [CCode (cname="GP_ERROR")]
-        ERROR,
-        BAD_PARAMETERS,
-        NO_MEMORY,
-        LIBRARY,
-        UNKNOWN_PORT,
-        NOT_SUPPORTED,
-        IO,
-        FIXED_LIMIT_EXCEEDED,
-        TIMEOUT,
-        IO_SUPPORTED_SERIAL,
-        IO_SUPPORTED_USB,
-        IO_INIT,
-        IO_READ,
-        IO_WRITE,
-        IO_UPDATE,
-        IO_SERIAL_SPEED,
-        IO_USB_CLEAR_HALT,
-        IO_USB_FIND,
-        IO_USB_CLAIM,
-        IO_LOCK,
-        HAL,
-        CORRUPTED_DATA,
-        FILE_EXISTS,
-        MODEL_NOT_FOUND,
-        DIRECTORY_NOT_FOUND,
-        FILE_NOT_FOUND,
-        DIRECTORY_EXISTS,
-        CAMERA_BUSY,
-        PATH_NOT_ABSOLUTE,
-        CANCEL,
-        CAMERA_ERROR,
-        OS_FAILURE;
-        
-        [CCode (cname="gp_port_result_as_string")]
-        public unowned string as_string();
-        
-        public string to_full_string() {
-            return "%s (%d)".printf(as_string(), this);
-        }
-    }
-    
-    [CCode (
-        cheader_filename="gphoto2/gphoto2-version.h",
-        cprefix="GP_VERSION"
-    )]
-    public enum VersionVerbosity {
-        SHORT,
-        VERBOSE
-    }
-    
-    public unowned string library_version(VersionVerbosity verbosity);
-}
-
-- 
1.7.9.5

