Switch downloads to be done asynchronously, use libsoup-2.4 instead of libcurl
[beifahrer] / src / beifahrer.vala
1 /* This file is part of Beifahrer.
2  *
3  * Copyright (C) 2010 Philipp Zabel
4  *
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.
9  *
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.
14  *
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/>.
17  */
18
19 using Hildon;
20
21 public class BeifahrerProgram : Hildon.Program {
22         public const string BEIFAHRER_SERVICE = "org.maemo.beifahrer";
23
24         QueryWindow window;
25         public static Orientation orientation;
26
27         construct {
28                 Environment.set_application_name ("Beifahrer");
29
30                 window = new QueryWindow ();
31                 window.destroy.connect (Gtk.main_quit);
32
33                 orientation = new Orientation ();
34                 orientation.changed.connect (on_orientation_changed);
35
36                 add_window (window);
37         }
38
39         private void on_orientation_changed () {
40                 if (orientation.portrait) {
41                         Hildon.gtk_window_set_portrait_flags (window, PortraitFlags.REQUEST);
42                 } else {
43                         Hildon.gtk_window_set_portrait_flags (window, PortraitFlags.SUPPORT);
44                 }
45         }
46
47         static int main (string[] args) {
48                 Gtk.init (ref args);
49
50                 Intl.setlocale (LocaleCategory.ALL, "");
51                 Intl.bindtextdomain (Config.GETTEXT_PACKAGE, Config.LOCALEDIR);
52                 Intl.textdomain (Config.GETTEXT_PACKAGE);
53
54                 var osso_context = new Osso.Context (BEIFAHRER_SERVICE, Config.VERSION, true, null);
55                 if (osso_context == null) {
56                         return Osso.Status.ERROR;
57                 }
58
59                 var app = new BeifahrerProgram ();
60
61                 Gtk.main ();
62
63                 return 0;
64         }
65 }
66