[gnome-initial-setup/wip/pwithnall/misc-fixes: 49/70] timezone: Hide when automatically detected




commit 6f35cd04769c7c0397b3830b8e7b993760815ddc
Author: Joaquim Rocha <jrocha endlessm com>
Date:   Tue Jul 31 15:53:18 2018 +0200

    timezone: Hide when automatically detected
    
    In downstream Endless, the timezone page shouldn't be shown if a timezone
    has been automatically detected.
    Talking to the GNOME Design team, this behavior would also be desirable
    but unfortunately it is not clear yet whether a detected timezone will
    be correct in every territory.
    
    The argument for skipping the page if location has been detected in some
    Endless images is that this makes the FBE process nicer enough to risk
    sometimes silently selecting the wrong timezone. If we believe this for
    some users, without any data about how often the wrong timezone is
    selected, then we should apply this behaviour for all systems.
    
    https://phabricator.endlessm.com/T23631

 .../pages/timezone/gis-timezone-page.c                | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)
---
diff --git a/gnome-initial-setup/pages/timezone/gis-timezone-page.c 
b/gnome-initial-setup/pages/timezone/gis-timezone-page.c
index ddebfd5c..ba7683ce 100644
--- a/gnome-initial-setup/pages/timezone/gis-timezone-page.c
+++ b/gnome-initial-setup/pages/timezone/gis-timezone-page.c
@@ -77,6 +77,8 @@ struct _GisTimezonePagePrivate
   GSettings *clock_settings;
   gboolean in_search;
 
+  gboolean show_if_detected;
+
   gulong search_entry_text_changed_id;
 };
 typedef struct _GisTimezonePagePrivate GisTimezonePagePrivate;
@@ -138,6 +140,11 @@ set_location (GisTimezonePage  *page,
 
       cc_timezone_map_set_timezone (CC_TIMEZONE_MAP (priv->map), tzid);
 
+      /* If the page hasn't yet been shown and we found the timezone
+       * automatically, then don't show the page */
+      if (!priv->show_if_detected)
+        gtk_widget_hide (GTK_WIDGET (page));
+
       /* If this location is manually set, stop waiting for geolocation. */
       if (!priv->in_geoclue_callback)
         stop_geolocation (page);
@@ -476,6 +483,17 @@ gis_timezone_page_locale_changed (GisPage *page)
   gis_page_set_title (GIS_PAGE (page), _("Time Zone"));
 }
 
+static void
+gis_timezone_page_shown (GisPage *page)
+{
+  GisTimezonePage *tz_page = GIS_TIMEZONE_PAGE (page);
+  GisTimezonePagePrivate *priv = gis_timezone_page_get_instance_private (tz_page);
+
+  /* After the page has been shown already, don't hide it even if the location
+   * is detected */
+  priv->show_if_detected = TRUE;
+}
+
 static gboolean
 gis_timezone_page_apply (GisPage      *page,
                          GCancellable *cancellable)
@@ -502,6 +520,7 @@ gis_timezone_page_class_init (GisTimezonePageClass *klass)
 
   page_class->page_id = PAGE_ID;
   page_class->locale_changed = gis_timezone_page_locale_changed;
+  page_class->shown = gis_timezone_page_shown;
   page_class->apply = gis_timezone_page_apply;
   object_class->constructed = gis_timezone_page_constructed;
   object_class->dispose = gis_timezone_page_dispose;


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