[PATCH 4/4] Pin the timezone to within the clicked zone. (#974211)
Vratislav Podzimek
vpodzime at redhat.com
Wed Nov 6 12:45:34 UTC 2013
On Tue, 2013-11-05 at 17:01 -0500, David Shea wrote:
> Instead of using the nearest city to a mouse click within any timezone,
> use the nearest city within the timezone that the user clicked.
> ---
> widgets/src/TimezoneMap.c | 12 +++++++++++-
> 1 file changed, 11 insertions(+), 1 deletion(-)
>
> diff --git a/widgets/src/TimezoneMap.c b/widgets/src/TimezoneMap.c
> index bcb2199..37bec3b 100644
> --- a/widgets/src/TimezoneMap.c
> +++ b/widgets/src/TimezoneMap.c
> @@ -470,6 +470,7 @@ button_press_event (GtkWidget *widget,
> if (color_codes[i].red == r && color_codes[i].green == g
> && color_codes[i].blue == b && color_codes[i].alpha == a) {
> priv->selected_offset = color_codes[i].offset;
> + break;
> }
> }
>
> @@ -487,6 +488,12 @@ button_press_event (GtkWidget *widget,
> gdouble pointx, pointy, dx, dy;
> TzLocation *loc = array->pdata[i];
>
> + /* Only select locations within the clicked offset */
> + if (tz_location_get_utc_offset(loc) != priv->selected_offset)
> + {
> + continue;
> + }
> +
> pointx = convert_longtitude_to_x (loc->longitude, width);
> pointy = convert_latitude_to_y (loc->latitude, height);
>
> @@ -500,7 +507,10 @@ button_press_event (GtkWidget *widget,
> distances = g_list_sort (distances, sort_locations);
>
>
> - set_location (ANACONDA_TIMEZONE_MAP (widget), (TzLocation*) distances->data, FALSE, FALSE);
> + if (distances)
> + {
> + set_location (ANACONDA_TIMEZONE_MAP (widget), (TzLocation*) distances->data, FALSE, FALSE);
> + }
>
> g_list_free (distances);
The following screencast shows an issue with this patch:
http://vpodzime.fedorapeople.org/tz_map_patches.webm
--
Vratislav Podzimek
Anaconda Rider | Red Hat, Inc. | Brno - Czech Republic
More information about the anaconda-patches
mailing list