diff options
author | Tristan Van Berkom <tristan.vanberkom@codethink.co.uk> | 2015-11-17 14:49:11 +0900 |
---|---|---|
committer | Tristan Van Berkom <tristan.vanberkom@codethink.co.uk> | 2015-11-17 17:16:33 +0900 |
commit | e0b7f968213d26807d00ca5841c03f4a5a4605b2 (patch) | |
tree | a2b08f92b3c64c3f18d2f965b1fbc7f7962a071c | |
parent | 763079172003fa2e5d750bc1daac80389bcfe018 (diff) | |
download | gnome-initial-setup-e0b7f968213d26807d00ca5841c03f4a5a4605b2.tar.gz |
GisTimezonePage: Fix timezone lookup after locale change
When the locale changes then all of the GisPages are rebuilt and
added to the already visible assistant widget - resulting in the
new timezone page being immediately mapped. The result is that
geolocation lookup is immediately cancelled and never gets a chance
to complete if a language is ever selected.
As the current code assumes that the widget is only mapped when it is
actually displayed (which is only true when the parent assistant is
not yet mapped when the child page is added) - Changed the code to
use the explicit gis_page_shown() api instead.
This performs the same intended geolocation lookup cancellation, only
in a more reliable codepath.
-rw-r--r-- | gnome-initial-setup/pages/timezone/gis-timezone-page.c | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/gnome-initial-setup/pages/timezone/gis-timezone-page.c b/gnome-initial-setup/pages/timezone/gis-timezone-page.c index 5b2d3df..1e4a603 100644 --- a/gnome-initial-setup/pages/timezone/gis-timezone-page.c +++ b/gnome-initial-setup/pages/timezone/gis-timezone-page.c @@ -424,16 +424,6 @@ stop_geolocation (GisTimezonePage *page) } static void -page_mapped (GtkWidget *widget, - gpointer user_data) -{ - GisTimezonePage *page = user_data; - - /* Stop timezone geolocation if it hasn't finished by the time we get here */ - stop_geolocation (page); -} - -static void gis_timezone_page_constructed (GObject *object) { GisTimezonePage *page = GIS_TIMEZONE_PAGE (object); @@ -462,8 +452,6 @@ gis_timezone_page_constructed (GObject *object) g_signal_connect (priv->search_entry, "notify::location", G_CALLBACK (entry_location_changed), page); - g_signal_connect (page, "map", - G_CALLBACK (page_mapped), page); g_signal_connect (priv->search_entry, "map", G_CALLBACK (entry_mapped), page); g_signal_connect (priv->stack, "notify::visible-child", @@ -494,6 +482,15 @@ gis_timezone_page_locale_changed (GisPage *page) } static void +gis_timezone_page_shown (GisPage *page) +{ + GisTimezonePage *tz_page = GIS_TIMEZONE_PAGE (page); + + /* Stop timezone geolocation if it hasn't finished by the time we get here */ + stop_geolocation (tz_page); +} + +static void gis_timezone_page_class_init (GisTimezonePageClass *klass) { GisPageClass *page_class = GIS_PAGE_CLASS (klass); @@ -510,6 +507,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; object_class->constructed = gis_timezone_page_constructed; object_class->dispose = gis_timezone_page_dispose; } |