diff options
author | Srinivasa Ragavan <sragavan@gnome.org> | 2010-07-20 00:21:19 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2010-07-26 09:30:01 +0800 |
commit | acd24acae600973b7aa2345d46c494a9c44244f8 (patch) | |
tree | b245e477fe53c366c632a74d84332d476b1863f3 /mail/message-list.c | |
parent | fa7a4af975007fe0c964f12e5138b869ba26faef (diff) | |
download | gsoc2013-evolution-acd24acae600973b7aa2345d46c494a9c44244f8.tar.gz gsoc2013-evolution-acd24acae600973b7aa2345d46c494a9c44244f8.tar.zst gsoc2013-evolution-acd24acae600973b7aa2345d46c494a9c44244f8.zip |
Add animations for selecting mail and search.
Diffstat (limited to 'mail/message-list.c')
-rw-r--r-- | mail/message-list.c | 98 |
1 files changed, 98 insertions, 0 deletions
diff --git a/mail/message-list.c b/mail/message-list.c index f88f08bc37..f19754a1fe 100644 --- a/mail/message-list.c +++ b/mail/message-list.c @@ -68,6 +68,12 @@ #include "mail-tools.h" #include "message-list.h" +#if HAVE_CLUTTER +#include <clutter/clutter.h> +#include <mx/mx.h> +#include <clutter-gtk/clutter-gtk.h> +#endif + /*#define TIMEIT */ #ifdef TIMEIT @@ -120,6 +126,11 @@ struct _MessageListPrivate { const gchar *newest_read_uid; time_t oldest_unread_date; const gchar *oldest_unread_uid; + +#if HAVE_CLUTTER + ClutterActor *search_texture; + ClutterTimeline *timeline; +#endif }; enum { @@ -2367,6 +2378,11 @@ message_list_init (MessageList *message_list) message_list->priv = MESSAGE_LIST_GET_PRIVATE (message_list); +#if HAVE_CLUTTER + message_list->priv->timeline = NULL; + message_list->priv->search_texture = NULL; +#endif + message_list->normalised_hash = g_hash_table_new_full ( g_str_hash, g_str_equal, (GDestroyNotify) NULL, @@ -4104,9 +4120,72 @@ message_list_set_hidedeleted (MessageList *ml, gboolean hidedeleted) } } +#if HAVE_CLUTTER +static void +on_timeline_started (ClutterTimeline *timeline, ClutterActor *actor) +{ + clutter_actor_show(actor); +} + +static void +on_timeline_stopped (ClutterTimeline *timeline, ClutterActor *actor) +{ + clutter_actor_hide(actor); +} +#endif + void message_list_set_search (MessageList *ml, const gchar *search) { +#if HAVE_CLUTTER + if (ml->priv->timeline == NULL) { + ClutterActor *stage = g_object_get_data ((GObject *)ml, "stage"); + + if (stage) { + ClutterActor *texture = NULL; + ClutterPath *path; + ClutterBehaviour *behaviour; + ClutterAlpha *alpha; + GtkIconInfo *info; + + info = gtk_icon_theme_lookup_icon (gtk_icon_theme_get_default(), + "system-search", + 72, + GTK_ICON_LOOKUP_NO_SVG); + + if (info) { + texture = clutter_texture_new_from_file (gtk_icon_info_get_filename(info), NULL); + gtk_icon_info_free(info); + } + clutter_container_add_actor ((ClutterContainer *)stage, texture); + ml->priv->search_texture = texture; + + ml->priv->timeline = clutter_timeline_new (2 * 1000); + alpha = clutter_alpha_new_full (ml->priv->timeline, CLUTTER_LINEAR); + path = clutter_path_new(); + behaviour = clutter_behaviour_path_new (alpha, path); + clutter_actor_hide (texture); + clutter_path_clear (path); + clutter_path_add_move_to (path, 100, 50); + clutter_path_add_line_to (path, 200, 50); + clutter_path_add_line_to (path, 200, 100); + clutter_path_add_line_to (path, 100, 100); + clutter_path_add_line_to (path, 100, 50); + + clutter_behaviour_apply (behaviour, texture); + clutter_timeline_set_loop (ml->priv->timeline, TRUE); + + g_signal_connect(ml->priv->timeline, "started", G_CALLBACK(on_timeline_started), texture); + g_signal_connect(ml->priv->timeline, "paused", G_CALLBACK(on_timeline_stopped), texture); + //g_signal_connect(ml->priv->timeline, "completed", G_CALLBACK(on_timeline_stopped), texture); + + clutter_timeline_pause (ml->priv->timeline); + clutter_timeline_stop (ml->priv->timeline); + + } + } +#endif + if (search == NULL || search[0] == '\0') if (ml->search == NULL || ml->search[0] == '\0') return; @@ -4119,6 +4198,10 @@ message_list_set_search (MessageList *ml, const gchar *search) ml->thread_tree = NULL; } +#if HAVE_CLUTTER + clutter_timeline_start (ml->priv->timeline); +#endif + if (ml->frozen == 0) mail_regen_list (ml, search, NULL, NULL); else { @@ -4568,6 +4651,21 @@ regen_list_done (struct _regen_list_msg *m) g_signal_emit (m->ml, message_list_signals[MESSAGE_LIST_BUILT], 0); m->ml->priv->any_row_changed = FALSE; + +#if HAVE_CLUTTER + if (clutter_timeline_is_playing(m->ml->priv->timeline)) { + clutter_timeline_stop (m->ml->priv->timeline); + } else { + ClutterActor *pane = g_object_get_data ((GObject *)m->ml, "actor"); + + if (pane) { + clutter_actor_set_opacity (pane, 0); + clutter_actor_animate (pane, CLUTTER_EASE_OUT_SINE, 150, + "opacity", 255, + NULL); + } + } +#endif } static void |