[clutter/wip/clutter-1.99: 18/28] 1.99: Remove deprecated API from ClutterLayoutManager
- From: Emmanuele Bassi <ebassi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [clutter/wip/clutter-1.99: 18/28] 1.99: Remove deprecated API from ClutterLayoutManager
- Date: Thu, 21 Jun 2012 20:09:35 +0000 (UTC)
commit c79f741e833c56dd18e835d07f2b1415b0988cd2
Author: Emmanuele Bassi <ebassi gnome org>
Date: Thu Jun 21 17:56:19 2012 +0100
1.99: Remove deprecated API from ClutterLayoutManager
clutter/clutter-layout-manager.c | 351 +-------------------------------------
clutter/clutter-layout-manager.h | 18 --
2 files changed, 3 insertions(+), 366 deletions(-)
---
diff --git a/clutter/clutter-layout-manager.c b/clutter/clutter-layout-manager.c
index 19b1daf..67f419c 100644
--- a/clutter/clutter-layout-manager.c
+++ b/clutter/clutter-layout-manager.c
@@ -79,173 +79,6 @@
* function whenever one of these properties changes.</para>
* </refsect2>
*
- * <refsect2 id="ClutterLayoutManager-animation">
- * <title>Animating a ClutterLayoutManager</title>
- * <para>A layout manager is used to let a #ClutterContainer take complete
- * ownership over the layout (that is: the position and sizing) of its
- * children; this means that using the Clutter animation API, like
- * clutter_actor_animate(), to animate the position and sizing of a child of
- * a layout manager it is not going to work properly, as the animation will
- * automatically override any setting done by the layout manager
- * itself.</para>
- * <para>It is possible for a #ClutterLayoutManager sub-class to animate its
- * children layout by using the base class animation support. The
- * #ClutterLayoutManager animation support consists of three virtual
- * functions: #ClutterLayoutManagerClass.begin_animation(),
- * #ClutterLayoutManagerClass.get_animation_progress(), and
- * #ClutterLayoutManagerClass.end_animation().</para>
- * <variablelist>
- * <varlistentry>
- * <term><function>begin_animation (duration, easing)</function></term>
- * <listitem><para>This virtual function is invoked when the layout
- * manager should begin an animation. The implementation should set up
- * the state for the animation and create the ancillary objects for
- * animating the layout. The default implementation creates a
- * #ClutterTimeline for the given duration and a #ClutterAlpha binding
- * the timeline to the given easing mode. This function returns a
- * #ClutterAlpha which should be used to control the animation from
- * the caller perspective.</para></listitem>
- * </varlistentry>
- * <varlistentry>
- * <term><function>get_animation_progress()</function></term>
- * <listitem><para>This virtual function should be invoked when animating
- * a layout manager. It returns the progress of the animation, using the
- * same semantics as the #ClutterAlpha:alpha value.</para></listitem>
- * </varlistentry>
- * <varlistentry>
- * <term><function>end_animation()</function></term>
- * <listitem><para>This virtual function is invoked when the animation of
- * a layout manager ends, and it is meant to be used for bookkeeping the
- * objects created in the <function>begin_animation()</function>
- * function. The default implementation will call it implicitly when the
- * timeline is complete.</para></listitem>
- * </varlistentry>
- * </variablelist>
- * <para>The simplest way to animate a layout is to create a #ClutterTimeline
- * inside the <function>begin_animation()</function> virtual function, along
- * with a #ClutterAlpha, and for each #ClutterTimeline::new-frame signal
- * emission call clutter_layout_manager_layout_changed(), which will cause a
- * relayout. The #ClutterTimeline::completed signal emission should cause
- * clutter_layout_manager_end_animation() to be called. The default
- * implementation provided internally by #ClutterLayoutManager does exactly
- * this, so most sub-classes should either not override any animation-related
- * virtual function or simply override #ClutterLayoutManagerClass.begin_animation()
- * and #ClutterLayoutManagerClass.end_animation() to set up ad hoc state, and then
- * chain up to the parent's implementation.</para>
- * <example id="example-ClutterLayoutManager-animation">
- * <title>Animation of a Layout Manager</title>
- * <para>The code below shows how a #ClutterLayoutManager sub-class should
- * provide animating the allocation of its children from within the
- * #ClutterLayoutManagerClass.allocate() virtual function implementation. The
- * animation is computed between the last stable allocation performed
- * before the animation started and the desired final allocation.</para>
- * <para>The <varname>is_animating</varname> variable is stored inside the
- * #ClutterLayoutManager sub-class and it is updated by overriding the
- * #ClutterLayoutManagerClass.begin_animation() and the
- * #ClutterLayoutManagerClass.end_animation() virtual functions and chaining up
- * to the base class implementation.</para>
- * <para>The last stable allocation is stored within a #ClutterLayoutMeta
- * sub-class used by the implementation.</para>
- * <programlisting>
- * static void
- * my_layout_manager_allocate (ClutterLayoutManager *manager,
- * ClutterContainer *container,
- * const ClutterActorBox *allocation,
- * ClutterAllocationFlags flags)
- * {
- * MyLayoutManager *self = MY_LAYOUT_MANAGER (manager);
- * ClutterActor *child;
- *
- * for (child = clutter_actor_get_first_child (CLUTTER_ACTOR (container));
- * child != NULL;
- * child = clutter_actor_get_next_sibling (child))
- * {
- * ClutterLayoutMeta *meta;
- * MyLayoutMeta *my_meta;
- *
- * /* retrieve the layout meta-object */
- * meta = clutter_layout_manager_get_child_meta (manager,
- * container,
- * child);
- * my_meta = MY_LAYOUT_META (meta);
- *
- * /* compute the desired allocation for the child */
- * compute_allocation (self, my_meta, child,
- * allocation, flags,
- * &child_box);
- *
- * /* this is the additional code that deals with the animation
- * * of the layout manager
- * */
- * if (!self->is_animating)
- * {
- * /* store the last stable allocation for later use */
- * my_meta->last_alloc = clutter_actor_box_copy (&child_box);
- * }
- * else
- * {
- * ClutterActorBox end = { 0, };
- * gdouble p;
- *
- * /* get the progress of the animation */
- * p = clutter_layout_manager_get_animation_progress (manager);
- *
- * if (my_meta->last_alloc != NULL)
- * {
- * /* copy the desired allocation as the final state */
- * end = child_box;
- *
- * /* then interpolate the initial and final state
- * * depending on the progress of the animation,
- * * and put the result inside the box we will use
- * * to allocate the child
- * */
- * clutter_actor_box_interpolate (my_meta->last_alloc,
- * &end,
- * p,
- * &child_box);
- * }
- * else
- * {
- * /* if there is no stable allocation then the child was
- * * added while animating; one possible course of action
- * * is to just bail out and fall through to the allocation
- * * to position the child directly at its final state
- * */
- * my_meta->last_alloc =
- * clutter_actor_box_copy (&child_box);
- * }
- * }
- *
- * /* allocate the child */
- * clutter_actor_allocate (child, &child_box, flags);
- * }
- * }
- * </programlisting>
- * </example>
- * <para>Sub-classes of #ClutterLayoutManager that support animations of the
- * layout changes should call clutter_layout_manager_begin_animation()
- * whenever a layout property changes value, e.g.:</para>
- * <informalexample>
- * <programlisting>
- * if (self->orientation != new_orientation)
- * {
- * ClutterLayoutManager *manager;
- *
- * self->orientation = new_orientation;
- *
- * manager = CLUTTER_LAYOUT_MANAGER (self);
- * clutter_layout_manager_layout_changed (manager);
- * clutter_layout_manager_begin_animation (manager, 500, CLUTTER_LINEAR);
- *
- * g_object_notify (G_OBJECT (self), "orientation");
- * }
- * </programlisting>
- * </informalexample>
- * <para>The code above will animate a change in the
- * <varname>orientation</varname> layout property of a layout manager.</para>
- * </refsect2>
- *
* <refsect2 id="clutter-layout-properties">
* <title>Layout Properties</title>
* <para>If a layout manager has layout properties, that is properties that
@@ -327,10 +160,7 @@
#include <glib-object.h>
#include <gobject/gvaluecollector.h>
-#define CLUTTER_DISABLE_DEPRECATION_WARNINGS
-#include "deprecated/clutter-container.h"
-#include "deprecated/clutter-alpha.h"
-
+#include "clutter-container.h"
#include "clutter-debug.h"
#include "clutter-enum-types.h"
#include "clutter-layout-manager.h"
@@ -380,7 +210,6 @@ G_DEFINE_ABSTRACT_TYPE (ClutterLayoutManager,
G_TYPE_INITIALLY_UNOWNED);
static GQuark quark_layout_meta = 0;
-static GQuark quark_layout_alpha = 0;
static guint manager_signals[LAST_SIGNAL] = { 0, };
@@ -517,89 +346,6 @@ layout_manager_real_get_child_meta_type (ClutterLayoutManager *manager)
return G_TYPE_INVALID;
}
-static ClutterAlpha *
-layout_manager_real_begin_animation (ClutterLayoutManager *manager,
- guint duration,
- gulong mode)
-{
- ClutterTimeline *timeline;
- ClutterAlpha *alpha;
-
- alpha = g_object_get_qdata (G_OBJECT (manager), quark_layout_alpha);
- if (alpha != NULL)
- {
- clutter_alpha_set_mode (alpha, mode);
-
- timeline = clutter_alpha_get_timeline (alpha);
- clutter_timeline_set_duration (timeline, duration);
- clutter_timeline_rewind (timeline);
-
- return alpha;
- };
-
- timeline = clutter_timeline_new (duration);
-
- alpha = clutter_alpha_new_full (timeline, mode);
-
- /* let the alpha take ownership of the timeline */
- g_object_unref (timeline);
-
- g_signal_connect_swapped (timeline, "completed",
- G_CALLBACK (clutter_layout_manager_end_animation),
- manager);
- g_signal_connect_swapped (timeline, "new-frame",
- G_CALLBACK (clutter_layout_manager_layout_changed),
- manager);
-
- g_object_set_qdata_full (G_OBJECT (manager),
- quark_layout_alpha, alpha,
- (GDestroyNotify) g_object_unref);
-
- clutter_timeline_start (timeline);
-
- return alpha;
-}
-
-static gdouble
-layout_manager_real_get_animation_progress (ClutterLayoutManager *manager)
-{
- ClutterAlpha *alpha;
-
- alpha = g_object_get_qdata (G_OBJECT (manager), quark_layout_alpha);
- if (alpha == NULL)
- return 1.0;
-
- return clutter_alpha_get_alpha (alpha);
-}
-
-static void
-layout_manager_real_end_animation (ClutterLayoutManager *manager)
-{
- ClutterTimeline *timeline;
- ClutterAlpha *alpha;
-
- alpha = g_object_get_qdata (G_OBJECT (manager), quark_layout_alpha);
- if (alpha == NULL)
- return;
-
- timeline = clutter_alpha_get_timeline (alpha);
- g_assert (timeline != NULL);
-
- if (clutter_timeline_is_playing (timeline))
- clutter_timeline_stop (timeline);
-
- g_signal_handlers_disconnect_by_func (timeline,
- G_CALLBACK (clutter_layout_manager_end_animation),
- manager);
- g_signal_handlers_disconnect_by_func (timeline,
- G_CALLBACK (clutter_layout_manager_layout_changed),
- manager);
-
- g_object_set_qdata (G_OBJECT (manager), quark_layout_alpha, NULL);
-
- clutter_layout_manager_layout_changed (manager);
-}
-
static void
layout_manager_set_property (GObject *gobject,
guint prop_id,
@@ -673,8 +419,6 @@ clutter_layout_manager_class_init (ClutterLayoutManagerClass *klass)
quark_layout_meta =
g_quark_from_static_string ("clutter-layout-manager-child-meta");
- quark_layout_alpha =
- g_quark_from_static_string ("clutter-layout-manager-alpha");
g_type_class_add_private (klass, sizeof (ClutterLayoutManagerPrivate));
@@ -686,9 +430,6 @@ clutter_layout_manager_class_init (ClutterLayoutManagerClass *klass)
klass->allocate = layout_manager_real_allocate;
klass->create_child_meta = layout_manager_real_create_child_meta;
klass->get_child_meta_type = layout_manager_real_get_child_meta_type;
- klass->begin_animation = layout_manager_real_begin_animation;
- klass->get_animation_progress = layout_manager_real_get_animation_progress;
- klass->end_animation = layout_manager_real_end_animation;
klass->set_container = layout_manager_real_set_container;
/**
@@ -714,8 +455,7 @@ clutter_layout_manager_class_init (ClutterLayoutManagerClass *klass)
*
* The easing mode has the same semantics of #ClutterAnimation:mode: it can
* either be a value from the #ClutterAnimationMode enumeration, like
- * %CLUTTER_EASE_OUT_CUBIC, or a logical id as returned by
- * clutter_alpha_register_func().
+ * %CLUTTER_EASE_OUT_CUBIC.
*
* The default value is %CLUTTER_EASE_OUT_CUBIC.
*
@@ -1476,90 +1216,6 @@ clutter_layout_manager_list_child_properties (ClutterLayoutManager *manager,
}
/**
- * clutter_layout_manager_begin_animation:
- * @manager: a #ClutterLayoutManager
- * @duration: the duration of the animation, in milliseconds
- * @mode: the easing mode of the animation
- *
- * Begins an animation of @duration milliseconds, using the provided
- * easing @mode
- *
- * The easing mode can be specified either as a #ClutterAnimationMode
- * or as a logical id returned by clutter_alpha_register_func()
- *
- * The result of this function depends on the @manager implementation
- *
- * Return value: (transfer none): The #ClutterAlpha created by the
- * layout manager; the returned instance is owned by the layout
- * manager and should not be unreferenced
- *
- * Since: 1.2
- *
- * Deprecated: 1.12
- */
-ClutterAlpha *
-clutter_layout_manager_begin_animation (ClutterLayoutManager *manager,
- guint duration,
- gulong mode)
-{
- ClutterLayoutManagerClass *klass;
-
- g_return_val_if_fail (CLUTTER_IS_LAYOUT_MANAGER (manager), NULL);
-
- klass = CLUTTER_LAYOUT_MANAGER_GET_CLASS (manager);
-
- return klass->begin_animation (manager, duration, mode);
-}
-
-/**
- * clutter_layout_manager_end_animation:
- * @manager: a #ClutterLayoutManager
- *
- * Ends an animation started by clutter_layout_manager_begin_animation()
- *
- * The result of this call depends on the @manager implementation
- *
- * Since: 1.2
- *
- * Deprecated: 1.12
- */
-void
-clutter_layout_manager_end_animation (ClutterLayoutManager *manager)
-{
- g_return_if_fail (CLUTTER_IS_LAYOUT_MANAGER (manager));
-
- CLUTTER_LAYOUT_MANAGER_GET_CLASS (manager)->end_animation (manager);
-}
-
-/**
- * clutter_layout_manager_get_animation_progress:
- * @manager: a #ClutterLayoutManager
- *
- * Retrieves the progress of the animation, if one has been started by
- * clutter_layout_manager_begin_animation()
- *
- * The returned value has the same semantics of the #ClutterAlpha:alpha
- * value
- *
- * Return value: the progress of the animation
- *
- * Since: 1.2
- *
- * Deprecated: 1.12
- */
-gdouble
-clutter_layout_manager_get_animation_progress (ClutterLayoutManager *manager)
-{
- ClutterLayoutManagerClass *klass;
-
- g_return_val_if_fail (CLUTTER_IS_LAYOUT_MANAGER (manager), 1.0);
-
- klass = CLUTTER_LAYOUT_MANAGER_GET_CLASS (manager);
-
- return klass->get_animation_progress (manager);
-}
-
-/**
* clutter_layout_manager_set_use_animations:
* @manager: a #ClutterLayoutManager
* @animate: %TRUE if the layout should use animations
@@ -1613,8 +1269,7 @@ clutter_layout_manager_get_use_animations (ClutterLayoutManager *manager)
/**
* clutter_layout_manager_set_easing_mode:
* @manager: a #ClutterLayoutManager
- * @mode: an easing mode, either from #ClutterAnimationMode or a logical id
- * from clutter_alpha_register_func()
+ * @mode: an easing mode, either from #ClutterAnimationMode
* Sets the easing mode to be used by @manager when animating changes in layout
* properties.
diff --git a/clutter/clutter-layout-manager.h b/clutter/clutter-layout-manager.h
index b034b40..da9f64d 100644
--- a/clutter/clutter-layout-manager.h
+++ b/clutter/clutter-layout-manager.h
@@ -127,15 +127,6 @@ struct _ClutterLayoutManagerClass
ClutterContainer *container,
ClutterActor *actor);
- /* deprecated */
- ClutterAlpha * (* begin_animation) (ClutterLayoutManager *manager,
- guint duration,
- gulong mode);
- /* deprecated */
- gdouble (* get_animation_progress) (ClutterLayoutManager *manager);
- /* deprecated */
- void (* end_animation) (ClutterLayoutManager *manager);
-
void (* layout_changed) (ClutterLayoutManager *manager);
/*< private >*/
@@ -201,15 +192,6 @@ void clutter_layout_manager_child_get_property (ClutterLayoutMa
const gchar *property_name,
GValue *value);
-CLUTTER_DEPRECATED_IN_1_12
-ClutterAlpha * clutter_layout_manager_begin_animation (ClutterLayoutManager *manager,
- guint duration,
- gulong mode);
-CLUTTER_DEPRECATED_IN_1_12
-void clutter_layout_manager_end_animation (ClutterLayoutManager *manager);
-CLUTTER_DEPRECATED_IN_1_12
-gdouble clutter_layout_manager_get_animation_progress (ClutterLayoutManager *manager);
-
CLUTTER_AVAILABLE_IN_1_12
void clutter_layout_manager_set_use_animations (ClutterLayoutManager *manager,
gboolean animate);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]