[gnome-initial-setup/more-vendor-config-hooks: 3/3] timezone: Allow to hide/show when automatically detected
- From: Philip Chimento <pchimento src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-initial-setup/more-vendor-config-hooks: 3/3] timezone: Allow to hide/show when automatically detected
- Date: Thu, 25 Jul 2019 22:29:39 +0000 (UTC)
commit 8c0bd850e04ba43db81846ef16d11540dbdfe038
Author: Joaquim Rocha <jrocha endlessm com>
Date: Tue Jul 31 15:53:18 2018 +0200
timezone: Allow to hide/show when automatically detected
For some vendors, 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.
Thus, this patch adds the ability to show or hide the timezone page
(when it detected the timezone) based on the vendor configuration, using
the boolean key "show-if-detected"; by default the page is always shown,
and it will always be shown if the user gets to it before the detection
is finished.
To skip the timezone page if a location was detected, put the following
in the vendor config file:
[page.timezone]
show-if-detected=false
.../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 e1b8aaf..a21aecd 100644
--- a/gnome-initial-setup/pages/timezone/gis-timezone-page.c
+++ b/gnome-initial-setup/pages/timezone/gis-timezone-page.c
@@ -55,6 +55,9 @@
#define CLOCK_SCHEMA "org.gnome.desktop.interface"
#define CLOCK_FORMAT_KEY "clock-format"
+#define CONFIG_TIMEZONE_GROUP "page.timezone"
+#define CONFIG_TIMEZONE_SHOW_IF_DETECTED_KEY "show-if-detected"
+
struct _GisTimezonePagePrivate
{
GtkWidget *map;
@@ -70,6 +73,8 @@ struct _GisTimezonePagePrivate
GnomeWallClock *clock;
GDesktopClockFormat clock_format;
gboolean in_search;
+
+ gboolean show_if_detected;
};
typedef struct _GisTimezonePagePrivate GisTimezonePagePrivate;
@@ -132,6 +137,11 @@ set_location (GisTimezonePage *page,
tzid = gweather_timezone_get_tzid (zone);
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));
}
}
@@ -384,6 +394,12 @@ gis_timezone_page_constructed (GObject *object)
exit (1);
}
+ priv->show_if_detected =
+ gis_driver_conf_get_boolean (GIS_PAGE (page)->driver,
+ CONFIG_TIMEZONE_GROUP,
+ CONFIG_TIMEZONE_SHOW_IF_DETECTED_KEY,
+ TRUE);
+
priv->clock = g_object_new (GNOME_TYPE_WALL_CLOCK, NULL);
g_signal_connect (priv->clock, "notify::clock", G_CALLBACK (on_clock_changed), page);
@@ -430,9 +446,12 @@ 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);
/* Stop timezone geolocation if it hasn't finished by the time we get here */
stop_geolocation (tz_page);
+
+ priv->show_if_detected = TRUE;
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]