summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Ancell <robert.ancell@canonical.com>2023-03-29 15:47:33 +1300
committerRobert Ancell <robert.ancell@canonical.com>2023-03-30 09:19:34 +1300
commitdd06bf7c117eef7acfa122da702bfa3d15911126 (patch)
tree28419bcfb00d2aba4d99c53cd03bef69ff15c99d
parent00e303998efe24df71362ba2d684e22737d7f12c (diff)
downloadgnome-control-center-dd06bf7c117eef7acfa122da702bfa3d15911126.tar.gz
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.
-rw-r--r--panels/datetime/cc-datetime-panel.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/panels/datetime/cc-datetime-panel.c b/panels/datetime/cc-datetime-panel.c
index cce2dc43a..6cd755fde 100644
--- a/panels/datetime/cc-datetime-panel.c
+++ b/panels/datetime/cc-datetime-panel.c
@@ -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 (self->network_time_switch, ntp_on);
+ gtk_switch_set_state (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,
@@ -908,7 +908,7 @@ cc_date_time_panel_init (CcDateTimePanel *self)
/* set up network time switch */
bind_switch_to_row (self,
self->network_time_switch,
- self->datetime_row);
+ GTK_WIDGET (self->datetime_row));
g_object_bind_property (self->dtm, "ntp",
self->network_time_switch, "active",
G_BINDING_DEFAULT | G_BINDING_SYNC_CREATE);