From 580dae2183e27ccec00f127b85188df143f49c54 Mon Sep 17 00:00:00 2001 From: Matthias Vogelgesang Date: Tue, 12 Jun 2012 10:21:55 +0200 Subject: Generate enum types from source It became a little unwieldy to create the enum types manually via g_enums_register_static(). This changeset creates the types from enum definitions in public headers using glib2-mkenum. Be sure to include uca-enums.h in every source file that needs to know GObject enum type. --- src/cameras/uca-pco-camera.c | 59 +++++++++++--------------------------------- src/cameras/uca-pco-camera.h | 4 --- 2 files changed, 14 insertions(+), 49 deletions(-) (limited to 'src/cameras') diff --git a/src/cameras/uca-pco-camera.c b/src/cameras/uca-pco-camera.c index bba69c2..d12083f 100644 --- a/src/cameras/uca-pco-camera.c +++ b/src/cameras/uca-pco-camera.c @@ -24,6 +24,7 @@ #include #include "uca-camera.h" #include "uca-pco-camera.h" +#include "uca-enums.h" #define FG_TRY_PARAM(fg, camobj, param, val_addr, port) \ { int r = Fg_setParameter(fg, param, val_addr, port); \ @@ -57,6 +58,19 @@ G_DEFINE_TYPE(UcaPcoCamera, uca_pco_camera, UCA_TYPE_CAMERA) #define TIMEBASE_INVALID 0xDEAD +/** + * UcaPcoCameraRecordMode: + * @UCA_PCO_CAMERA_RECORD_MODE_SEQUENCE: Store all frames and stop if necessary + * @UCA_PCO_CAMERA_RECORD_MODE_RING_BUFFER: Store frames in ring-buffer fashion + * and overwrite if necessary + */ + +/** + * UcaPcoCameraAcquireMode: + * @UCA_PCO_CAMERA_ACQUIRE_MODE_AUTO: Take all images + * @UCA_PCO_CAMERA_ACQUIRE_MODE_EXTERNAL: Use signal + */ + /** * UcaPcoCameraError: * @UCA_PCO_CAMERA_ERROR_LIBPCO_INIT: Initializing libpco failed @@ -156,51 +170,6 @@ struct _UcaPcoCameraPrivate { guint current_image; }; -/** - * UcaPcoCameraRecordMode: - * @UCA_PCO_CAMERA_RECORD_MODE_SEQUENCE: Store all frames and stop if necessary - * @UCA_PCO_CAMERA_RECORD_MODE_RING_BUFFER: Store frames in ring-buffer fashion - * and overwrite if necessary - */ -static GType uca_pco_camera_record_mode_get_type(void) -{ - static GType record_mode_type = 0; - - if (!record_mode_type) { - static GEnumValue record_modes[] = { - { UCA_PCO_CAMERA_RECORD_MODE_SEQUENCE, "Store frames in a ring buffer", "ring-buffer" }, - { UCA_PCO_CAMERA_RECORD_MODE_RING_BUFFER, "Store frames in a sequence", "sequence" }, - { 0, NULL, NULL } - }; - - record_mode_type = g_enum_register_static("UcaPcoCameraRecordMode", record_modes); - } - - return record_mode_type; -} - -/** - * UcaPcoCameraAcquireMode: - * @UCA_PCO_CAMERA_ACQUIRE_MODE_AUTO: Take all images - * @UCA_PCO_CAMERA_ACQUIRE_MODE_EXTERNAL: Use signal - */ -static GType uca_pco_camera_acquire_mode_get_type(void) -{ - static GType acquire_mode_type = 0; - - if (!acquire_mode_type) { - static GEnumValue acquire_modes[] = { - { UCA_PCO_CAMERA_ACQUIRE_MODE_AUTO, "Take all images", "auto" }, - { UCA_PCO_CAMERA_ACQUIRE_MODE_EXTERNAL, "Use signal", "external" }, - { 0, NULL, NULL } - }; - - acquire_mode_type = g_enum_register_static("UcaPcoCameraAcquireMode", acquire_modes); - } - - return acquire_mode_type; -} - static pco_cl_map_entry pco_cl_map[] = { { CAMERATYPE_PCO_EDGE, "libFullAreaGray8.so", FG_CL_8BIT_FULL_10, FG_GRAY, 30.0f, FALSE }, { CAMERATYPE_PCO4000, "libDualAreaGray16.so", FG_CL_SINGLETAP_16_BIT, FG_GRAY16, 5.0f, TRUE }, diff --git a/src/cameras/uca-pco-camera.h b/src/cameras/uca-pco-camera.h index 243fac4..d2892b2 100644 --- a/src/cameras/uca-pco-camera.h +++ b/src/cameras/uca-pco-camera.h @@ -42,15 +42,11 @@ typedef struct _UcaPcoCamera UcaPcoCamera; typedef struct _UcaPcoCameraClass UcaPcoCameraClass; typedef struct _UcaPcoCameraPrivate UcaPcoCameraPrivate; -#define UCA_TYPE_PCO_CAMERA_RECORD_MODE (uca_pco_camera_record_mode_get_type()) - typedef enum { UCA_PCO_CAMERA_RECORD_MODE_SEQUENCE, UCA_PCO_CAMERA_RECORD_MODE_RING_BUFFER, } UcaPcoCameraRecordMode; -#define UCA_TYPE_PCO_CAMERA_ACQUIRE_MODE (uca_pco_camera_acquire_mode_get_type()) - typedef enum { UCA_PCO_CAMERA_ACQUIRE_MODE_AUTO, UCA_PCO_CAMERA_ACQUIRE_MODE_EXTERNAL -- cgit v1.2.3