[libshumate] simple-map: Add map property



commit a41c6de47e9c5223995e6ee22cdbe1febb3014e7
Author: James Westman <james jwestman net>
Date:   Sat Apr 23 19:51:43 2022 -0500

    simple-map: Add map property

 shumate/shumate-simple-map.c | 29 +++++++++++++++++++++++++++++
 shumate/shumate-simple-map.h |  3 +++
 2 files changed, 32 insertions(+)
---
diff --git a/shumate/shumate-simple-map.c b/shumate/shumate-simple-map.c
index e0f7a7c..627935e 100644
--- a/shumate/shumate-simple-map.c
+++ b/shumate/shumate-simple-map.c
@@ -60,6 +60,7 @@ enum {
   PROP_LICENSE,
   PROP_SCALE,
   PROP_SHOW_ZOOM_BUTTONS,
+  PROP_MAP,
   N_PROPS
 };
 
@@ -118,6 +119,10 @@ shumate_simple_map_get_property (GObject    *object,
       g_value_set_boolean (value, shumate_simple_map_get_show_zoom_buttons (self));
       break;
 
+    case PROP_MAP:
+      g_value_set_object (value, shumate_simple_map_get_map (self));
+      break;
+
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
     }
@@ -242,6 +247,13 @@ shumate_simple_map_class_init (ShumateSimpleMapClass *klass)
                          SHUMATE_TYPE_SCALE,
                          G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
 
+  properties[PROP_MAP] =
+    g_param_spec_object ("map",
+                         "Map",
+                         "Map",
+                         SHUMATE_TYPE_MAP,
+                         G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
+
   properties[PROP_SHOW_ZOOM_BUTTONS] =
     g_param_spec_boolean ("show-zoom-buttons",
                           "Show zoom buttons",
@@ -511,6 +523,23 @@ shumate_simple_map_get_show_zoom_buttons (ShumateSimpleMap *self)
 }
 
 
+/**
+ * shumate_simple_map_get_map:
+ * @self: a [class@SimpleMap]
+ *
+ * Gets the [class@SimpleMap]'s underlying [class@Map].
+ *
+ * Returns: (transfer none): a [class@Map]
+ */
+ShumateMap *
+shumate_simple_map_get_map (ShumateSimpleMap *self)
+{
+  g_return_val_if_fail (SHUMATE_IS_SIMPLE_MAP (self), NULL);
+
+  return self->map;
+}
+
+
 /**
  * shumate_simple_map_set_show_zoom_buttons:
  * @self: a [class@SimpleMap]
diff --git a/shumate/shumate-simple-map.h b/shumate/shumate-simple-map.h
index 95f0430..d7cc347 100644
--- a/shumate/shumate-simple-map.h
+++ b/shumate/shumate-simple-map.h
@@ -18,6 +18,7 @@
 #pragma once
 
 #include <gtk/gtk.h>
+#include <shumate/shumate-map.h>
 #include <shumate/shumate-map-source.h>
 #include <shumate/shumate-layer.h>
 #include <shumate/shumate-compass.h>
@@ -56,4 +57,6 @@ gboolean          shumate_simple_map_get_show_zoom_buttons (ShumateSimpleMap *se
 void              shumate_simple_map_set_show_zoom_buttons (ShumateSimpleMap *self,
                                                             gboolean          show_zoom_buttons);
 
+ShumateMap *shumate_simple_map_get_map (ShumateSimpleMap *self);
+
 G_END_DECLS


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