diff options
author | Jonny Lamb <jonnylamb@gnome.org> | 2010-12-14 13:24:01 +0000 |
---|---|---|
committer | Jonny Lamb <jonnylamb@gnome.org> | 2010-12-15 09:30:48 +0000 |
commit | 183f3ad98fbbe6439947b4569d934b5b8a54c9f7 (patch) | |
tree | f26fa3ab781c96b96c10548573066cd6a86cacaa | |
parent | af5ec5fd1185cc5dc12c19157dd240af2dfb0156 (diff) |
contact-view: animate the showing and hiding of the actions
Signed-off-by: Jonny Lamb <jonnylamb@gnome.org>
-rw-r--r-- | liszt/contact-view.c | 48 |
1 files changed, 47 insertions, 1 deletions
diff --git a/liszt/contact-view.c b/liszt/contact-view.c index 968027910..21ed0fd38 100644 --- a/liszt/contact-view.c +++ b/liszt/contact-view.c @@ -475,6 +475,48 @@ lol_contact_view_new (void) NULL); } +static gboolean +selected_timeout_add (gpointer data) +{ + LolContactView *self = data; + LolContactViewPrivate *priv = self->priv; + gfloat to_add = 3.2; + gfloat height; + + height = clutter_actor_get_height (priv->actions) + to_add; + + clutter_actor_set_height (priv->actions, height); + + if (height >= 32.0) + return FALSE; + + return TRUE; +} + +static gboolean +selected_timeout_subtract (gpointer data) +{ + LolContactView *self = data; + LolContactViewPrivate *priv = self->priv; + gfloat to_sub = 3.2; + gfloat height; + + height = clutter_actor_get_height (priv->actions) - to_sub; + + if (height <= 0) + height = 0.0; + + clutter_actor_set_height (priv->actions, height); + + if (height == 0.0) + { + clutter_actor_hide (priv->actions); + return FALSE; + } + + return TRUE; +} + void lol_contact_view_toggle_selected (LolContactView *self) { @@ -490,12 +532,16 @@ lol_contact_view_toggle_selected (LolContactView *self) clutter_box_set_color (CLUTTER_BOX (self), &blue); clutter_actor_show (priv->actions); clutter_text_set_color (CLUTTER_TEXT (priv->name_text), &white); + + clutter_actor_set_height (priv->actions, 0); + g_timeout_add (10, selected_timeout_add, self); } else { clutter_box_set_color (CLUTTER_BOX (self), &white); - clutter_actor_hide (priv->actions); clutter_text_set_color (CLUTTER_TEXT (priv->name_text), &black); + + g_timeout_add (10, selected_timeout_subtract, self); } g_signal_emit (self, signals[SELECTED], 0, priv->selected); |