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;
12 public IdentityManagerApp () {
13 model = new IdentityManagerModel(this);
14 view = new IdentityManagerView(this);
20 private void init_ipc_server ()
22 // Errors will currently be sent via g_log - ie. to an
23 // obtrusive message box, on Windows
25 this.ipc_server = MoonshotServer.get_instance ();
26 MoonshotServer.start (this.view);
29 private void init_ipc_server ()
33 var conn = DBus.Bus.get (DBus.BusType.SESSION);
34 dynamic DBus.Object bus = conn.get_object ("org.freedesktop.DBus",
35 "/org/freedesktop/DBus",
36 "org.freedesktop.DBus");
38 // try to register service in session bus
39 uint reply = bus.request_name ("org.janet.Moonshot", (uint) 0);
40 assert (reply == DBus.RequestNameReply.PRIMARY_OWNER);
42 this.ipc_server = new MoonshotServer (this.view);
43 conn.register_object ("/org/janet/moonshot", ipc_server);
47 stderr.printf ("%s\n", e.message);
51 private void bus_acquired_cb (DBusConnection conn)
54 conn.register_object ("/org/janet/moonshot", ipc_server);
58 stderr.printf ("%s\n", e.message);
62 private void init_ipc_server ()
64 this.ipc_server = new MoonshotServer (this.view);
65 GLib.Bus.own_name (GLib.BusType.SESSION,
67 GLib.BusNameOwnerFlags.NONE,
71 error ("Couldn't own name %s on DBus.", name);
78 public static int main(string[] args){
82 // Force specific theme settings on Windows without requiring a gtkrc file
83 Gtk.Settings settings = Gtk.Settings.get_default ();
84 settings.set_string_property ("gtk-theme-name", "ms-windows", "moonshot");
85 settings.set_long_property ("gtk-menu-images", 0, "moonshot");
88 Intl.bindtextdomain (Config.GETTEXT_PACKAGE, Config.LOCALEDIR);
89 Intl.bind_textdomain_codeset (Config.GETTEXT_PACKAGE, "UTF-8");
90 Intl.textdomain (Config.GETTEXT_PACKAGE);
92 var app = new IdentityManagerApp();