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 | |
parent | fa7a4af975007fe0c964f12e5138b869ba26faef (diff) | |
download | gsoc2013-evolution-acd24acae600973b7aa2345d46c494a9c44244f8.tar gsoc2013-evolution-acd24acae600973b7aa2345d46c494a9c44244f8.tar.gz gsoc2013-evolution-acd24acae600973b7aa2345d46c494a9c44244f8.tar.bz2 gsoc2013-evolution-acd24acae600973b7aa2345d46c494a9c44244f8.tar.lz gsoc2013-evolution-acd24acae600973b7aa2345d46c494a9c44244f8.tar.xz gsoc2013-evolution-acd24acae600973b7aa2345d46c494a9c44244f8.tar.zst gsoc2013-evolution-acd24acae600973b7aa2345d46c494a9c44244f8.zip |
Add animations for selecting mail and search.
-rw-r--r-- | mail/e-mail-notebook-view.c | 16 | ||||
-rw-r--r-- | mail/e-mail-paned-view.c | 28 | ||||
-rw-r--r-- | mail/e-mail-paned-view.h | 2 | ||||
-rw-r--r-- | mail/message-list.c | 98 |
4 files changed, 141 insertions, 3 deletions
diff --git a/mail/e-mail-notebook-view.c b/mail/e-mail-notebook-view.c index 9d13bb11de..34ebd1d7b7 100644 --- a/mail/e-mail-notebook-view.c +++ b/mail/e-mail-notebook-view.c @@ -739,6 +739,7 @@ mail_netbook_view_open_mail (EMailView *view, const char *uid, EMailNotebookView int page; EMailNotebookViewPrivate *priv = E_MAIL_NOTEBOOK_VIEW (nview)->priv; CamelMessageInfo *info; + GtkWidget *preview; #if HAVE_CLUTTER EMailTab *tab; ClutterActor *clone; @@ -751,6 +752,8 @@ mail_netbook_view_open_mail (EMailView *view, const char *uid, EMailNotebookView pane = e_mail_message_pane_new (E_MAIL_VIEW(nview)->content); priv->current_view = (EMailView *)pane; gtk_widget_show (pane); + + preview = e_mail_paned_view_get_preview (E_MAIL_PANED_VIEW(pane)); folder = e_mail_reader_get_folder (E_MAIL_READER(view)); folder_uri = e_mail_reader_get_folder_uri (E_MAIL_READER(view)); @@ -764,6 +767,9 @@ mail_netbook_view_open_mail (EMailView *view, const char *uid, EMailNotebookView #if HAVE_CLUTTER mnv_set_current_tab (nview, page); + g_object_set_data ((GObject *)priv->current_view, "stage", priv->stage); + g_object_set_data ((GObject *)preview, "stage", priv->stage); + g_object_set_data ((GObject *)preview, "actor", priv->actor); #else gtk_notebook_set_current_page (priv->book, page); #endif @@ -857,7 +863,8 @@ mail_notebook_view_set_folder (EMailReader *reader, if (folder || folder_uri) { int page; - + GtkWidget *list; + if (priv->inited) { priv->current_view = (EMailView *)e_mail_folder_pane_new (E_MAIL_VIEW(reader)->content); gtk_widget_show ((GtkWidget *)priv->current_view); @@ -920,10 +927,15 @@ mail_notebook_view_set_folder (EMailReader *reader, e_mail_tab_set_text ((EMailTab *)clone, camel_folder_get_full_name(folder)); #endif } - + + list = e_mail_reader_get_message_list (E_MAIL_READER(priv->current_view)); #if HAVE_CLUTTER g_signal_connect (tab , "closed", G_CALLBACK (mnv_tab_closed), reader); + g_object_set_data ((GObject *)priv->current_view, "stage", priv->stage); + g_object_set_data ((GObject *)list, "stage", priv->stage); + g_object_set_data ((GObject *)list, "actor", priv->actor); + #endif e_mail_reader_set_folder (E_MAIL_READER(priv->current_view), folder, folder_uri); g_hash_table_insert (priv->views, g_strdup(folder_uri), priv->current_view); diff --git a/mail/e-mail-paned-view.c b/mail/e-mail-paned-view.c index 67268df399..57f0c00704 100644 --- a/mail/e-mail-paned-view.c +++ b/mail/e-mail-paned-view.c @@ -48,6 +48,11 @@ #include "message-list.h" #include "e-mail-reader-utils.h" +#if HAVE_CLUTTER +#include <clutter/clutter.h> +#include <mx/mx.h> +#include <clutter-gtk/clutter-gtk.h> +#endif #define E_SHELL_WINDOW_ACTION_GROUP_MAIL(window) \ E_SHELL_WINDOW_ACTION_GROUP ((window), "mail") @@ -57,6 +62,7 @@ struct _EMailPanedViewPrivate { GtkWidget *scrolled_window; GtkWidget *message_list; GtkWidget *search_bar; + GtkWidget *preview; EMFormatHTMLDisplay *formatter; GalViewInstance *view_instance; @@ -178,7 +184,9 @@ mail_paned_view_message_selected_cb (EMailPanedView *view, const gchar *folder_uri; const gchar *key; gchar *group_name; - +#if HAVE_CLUTTER + ClutterActor *actor = g_object_get_data ((GObject *)view->priv->preview, "actor"); +#endif folder_uri = message_list->folder_uri; /* This also gets triggered when selecting a store name on @@ -201,6 +209,17 @@ mail_paned_view_message_selected_cb (EMailPanedView *view, e_shell_view_set_state_dirty (shell_view); g_free (group_name); + +#if HAVE_CLUTTER + if (actor) { + clutter_actor_set_opacity (actor, 0); + clutter_actor_animate (actor, CLUTTER_EASE_OUT_SINE, 150, + "opacity", 255, + NULL); + } + +#endif + } static void @@ -632,6 +651,7 @@ mail_paned_view_constructed (GObject *object) gtk_widget_show (GTK_WIDGET (web_view)); widget = e_preview_pane_new (web_view); + priv->preview = widget; gtk_paned_pack2 (GTK_PANED (container), widget, FALSE, FALSE); gtk_widget_show (widget); @@ -1114,3 +1134,9 @@ e_mail_paned_view_hide_message_list_pane (EMailPanedView *view, gtk_widget_hide (priv->scrolled_window); } + +GtkWidget * +e_mail_paned_view_get_preview (EMailPanedView *view) +{ + return view->priv->preview; +} diff --git a/mail/e-mail-paned-view.h b/mail/e-mail-paned-view.h index 4b3f3a1482..8cb5a0e561 100644 --- a/mail/e-mail-paned-view.h +++ b/mail/e-mail-paned-view.h @@ -88,5 +88,7 @@ e_mail_paned_view_get_orientation (EMailPanedView *view); void e_mail_paned_view_hide_message_list_pane (EMailPanedView *view, gboolean visible); +GtkWidget * +e_mail_paned_view_get_preview (EMailPanedView *view); #endif 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 |