Branch data Line data Source code
1 : : /*
2 : : * Copyright (C) 2021 James Westman <james@jwestman.net>
3 : : *
4 : : * This library is free software; you can redistribute it and/or
5 : : * modify it under the terms of the GNU Lesser General Public
6 : : * License as published by the Free Software Foundation; either
7 : : * version 2.1 of the License, or (at your option) any later version.
8 : : *
9 : : * This library is distributed in the hope that it will be useful,
10 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 : : * Lesser General Public License for more details.
13 : : *
14 : : * You should have received a copy of the GNU Lesser General Public
15 : : * License along with this library; if not, see <https://www.gnu.org/licenses/>.
16 : : */
17 : :
18 : : #include "shumate-simple-map.h"
19 : : #include "shumate-map.h"
20 : : #include "shumate-map-layer.h"
21 : : #include "shumate-symbol-event.h"
22 : :
23 : : /**
24 : : * ShumateSimpleMap:
25 : : *
26 : : * A ready-to-use map [class@Gtk.Widget].If you want to use your own implementation,
27 : : * you can look at the [class@Shumate.Map] widget.
28 : : *
29 : : * The simple map contains a zoom widget, a [class@Shumate.License] at the bottom,
30 : : * a [class@Shumate.Scale] and a [class@Shumate.Compass].
31 : : */
32 : :
33 : : struct _ShumateSimpleMap
34 : : {
35 : : GtkWidget parent_instance;
36 : :
37 : : ShumateMapSource *map_source;
38 : : GList *overlay_layers;
39 : :
40 : : ShumateMap *map;
41 : : ShumateMapLayer *map_layer;
42 : :
43 : : ShumateLicense *license;
44 : : ShumateScale *scale;
45 : : ShumateCompass *compass;
46 : :
47 : : GtkBox *buttons;
48 : : GtkBox *zoom_buttons;
49 : : };
50 : :
51 : : static void buildable_interface_init (GtkBuildableIface *iface);
52 : :
53 [ + + + - ]: 3 : G_DEFINE_TYPE_WITH_CODE (ShumateSimpleMap, shumate_simple_map, GTK_TYPE_WIDGET,
54 : : G_IMPLEMENT_INTERFACE (GTK_TYPE_BUILDABLE, buildable_interface_init))
55 : :
56 : : enum {
57 : : PROP_0,
58 : : PROP_MAP_SOURCE,
59 : : PROP_VIEWPORT,
60 : : PROP_COMPASS,
61 : : PROP_LICENSE,
62 : : PROP_SCALE,
63 : : PROP_SHOW_ZOOM_BUTTONS,
64 : : PROP_MAP,
65 : : N_PROPS
66 : : };
67 : :
68 : : static GParamSpec *properties [N_PROPS];
69 : :
70 : : enum {
71 : : SYMBOL_CLICKED,
72 : : LAST_SIGNAL
73 : : };
74 : :
75 : : static guint signals[LAST_SIGNAL] = { 0, };
76 : :
77 : : ShumateSimpleMap *
78 : 0 : shumate_simple_map_new (void)
79 : : {
80 : 0 : return g_object_new (SHUMATE_TYPE_SIMPLE_MAP, NULL);
81 : : }
82 : :
83 : :
84 : : static void
85 : 0 : shumate_simple_map_finalize (GObject *object)
86 : : {
87 : 0 : ShumateSimpleMap *self = (ShumateSimpleMap *)object;
88 : :
89 [ # # ]: 0 : g_clear_object (&self->map_source);
90 [ # # ]: 0 : g_clear_list (&self->overlay_layers, NULL);
91 : :
92 : 0 : G_OBJECT_CLASS (shumate_simple_map_parent_class)->finalize (object);
93 : 0 : }
94 : :
95 : :
96 : : static void
97 : 0 : shumate_simple_map_get_property (GObject *object,
98 : : guint prop_id,
99 : : GValue *value,
100 : : GParamSpec *pspec)
101 : : {
102 : 0 : ShumateSimpleMap *self = SHUMATE_SIMPLE_MAP (object);
103 : :
104 [ # # # # : 0 : switch (prop_id)
# # # # ]
105 : : {
106 : 0 : case PROP_MAP_SOURCE:
107 : 0 : g_value_set_object (value, shumate_simple_map_get_map_source (self));
108 : 0 : break;
109 : :
110 : 0 : case PROP_VIEWPORT:
111 : 0 : g_value_set_object (value, shumate_simple_map_get_viewport (self));
112 : 0 : break;
113 : :
114 : 0 : case PROP_COMPASS:
115 : 0 : g_value_set_object (value, shumate_simple_map_get_compass (self));
116 : 0 : break;
117 : :
118 : 0 : case PROP_SCALE:
119 : 0 : g_value_set_object (value, shumate_simple_map_get_scale (self));
120 : 0 : break;
121 : :
122 : 0 : case PROP_LICENSE:
123 : 0 : g_value_set_object (value, shumate_simple_map_get_license (self));
124 : 0 : break;
125 : :
126 : 0 : case PROP_SHOW_ZOOM_BUTTONS:
127 : 0 : g_value_set_boolean (value, shumate_simple_map_get_show_zoom_buttons (self));
128 : 0 : break;
129 : :
130 : 0 : case PROP_MAP:
131 : 0 : g_value_set_object (value, shumate_simple_map_get_map (self));
132 : 0 : break;
133 : :
134 : 0 : default:
135 : 0 : G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
136 : : }
137 : 0 : }
138 : :
139 : :
140 : : static void
141 : 0 : shumate_simple_map_set_property (GObject *object,
142 : : guint prop_id,
143 : : const GValue *value,
144 : : GParamSpec *pspec)
145 : : {
146 : 0 : ShumateSimpleMap *self = SHUMATE_SIMPLE_MAP (object);
147 : :
148 [ # # # ]: 0 : switch (prop_id)
149 : : {
150 : 0 : case PROP_MAP_SOURCE:
151 : 0 : shumate_simple_map_set_map_source (self, g_value_get_object (value));
152 : 0 : break;
153 : :
154 : 0 : case PROP_SHOW_ZOOM_BUTTONS:
155 : 0 : shumate_simple_map_set_show_zoom_buttons (self, g_value_get_boolean (value));
156 : 0 : break;
157 : :
158 : 0 : default:
159 : 0 : G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
160 : : }
161 : 0 : }
162 : :
163 : :
164 : : static void
165 : 0 : shumate_simple_map_dispose (GObject *object)
166 : : {
167 : 0 : GtkWidget *child;
168 : :
169 [ # # ]: 0 : while ((child = gtk_widget_get_first_child (GTK_WIDGET (object))))
170 : 0 : gtk_widget_unparent (child);
171 : :
172 : 0 : G_OBJECT_CLASS (shumate_simple_map_parent_class)->dispose (object);
173 : 0 : }
174 : :
175 : :
176 : : static void
177 : 0 : on_zoom_in_clicked (ShumateSimpleMap *self,
178 : : GtkButton *button)
179 : : {
180 : 0 : shumate_map_zoom_in (self->map);
181 : 0 : }
182 : :
183 : :
184 : : static void
185 : 0 : on_zoom_out_clicked (ShumateSimpleMap *self,
186 : : GtkButton *button)
187 : : {
188 : 0 : shumate_map_zoom_out (self->map);
189 : 0 : }
190 : :
191 : :
192 : : static void
193 : 0 : on_symbol_clicked (ShumateSimpleMap *self,
194 : : ShumateSymbolEvent *event,
195 : : ShumateMapLayer *map_layer)
196 : : {
197 : 0 : g_signal_emit (self, signals[SYMBOL_CLICKED], 0, event);
198 : 0 : }
199 : :
200 : :
201 : : static GObject *
202 : 0 : shumate_simple_map_get_internal_child (GtkBuildable *buildable,
203 : : GtkBuilder *builder,
204 : : const char *childname)
205 : : {
206 : 0 : ShumateSimpleMap *self = SHUMATE_SIMPLE_MAP (buildable);
207 : :
208 [ # # ]: 0 : if (!g_strcmp0 (childname, "compass"))
209 : 0 : return G_OBJECT (self->compass);
210 [ # # ]: 0 : else if (!g_strcmp0 (childname, "license"))
211 : 0 : return G_OBJECT (self->license);
212 [ # # ]: 0 : else if (!g_strcmp0 (childname, "scale"))
213 : 0 : return G_OBJECT (self->scale);
214 [ # # ]: 0 : else if (!g_strcmp0 (childname, "map"))
215 : 0 : return G_OBJECT (self->map);
216 : : else
217 : : return NULL;
218 : : }
219 : :
220 : :
221 : : static void
222 : 1 : shumate_simple_map_class_init (ShumateSimpleMapClass *klass)
223 : : {
224 : 1 : GObjectClass *object_class = G_OBJECT_CLASS (klass);
225 : 1 : GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
226 : :
227 : 1 : object_class->dispose = shumate_simple_map_dispose;
228 : 1 : object_class->finalize = shumate_simple_map_finalize;
229 : 1 : object_class->get_property = shumate_simple_map_get_property;
230 : 1 : object_class->set_property = shumate_simple_map_set_property;
231 : :
232 : 2 : properties[PROP_VIEWPORT] =
233 : 1 : g_param_spec_object ("viewport",
234 : : "Viewport",
235 : : "Viewport",
236 : : SHUMATE_TYPE_VIEWPORT,
237 : : G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
238 : :
239 : 2 : properties[PROP_MAP_SOURCE] =
240 : 1 : g_param_spec_object ("map-source",
241 : : "Map source",
242 : : "Map source",
243 : : SHUMATE_TYPE_MAP_SOURCE,
244 : : G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | G_PARAM_EXPLICIT_NOTIFY);
245 : :
246 : 2 : properties[PROP_COMPASS] =
247 : 1 : g_param_spec_object ("compass",
248 : : "Compass",
249 : : "Compass",
250 : : SHUMATE_TYPE_COMPASS,
251 : : G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
252 : :
253 : 2 : properties[PROP_LICENSE] =
254 : 1 : g_param_spec_object ("license",
255 : : "License",
256 : : "License",
257 : : SHUMATE_TYPE_LICENSE,
258 : : G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
259 : :
260 : 2 : properties[PROP_SCALE] =
261 : 1 : g_param_spec_object ("scale",
262 : : "Scale",
263 : : "Scale",
264 : : SHUMATE_TYPE_SCALE,
265 : : G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
266 : :
267 : 2 : properties[PROP_MAP] =
268 : 1 : g_param_spec_object ("map",
269 : : "Map",
270 : : "Map",
271 : : SHUMATE_TYPE_MAP,
272 : : G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
273 : :
274 : 2 : properties[PROP_SHOW_ZOOM_BUTTONS] =
275 : 1 : g_param_spec_boolean ("show-zoom-buttons",
276 : : "Show zoom buttons",
277 : : "Show zoom buttons",
278 : : TRUE,
279 : : G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | G_PARAM_EXPLICIT_NOTIFY);
280 : :
281 : 1 : g_object_class_install_properties (object_class, N_PROPS, properties);
282 : :
283 : : /**
284 : : * ShumateSimpleMap::symbol-clicked:
285 : : * @self: the [class@SimpleMap] emitting the signal
286 : : * @event: a [class@SymbolEvent] with details about the clicked symbol.
287 : : *
288 : : * Emitted when a symbol in the base map layer (not in overlay layers) is
289 : : * clicked.
290 : : *
291 : : * Since: 1.1
292 : : */
293 : 2 : signals[SYMBOL_CLICKED] =
294 : 1 : g_signal_new ("symbol-clicked",
295 : : G_OBJECT_CLASS_TYPE (object_class),
296 : : G_SIGNAL_RUN_LAST,
297 : : 0, NULL, NULL,
298 : : g_cclosure_marshal_VOID__OBJECT,
299 : : G_TYPE_NONE,
300 : : 1,
301 : : SHUMATE_TYPE_SYMBOL_EVENT);
302 : :
303 : 1 : gtk_widget_class_set_template_from_resource (widget_class, "/org/gnome/shumate/shumate-simple-map.ui");
304 : 1 : gtk_widget_class_bind_template_child (widget_class, ShumateSimpleMap, map);
305 : 1 : gtk_widget_class_bind_template_child (widget_class, ShumateSimpleMap, license);
306 : 1 : gtk_widget_class_bind_template_child (widget_class, ShumateSimpleMap, scale);
307 : 1 : gtk_widget_class_bind_template_child (widget_class, ShumateSimpleMap, compass);
308 : 1 : gtk_widget_class_bind_template_child (widget_class, ShumateSimpleMap, zoom_buttons);
309 : 1 : gtk_widget_class_bind_template_callback (widget_class, on_zoom_in_clicked);
310 : 1 : gtk_widget_class_bind_template_callback (widget_class, on_zoom_out_clicked);
311 : 1 : gtk_widget_class_set_layout_manager_type (widget_class, GTK_TYPE_BIN_LAYOUT);
312 : 1 : }
313 : :
314 : : static void
315 : 1 : buildable_interface_init (GtkBuildableIface *iface)
316 : : {
317 : 1 : iface->get_internal_child = shumate_simple_map_get_internal_child;
318 : 1 : }
319 : :
320 : : static void
321 : 0 : shumate_simple_map_init (ShumateSimpleMap *self)
322 : : {
323 : 0 : gtk_widget_init_template (GTK_WIDGET (self));
324 : 0 : }
325 : :
326 : :
327 : : /**
328 : : * shumate_simple_map_get_viewport:
329 : : * @self: a [class@Map]
330 : : *
331 : : * Gets the map's viewport, needed for constructing map layers that will be added
332 : : * to it.
333 : : *
334 : : * Returns: (transfer none): a [class@Viewport]
335 : : */
336 : : ShumateViewport *
337 : 0 : shumate_simple_map_get_viewport (ShumateSimpleMap *self)
338 : : {
339 [ # # ]: 0 : g_return_val_if_fail (SHUMATE_IS_SIMPLE_MAP (self), NULL);
340 : 0 : return shumate_map_get_viewport (self->map);
341 : : }
342 : :
343 : :
344 : : /**
345 : : * shumate_simple_map_get_map_source:
346 : : * @self: a [class@SimpleMap]
347 : : *
348 : : * Gets the map source for the current base layer.
349 : : *
350 : : * Returns: (transfer none): a [class@MapSource]
351 : : */
352 : : ShumateMapSource *
353 : 0 : shumate_simple_map_get_map_source (ShumateSimpleMap *self)
354 : : {
355 [ # # ]: 0 : g_return_val_if_fail (SHUMATE_IS_SIMPLE_MAP (self), NULL);
356 : 0 : return self->map_source;
357 : : }
358 : :
359 : :
360 : : /**
361 : : * shumate_simple_map_set_map_source:
362 : : * @self: a [class@SimpleMap]
363 : : * @map_source: (nullable): a [class@MapSource]
364 : : *
365 : : * Sets the source for the base map.
366 : : */
367 : : void
368 : 0 : shumate_simple_map_set_map_source (ShumateSimpleMap *self,
369 : : ShumateMapSource *map_source)
370 : : {
371 : 0 : ShumateViewport *viewport;
372 : 0 : ShumateMapLayer *map_layer;
373 : :
374 [ # # ]: 0 : g_return_if_fail (SHUMATE_IS_SIMPLE_MAP (self));
375 [ # # # # ]: 0 : g_return_if_fail (map_source == NULL || SHUMATE_IS_MAP_SOURCE (map_source));
376 : :
377 : 0 : viewport = shumate_map_get_viewport (self->map);
378 : :
379 [ # # ]: 0 : if (self->map_source == map_source)
380 : : return;
381 : :
382 [ # # ]: 0 : if (self->map_source) {
383 : 0 : shumate_license_remove_map_source (self->license, self->map_source);
384 : : }
385 : :
386 : 0 : g_set_object (&self->map_source, map_source);
387 : :
388 : 0 : shumate_viewport_set_reference_map_source (viewport, map_source);
389 : 0 : shumate_map_set_map_source (self->map, map_source);
390 : :
391 : 0 : map_layer = shumate_map_layer_new (map_source, viewport);
392 : 0 : shumate_map_insert_layer_behind (self->map, SHUMATE_LAYER (map_layer), SHUMATE_LAYER (self->map_layer));
393 : 0 : g_signal_connect_object (map_layer, "symbol-clicked", (GCallback)on_symbol_clicked, self, G_CONNECT_SWAPPED);
394 : :
395 [ # # ]: 0 : if (self->map_layer) {
396 : 0 : g_signal_handlers_disconnect_by_func (self->map_layer, on_symbol_clicked, self);
397 : 0 : shumate_map_remove_layer (self->map, SHUMATE_LAYER (self->map_layer));
398 : : }
399 : 0 : self->map_layer = map_layer;
400 : :
401 : 0 : shumate_license_append_map_source (self->license, map_source);
402 : :
403 : 0 : g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_MAP_SOURCE]);
404 : : }
405 : :
406 : :
407 : : /**
408 : : * shumate_simple_map_add_overlay_layer:
409 : : * @self: a [class@SimpleMap]
410 : : * @layer: a [class@Layer] to add
411 : : *
412 : : * Adds a map layer as an overlay on top of the base map.
413 : : */
414 : : void
415 : 0 : shumate_simple_map_add_overlay_layer (ShumateSimpleMap *self,
416 : : ShumateLayer *layer)
417 : : {
418 [ # # ]: 0 : g_return_if_fail (SHUMATE_IS_SIMPLE_MAP (self));
419 [ # # ]: 0 : g_return_if_fail (SHUMATE_IS_LAYER (layer));
420 : :
421 : 0 : self->overlay_layers = g_list_append (self->overlay_layers, layer);
422 : 0 : shumate_map_add_layer (self->map, layer);
423 : : }
424 : :
425 : :
426 : : /**
427 : : * shumate_simple_map_insert_overlay_layer_above:
428 : : * @self: a [class@SimpleMap]
429 : : * @layer: a [class@Layer] to insert
430 : : *
431 : : * Inserts a map layer as an overlay on top of the base map. The layer will
432 : : * appear above @sibling, or at the bottom (but still above the base map)
433 : : * if @sibling is %NULL.
434 : : */
435 : : void
436 : 0 : shumate_simple_map_insert_overlay_layer_above (ShumateSimpleMap *self,
437 : : ShumateLayer *layer,
438 : : ShumateLayer *sibling)
439 : : {
440 : 0 : gint idx;
441 : :
442 [ # # ]: 0 : g_return_if_fail (SHUMATE_IS_SIMPLE_MAP (self));
443 [ # # ]: 0 : g_return_if_fail (SHUMATE_IS_LAYER (layer));
444 [ # # # # ]: 0 : g_return_if_fail (sibling == NULL || SHUMATE_IS_LAYER (sibling));
445 : :
446 [ # # ]: 0 : if (sibling == NULL)
447 : : idx = 0;
448 : : else
449 : 0 : idx = g_list_index (self->overlay_layers, sibling) + 1;
450 : :
451 : 0 : self->overlay_layers = g_list_insert (self->overlay_layers, layer, idx);
452 : 0 : shumate_map_insert_layer_above (self->map, layer, sibling);
453 : : }
454 : :
455 : :
456 : : /**
457 : : * shumate_simple_map_insert_overlay_layer_behind:
458 : : * @self: a [class@SimpleMap]
459 : : * @layer: a [class@Layer] to insert
460 : : *
461 : : * Inserts a map layer as an overlay on top of the base map. The layer will
462 : : * appear just below @sibling, or above everything else if @sibling is %NULL.
463 : : */
464 : : void
465 : 0 : shumate_simple_map_insert_overlay_layer_behind (ShumateSimpleMap *self,
466 : : ShumateLayer *layer,
467 : : ShumateLayer *sibling)
468 : : {
469 : 0 : GList *sibling_link;
470 : :
471 [ # # ]: 0 : g_return_if_fail (SHUMATE_IS_SIMPLE_MAP (self));
472 [ # # ]: 0 : g_return_if_fail (SHUMATE_IS_LAYER (layer));
473 [ # # # # ]: 0 : g_return_if_fail (sibling == NULL || SHUMATE_IS_LAYER (sibling));
474 : :
475 : 0 : sibling_link = g_list_find (self->overlay_layers, sibling);
476 : 0 : self->overlay_layers = g_list_insert_before (self->overlay_layers, sibling_link, layer);
477 : 0 : shumate_map_insert_layer_behind (self->map, layer, sibling);
478 : : }
479 : :
480 : :
481 : : /**
482 : : * shumate_simple_map_remove_overlay_layer:
483 : : * @self: a [class@SimpleMap]
484 : : * @layer: a [class@Layer] that was added to the map previously
485 : : *
486 : : * Removes a layer from the map.
487 : : */
488 : : void
489 : 0 : shumate_simple_map_remove_overlay_layer (ShumateSimpleMap *self,
490 : : ShumateLayer *layer)
491 : : {
492 [ # # ]: 0 : g_return_if_fail (SHUMATE_IS_SIMPLE_MAP (self));
493 [ # # ]: 0 : g_return_if_fail (SHUMATE_IS_LAYER (layer));
494 : :
495 : 0 : self->overlay_layers = g_list_remove (self->overlay_layers, layer);
496 : 0 : shumate_map_remove_layer (self->map, layer);
497 : : }
498 : :
499 : :
500 : : /**
501 : : * shumate_simple_map_get_compass:
502 : : * @self: a [class@SimpleMap]
503 : : *
504 : : * Gets the compass widget for the map.
505 : : *
506 : : * Returns: (transfer none): a [class@Compass]
507 : : */
508 : : ShumateCompass *
509 : 0 : shumate_simple_map_get_compass (ShumateSimpleMap *self)
510 : : {
511 [ # # ]: 0 : g_return_val_if_fail (SHUMATE_IS_SIMPLE_MAP (self), NULL);
512 : :
513 : 0 : return self->compass;
514 : : }
515 : :
516 : :
517 : : /**
518 : : * shumate_simple_map_get_license:
519 : : * @self: a [class@SimpleMap]
520 : : *
521 : : * Gets the license widget for the map.
522 : : *
523 : : * Returns: (transfer none): a [class@License]
524 : : */
525 : : ShumateLicense *
526 : 0 : shumate_simple_map_get_license (ShumateSimpleMap *self)
527 : : {
528 [ # # ]: 0 : g_return_val_if_fail (SHUMATE_IS_SIMPLE_MAP (self), NULL);
529 : :
530 : 0 : return self->license;
531 : : }
532 : :
533 : :
534 : : /**
535 : : * shumate_simple_map_get_scale:
536 : : * @self: a [class@SimpleMap]
537 : : *
538 : : * Gets the scale widget for the map.
539 : : *
540 : : * Returns: (transfer none): a [class@Scale]
541 : : */
542 : : ShumateScale *
543 : 0 : shumate_simple_map_get_scale (ShumateSimpleMap *self)
544 : : {
545 [ # # ]: 0 : g_return_val_if_fail (SHUMATE_IS_SIMPLE_MAP (self), NULL);
546 : 0 : return self->scale;
547 : : }
548 : :
549 : :
550 : : /**
551 : : * shumate_simple_map_get_show_zoom_buttons:
552 : : * @self: a [class@SimpleMap]
553 : : *
554 : : * Gets whether or not the zoom buttons are shown.
555 : : *
556 : : * Returns: %TRUE if the zoom buttons are visible, otherwise %FALSE
557 : : */
558 : : gboolean
559 : 0 : shumate_simple_map_get_show_zoom_buttons (ShumateSimpleMap *self)
560 : : {
561 [ # # ]: 0 : g_return_val_if_fail (SHUMATE_IS_SIMPLE_MAP (self), FALSE);
562 : 0 : return gtk_widget_is_visible (GTK_WIDGET (self->zoom_buttons));
563 : : }
564 : :
565 : :
566 : : /**
567 : : * shumate_simple_map_get_map:
568 : : * @self: a [class@SimpleMap]
569 : : *
570 : : * Gets the [class@SimpleMap]'s underlying [class@Map].
571 : : *
572 : : * Returns: (transfer none): a [class@Map]
573 : : */
574 : : ShumateMap *
575 : 0 : shumate_simple_map_get_map (ShumateSimpleMap *self)
576 : : {
577 [ # # ]: 0 : g_return_val_if_fail (SHUMATE_IS_SIMPLE_MAP (self), NULL);
578 : :
579 : 0 : return self->map;
580 : : }
581 : :
582 : :
583 : : /**
584 : : * shumate_simple_map_set_show_zoom_buttons:
585 : : * @self: a [class@SimpleMap]
586 : : * @show_zoom_buttons: %TRUE to show the zoom buttons, %FALSE to hide them
587 : : *
588 : : * Sets whether or not the zoom buttons are shown.
589 : : */
590 : : void
591 : 0 : shumate_simple_map_set_show_zoom_buttons (ShumateSimpleMap *self,
592 : : gboolean show_zoom_buttons)
593 : : {
594 [ # # ]: 0 : g_return_if_fail (SHUMATE_IS_SIMPLE_MAP (self));
595 : 0 : gtk_widget_set_visible (GTK_WIDGET (self->zoom_buttons), show_zoom_buttons);
596 : 0 : g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_SHOW_ZOOM_BUTTONS]);
597 : : }
|