diff options
author | Matthias Vogelgesang <matthias.vogelgesang@gmail.com> | 2012-07-05 09:08:56 +0200 |
---|---|---|
committer | Matthias Vogelgesang <matthias.vogelgesang@gmail.com> | 2012-07-06 14:45:38 +0200 |
commit | 9ab5d3dbed8b7f724c3c83de505ca2eb56b72d8a (patch) | |
tree | 273fa5905cb58d24f3d67c385b052aaad76afef4 /src/uca-camera.c | |
parent | 09e2477d822ee21a4a98bdee0eae24f487c8101b (diff) | |
download | libuca-9ab5d3dbed8b7f724c3c83de505ca2eb56b72d8a.tar.gz libuca-9ab5d3dbed8b7f724c3c83de505ca2eb56b72d8a.tar.bz2 libuca-9ab5d3dbed8b7f724c3c83de505ca2eb56b72d8a.tar.xz libuca-9ab5d3dbed8b7f724c3c83de505ca2eb56b72d8a.zip |
Fix UcaUfoCamera instantiation
Diffstat (limited to 'src/uca-camera.c')
-rw-r--r-- | src/uca-camera.c | 44 |
1 files changed, 30 insertions, 14 deletions
diff --git a/src/uca-camera.c b/src/uca-camera.c index 1bf4e75..b36cd3a 100644 --- a/src/uca-camera.c +++ b/src/uca-camera.c @@ -28,6 +28,10 @@ #include "cameras/uca-mock-camera.h" #endif +#ifdef HAVE_UFO_CAMERA +#include "cameras/uca-ufo-camera.h" +#endif + #ifdef HAVE_PHOTON_FOCUS #include "cameras/uca-pf-camera.h" #endif @@ -352,6 +356,31 @@ static void uca_camera_init(UcaCamera *camera) */ } +static UcaCamera *uca_camera_new_from_type(const gchar *type, GError **error) +{ +#ifdef HAVE_MOCK_CAMERA + if (!g_strcmp0(type, "mock")) + return UCA_CAMERA(uca_mock_camera_new(error)); +#endif + +#ifdef HAVE_PCO_CL + if (!g_strcmp0(type, "pco")) + return UCA_CAMERA(uca_pco_camera_new(error)); +#endif + +#ifdef HAVE_UFO_CAMERA + if (!g_strcmp0(type, "ufo")) + return UCA_CAMERA(uca_ufo_camera_new(error)); +#endif + +#ifdef HAVE_PHOTON_FOCUS + if (!g_strcmp0(type, "pf")) + return UCA_CAMERA(uca_pf_camera_new(error)); +#endif + + return NULL; +} + /** * uca_camera_get_types: * @@ -380,20 +409,7 @@ UcaCamera *uca_camera_new(const gchar *type, GError **error) UcaCamera *camera = NULL; GError *tmp_error = NULL; -#ifdef HAVE_MOCK_CAMERA - if (!g_strcmp0(type, "mock")) - camera = UCA_CAMERA(uca_mock_camera_new(&tmp_error)); -#endif - -#ifdef HAVE_PCO_CL - if (!g_strcmp0(type, "pco")) - camera = UCA_CAMERA(uca_pco_camera_new(&tmp_error)); -#endif - -#ifdef HAVE_PHOTON_FOCUS - if (!g_strcmp0(type, "pf")) - camera = UCA_CAMERA(uca_pf_camera_new(&tmp_error)); -#endif + camera = uca_camera_new_from_type(type, &tmp_error); if (tmp_error != NULL) { g_propagate_error(error, tmp_error); |