4 class IdentityManagerApp : Window {
5 public IdentityManagerModel model;
6 private IdentityManagerView view;
7 private MoonshotServer ipc_server;
9 public OSXApplication osxApp;
11 private const int WINDOW_WIDTH = 400;
12 private const int WINDOW_HEIGHT = 500;
16 public IdentityManagerApp () {
17 model = new IdentityManagerModel(this);
18 view = new IdentityManagerView(this);
21 osxApp = OSXApplication.get_instance();
22 osxApp.ns_application_open_file.connect(ipc_server.install_from_file);
28 private void init_ipc_server ()
30 // Errors will currently be sent via g_log - ie. to an
31 // obtrusive message box, on Windows
33 this.ipc_server = MoonshotServer.get_instance ();
34 MoonshotServer.start (this.view);
37 private void init_ipc_server ()
41 var conn = DBus.Bus.get (DBus.BusType.SESSION);
42 dynamic DBus.Object bus = conn.get_object ("org.freedesktop.DBus",
43 "/org/freedesktop/DBus",
44 "org.freedesktop.DBus");
46 // try to register service in session bus
47 uint reply = bus.request_name ("org.janet.Moonshot", (uint) 0);
48 assert (reply == DBus.RequestNameReply.PRIMARY_OWNER);
50 this.ipc_server = new MoonshotServer (this.view);
51 conn.register_object ("/org/janet/moonshot", ipc_server);
55 stderr.printf ("%s\n", e.message);
59 private void bus_acquired_cb (DBusConnection conn)
62 conn.register_object ("/org/janet/moonshot", ipc_server);
66 stderr.printf ("%s\n", e.message);
70 private void init_ipc_server ()
72 this.ipc_server = new MoonshotServer (this.view);
73 GLib.Bus.own_name (GLib.BusType.SESSION,
75 GLib.BusNameOwnerFlags.NONE,
79 error ("Couldn't own name %s on DBus.", name);
86 public static int main(string[] args){
88 stdout.printf("Hello\n");
89 foreach (string arg in args)
90 stdout.printf("arg %s\n", arg);
93 // Force specific theme settings on Windows without requiring a gtkrc file
94 Gtk.Settings settings = Gtk.Settings.get_default ();
95 settings.set_string_property ("gtk-theme-name", "ms-windows", "moonshot");
96 settings.set_long_property ("gtk-menu-images", 0, "moonshot");
99 Intl.bindtextdomain (Config.GETTEXT_PACKAGE, Config.LOCALEDIR);
100 Intl.bind_textdomain_codeset (Config.GETTEXT_PACKAGE, "UTF-8");
101 Intl.textdomain (Config.GETTEXT_PACKAGE);
104 var app = new IdentityManagerApp();