diff options
-rw-r--r-- | libplanfahr/Makefile.am | 4 | ||||
-rw-r--r-- | libplanfahr/libplanfahr.sym | 1 | ||||
-rw-r--r-- | libplanfahr/lpf-trip.c | 26 | ||||
-rw-r--r-- | libplanfahr/lpf-trip.h | 12 |
4 files changed, 39 insertions, 4 deletions
diff --git a/libplanfahr/Makefile.am b/libplanfahr/Makefile.am index 82e8f43..12044fb 100644 --- a/libplanfahr/Makefile.am +++ b/libplanfahr/Makefile.am @@ -3,8 +3,8 @@ include $(top_srcdir)/flymake.mk SUBDIRS = providers tests EXTRA_DIST = libplanfahr.sym \ - lpf-enumtypes.c \ - lpf-enumtypes.h \ + lpf-enumtypes.c.template \ + lpf-enumtypes.h.template \ $(NULL) BUILT_SOURCES = \ diff --git a/libplanfahr/libplanfahr.sym b/libplanfahr/libplanfahr.sym index 1f16b11..dda8981 100644 --- a/libplanfahr/libplanfahr.sym +++ b/libplanfahr/libplanfahr.sym @@ -37,6 +37,7 @@ LIBPLANFAHR_0.0.0 { lpf_provider_error_get_type; lpf_provider_get_locs_flags_get_type; lpf_provider_get_trips_flags_get_type; + lpf_trip_status_flags_get_type; local: *; }; diff --git a/libplanfahr/lpf-trip.c b/libplanfahr/lpf-trip.c index 7e4bb3a..30a21f3 100644 --- a/libplanfahr/lpf-trip.c +++ b/libplanfahr/lpf-trip.c @@ -36,6 +36,7 @@ enum { LPF_TRIP_PROP_0 = 0, LPF_TRIP_PROP_PARTS, + LPF_TRIP_PROP_STATUS, }; /** @@ -53,6 +54,7 @@ G_DEFINE_TYPE (LpfTrip, lpf_trip, G_TYPE_OBJECT) typedef struct _LpfTripPrivate LpfTripPrivate; struct _LpfTripPrivate { GSList *parts; + LpfTripStatusFlags status; }; /** @@ -86,7 +88,9 @@ lpf_trip_set_property (GObject *object, case LPF_TRIP_PROP_PARTS: priv->parts = g_value_get_pointer(value); break; - + case LPF_TRIP_PROP_STATUS: + priv->status = g_value_get_flags (value); + break; default: /* We don't have any other property... */ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); @@ -107,7 +111,9 @@ lpf_trip_get_property (GObject *object, case LPF_TRIP_PROP_PARTS: g_value_set_pointer (value, priv->parts); break; - + case LPF_TRIP_PROP_STATUS: + g_value_set_flags (value, priv->status); + break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); break; @@ -162,6 +168,22 @@ lpf_trip_class_init (LpfTripClass *klass) "trip parts", "The parts of the trip", G_PARAM_CONSTRUCT | G_PARAM_READWRITE)); + +/** + * LpfTrip:status: (type GSList(LpfTripPart)) + * + * The status of this trip + */ + g_object_class_install_property (object_class, + LPF_TRIP_PROP_STATUS, + g_param_spec_flags ("status", + "trip status", + "The statusof the trip", + LPF_TYPE_TRIP_STATUS_FLAGS, + LPF_TRIP_STATUS_FLAGS_NONE, + G_PARAM_CONSTRUCT | + G_PARAM_READWRITE | + G_PARAM_STATIC_STRINGS)); } static void diff --git a/libplanfahr/lpf-trip.h b/libplanfahr/lpf-trip.h index fd2e0b4..01b90a1 100644 --- a/libplanfahr/lpf-trip.h +++ b/libplanfahr/lpf-trip.h @@ -31,6 +31,18 @@ G_BEGIN_DECLS +/** + * LpfTripStatusFlags: + * @LPF_TRIP_STATUS_FLAGS_NONE: No flags set. + * @LPF_TRIP_STATUS_FLAGS_CANCELED: Trip got canceled + * + * Flags used for the status of a #LpfTrip. + */ +typedef enum { + LPF_TRIP_STATUS_FLAGS_NONE = 0, + LPF_TRIP_STATUS_FLAGS_CANCELED = (1<<0), +} LpfTripStatusFlags; + #define LPF_TYPE_TRIP lpf_trip_get_type() #define LPF_TRIP(obj) \ |