Respect the date tolerance setting
authorPhilipp Zabel <philipp.zabel@gmail.com>
Sat, 24 Apr 2010 18:36:23 +0000 (20:36 +0200)
committerPhilipp Zabel <philipp.zabel@gmail.com>
Sun, 25 Apr 2010 08:46:59 +0000 (10:46 +0200)
src/adac-mitfahrclub.vala
src/lift-list-window.vala
src/query-window.vala

index c3d585f..2d080e0 100644 (file)
@@ -230,7 +230,7 @@ public class AdacMitfahrclub {
                return result;
        }
 
-       public List<Lift>? get_lift_list (string city_from, string city_to, Date date) {
+       public List<Lift>? get_lift_list (string city_from, string city_to, Date date, int tolerance = 0) {
                if (city_list == null)
                        get_city_list ();
 
@@ -256,8 +256,6 @@ public class AdacMitfahrclub {
                        num_to
                );
 
-               int tolerance = 0;
-
                url += "&date=date&day=%d&month=%d&year=%d&tolerance=%d&smoking=&avg_speed=&".printf (
                        date.get_day (),
                        date.get_month (),
index ead447a..8ba1e6f 100644 (file)
@@ -99,10 +99,10 @@ public class LiftListWindow : StackableWindow {
                BeifahrerProgram.orientation.changed.connect (this.on_orientation_changed);
        }
 
-       public void find_lifts (string city_from, string city_to, Date date) {
+       public void find_lifts (string city_from, string city_to, Date date, int tolerance = 0) {
                set_title ("%s - %s".printf (city_from, city_to));
 
-               var lift_list = adac.get_lift_list (city_from, city_to, date);
+               var lift_list = adac.get_lift_list (city_from, city_to, date, tolerance);
                foreach (Lift lift in lift_list) {
                        TreeIter iter;
                        string icon_name = null;
index b71acf1..ddb15c5 100644 (file)
@@ -237,10 +237,12 @@ public class QueryWindow : StackableWindow {
                date.set_month ((DateMonth) (month + DateMonth.JANUARY));
                date.set_year ((DateYear) year);
 
+               int tolerance = tolerance_selector.get_active (0);
+
                Hildon.gtk_window_set_progress_indicator (this, 1);
                var window = new LiftListWindow (adac);
                window.show_all ();
-               window.find_lifts (city_from, city_to, date);
+               window.find_lifts (city_from, city_to, date, tolerance);
                Hildon.gtk_window_set_progress_indicator (this, 0);
        }