for (int days = 0; days <= 4; days += 1)
tolerance_selector.append_text (_("+/- %d days").printf (days));
- var table = new Table (4, 2, false);
+ var table = new Table (5, 2, false);
var button = new PickerButton (SizeType.FINGER_HEIGHT,
ButtonArrangement.VERTICAL);
button.set_alignment (0.0f, 0.0f, 0.5f, 0.5f);
table.attach (button, 1, 2, 1, 2, AttachOptions.FILL, AttachOptions.FILL, 0, 0);
+ var switch_button = new Gtk.Button.with_label (_("Switch departure and arrival"));
+ Hildon.gtk_widget_set_theme_size (switch_button, SizeType.FINGER_HEIGHT);
+ switch_button.set_alignment (0.0f, 0.5f);
+ table.attach (switch_button, 0, 1, 2, 3, AttachOptions.FILL, AttachOptions.FILL, 0, 0);
+
date = new DateButton (SizeType.FINGER_HEIGHT,
ButtonArrangement.VERTICAL);
date.set_alignment (0.0f, 0.0f, 0.5f, 0.5f);
- table.attach (date, 0, 1, 2, 3, AttachOptions.FILL | AttachOptions.EXPAND, AttachOptions.FILL, 0, 0);
+ table.attach (date, 0, 1, 3, 4, AttachOptions.FILL | AttachOptions.EXPAND, AttachOptions.FILL, 0, 0);
button = new PickerButton (SizeType.FINGER_HEIGHT,
ButtonArrangement.VERTICAL);
button.set_title (_("Tolerance"));
button.set_value (_("+/- 0 days"));
button.set_alignment (0.0f, 0.0f, 0.5f, 0.5f);
- table.attach (button, 1, 2, 2, 3, AttachOptions.FILL, AttachOptions.FILL, 0, 0);
+ table.attach (button, 1, 2, 3, 4, AttachOptions.FILL, AttachOptions.FILL, 0, 0);
var search_button = new Gtk.Button.with_label (_("Search"));
Hildon.gtk_widget_set_theme_size (search_button, SizeType.FINGER_HEIGHT);
- table.attach (search_button, 0, 2, 3, 4, AttachOptions.FILL, AttachOptions.FILL, 0, 0);
+ table.attach (search_button, 0, 2, 4, 5, AttachOptions.FILL, AttachOptions.FILL, 0, 0);
add (table);
+ switch_button.clicked.connect (on_switch_button_clicked);
search_button.clicked.connect (on_search_button_clicked);
settings.clicked.connect (on_settings_clicked);
window.find_lifts.begin (city_from, city_to, date, tolerance);
}
+ // Switch departure and arrival
+ void on_switch_button_clicked () {
+ int n = city_from_selector.get_active (0);
+ city_from_selector.set_active (0, city_to_selector.get_active (0));
+ city_to_selector.set_active (0, n);
+ n = umkreis_from_selector.get_active (0);
+ umkreis_from_selector.set_active (0, umkreis_to_selector.get_active (0));
+ umkreis_to_selector.set_active (0, n);
+ }
+
void on_settings_clicked () {
var dialog = new SettingsDialog (this);
dialog.response.connect (on_settings_response);