using Gee;
using Gtk;
+[DBus (name = "org.janet.Moonshot")]
+interface IIdentityManager : GLib.Object {
+ public abstract bool show_ui() throws IOError;
+}
public class IdentityManagerApp {
public IdentityManagerModel model;
public IdCard default_id_card;
public bool explicitly_launched;
- private IdentityManagerView view;
+ public IdentityManagerView view;
private MoonshotServer ipc_server;
#if OS_MACOS
bus_acquired_cb,
(conn, name) => {},
(conn, name) => {
- error ("Couldn't own name %s on DBus.", name);
+ bool shown=false;
+ try {
+ IIdentityManager manager = Bus.get_proxy_sync (BusType.SESSION, name, "/org/janet/moonshot");
+ shown = manager.show_ui();
+ } catch (IOError e) {
+ }
+ if (!shown) {
+ GLib.error ("Couldn't own name %s on dbus or show previously launched identity manager.", name);
+ } else {
+ stdout.printf("Showed previously launched identity manager.\n");
+ GLib.Process.exit(0);
+ }
});
}
#endif
this.parent_app = app;
}
+ public bool show_ui()
+ {
+ if (parent_app.view == null) {
+ return false;
+ }
+ parent_app.show();
+ parent_app.explicitly_launched = true;
+ return true;
+ }
+
public async bool get_identity (string nai,
string password,
string service,