using GLib; using Gtk; using DBus; using Osso; BrowserProxyServer server; [DBus (name = "com.nokia.osso_browser")] public class BrowserProxyServer : GLib.Object { [DBus (visible = false)] public void OpenAddress(string uri) { uri.printf(); Process.spawn_async( null, ("/usr/bin/dbus-send --session --type=method_call --print-reply --dest=com.nokia.tear "+ "/com/nokia/tear com.nokia.Tear.OpenAddress string:"+uri).split(" "), null, 0, null, null ); } public int load_url(string uri) { warning( "load_url" ); this.OpenAddress( uri ); return 1; } public int open_new_window(string uri) { warning( "open_new_window" ); return this.load_url( uri ); } } public class BrowserProxy : GLib.Object { construct { var connection = DBus.Bus.get( BusType.SESSION ); dynamic DBus.Object bus = connection.get_object ("org.freedesktop.DBus", "/org/freedesktop/DBus", "org.freedesktop.DBus"); uint request_name_result = bus.request_name ("com.nokia.osso_browser", (uint) 0); if (request_name_result == DBus.RequestNameReply.PRIMARY_OWNER) connection.register_object ("/com/nokia/osso_browser", server); } static int main (string[] args) { Osso.Context ctx; Gtk.init (ref args); ctx = new Osso.Context("BrowserProxy", "0.1", false, null); if (ctx.display_state_on() != Osso.Status.OK) warning("Osso Initialization failed."); server = new BrowserProxyServer(); var pbrowser = new BrowserProxy(); Gtk.main(); return 0; } }