aboutsummaryrefslogtreecommitdiffstats
path: root/widgets/misc/e-map.c
diff options
context:
space:
mode:
authorBenjamin Otte <otte@redhat.com>2010-10-19 17:15:32 +0800
committerMatthew Barnes <mbarnes@redhat.com>2010-10-30 01:50:03 +0800
commit5d73cd320faf322c8e5f3a4753bf85b1ebc64c2c (patch)
treed325af9bd763e28e0b2ab9fa9d8ae90a8db2bb63 /widgets/misc/e-map.c
parent963d59c44a22923bf0e32f5bc55710ff8eed7c5b (diff)
downloadgsoc2013-evolution-5d73cd320faf322c8e5f3a4753bf85b1ebc64c2c.tar.gz
gsoc2013-evolution-5d73cd320faf322c8e5f3a4753bf85b1ebc64c2c.tar.zst
gsoc2013-evolution-5d73cd320faf322c8e5f3a4753bf85b1ebc64c2c.zip
e-map: Add simplification API to zoom from a certain state
Diffstat (limited to 'widgets/misc/e-map.c')
-rw-r--r--widgets/misc/e-map.c33
1 files changed, 17 insertions, 16 deletions
diff --git a/widgets/misc/e-map.c b/widgets/misc/e-map.c
index 288bc220eb..11ca6de380 100644
--- a/widgets/misc/e-map.c
+++ b/widgets/misc/e-map.c
@@ -238,6 +238,20 @@ G_DEFINE_TYPE (
e_map,
GTK_TYPE_WIDGET)
+static void
+e_map_tween_new_from (EMap *view, guint msecs, double longitude, double latitude, double zoom)
+{
+ double current_longitude, current_latitude;
+
+ e_map_get_current_location (view, &current_longitude, &current_latitude);
+
+ e_map_tween_new (view,
+ msecs,
+ longitude - current_longitude,
+ latitude - current_latitude,
+ zoom / e_map_get_magnification (view));
+}
+
/* ----------------- *
* Widget management *
* ----------------- */
@@ -842,20 +856,14 @@ e_map_zoom_to_location (EMap *map, gdouble longitude, gdouble latitude)
e_map_set_zoom (map, E_MAP_ZOOMED_IN);
center_at (map, longitude, latitude);
- /* need to reget location, centering might have clipped it */
- e_map_get_current_location (map, &longitude, &latitude);
- e_map_tween_new (map,
- 150,
- prevlong - longitude,
- prevlat - latitude,
- prevzoom / e_map_get_magnification (map));
+ e_map_tween_new_from (map, 150, prevlong, prevlat, prevzoom);
}
void
e_map_zoom_out (EMap *map)
{
- double longitude, latitude, actual_longitude, actual_latitude;
+ double longitude, latitude;
double prevzoom;
g_return_if_fail (map);
@@ -866,14 +874,7 @@ e_map_zoom_out (EMap *map)
e_map_set_zoom (map, E_MAP_ZOOMED_OUT);
center_at (map, longitude, latitude);
- /* need to reget location, centering might have clipped it */
- e_map_get_current_location (map, &actual_longitude, &actual_latitude);
-
- e_map_tween_new (map,
- 150,
- longitude - actual_longitude,
- latitude - actual_latitude,
- prevzoom / e_map_get_magnification (map));
+ e_map_tween_new_from (map, 150, longitude, latitude, prevzoom);
}
void