[gnome-control-center] fingerprint-manager: Add state for state updating
- From: Robert Ancell <rancell src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-control-center] fingerprint-manager: Add state for state updating
- Date: Fri, 26 Jun 2020 01:59:43 +0000 (UTC)
commit 840b906efe7eedc84e07ff3b672063b38fbb7b61
Author: Marco Trevisan (TreviƱo) <mail 3v1n0 net>
Date: Tue Apr 14 00:51:05 2020 +0200
fingerprint-manager: Add state for state updating
Add add an "updating" state to the fingerprint manager so that the UI can
adapt the widgets depending on it, as the dbus calls might be a bit slow at
times.
panels/user-accounts/cc-fingerprint-manager.c | 2 ++
panels/user-accounts/cc-fingerprint-manager.h | 2 ++
panels/user-accounts/cc-user-panel.c | 17 ++++++++++++++---
3 files changed, 18 insertions(+), 3 deletions(-)
---
diff --git a/panels/user-accounts/cc-fingerprint-manager.c b/panels/user-accounts/cc-fingerprint-manager.c
index 784ad1700..07a50e7b9 100644
--- a/panels/user-accounts/cc-fingerprint-manager.c
+++ b/panels/user-accounts/cc-fingerprint-manager.c
@@ -570,6 +570,8 @@ cc_fingerprint_manager_update_state (CcFingerprintManager *self,
g_task_set_source_tag (priv->current_task, cc_fingerprint_manager_update_state);
g_task_set_task_data (priv->current_task, data, g_free);
+ set_state (self, CC_FINGERPRINT_STATE_UPDATING);
+
cc_fingerprint_manager_get_devices (self, cancellable, on_manager_devices_list,
priv->current_task);
}
diff --git a/panels/user-accounts/cc-fingerprint-manager.h b/panels/user-accounts/cc-fingerprint-manager.h
index 20771ae6f..d12f52c1f 100644
--- a/panels/user-accounts/cc-fingerprint-manager.h
+++ b/panels/user-accounts/cc-fingerprint-manager.h
@@ -34,6 +34,7 @@ G_DECLARE_FINAL_TYPE (CcFingerprintManager, cc_fingerprint_manager, CC, FINGERPR
/**
* CcFingerprintManager:
* @CC_FINGERPRINT_STATE_NONE: Fingerprint recognition is not available
+ * @CC_FINGERPRINT_STATE_UPDATING: Fingerprint recognition is being fetched
* @CC_FINGERPRINT_STATE_ENABLED: Fingerprint recognition is enabled
* @CC_FINGERPRINT_STATE_DISABLED: Fingerprint recognition is disabled
*
@@ -41,6 +42,7 @@ G_DECLARE_FINAL_TYPE (CcFingerprintManager, cc_fingerprint_manager, CC, FINGERPR
*/
typedef enum {
CC_FINGERPRINT_STATE_NONE,
+ CC_FINGERPRINT_STATE_UPDATING,
CC_FINGERPRINT_STATE_ENABLED,
CC_FINGERPRINT_STATE_DISABLED,
} CcFingerprintState;
diff --git a/panels/user-accounts/cc-user-panel.c b/panels/user-accounts/cc-user-panel.c
index b52839e17..81ad6825f 100644
--- a/panels/user-accounts/cc-user-panel.c
+++ b/panels/user-accounts/cc-user-panel.c
@@ -852,8 +852,13 @@ update_fingerprint_row_state (CcUserPanel *self, GParamSpec *spec, CcFingerprint
{
CcFingerprintState state = cc_fingerprint_manager_get_state (fingerprint_manager);
- gtk_widget_set_visible (GTK_WIDGET (self->fingerprint_row),
- state != CC_FINGERPRINT_STATE_NONE);
+ if (state != CC_FINGERPRINT_STATE_UPDATING) {
+ gtk_widget_set_visible (GTK_WIDGET (self->fingerprint_row),
+ state != CC_FINGERPRINT_STATE_NONE);
+ }
+
+ gtk_widget_set_sensitive (GTK_WIDGET (self->fingerprint_row),
+ state != CC_FINGERPRINT_STATE_UPDATING);
if (state == CC_FINGERPRINT_STATE_ENABLED)
gtk_label_set_text (self->fingerprint_state_label, _("Enabled"));
@@ -1430,6 +1435,11 @@ on_permission_changed (CcUserPanel *self)
}
if (is_authorized || self_selected) {
+ CcFingerprintState fingerprint_state = CC_FINGERPRINT_STATE_NONE;
+
+ if (self->fingerprint_manager)
+ fingerprint_state = cc_fingerprint_manager_get_state (self->fingerprint_manager);
+
gtk_stack_set_visible_child (self->user_icon_stack, GTK_WIDGET (self->user_icon_button));
gtk_widget_set_sensitive (GTK_WIDGET (self->language_row), TRUE);
@@ -1438,7 +1448,8 @@ on_permission_changed (CcUserPanel *self)
gtk_widget_set_sensitive (GTK_WIDGET (self->password_row), TRUE);
remove_unlock_tooltip (GTK_WIDGET (self->password_row));
- gtk_widget_set_sensitive (GTK_WIDGET (self->fingerprint_row), TRUE);
+ gtk_widget_set_sensitive (GTK_WIDGET (self->fingerprint_row),
+ fingerprint_state != CC_FINGERPRINT_STATE_UPDATING);
remove_unlock_tooltip (GTK_WIDGET (self->fingerprint_row));
gtk_widget_set_sensitive (GTK_WIDGET (self->last_login_row), TRUE);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]