[09/13] ivi-shell: add new method to remove a callback to get notificaiton of ivi_layer property changes.

Submitted by Nobuhiko Tanibata on June 22, 2015, 6:31 a.m.

Details

Message ID 1434954699-26899-1-git-send-email-nobuhiko_tanibata@xddp.denso.co.jp
State Accepted
Commit db8efd1f267b4a749a3b22488f273613372f5a90
Headers show

Not browsing as part of any series.

Commit Message

Nobuhiko Tanibata June 22, 2015, 6:31 a.m.
From: Nobuhiko Tanibata <NOBUHIKO_TANIBATA@xddp.denso.co.jp>

To get property changes of ivi_layer, callbacks can be registered.
However there was no API to remove a callback rather than removing all
callbacks by using layer_remove_notification.
layer_remove_notification_by_callback can do it.

Signed-off-by: Nobuhiko Tanibata <NOBUHIKO_TANIBATA@xddp.denso.co.jp>
Acked-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
---
 ivi-shell/ivi-layout-export.h |  7 +++++++
 ivi-shell/ivi-layout.c        | 18 ++++++++++++++++--
 2 files changed, 23 insertions(+), 2 deletions(-)

Patch hide | download patch | download mbox

diff --git a/ivi-shell/ivi-layout-export.h b/ivi-shell/ivi-layout-export.h
index ed8db9d..2f93811 100644
--- a/ivi-shell/ivi-layout-export.h
+++ b/ivi-shell/ivi-layout-export.h
@@ -790,6 +790,13 @@  struct ivi_controller_interface {
 							surface_property_notification_func callback,
 							void *userdata);
 
+	/**
+	 * \brief remove notification by callback on property changes of ivi_layer
+	 */
+	void (*layer_remove_notification_by_callback)(struct ivi_layout_layer *ivilayer,
+						      layer_property_notification_func callback,
+						      void *userdata);
+
 };
 
 #ifdef __cplusplus
diff --git a/ivi-shell/ivi-layout.c b/ivi-shell/ivi-layout.c
index 6dc5723..bfd9d32 100644
--- a/ivi-shell/ivi-layout.c
+++ b/ivi-shell/ivi-layout.c
@@ -1883,6 +1883,19 @@  ivi_layout_layer_remove_notification(struct ivi_layout_layer *ivilayer)
 }
 
 static void
+ivi_layout_layer_remove_notification_by_callback(struct ivi_layout_layer *ivilayer,
+						 layer_property_notification_func callback,
+						 void *userdata)
+{
+	if (ivilayer == NULL) {
+		weston_log("ivi_layout_layer_remove_notification_by_callback: invalid argument\n");
+		return;
+	}
+
+	remove_notification(&ivilayer->property_changed.listener_list, callback, userdata);
+}
+
+static void
 ivi_layout_layer_remove(struct ivi_layout_layer *ivilayer)
 {
 	struct ivi_layout *layout = get_instance();
@@ -2982,9 +2995,10 @@  static struct ivi_controller_interface ivi_controller_interface = {
 	.surface_dump			= ivi_layout_surface_dump,
 
 	/**
-	 * remove notification by callback on property changes of ivi_surface
+	 * remove notification by callback on property changes of ivi_surface/layer
 	 */
-	.surface_remove_notification_by_callback	= ivi_layout_surface_remove_notification_by_callback
+	.surface_remove_notification_by_callback	= ivi_layout_surface_remove_notification_by_callback,
+	.layer_remove_notification_by_callback		= ivi_layout_layer_remove_notification_by_callback
 };
 
 int