[gnome-control-center/benzea/fix-timezone-update] datetime: Allow changing the timezone when auto-update is prohibited



commit 8d9affbd6a8c3b5d71118f0c67f11b6cfaafe6f1
Author: Benjamin Berg <bberg redhat com>
Date:   Wed Sep 11 18:39:54 2019 +0200

    datetime: Allow changing the timezone when auto-update is prohibited
    
    When the user disables the use of location services in the privacy
    panel, then the timezone will never be updated automatically. Automatic
    timezone may still be enabled though, so we need to allow the user to
    change the timezone when location services are disabled or when
    automatic timezone updating is disabled.

 panels/datetime/cc-datetime-panel.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
---
diff --git a/panels/datetime/cc-datetime-panel.c b/panels/datetime/cc-datetime-panel.c
index cb7ddf5f1..082328deb 100644
--- a/panels/datetime/cc-datetime-panel.c
+++ b/panels/datetime/cc-datetime-panel.c
@@ -738,7 +738,7 @@ on_permission_changed (CcDateTimePanel *self)
   gtk_widget_set_sensitive (self->auto_datetime_row, allowed);
   gtk_widget_set_sensitive (self->auto_timezone_row, location_allowed && (allowed || tz_allowed));
   gtk_widget_set_sensitive (self->datetime_button, allowed && !using_ntp);
-  gtk_widget_set_sensitive (self->timezone_button, (allowed || tz_allowed) && !auto_timezone);
+  gtk_widget_set_sensitive (self->timezone_button, (allowed || tz_allowed) && (!auto_timezone || 
!location_allowed));
 
   /* Hide the subdialogs if we no longer have permissions */
   if (!allowed)
@@ -842,12 +842,14 @@ tz_switch_to_row_transform_func (GBinding        *binding,
 {
   gboolean active;
   gboolean allowed;
+  gboolean location_allowed;
 
   active = g_value_get_boolean (source_value);
   allowed = (self->permission != NULL && g_permission_get_allowed (self->permission)) ||
             (self->tz_permission != NULL && g_permission_get_allowed (self->tz_permission));
+  location_allowed = g_settings_get_boolean (self->location_settings, LOCATION_ENABLED);
 
-  g_value_set_boolean (target_value, !active && allowed);
+  g_value_set_boolean (target_value, allowed && (!active || !location_allowed));
 
   return TRUE;
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]