private void setup_list_model()
{
- this.listmodel = new Gtk.ListStore (Columns.N_COLUMNS, typeof(IdCard),
- typeof(Gdk.Pixbuf),
- typeof(string),
- typeof(string),
- typeof(string));
+ this.listmodel = new Gtk.ListStore(Columns.N_COLUMNS, typeof(IdCard),
+ typeof(Gdk.Pixbuf),
+ typeof(string),
+ typeof(string),
+ typeof(string));
this.filter = new TreeModelFilter(listmodel, null);
filter.set_visible_func(visible_func);
public void send_identity_cb(IdCard id)
{
IdCard identity = id;
- return_if_fail (request_queue.length > 0);
+ return_if_fail(request_queue.length > 0);
candidates = null;
var request = this.request_queue.pop_head();
public bool explicitly_launched;
public IdentityManagerView view;
private MoonshotServer ipc_server;
+ private bool name_is_owned;
+ private bool show_requested;
#if OS_MACOS
public OSXApplication osxApp;
private const int WINDOW_WIDTH = 400;
private const int WINDOW_HEIGHT = 500;
+
+
+ /** If we're successfully registered with DBus, then show the UI. Otherwise, wait until we're registered. */
public void show() {
- if (view != null) view.make_visible();
+ if (name_is_owned) {
+ if (view != null) {
+ view.make_visible();
+ }
+ }
+ else {
+ show_requested = true;
+ }
}
public IdentityManagerApp(bool headless, bool use_flat_file_store) {
}
public void select_identity(IdentityRequest request) {
+
IdCard identity = null;
if (request.select_default)
private void init_ipc_server() {
this.ipc_server = new MoonshotServer(this);
+ bool shown = false;
GLib.Bus.own_name(GLib.BusType.SESSION,
"org.janet.Moonshot",
GLib.BusNameOwnerFlags.NONE,
bus_acquired_cb,
- (conn, name) => {},
+
+ // Name acquired callback:
(conn, name) => {
- bool shown = false;
+
+ name_is_owned = true;
+
+ // Now that we know that we own the name, it's safe to show the UI.
+ if (show_requested) {
+ show();
+ show_requested = false;
+ }
+ shown = true;
+ },
+
+ // Name lost callback:
+ (conn, name) => {
+
+ // This callback usually means that another moonshot is already running.
+ // But it *might* mean that we lost the name for some other reason
+ // (though it's unclear to me yet what those reasons are.)
+ // Clearing these flags seems like a good idea for that case. -- dbreslau
+ name_is_owned = false;
+ show_requested = false;
+
try {
- IIdentityManager manager = Bus.get_proxy_sync(BusType.SESSION, name, "/org/janet/moonshot");
- shown = manager.show_ui();
+ if (!shown) {
+ IIdentityManager manager = Bus.get_proxy_sync(BusType.SESSION, name, "/org/janet/moonshot");
+ shown = manager.show_ui();
+ }
} catch (IOError e) {
}
if (!shown) {
if ((id_card != null) && (id_card.display_name != IdCard.NO_IDENTITY)) {
nai_out = id_card.nai;
- if ((request.password!=null) && (request.password != ""))
+ if ((request.password != null) && (request.password != ""))
password_out = request.password;
else
password_out = id_card.password;
return false;
}
- public bool install_id_card (string display_name,
- string user_name,
- string ?password,
- string ?realm,
- string[] ?rules_patterns,
- string[] ?rules_always_confirm,
- string[] ?services,
- string ?ca_cert,
- string ?subject,
- string ?subject_alt,
- string ?server_cert,
- int force_flat_file_store)
+ public bool install_id_card(string display_name,
+ string user_name,
+ string ?password,
+ string ?realm,
+ string[] ?rules_patterns,
+ string[] ?rules_always_confirm,
+ string[] ?services,
+ string ?ca_cert,
+ string ?subject,
+ string ?subject_alt,
+ string ?server_cert,
+ int force_flat_file_store)
{
IdCard idcard = new IdCard();