aboutsummaryrefslogtreecommitdiff
path: root/libplanfahr/lpf-trip.c
diff options
context:
space:
mode:
authorGuido Günther <agx@sigxcpu.org>2015-05-07 09:12:22 +0200
committerGuido Günther <agx@sigxcpu.org>2015-05-07 09:47:12 +0200
commitff4b3279432b8f0facda456c15a6b2ba597c6909 (patch)
treedbf427e66639b3b58115fc16ac48153cd2df807e /libplanfahr/lpf-trip.c
parent6dc49293225cf01f1663b6c7387c283057b3c30a (diff)
Introduce status flags for each trip
This can be used to e.g. indicate cancelled trips
Diffstat (limited to 'libplanfahr/lpf-trip.c')
-rw-r--r--libplanfahr/lpf-trip.c26
1 files changed, 24 insertions, 2 deletions
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