From dc3dd87cdaf9592dad9af8ef0ecbc7beae2d345e Mon Sep 17 00:00:00 2001 From: Guido Günther Date: Thu, 9 Oct 2014 12:45:38 +0200 Subject: Add geters for LpfTripPart and LpfTrip properties --- libplanfahr/libplanfahr.sym | 4 +++ libplanfahr/lpf-trip-part.c | 57 +++++++++++++++++++++++++++++++++++++- libplanfahr/lpf-trip-part.h | 4 +++ libplanfahr/lpf-trip.c | 18 ++++++++++++ libplanfahr/lpf-trip.h | 2 ++ libplanfahr/providers/hafas-bin6.c | 3 +- 6 files changed, 86 insertions(+), 2 deletions(-) (limited to 'libplanfahr') diff --git a/libplanfahr/libplanfahr.sym b/libplanfahr/libplanfahr.sym index 419eb86..0e7b5bf 100644 --- a/libplanfahr/libplanfahr.sym +++ b/libplanfahr/libplanfahr.sym @@ -26,8 +26,12 @@ LIBPLANFAHR_0.0.0 { lpf_stop_get_type; /* LpfTrip */ lpf_trip_get_type; + lpf_trip_get_parts; /* LpfTripPart */ lpf_trip_part_get_type; + lpf_trip_part_get_end; + lpf_trip_part_get_start; + lpf_trip_part_get_stops; local: *; }; diff --git a/libplanfahr/lpf-trip-part.c b/libplanfahr/lpf-trip-part.c index 6fbc8ff..09ed920 100644 --- a/libplanfahr/lpf-trip-part.c +++ b/libplanfahr/lpf-trip-part.c @@ -28,8 +28,8 @@ #include #include -#include "lpf-trip-part.h" #include "lpf-stop.h" +#include "lpf-trip-part.h" #include "lpf-priv.h" enum { @@ -60,6 +60,61 @@ struct _LpfTripPartPrivate { GSList *stops; }; + +/** + * lpf_trip_part_get_end + * @self: A #LpfTripPart + * + * Returns the end location of this trip part. + * + * Returns: (transfer full): The end of a #LpfTripPart. + **/ +LpfStop* +lpf_trip_part_get_end(LpfTripPart *self) +{ + LpfStop *end; + + g_object_get(self, "end", &end, NULL); + return end; +} + + +/** + * lpf_trip_part_get_start + * @self: A #LpfTripPart + * + * Returns the start of this trip part. + * + * Returns: (transfer full): The start of a #LpfTripPart. + **/ +LpfStop* +lpf_trip_part_get_start(LpfTripPart *self) +{ + LpfStop *start; + + g_object_get(self, "start", &start, NULL); + return start; +} + + +/** + * lpf_trip_part_get_stops + * @self: A #LpfTripPart + * + * Returns the stops of the the trip part. + * + * Returns: (transfer none) (element-type LpfStop): The stops of a #LpfTripPart. + **/ +GSList* +lpf_trip_part_get_stops(LpfTripPart *self) +{ + GSList *stops; + + g_object_get(self, "stops", &stops, NULL); + return stops; +} + + static void lpf_trip_part_set_property (GObject *object, guint property_id, diff --git a/libplanfahr/lpf-trip-part.h b/libplanfahr/lpf-trip-part.h index 57be140..1f9a59e 100644 --- a/libplanfahr/lpf-trip-part.h +++ b/libplanfahr/lpf-trip-part.h @@ -58,6 +58,10 @@ typedef struct { GType lpf_trip_part_get_type (void); +LpfStop* lpf_trip_part_get_start(LpfTripPart *self); +LpfStop* lpf_trip_part_get_end(LpfTripPart *self); +GSList* lpf_trip_part_get_stops(LpfTripPart *self); + G_END_DECLS #endif /* _LPF_TRIP_PART_H */ diff --git a/libplanfahr/lpf-trip.c b/libplanfahr/lpf-trip.c index 8be284c..a6146a9 100644 --- a/libplanfahr/lpf-trip.c +++ b/libplanfahr/lpf-trip.c @@ -54,6 +54,24 @@ struct _LpfTripPrivate { GSList *parts; }; +/** + * lpf_trip_get_parts: + * @self: A #LpfTrip + * + * Returns the individual parts of the trip. + * + * Returns: (transfer none) (element-type LpfTripPart): The parts of the trip. + **/ +GSList* +lpf_trip_get_parts(LpfTrip *self) +{ + GSList *parts; + + g_object_get(self, "parts", &parts, NULL); + return parts; +} + + static void lpf_trip_set_property (GObject *object, guint property_id, diff --git a/libplanfahr/lpf-trip.h b/libplanfahr/lpf-trip.h index 3f2af42..fd2e0b4 100644 --- a/libplanfahr/lpf-trip.h +++ b/libplanfahr/lpf-trip.h @@ -58,6 +58,8 @@ typedef struct { GType lpf_trip_get_type (void); +GSList* lpf_trip_get_parts(LpfTrip *self); + G_END_DECLS #endif /* _LPF_TRIP_H */ diff --git a/libplanfahr/providers/hafas-bin6.c b/libplanfahr/providers/hafas-bin6.c index fc059aa..fc193bf 100644 --- a/libplanfahr/providers/hafas-bin6.c +++ b/libplanfahr/providers/hafas-bin6.c @@ -33,8 +33,9 @@ #include "lpf-priv.h" #include "lpf-provider.h" #include "lpf-trip.h" -#include "lpf-trip-part.h" #include "lpf-stop.h" +#include "lpf-trip-part.h" + static void lpf_provider_hafas_bin6_interface_init (LpfProviderInterface *iface); -- cgit v1.2.3