X-Git-Url: http://www.project-moonshot.org/gitweb/?a=blobdiff_plain;f=src%2Fmoonshot-identity-manager-app.vala;h=2897e0deff5a5908f09d2ece816c7caf0f444e99;hb=5496446012d9ebeb04e894067e5708d7ea4c2881;hp=7b4389d28f270bf6c00578e0a8487b1228a5b847;hpb=a8f03b7aab24af9a73d6d6e8ceadd2f78a310693;p=moonshot-ui.git diff --git a/src/moonshot-identity-manager-app.vala b/src/moonshot-identity-manager-app.vala index 7b4389d..2897e0d 100644 --- a/src/moonshot-identity-manager-app.vala +++ b/src/moonshot-identity-manager-app.vala @@ -1,12 +1,16 @@ 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 @@ -252,7 +256,18 @@ public class IdentityManagerApp { 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