thunderbolt: Decouple active and state properties usage
The ability to tweak the state property was mainly introduced in order to implement delayed state change via the state-set signal. Since GTK 4.9.3[1] the active and state properties are no more interchangeable. [1] https://gitlab.gnome.org/GNOME/gtk/-/merge_requests/5442
This commit is contained in:
parent
6c125accc3
commit
19c5d9d4fc
1 changed files with 14 additions and 4 deletions
|
@ -481,7 +481,7 @@ cc_bolt_panel_authmode_sync (CcBoltPanel *panel)
|
||||||
|
|
||||||
g_signal_handlers_block_by_func (panel->authmode_switch, on_authmode_state_set_cb, panel);
|
g_signal_handlers_block_by_func (panel->authmode_switch, on_authmode_state_set_cb, panel);
|
||||||
|
|
||||||
gtk_switch_set_state (panel->authmode_switch, enabled);
|
gtk_switch_set_active (panel->authmode_switch, enabled);
|
||||||
|
|
||||||
g_signal_handlers_unblock_by_func (panel->authmode_switch, on_authmode_state_set_cb, panel);
|
g_signal_handlers_unblock_by_func (panel->authmode_switch, on_authmode_state_set_cb, panel);
|
||||||
|
|
||||||
|
@ -666,11 +666,22 @@ on_authmode_ready (GObject *source_object,
|
||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
g_autoptr(GError) error = NULL;
|
g_autoptr(GError) error = NULL;
|
||||||
|
BoltClient *client = BOLT_CLIENT (source_object);
|
||||||
CcBoltPanel *panel;
|
CcBoltPanel *panel;
|
||||||
gboolean ok;
|
gboolean ok;
|
||||||
|
|
||||||
ok = bolt_client_set_authmode_finish (BOLT_CLIENT (source_object), res, &error);
|
ok = bolt_client_set_authmode_finish (client, res, &error);
|
||||||
if (!ok)
|
if (ok)
|
||||||
|
{
|
||||||
|
BoltAuthMode mode;
|
||||||
|
gboolean enabled;
|
||||||
|
|
||||||
|
panel = CC_BOLT_PANEL (user_data);
|
||||||
|
mode = bolt_client_get_authmode (client);
|
||||||
|
enabled = (mode & BOLT_AUTH_ENABLED) != 0;
|
||||||
|
gtk_switch_set_state (panel->authmode_switch, enabled);
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
g_autofree char *text = NULL;
|
g_autofree char *text = NULL;
|
||||||
|
|
||||||
|
@ -688,7 +699,6 @@ on_authmode_ready (GObject *source_object,
|
||||||
cc_bolt_panel_authmode_sync (panel);
|
cc_bolt_panel_authmode_sync (panel);
|
||||||
}
|
}
|
||||||
|
|
||||||
panel = CC_BOLT_PANEL (user_data);
|
|
||||||
gtk_spinner_stop (panel->authmode_spinner);
|
gtk_spinner_stop (panel->authmode_spinner);
|
||||||
gtk_widget_set_sensitive (GTK_WIDGET (panel->authmode_switch), TRUE);
|
gtk_widget_set_sensitive (GTK_WIDGET (panel->authmode_switch), TRUE);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue