[clutter] container: Add diagnostic warnings for deprecated vfuncs
- From: Emmanuele Bassi <ebassi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [clutter] container: Add diagnostic warnings for deprecated vfuncs
- Date: Mon, 16 Jan 2012 23:57:41 +0000 (UTC)
commit 7f092af15b46daba025d41646bb18c5d7ebb4d03
Author: Emmanuele Bassi <ebassi linux intel com>
Date: Tue Dec 20 15:21:06 2011 +0000
container: Add diagnostic warnings for deprecated vfuncs
The old add(), remove(), and foreach() virtual functions are deprecated;
ClutterContainer should warn if the public API detects that the vfuncs
have been overridden.
Strictly speaking, it's still legal to override those vfuncs: you can
chain up to the default vtable, or you could just provide an equivalent
implementation. The goal is to avoid having to override the Container
interface, until we can safely deprecate it and remove it in Clutter
2.0.
clutter/clutter-container.c | 51 ++++++++++++++++++++++++++++++++++++++++--
1 files changed, 48 insertions(+), 3 deletions(-)
---
diff --git a/clutter/clutter-container.c b/clutter/clutter-container.c
index 69561ce..3b17f31 100644
--- a/clutter/clutter-container.c
+++ b/clutter/clutter-container.c
@@ -247,6 +247,19 @@ container_add_actor (ClutterContainer *container,
clutter_container_create_child_meta (container, actor);
+#ifdef CLUTTER_ENABLE_DEBUG
+ if (G_UNLIKELY (_clutter_diagnostic_enabled ()))
+ {
+ ClutterContainerIface *iface = CLUTTER_CONTAINER_GET_IFACE (container);
+
+ if (iface->add != container_real_add)
+ _clutter_diagnostic_message ("The ClutterContainer::add() virtual "
+ "function has been deprecated and it "
+ "should not be overridden by newly "
+ "written code");
+ }
+#endif /* CLUTTER_ENABLE_DEBUG */
+
CLUTTER_CONTAINER_GET_IFACE (container)->add (container, actor);
}
@@ -269,6 +282,19 @@ container_remove_actor (ClutterContainer *container,
clutter_container_destroy_child_meta (container, actor);
+#ifdef CLUTTER_ENABLE_DEBUG
+ if (G_UNLIKELY (_clutter_diagnostic_enabled ()))
+ {
+ ClutterContainerIface *iface = CLUTTER_CONTAINER_GET_IFACE (container);
+
+ if (iface->remove != container_real_remove)
+ _clutter_diagnostic_message ("The ClutterContainer::remove() virtual "
+ "function has been deprecated and it "
+ "should not be overridden by newly "
+ "written code");
+ }
+#endif /* CLUTTER_ENABLE_DEBUG */
+
CLUTTER_CONTAINER_GET_IFACE (container)->remove (container, actor);
}
@@ -521,6 +547,19 @@ clutter_container_foreach (ClutterContainer *container,
g_return_if_fail (CLUTTER_IS_CONTAINER (container));
g_return_if_fail (callback != NULL);
+#ifdef CLUTTER_ENABLE_DEBUG
+ if (G_UNLIKELY (_clutter_diagnostic_enabled ()))
+ {
+ ClutterContainerIface *iface = CLUTTER_CONTAINER_GET_IFACE (container);
+
+ if (iface->foreach != container_real_foreach)
+ _clutter_diagnostic_message ("The ClutterContainer::foreach() "
+ "virtual function has been deprecated "
+ "and it should not be overridden by "
+ "newly written code");
+ }
+#endif /* CLUTTER_ENABLE_DEBUG */
+
CLUTTER_CONTAINER_GET_IFACE (container)->foreach (container,
callback,
user_data);
@@ -551,11 +590,17 @@ clutter_container_foreach_with_internals (ClutterContainer *container,
g_return_if_fail (callback != NULL);
iface = CLUTTER_CONTAINER_GET_IFACE (container);
- if (!iface->foreach)
+
+#ifdef CLUTTER_ENABLE_DEBUG
+ if (G_UNLIKELY (_clutter_diagnostic_enabled ()))
{
- CLUTTER_CONTAINER_WARN_NOT_IMPLEMENTED (container, "foreach");
- return;
+ if (iface->foreach_with_internals != NULL)
+ _clutter_diagnostic_message ("The ClutterContainer::foreach_with_internals() "
+ "virtual function has been deprecated "
+ "and it should not be overridden by "
+ "newly written code");
}
+#endif /* CLUTTER_ENABLE_DEBUG */
if (iface->foreach_with_internals != NULL)
iface->foreach_with_internals (container, callback, user_data);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]