]> err.no Git - libchamplain/commitdiff
Add champlain_view_remove_layer
authorPierre-Luc Beaudoin <pierre-luc@pierlux.com>
Fri, 16 Oct 2009 21:01:08 +0000 (17:01 -0400)
committerPierre-Luc Beaudoin <pierre-luc@pierlux.com>
Fri, 16 Oct 2009 21:01:08 +0000 (17:01 -0400)
champlain/champlain-view.c
champlain/champlain-view.h

index d6ae74fcb59ee5d43e5f7333c2d680f3d64b2fe7..8ba5ee94b867a783e50f81f29d697fc3df3338c6 100644 (file)
@@ -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
index cb46f136f872b1be4c7b5fb6e0393e448c7495f7..85eb0e818aef3917b4a8e496378a1084a8f73160 100644 (file)
@@ -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,