1 delegate void ReturnIdentityCallback (IdentityRequest request);
3 class IdentityRequest : Object {
4 public IdCard? id_card = null;
5 public bool complete = false;
7 private MainWindow main_window;
9 private string password;
10 private string certificate;
12 // Only one of these is used, we must support two types for
13 // the DBus and MSRPC servers.
14 ReturnIdentityCallback return_identity_cb = null;
15 SourceFunc source_func_cb = null;
17 public IdentityRequest (MainWindow main_window,
22 this.main_window = main_window;
24 this.password = password;
25 this.certificate = certificate;
28 public void set_return_identity_callback (owned ReturnIdentityCallback cb)
31 this.return_identity_cb = ((owned) cb);
33 this.return_identity_cb = ((IdCard) => cb (IdCard));
37 public void set_source_func_callback (owned SourceFunc cb)
40 this.source_func_cb = ((owned) cb);
42 this.source_func_cb = (() => cb ());
46 public bool execute () {
47 main_window.select_identity (this);
49 /* This function works as a GSourceFunc, so it can be passed to
50 * the main loop from other threads
55 public void return_identity (IdCard? id_card) {
56 this.id_card = id_card;
59 if (return_identity_cb != null)
60 return_identity_cb (this);
61 else if (source_func_cb != null)
68 /* For synchronisation between RPC thread and main loop. Because
69 * these objects are not refcounted, it's best to tie them to the
70 * lifecycle of the IdentityRequest object.