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.
This commit is contained in:
parent
d5f6d8e965
commit
840b906efe
3 changed files with 18 additions and 3 deletions
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue