[libshumate] path, marker layers: Listen to all viewport properties



commit 7cb7324e091feee4c236063131bed5598a3499cc
Author: James Westman <james jwestman net>
Date:   Sun Aug 14 15:42:58 2022 -0500

    path, marker layers: Listen to all viewport properties
    
    Layers need to update when any property of the viewport changes, so it's
    easier to connect to `notify` rather than the detailed signals.

 shumate/shumate-marker-layer.c | 41 ++++-------------------------------------
 shumate/shumate-path-layer.c   | 41 ++++-------------------------------------
 2 files changed, 8 insertions(+), 74 deletions(-)
---
diff --git a/shumate/shumate-marker-layer.c b/shumate/shumate-marker-layer.c
index e7cf0c8..fb880ae 100644
--- a/shumate/shumate-marker-layer.c
+++ b/shumate/shumate-marker-layer.c
@@ -156,39 +156,9 @@ shumate_marker_layer_reposition_markers (ShumateMarkerLayer *self)
 }
 
 static void
-on_view_longitude_changed (ShumateMarkerLayer *self,
-                           GParamSpec      *pspec,
-                           ShumateViewport *view)
-{
-  g_assert (SHUMATE_IS_MARKER_LAYER (self));
-
-  shumate_marker_layer_reposition_markers (self);
-}
-
-static void
-on_view_latitude_changed (ShumateMarkerLayer *self,
-                          GParamSpec      *pspec,
-                          ShumateViewport *view)
-{
-  g_assert (SHUMATE_IS_MARKER_LAYER (self));
-
-  shumate_marker_layer_reposition_markers (self);
-}
-
-static void
-on_view_zoom_level_changed (ShumateMarkerLayer *self,
-                            GParamSpec      *pspec,
-                            ShumateViewport *view)
-{
-  g_assert (SHUMATE_IS_MARKER_LAYER (self));
-
-  shumate_marker_layer_reposition_markers (self);
-}
-
-static void
-on_view_rotation_changed (ShumateMarkerLayer *self,
-                          GParamSpec      *pspec,
-                          ShumateViewport *view)
+on_viewport_changed (ShumateMarkerLayer *self,
+                     GParamSpec         *pspec,
+                     ShumateViewport    *view)
 {
   g_assert (SHUMATE_IS_MARKER_LAYER (self));
 
@@ -321,10 +291,7 @@ shumate_marker_layer_constructed (GObject *object)
   G_OBJECT_CLASS (shumate_marker_layer_parent_class)->constructed (object);
 
   viewport = shumate_layer_get_viewport (SHUMATE_LAYER (self));
-  g_signal_connect_swapped (viewport, "notify::longitude", G_CALLBACK (on_view_longitude_changed), self);
-  g_signal_connect_swapped (viewport, "notify::latitude", G_CALLBACK (on_view_latitude_changed), self);
-  g_signal_connect_swapped (viewport, "notify::zoom-level", G_CALLBACK (on_view_zoom_level_changed), self);
-  g_signal_connect_swapped (viewport, "notify::rotation", G_CALLBACK (on_view_rotation_changed), self);
+  g_signal_connect_swapped (viewport, "notify", G_CALLBACK (on_viewport_changed), self);
 
 }
 
diff --git a/shumate/shumate-path-layer.c b/shumate/shumate-path-layer.c
index 6c236b1..c0fef6c 100644
--- a/shumate/shumate-path-layer.c
+++ b/shumate/shumate-path-layer.c
@@ -78,39 +78,9 @@ struct _ShumatePathLayer
 G_DEFINE_TYPE (ShumatePathLayer, shumate_path_layer, SHUMATE_TYPE_LAYER);
 
 static void
-on_view_longitude_changed (ShumatePathLayer *self,
-                           GParamSpec       *pspec,
-                           ShumateViewport  *view)
-{
-  g_assert (SHUMATE_IS_PATH_LAYER (self));
-
-  gtk_widget_queue_draw (GTK_WIDGET (self));
-}
-
-static void
-on_view_latitude_changed (ShumatePathLayer *self,
-                          GParamSpec       *pspec,
-                          ShumateViewport  *view)
-{
-  g_assert (SHUMATE_IS_PATH_LAYER (self));
-
-  gtk_widget_queue_draw (GTK_WIDGET (self));
-}
-
-static void
-on_view_zoom_level_changed (ShumatePathLayer *self,
-                            GParamSpec       *pspec,
-                            ShumateViewport  *view)
-{
-  g_assert (SHUMATE_IS_PATH_LAYER (self));
-
-  gtk_widget_queue_draw (GTK_WIDGET (self));
-}
-
-static void
-on_view_rotation_changed (ShumatePathLayer *self,
-                          GParamSpec       *pspec,
-                          ShumateViewport  *view)
+on_viewport_changed (ShumatePathLayer *self,
+                     GParamSpec       *pspec,
+                     ShumateViewport  *view)
 {
   g_assert (SHUMATE_IS_PATH_LAYER (self));
 
@@ -243,10 +213,7 @@ shumate_path_layer_constructed (GObject *object)
   G_OBJECT_CLASS (shumate_path_layer_parent_class)->constructed (object);
 
   viewport = shumate_layer_get_viewport (SHUMATE_LAYER (self));
-  g_signal_connect_swapped (viewport, "notify::longitude", G_CALLBACK (on_view_longitude_changed), self);
-  g_signal_connect_swapped (viewport, "notify::latitude", G_CALLBACK (on_view_latitude_changed), self);
-  g_signal_connect_swapped (viewport, "notify::zoom-level", G_CALLBACK (on_view_zoom_level_changed), self);
-  g_signal_connect_swapped (viewport, "notify::rotation", G_CALLBACK (on_view_rotation_changed), self);
+  g_signal_connect_swapped (viewport, "notify", G_CALLBACK (on_viewport_changed), self);
 }
 
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]