[libshumate] scale: Update when the reference map source changes
- From: Corentin Noël <corentinnoel src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libshumate] scale: Update when the reference map source changes
- Date: Wed, 10 Mar 2021 20:59:54 +0000 (UTC)
commit 327cabb76c7316fcfe18ba71ffea75c4519f322b
Author: James Westman <james jwestman net>
Date: Wed Mar 10 14:30:49 2021 -0600
scale: Update when the reference map source changes
Previously, if you set the scale's viewport before you set the
viewport's reference map source, the scale would start out at 1ft/1m.
shumate/shumate-scale.c | 19 ++++++-------------
1 file changed, 6 insertions(+), 13 deletions(-)
---
diff --git a/shumate/shumate-scale.c b/shumate/shumate-scale.c
index 0b9da5d..ff91d0f 100644
--- a/shumate/shumate-scale.c
+++ b/shumate/shumate-scale.c
@@ -212,22 +212,14 @@ shumate_scale_on_scale_changed (ShumateScale *self)
}
static void
-on_latitude_changed (ShumateScale *self,
- G_GNUC_UNUSED GParamSpec *pspec,
- ShumateViewport *viewport)
+on_viewport_props_changed (ShumateScale *self,
+ G_GNUC_UNUSED GParamSpec *pspec,
+ ShumateViewport *viewport)
{
shumate_scale_on_scale_changed (self);
}
-static void
-on_zoom_level_changed (ShumateScale *self,
- G_GNUC_UNUSED GParamSpec *pspec,
- ShumateViewport *viewport)
-{
- shumate_scale_on_scale_changed (self);
-}
-
static void
shumate_scale_get_property (GObject *object,
guint prop_id,
@@ -477,8 +469,9 @@ shumate_scale_set_viewport (ShumateScale *scale,
g_object_notify_by_pspec(G_OBJECT (scale), obj_properties[PROP_VIEWPORT]);
if (scale->viewport)
{
- g_signal_connect_swapped (scale->viewport, "notify::latitude", G_CALLBACK (on_latitude_changed),
scale);
- g_signal_connect_swapped (scale->viewport, "notify::zoom-level", G_CALLBACK
(on_zoom_level_changed), scale);
+ g_signal_connect_swapped (scale->viewport, "notify::latitude", G_CALLBACK
(on_viewport_props_changed), scale);
+ g_signal_connect_swapped (scale->viewport, "notify::zoom-level", G_CALLBACK
(on_viewport_props_changed), scale);
+ g_signal_connect_swapped (scale->viewport, "notify::reference-map-source", G_CALLBACK
(on_viewport_props_changed), scale);
}
shumate_scale_on_scale_changed (scale);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]