Commit 13a71fd7 authored by Vincent Untz's avatar Vincent Untz

[clock] Improve previous commit, to not uselessly redisplay the map

parent d81098b8
...@@ -406,7 +406,10 @@ clock_map_mark (ClockMap *this, gfloat latitude, gfloat longitude, gint mark) ...@@ -406,7 +406,10 @@ clock_map_mark (ClockMap *this, gfloat latitude, gfloat longitude, gint mark)
} }
} }
static void /**
* Return value: %TRUE if @loc can be placed on the map, %FALSE otherwise.
**/
static gboolean
clock_map_place_location (ClockMap *this, ClockLocation *loc, gboolean hilight) clock_map_place_location (ClockMap *this, ClockLocation *loc, gboolean hilight)
{ {
gfloat latitude, longitude; gfloat latitude, longitude;
...@@ -415,7 +418,7 @@ clock_map_place_location (ClockMap *this, ClockLocation *loc, gboolean hilight) ...@@ -415,7 +418,7 @@ clock_map_place_location (ClockMap *this, ClockLocation *loc, gboolean hilight)
clock_location_get_coords (loc, &latitude, &longitude); clock_location_get_coords (loc, &latitude, &longitude);
/* 0/0 means unset, basically */ /* 0/0 means unset, basically */
if (latitude == 0 && longitude == 0) if (latitude == 0 && longitude == 0)
return; return FALSE;
if (hilight) if (hilight)
marker = MARKER_HILIGHT; marker = MARKER_HILIGHT;
...@@ -425,6 +428,8 @@ clock_map_place_location (ClockMap *this, ClockLocation *loc, gboolean hilight) ...@@ -425,6 +428,8 @@ clock_map_place_location (ClockMap *this, ClockLocation *loc, gboolean hilight)
marker = MARKER_NORMAL; marker = MARKER_NORMAL;
clock_map_mark (this, latitude, longitude, marker); clock_map_mark (this, latitude, longitude, marker);
return TRUE;
} }
static void static void
...@@ -607,9 +612,11 @@ highlight (gpointer user_data) ...@@ -607,9 +612,11 @@ highlight (gpointer user_data)
if (data->count == 6) if (data->count == 6)
return FALSE; return FALSE;
if (data->count % 2 == 0) if (data->count % 2 == 0) {
clock_map_place_location (data->map, data->location, TRUE); if (!clock_map_place_location (data->map,
else data->location, TRUE))
return FALSE;
} else
clock_map_place_locations (data->map); clock_map_place_locations (data->map);
clock_map_display (data->map); clock_map_display (data->map);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment