[PATCH 4/4] Pin the timezone to within the clicked zone. (#974211)

David Shea dshea at redhat.com
Tue Nov 5 22:01:31 UTC 2013


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);
 
-- 
1.8.3.1



More information about the anaconda-patches mailing list