ivi-shell: rework remove_layer notification

The add_notification_remove_layer API accepts a simple
wl_listener instead of a ivi-shell specific notification
function. Therefore, the API is renamed to add_listener_remove_layer.

This change has several advantages:
1. Code cleanup
2. No dynamic memory allocation. Listeners are allocated
   by controller plugins
3. Remove API is not needed. Controller plugins can easily
   remove the listener link.

The remove API is removed too:
- ivi_layout_remove_notification_remove_layer

Signed-off-by: Emre Ucan <eucan@de.adit-jv.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
diff --git a/tests/ivi_layout-internal-test.c b/tests/ivi_layout-internal-test.c
index ca47b01..d7878d3 100644
--- a/tests/ivi_layout-internal-test.c
+++ b/tests/ivi_layout-internal-test.c
@@ -44,6 +44,7 @@
 
 	struct wl_listener layer_property_changed;
 	struct wl_listener layer_created;
+	struct wl_listener layer_removed;
 };
 
 static void
@@ -767,11 +768,13 @@
 }
 
 static void
-test_layer_remove_notification_callback(struct ivi_layout_layer *ivilayer,
-					void *userdata)
+test_layer_remove_notification_callback(struct wl_listener *listener, void *data)
 {
-	struct test_context *ctx = userdata;
+	struct test_context *ctx =
+			container_of(listener, struct test_context,
+					layer_removed);
 	const struct ivi_layout_interface *lyt = ctx->layout_interface;
+	struct ivi_layout_layer *ivilayer = data;
 	const struct ivi_layout_layer_properties *prop =
 		lyt->get_properties_of_layer(ivilayer);
 
@@ -793,17 +796,19 @@
 	struct ivi_layout_layer *ivilayers[LAYER_NUM] = {};
 
 	ctx->user_flags = 0;
+	ctx->layer_removed.notify = test_layer_remove_notification_callback;
 
 	ivilayers[0] = lyt->layer_create_with_dimension(layers[0], 200, 300);
-	iassert(lyt->add_notification_remove_layer(
-		    test_layer_remove_notification_callback, ctx) == IVI_SUCCEEDED);
+	iassert(lyt->add_listener_remove_layer(&ctx->layer_removed) == IVI_SUCCEEDED);
 	lyt->layer_destroy(ivilayers[0]);
 
 	iassert(ctx->user_flags == 1);
 
 	ctx->user_flags = 0;
 	ivilayers[1] = lyt->layer_create_with_dimension(layers[1], 250, 350);
-	lyt->remove_notification_remove_layer(test_layer_remove_notification_callback, ctx);
+
+	// remove layer property changed listener.
+	wl_list_remove(&ctx->layer_removed.link);
 	lyt->layer_destroy(ivilayers[1]);
 
 	iassert(ctx->user_flags == 0);
@@ -860,7 +865,7 @@
 {
 	const struct ivi_layout_interface *lyt = ctx->layout_interface;
 
-	iassert(lyt->add_notification_remove_layer(NULL, NULL) == IVI_FAILED);
+	iassert(lyt->add_listener_remove_layer(NULL) == IVI_FAILED);
 }
 
 static void