1 /* This file is part of Beifahrer.
3 * Copyright (C) 2010 Philipp Zabel
5 * Beifahrer is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
10 * Beifahrer is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with Beifahrer. If not, see <http://www.gnu.org/licenses/>.
22 public class MyInformationWindow : StackableWindow {
34 private async void get_information () {
35 Hildon.gtk_window_set_progress_indicator (this, 1);
36 bool logged_in = yield adac.login_async ();
38 Banner.show_information (this, null, "Login failed.");
42 MyInformation my_info = yield adac.get_my_information ();
43 if (my_info != null) {
44 fields[FieldIndex.NAME].set_label (my_info.first_name + " " + my_info.last_name);
45 fields[FieldIndex.CELL].set_label (my_info.cell);
46 fields[FieldIndex.PHONE].set_label (my_info.phone1);
47 fields[FieldIndex.EMAIL].set_label (my_info.email1);
49 Hildon.gtk_window_set_progress_indicator (this, 0);
52 public MyInformationWindow (AdacMitfahrclub _adac) {
55 get_information.begin ();
58 const string[] labels = {
59 "Name", "Cell", "Phone", "E-mail", "Birthday"
63 set_title ("My information");
65 var menu = new AppMenu ();
66 var goto_website = new Gtk.Button.with_label (_("Show website"));
68 menu.append (goto_website);
71 var table = new Gtk.Table (5, 2, false);
73 fields = new Gtk.Label[5];
74 for (int i = 0; i < 5; i++) {
75 var label = new Gtk.Label (_(labels[i]));
76 label.set_alignment (0.0f, 0.0f);
77 Hildon.helper_set_logical_color (label, RcFlags.FG, StateType.NORMAL, "SecondaryTextColor");
78 table.attach (label, 0, 1, i, i+1, AttachOptions.FILL, AttachOptions.FILL, 0, 0);
80 fields[i] = new Gtk.Label ("");
81 fields[i].set_alignment (0.0f, 0.0f);
82 table.attach (fields[i], 1, 2, i, i+1, AttachOptions.FILL, AttachOptions.FILL, 0, 0);
88 goto_website.clicked.connect (on_goto_website_clicked);
91 void on_goto_website_clicked () {
92 BeifahrerProgram.open_browser (this, adac.get_my_information_url ());
97 // Date registered_since;
101 string street; string number;
102 string PLZ; string city;
114 string familienstand;
115 string language1; // list
121 bool newsletter_html;
135 // 2. parse https://mitfahrclub.adac.de/users/view