diff options
-rw-r--r-- | src/tripview.ui | 10 | ||||
-rw-r--r-- | src/uplanfahrtripview.c | 18 |
2 files changed, 26 insertions, 2 deletions
diff --git a/src/tripview.ui b/src/tripview.ui index 69a7b6d..9ad0a11 100644 --- a/src/tripview.ui +++ b/src/tripview.ui @@ -22,6 +22,10 @@ <column type="gchararray"/> <!-- column-name arrival_delay_color --> <column type="gchararray"/> + <!-- column-name status --> + <column type="gchararray"/> + <!-- column-name strikethrough --> + <column type="gboolean"/> </columns> </object> <template class="UPlanFahrTripView" parent="GtkTreeView"> @@ -41,6 +45,7 @@ <object class="GtkCellRendererText" id="cr_departure_time"/> <attributes> <attribute name="markup">2</attribute> + <attribute name="strikethrough">10</attribute> </attributes> </child> </object> @@ -66,6 +71,7 @@ <object class="GtkCellRendererText" id="cr_arrival_time"/> <attributes> <attribute name="markup">3</attribute> + <attribute name="strikethrough">10</attribute> </attributes> </child> </object> @@ -91,6 +97,7 @@ <object class="GtkCellRendererText" id="cr_switches"/> <attributes> <attribute name="markup">4</attribute> + <attribute name="strikethrough">10</attribute> </attributes> </child> </object> @@ -102,6 +109,9 @@ <property name="reorderable">True</property> <child> <object class="GtkCellRendererPixbuf" id="cr_status"/> + <attributes> + <attribute name="icon-name">9</attribute> + </attributes> </child> </object> </child> diff --git a/src/uplanfahrtripview.c b/src/uplanfahrtripview.c index a24b04d..715724c 100644 --- a/src/uplanfahrtripview.c +++ b/src/uplanfahrtripview.c @@ -14,6 +14,8 @@ #define COL_ARRIVAL_DELAY 6 #define COL_DEPARTURE_DELAY_COLOR 7 #define COL_ARRIVAL_DELAY_COLOR 8 +#define COL_STATUS_ICON 9 +#define COL_STRIKETHROUGH 10 struct _UPlanFahrTripView { @@ -96,15 +98,17 @@ u_plan_fahr_trip_view_store_trips (UPlanFahrTripView *self, GSList *trips) LpfStop *start, *end; GDateTime *arrival, *departure, *rt_departure, *rt_arrival; gchar *deptime, *arrtime, *dep_delay, *arr_delay; - const gchar *dep_delay_color = NULL, *arr_delay_color = NULL; + const gchar *dep_delay_color = NULL, *arr_delay_color = NULL, *icon = NULL; gint ddelay, adelay; + LpfTripStatusFlags flags; + gboolean strikethrough; priv = u_plan_fahr_trip_view_get_instance_private (U_PLAN_FAHR_TRIP_VIEW (self)); gtk_list_store_clear (priv->liststore); for (trip = trips; trip; trip = g_slist_next (trip)) { tripobj = trip->data; - g_object_get(tripobj, "parts", &parts, NULL); + g_object_get(tripobj, "parts", &parts, "status", &flags, NULL); firstpart = LPF_TRIP_PART(parts->data); lastpart = LPF_TRIP_PART(g_slist_last (parts)->data); @@ -128,6 +132,14 @@ u_plan_fahr_trip_view_store_trips (UPlanFahrTripView *self, GSList *trips) dep_delay = delay_str (rt_departure, ddelay, &dep_delay_color); arr_delay = delay_str (rt_arrival, adelay, &arr_delay_color); + if (flags & LPF_TRIP_STATUS_FLAGS_CANCELED) { + icon = "gtk-cancel"; + strikethrough = TRUE; + } else { + icon = NULL; + strikethrough = FALSE; + } + gtk_list_store_append (priv->liststore, &iter); gtk_list_store_set (priv->liststore, &iter, COL_START, start, @@ -139,6 +151,8 @@ u_plan_fahr_trip_view_store_trips (UPlanFahrTripView *self, GSList *trips) COL_ARRIVAL_DELAY, arr_delay, COL_DEPARTURE_DELAY_COLOR, dep_delay_color, COL_ARRIVAL_DELAY_COLOR, arr_delay_color, + COL_STATUS_ICON, icon, + COL_STRIKETHROUGH, strikethrough, -1); g_date_time_unref (departure); |