3 class IdentityManagerApp : Window {
4 public IdentityManagerModel model;
5 private IdentityManagerView view;
6 private MoonshotServer ipc_server;
7 private const int WINDOW_WIDTH = 400;
8 private const int WINDOW_HEIGHT = 500;
10 public IdentityManagerApp () {
11 model = new IdentityManagerModel(this);
12 view = new IdentityManagerView(this);
19 private void init_ipc_server ()
21 // Errors will currently be sent via g_log - ie. to an
22 // obtrusive message box, on Windows
24 this.ipc_server = MoonshotServer.get_instance ();
25 MoonshotServer.start (this.view);
28 private void init_ipc_server ()
31 var conn = DBus.Bus.get (DBus.BusType.SESSION);
32 dynamic DBus.Object bus = conn.get_object ("org.freedesktop.DBus",
33 "/org/freedesktop/DBus",
34 "org.freedesktop.DBus");
36 // try to register service in session bus
37 uint reply = bus.request_name ("org.janet.Moonshot", (uint) 0);
38 assert (reply == DBus.RequestNameReply.PRIMARY_OWNER);
40 this.ipc_server = new MoonshotServer (this.view);
41 conn.register_object ("/org/janet/moonshot", ipc_server);
45 stderr.printf ("%s\n", e.message);
49 private void bus_acquired_cb (DBusConnection conn)
52 conn.register_object ("/org/janet/moonshot", ipc_server);
56 stderr.printf ("%s\n", e.message);
60 private void init_ipc_server ()
62 this.ipc_server = new MoonshotServer (this.view);
63 GLib.Bus.own_name (GLib.BusType.SESSION,
65 GLib.BusNameOwnerFlags.NONE,
69 error ("Couldn't own name %s on DBus.", name);
76 public static int main(string[] args){
80 // Force specific theme settings on Windows without requiring a gtkrc file
81 Gtk.Settings settings = Gtk.Settings.get_default ();
82 settings.set_string_property ("gtk-theme-name", "ms-windows", "moonshot");
83 settings.set_long_property ("gtk-menu-images", 0, "moonshot");
86 Intl.bindtextdomain (Config.GETTEXT_PACKAGE, Config.LOCALEDIR);
87 Intl.bind_textdomain_codeset (Config.GETTEXT_PACKAGE, "UTF-8");
88 Intl.textdomain (Config.GETTEXT_PACKAGE);
90 var app = new IdentityManagerApp();