[gnome-shell] gdmUtil: factor out some duplicated code in beginVerification
- From: Ray Strode <halfline src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell] gdmUtil: factor out some duplicated code in beginVerification
- Date: Mon, 19 Aug 2013 01:40:02 +0000 (UTC)
commit fd11ad95f61b904d6f7014f8d56c1c27d88af65c
Author: Ray Strode <rstrode redhat com>
Date: Fri Aug 16 10:29:26 2013 -0400
gdmUtil: factor out some duplicated code in beginVerification
The duplication makes the function look a lot more complicated
than it actually is.
This commit moves the common code to a new _startService function.
https://bugzilla.gnome.org/show_bug.cgi?id=683437
js/gdm/util.js | 73 ++++++++++++++++---------------------------------------
1 files changed, 21 insertions(+), 52 deletions(-)
---
diff --git a/js/gdm/util.js b/js/gdm/util.js
index f41b2b2..acab471 100644
--- a/js/gdm/util.js
+++ b/js/gdm/util.js
@@ -317,61 +317,30 @@ const ShellUserVerifier = new Lang.Class({
this._defaultService = PASSWORD_SERVICE_NAME;
},
- _beginVerification: function() {
+ _startService: function(serviceName) {
this._hold.acquire();
+ this._userVerifier.call_begin_verification_for_user(serviceName,
+ this._userName,
+ this._cancellable,
+ Lang.bind(this, function(obj, result) {
+ try {
+ obj.call_begin_verification_for_user_finish(result);
+ } catch(e if e.matches(Gio.IOErrorEnum, Gio.IOErrorEnum.CANCELLED)) {
+ return;
+ } catch(e) {
+ this._reportInitError('Failed to start verification for user', e);
+ return;
+ }
- if (this._userName) {
- this._userVerifier.call_begin_verification_for_user(this._getForegroundService(),
- this._userName,
- this._cancellable,
- Lang.bind(this, function(obj, result) {
- try {
- obj.call_begin_verification_for_user_finish(result);
- } catch(e if e.matches(Gio.IOErrorEnum, Gio.IOErrorEnum.CANCELLED)) {
- return;
- } catch(e) {
- this._reportInitError('Failed to start verification for user', e);
- return;
- }
-
- this._hold.release();
- }));
+ this._hold.release();
+ }));
+ },
- if (this._haveFingerprintReader) {
- this._hold.acquire();
-
- this._userVerifier.call_begin_verification_for_user(FINGERPRINT_SERVICE_NAME,
- this._userName,
- this._cancellable,
- Lang.bind(this, function(obj, result) {
- try {
- obj.call_begin_verification_for_user_finish(result);
- } catch(e if e.matches(Gio.IOErrorEnum, Gio.IOErrorEnum.CANCELLED)) {
- return;
- } catch(e) {
- this._reportInitError('Failed to start fingerprint verification for user', e);
- return;
- }
-
- this._hold.release();
- }));
- }
- } else {
- this._userVerifier.call_begin_verification(this._getForegroundService(),
- this._cancellable,
- Lang.bind(this, function(obj, result) {
- try {
- obj.call_begin_verification_finish(result);
- } catch(e if e.matches(Gio.IOErrorEnum, Gio.IOErrorEnum.CANCELLED)) {
- return;
- } catch(e) {
- this._reportInitError('Failed to start verification', e);
- return;
- }
-
- this._hold.release();
- }));
- }
+ _beginVerification: function() {
+ this._startService(this._getForegroundService());
+
+ if (this._userName && this._haveFingerprintReader)
+ this._startService(FINGERPRINT_SERVICE_NAME);
},
_onInfo: function(client, serviceName, info) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]