X-Git-Url: http://www.project-moonshot.org/gitweb/?a=blobdiff_plain;f=src%2Fmoonshot-identity-request.vala;h=8d0b24e73bb738c03c05d56b0453bf530c1fbf74;hb=c64066e0fd6838caafba7cac51b00ea2980a717e;hp=cc436ac4a16f6396d9d0792daa7c77aa6291a9bb;hpb=a080b6cf5e60ae41590887d5a01356e00536fb65;p=moonshot-ui.git diff --git a/src/moonshot-identity-request.vala b/src/moonshot-identity-request.vala index cc436ac..8d0b24e 100644 --- a/src/moonshot-identity-request.vala +++ b/src/moonshot-identity-request.vala @@ -1,4 +1,35 @@ -public delegate void ReturnIdentityCallback (IdentityRequest request); +/* + * Copyright (c) 2011-2014, JANET(UK) + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of JANET(UK) nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. +*/ +public delegate void ReturnIdentityCallback(IdentityRequest request); public class IdentityRequest : Object { public IdCard? id_card = null; @@ -13,10 +44,10 @@ public class IdentityRequest : Object { ReturnIdentityCallback callback = null; - public IdentityRequest (IdentityManagerApp app, - string nai, - string password, - string service) + public IdentityRequest(IdentityManagerApp app, + string nai, + string password, + string service) { this.parent_app = app; this.nai = nai; @@ -24,23 +55,23 @@ public class IdentityRequest : Object { this.service = service; } - public IdentityRequest.default (IdentityManagerApp app) + public IdentityRequest.default(IdentityManagerApp app) { this.parent_app = app; this.select_default = true; } - public void set_callback (owned ReturnIdentityCallback cb) + public void set_callback(owned ReturnIdentityCallback cb) { -#if VALA_0_12 - this.callback = ((owned) cb); -#else - this.callback = ((IdCard) => cb (IdCard)); -#endif + #if VALA_0_12 + this.callback = ((owned) cb); + #else + this.callback = ((IdCard) => cb(IdCard)); + #endif } - public bool execute () { - parent_app.select_identity (this); + public bool execute() { + parent_app.select_identity(this); /* This function works as a GSourceFunc, so it can be passed to * the main loop from other threads @@ -48,7 +79,7 @@ public class IdentityRequest : Object { return false; } - public void return_identity (IdCard? id_card) { + public void return_identity(IdCard? id_card) { this.id_card = id_card; this.complete = true; @@ -72,12 +103,12 @@ public class IdentityRequest : Object { services[id_card.services.length] = this.service; id_card.services = services; - this.id_card = this.parent_app.model.update_card (id_card); + this.id_card = this.parent_app.model.update_card(id_card); } } return_if_fail (callback != null); - callback (this); + callback(this); } #if OS_WIN32