diff options
author | Matthias Vogelgesang <matthias.vogelgesang@gmail.com> | 2012-06-12 10:21:55 +0200 |
---|---|---|
committer | Matthias Vogelgesang <matthias.vogelgesang@gmail.com> | 2012-06-12 10:21:55 +0200 |
commit | 580dae2183e27ccec00f127b85188df143f49c54 (patch) | |
tree | 35e43a1587a8b624218006e2e41d73c28dd1b160 /src/uca-camera.c | |
parent | 733da14c66d347bb2ae452766a36bf3c1381cacd (diff) | |
download | uca-580dae2183e27ccec00f127b85188df143f49c54.tar.gz uca-580dae2183e27ccec00f127b85188df143f49c54.tar.bz2 uca-580dae2183e27ccec00f127b85188df143f49c54.tar.xz uca-580dae2183e27ccec00f127b85188df143f49c54.zip |
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.
Diffstat (limited to 'src/uca-camera.c')
-rw-r--r-- | src/uca-camera.c | 34 |
1 files changed, 9 insertions, 25 deletions
diff --git a/src/uca-camera.c b/src/uca-camera.c index fcb2ab7..5844eef 100644 --- a/src/uca-camera.c +++ b/src/uca-camera.c @@ -18,6 +18,7 @@ #include <glib.h> #include "config.h" #include "uca-camera.h" +#include "uca-enums.h" #ifdef HAVE_PCO_CL #include "cameras/uca-pco-camera.h" @@ -36,6 +37,14 @@ G_DEFINE_TYPE(UcaCamera, uca_camera, G_TYPE_OBJECT) /** + * UcaCameraTrigger: + * @UCA_CAMERA_TRIGGER_AUTO: Trigger automatically + * @UCA_CAMERA_TRIGGER_EXTERNAL: Trigger from an external source + * @UCA_CAMERA_TRIGGER_INTERNAL: Trigger internally from software using + * #uca_camera_trigger + */ + +/** * UcaCameraError: * @UCA_CAMERA_ERROR_NOT_FOUND: Camera type is unknown * @UCA_CAMERA_ERROR_RECORDING: Camera is already recording @@ -103,31 +112,6 @@ struct _UcaCameraPrivate { gboolean transfer_async; }; -/** - * UcaCameraTrigger: - * @UCA_CAMERA_TRIGGER_AUTO: Trigger automatically - * @UCA_CAMERA_TRIGGER_EXTERNAL: Trigger from an external source - * @UCA_CAMERA_TRIGGER_INTERNAL: Trigger internally from software using - * #uca_camera_trigger - */ -static GType uca_camera_trigger_get_type(void) -{ - static GType camera_trigger_type = 0; - - if (!camera_trigger_type) { - static GEnumValue trigger_types[] = { - { UCA_CAMERA_TRIGGER_AUTO, "Automatic internal camera trigger", "auto" }, - { UCA_CAMERA_TRIGGER_EXTERNAL, "External trigger", "external" }, - { UCA_CAMERA_TRIGGER_INTERNAL, "Internal software trigger", "internal" }, - { 0, NULL, NULL } - }; - - camera_trigger_type = g_enum_register_static("UcaCameraTrigger", trigger_types); - } - - return camera_trigger_type; -} - static void uca_camera_set_property(GObject *object, guint property_id, const GValue *value, GParamSpec *pspec) { UcaCameraPrivate *priv = UCA_CAMERA_GET_PRIVATE(object); |