datetime: Fix NTP switch getting out of sync.
The state needs to be set to the state that was requested before the D-Bus call. The existing code used the state received from D-Bus, which will be the previous state.
This commit is contained in:
parent
c262359ef3
commit
03fcffdd94
1 changed files with 4 additions and 4 deletions
|
@ -103,6 +103,8 @@ struct _CcDateTimePanel
|
|||
Timedate1 *dtm;
|
||||
GCancellable *cancellable;
|
||||
|
||||
gboolean pending_ntp_state;
|
||||
|
||||
GPermission *permission;
|
||||
GPermission *tz_permission;
|
||||
GSettings *location_settings;
|
||||
|
@ -303,10 +305,7 @@ set_using_ntp_cb (GObject *source,
|
|||
}
|
||||
else
|
||||
{
|
||||
gboolean ntp_on;
|
||||
|
||||
g_object_get (self->dtm, "ntp", &ntp_on, NULL);
|
||||
gtk_switch_set_state (GTK_SWITCH (self->network_time_switch), ntp_on);
|
||||
gtk_switch_set_state (GTK_SWITCH (self->network_time_switch), self->pending_ntp_state);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -331,6 +330,7 @@ static void
|
|||
queue_set_ntp (CcDateTimePanel *self,
|
||||
gboolean using_ntp)
|
||||
{
|
||||
self->pending_ntp_state = using_ntp;
|
||||
timedate1_call_set_ntp (self->dtm,
|
||||
using_ntp,
|
||||
TRUE,
|
||||
|
|
Loading…
Add table
Reference in a new issue