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/>.
21 public class BeifahrerProgram : Hildon.Program {
22 private const string BEIFAHRER_SERVICE = "org.maemo.beifahrer";
23 private const string BROWSER_SERVICE = "com.nokia.osso_browser";
24 private const string BROWSER_PATH = "/com/nokia/osso_browser";
25 private const string BROWSER_IF = "com.nokia.osso_browser";
28 public static Orientation orientation;
31 Environment.set_application_name ("Beifahrer");
33 window = new QueryWindow ();
34 window.destroy.connect (Gtk.main_quit);
36 orientation = new Orientation ();
37 orientation.changed.connect (on_orientation_changed);
42 private void on_orientation_changed () {
43 if (orientation.portrait) {
44 Hildon.gtk_window_set_portrait_flags (window, PortraitFlags.REQUEST);
46 Hildon.gtk_window_set_portrait_flags (window, PortraitFlags.SUPPORT);
50 public static void open_browser (Gtk.Window window, string url) {
52 var conn = DBus.Bus.get (DBus.BusType.SESSION);
54 dynamic DBus.Object browser = conn.get_object (BROWSER_SERVICE, BROWSER_PATH, BROWSER_IF);
55 browser.open_new_window (url, false);
57 Banner.show_information (window, null, _("Failed to open browser."));
61 static int main (string[] args) {
64 Intl.setlocale (LocaleCategory.ALL, "");
65 Intl.bindtextdomain (Config.GETTEXT_PACKAGE, Config.LOCALEDIR);
66 Intl.textdomain (Config.GETTEXT_PACKAGE);
68 var osso_context = new Osso.Context (BEIFAHRER_SERVICE, Config.VERSION, true, null);
69 if (osso_context == null) {
70 return Osso.Status.ERROR;
73 var app = new BeifahrerProgram ();