Debian packaging: 0.0.4-1
[beifahrer] / src / beifahrer.vala
index 80aaace..4b23715 100644 (file)
 using Hildon;
 
 public class BeifahrerProgram : Hildon.Program {
-       public const string BEIFAHRER_SERVICE = "org.maemo.beifahrer";
+       private const string BEIFAHRER_SERVICE = "org.maemo.beifahrer";
+       private const string BROWSER_SERVICE = "com.nokia.osso_browser";
+       private const string BROWSER_PATH = "/com/nokia/osso_browser";
+       private const string BROWSER_IF = "com.nokia.osso_browser";
 
        QueryWindow window;
        public static Orientation orientation;
@@ -44,6 +47,17 @@ public class BeifahrerProgram : Hildon.Program {
                }
        }
 
+       public static void open_browser (Gtk.Window window, string url) {
+               try {
+                       var conn = DBus.Bus.get (DBus.BusType.SESSION);
+
+                       dynamic DBus.Object browser = conn.get_object (BROWSER_SERVICE, BROWSER_PATH, BROWSER_IF);
+                       browser.open_new_window (url, false);
+               } catch (Error e) {
+                       Banner.show_information (window, null, _("Failed to open browser."));
+               }
+       }
+
        static int main (string[] args) {
                Gtk.init (ref args);
 
@@ -51,10 +65,6 @@ public class BeifahrerProgram : Hildon.Program {
                Intl.bindtextdomain (Config.GETTEXT_PACKAGE, Config.LOCALEDIR);
                Intl.textdomain (Config.GETTEXT_PACKAGE);
 
-               var result = Curl.global_init (Curl.GLOBAL_DEFAULT);
-               if (result != Curl.Code.OK)
-                       return 1;
-
                var osso_context = new Osso.Context (BEIFAHRER_SERVICE, Config.VERSION, true, null);
                if (osso_context == null) {
                        return Osso.Status.ERROR;
@@ -64,8 +74,6 @@ public class BeifahrerProgram : Hildon.Program {
 
                Gtk.main ();
 
-               Curl.global_cleanup ();
-
                return 0;
        }
 }