From 182cac1ea35e95ed23de0605cca1c1abdc8d2fcb Mon Sep 17 00:00:00 2001 From: Debarshi Ray Date: Thu, 15 Dec 2016 19:08:47 +0100 Subject: [PATCH] online-accounts: Update the UI if IsLocked changes We want to check the IsLocked property whenever we call show_page_account. ie. when we show an account for the first time, and also when the displayed account emits account-changed. Hence it is better to have them together. https://bugzilla.gnome.org/show_bug.cgi?id=774222 --- panels/online-accounts/cc-online-accounts-panel.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/panels/online-accounts/cc-online-accounts-panel.c b/panels/online-accounts/cc-online-accounts-panel.c index 43fb55909..de6dcebd8 100644 --- a/panels/online-accounts/cc-online-accounts-panel.c +++ b/panels/online-accounts/cc-online-accounts-panel.c @@ -349,6 +349,7 @@ show_page_account (CcGoaPanel *panel, GList *l; GoaProvider *provider; GoaAccount *account; + gboolean is_locked; const gchar *provider_name; const gchar *provider_type; gchar *title; @@ -359,6 +360,9 @@ show_page_account (CcGoaPanel *panel, gtk_widget_set_sensitive (panel->accounts_tree_box, TRUE); gtk_widget_hide (panel->accounts_tree_label); + is_locked = goa_account_get_is_locked (goa_object_peek_account (object)); + gtk_widget_set_sensitive (panel->toolbar_remove_button, !is_locked); + /* Out with the old */ children = gtk_container_get_children (GTK_CONTAINER (panel->accounts_vbox)); for (l = children; l != NULL; l = l->next) @@ -431,14 +435,9 @@ on_listbox_selection_changed (CcGoaPanel *self, if (selected_row != NULL) { GoaObject *object; - gboolean is_locked; object = g_object_get_data (G_OBJECT (selected_row), "goa-object"); - is_locked = goa_account_get_is_locked (goa_object_peek_account (object)); - show_page_account (self, object); - - gtk_widget_set_sensitive (self->toolbar_remove_button, !is_locked); } else {