From 7b72bff09d1eb2bcd16e7fdf07438edcdf52ae8b Mon Sep 17 00:00:00 2001 From: Pierre-Luc Beaudoin Date: Fri, 16 Oct 2009 17:01:08 -0400 Subject: [PATCH] Add champlain_view_remove_layer --- champlain/champlain-view.c | 30 +++++++++++++++++++++++++++--- champlain/champlain-view.h | 2 ++ 2 files changed, 29 insertions(+), 3 deletions(-) diff --git a/champlain/champlain-view.c b/champlain/champlain-view.c index d6ae74f..8ba5ee9 100644 --- a/champlain/champlain-view.c +++ b/champlain/champlain-view.c @@ -1716,11 +1716,11 @@ champlain_view_add_layer (ChamplainView *view, ChamplainLayer *layer) { g_return_if_fail (CHAMPLAIN_IS_VIEW (view)); - g_return_if_fail (CLUTTER_IS_ACTOR (layer)); + g_return_if_fail (CHAMPLAIN_IS_LAYER (layer)); ChamplainViewPrivate *priv = view->priv; - clutter_container_add (CLUTTER_CONTAINER (priv->user_layers), - CLUTTER_ACTOR (layer), NULL); + clutter_container_add_actor (CLUTTER_CONTAINER (priv->user_layers), + CLUTTER_ACTOR (layer)); clutter_actor_raise_top (CLUTTER_ACTOR (layer)); if (priv->map) @@ -1733,6 +1733,30 @@ champlain_view_add_layer (ChamplainView *view, CLUTTER_CALLBACK (connect_marker_notify_cb), view); } +/** + * champlain_view_remove_layer: + * @view: a #ChamplainView + * @layer: a #ChamplainLayer + * + * Removes the layer from the view + * + * Since: 0.4.1 + */ +void +champlain_view_remove_layer (ChamplainView *view, + ChamplainLayer *layer) +{ + g_return_if_fail (CHAMPLAIN_IS_VIEW (view)); + g_return_if_fail (CHAMPLAIN_IS_LAYER (layer)); + + ChamplainViewPrivate *priv = view->priv; + + g_signal_handlers_disconnect_by_func (layer, + G_CALLBACK (layer_add_marker_cb), view); + clutter_container_remove_actor (CLUTTER_CONTAINER (priv->user_layers), + CLUTTER_ACTOR (layer)); +} + /** * champlain_view_get_coords_from_event: * @view: a #ChamplainView diff --git a/champlain/champlain-view.h b/champlain/champlain-view.h index cb46f13..85eb0e8 100644 --- a/champlain/champlain-view.h +++ b/champlain/champlain-view.h @@ -118,6 +118,8 @@ void champlain_view_set_zoom_on_double_click (ChamplainView *view, void champlain_view_add_layer (ChamplainView *view, ChamplainLayer *layer); +void champlain_view_remove_layer (ChamplainView *view, + ChamplainLayer *layer); gboolean champlain_view_get_coords_from_event (ChamplainView *view, ClutterEvent *event, -- 2.39.5