[libchamplain/libchamplain-0-4] do not emit a notify for lat and lon if the change is too small
- From: Pierre-Luc Beaudoin <plbeaudoin src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [libchamplain/libchamplain-0-4] do not emit a notify for lat and lon if the change is too small
- Date: Fri, 29 Jan 2010 02:52:22 +0000 (UTC)
commit ef14ca5f7448366dde169f3648e6b0ce4dc21b25
Author: Pierre-Luc Beaudoin <pierre-luc pierlux com>
Date: Thu Jan 28 20:09:35 2010 -0500
do not emit a notify for lat and lon if the change is too small
NEWS | 2 ++
champlain/champlain-view.c | 15 +++++++++++----
2 files changed, 13 insertions(+), 4 deletions(-)
---
diff --git a/NEWS b/NEWS
index ec32c43..2669666 100644
--- a/NEWS
+++ b/NEWS
@@ -24,6 +24,8 @@ Fixes:
Beaudoin)
* 606393: The display of tiles looks very programmatic, they now load in spiral
order (Jason Woofenden)
+* Limit the number of times notify::latitude and notify::longitude are emited
+ (Pierre-Luc Beaudoin)
libchamplain 0.4.3 (2010-01-09)
===============================
diff --git a/champlain/champlain-view.c b/champlain/champlain-view.c
index b019f47..9e7e2d8 100644
--- a/champlain/champlain-view.c
+++ b/champlain/champlain-view.c
@@ -285,6 +285,7 @@ update_viewport (ChamplainView *view,
gfloat y)
{
ChamplainViewPrivate *priv = view->priv;
+ gfloat lat, lon;
ChamplainFloatPoint old_anchor;
@@ -317,11 +318,17 @@ update_viewport (ChamplainView *view,
update_scale (view);
view_update_polygons (view);
- priv->longitude = viewport_get_current_longitude (priv);
- priv->latitude = viewport_get_current_latitude (priv);
+ lon = viewport_get_current_longitude (priv);
+ lat = viewport_get_current_latitude (priv);
- g_object_notify (G_OBJECT (view), "longitude");
- g_object_notify (G_OBJECT (view), "latitude");
+ priv->longitude = lon;
+ priv->latitude = lat;
+
+ if (fabs (priv->longitude - lon) > 0.001)
+ g_object_notify (G_OBJECT (view), "longitude");
+
+ if (fabs (priv->latitude - lat) > 0.001)
+ g_object_notify (G_OBJECT (view), "latitude");
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]