datetime: support new timedated CanNTP property
Set the NTP switch insensitive in the case that timedated has a CanNTP property and that property is set to false. https://bugzilla.gnome.org/show_bug.cgi?id=695253
This commit is contained in:
parent
2416068984
commit
8d813defb1
2 changed files with 31 additions and 1 deletions
|
@ -847,6 +847,30 @@ update_ntp_switch_from_system (CcDateTimePanel *self)
|
|||
g_signal_handlers_unblock_by_func (switch_widget, change_ntp, self);
|
||||
}
|
||||
|
||||
static void
|
||||
on_can_ntp_changed (CcDateTimePanel *self)
|
||||
{
|
||||
CcDateTimePanelPrivate *priv = self->priv;
|
||||
GtkWidget *switch_widget;
|
||||
gboolean sensitive = TRUE;
|
||||
GVariant *value;
|
||||
|
||||
switch_widget = W("network_time_switch");
|
||||
|
||||
/* We need to access this directly so that we can default to TRUE if
|
||||
* it is not set.
|
||||
*/
|
||||
value = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (self->priv->dtm), "CanNTP");
|
||||
if (value)
|
||||
{
|
||||
if (g_variant_is_of_type (value, G_VARIANT_TYPE_BOOLEAN))
|
||||
sensitive = g_variant_get_boolean (value);
|
||||
g_variant_unref (value);
|
||||
}
|
||||
|
||||
gtk_widget_set_sensitive (switch_widget, sensitive);
|
||||
}
|
||||
|
||||
static void
|
||||
on_ntp_changed (CcDateTimePanel *self)
|
||||
{
|
||||
|
@ -990,7 +1014,10 @@ cc_date_time_panel_init (CcDateTimePanel *self)
|
|||
|
||||
/* set up network time button */
|
||||
if (priv->dtm != NULL)
|
||||
update_ntp_switch_from_system (self);
|
||||
{
|
||||
update_ntp_switch_from_system (self);
|
||||
on_can_ntp_changed (self);
|
||||
}
|
||||
g_signal_connect (W("network_time_switch"), "notify::active",
|
||||
G_CALLBACK (change_ntp), self);
|
||||
|
||||
|
@ -1119,6 +1146,8 @@ cc_date_time_panel_init (CcDateTimePanel *self)
|
|||
G_CALLBACK (on_timedated_properties_changed), self);
|
||||
g_signal_connect_swapped (priv->dtm, "notify::ntp",
|
||||
G_CALLBACK (on_ntp_changed), self);
|
||||
g_signal_connect_swapped (priv->dtm, "notify::can-ntp",
|
||||
G_CALLBACK (on_can_ntp_changed), self);
|
||||
g_signal_connect_swapped (priv->dtm, "notify::timezone",
|
||||
G_CALLBACK (on_timezone_changed), self);
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
<interface name="org.freedesktop.timedate1">
|
||||
<property name="Timezone" type="s" access="read"/>
|
||||
<property name="LocalRTC" type="b" access="read"/>
|
||||
<property name="CanNTP" type="b" access="read"/>
|
||||
<property name="NTP" type="b" access="read"/>
|
||||
<method name="SetTime">
|
||||
<arg name="usec_utc" type="x" direction="in"/>
|
||||
|
|
Loading…
Add table
Reference in a new issue