diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2012-08-11 20:35:00 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2012-08-11 20:40:34 +0800 |
commit | fc30659d1b22894638f34b558c55cd8435106e75 (patch) | |
tree | 5481e43201f7adc94dbd7cab7b3d480d5db23a96 | |
parent | 40187cd30a715c428cfa6087c6e3df9fb7159372 (diff) | |
download | gsoc2013-evolution-fc30659d1b22894638f34b558c55cd8435106e75.tar.gz gsoc2013-evolution-fc30659d1b22894638f34b558c55cd8435106e75.tar.zst gsoc2013-evolution-fc30659d1b22894638f34b558c55cd8435106e75.zip |
express: Remove clutter-based email tabs.
This was another MeeGo feature. MeeGo is dead, the code is starting to
bit rot and crashes on startup, the original author disappeared and the
remaining developers are not interested in maintaining it. So it's out.
33 files changed, 1 insertions, 4409 deletions
diff --git a/configure.ac b/configure.ac index 27ad00ccaf..13a3021b4e 100644 --- a/configure.ac +++ b/configure.ac @@ -592,27 +592,6 @@ if test x"$have_xfree" = "xyes" ; then fi dnl ************************************************** -dnl Clutter support. -dnl ************************************************** -AC_MSG_CHECKING([whether to build with Clutter]) -AC_ARG_WITH([clutter], - [AC_HELP_STRING([--with-clutter], - [Build with Clutter [default=no]])], - with_clutter="$withval", with_clutter="no") -AC_MSG_RESULT($with_clutter) - -if test "x$with_clutter" = "xyes"; then - PKG_CHECK_MODULES(CLUTTER, [clutter-gtk-1.0 >= clutter_gtk_minimum_version mx-1.0 clutter-1.0 >= 1.0.0]) - - AC_DEFINE(HAVE_CLUTTER, 1, [Clutter available]) - AM_CONDITIONAL(ENABLE_CLUTTER, true) -else - AC_DEFINE(HAVE_CLUTTER, 0, [Clutter not available]) - AM_CONDITIONAL(ENABLE_CLUTTER, false) -fi - - -dnl ************************************************** dnl LDAP support. dnl ************************************************** if test "$os_win32" != yes; then @@ -1275,10 +1254,6 @@ AC_ARG_ENABLE([contact-maps], [enable_contact_maps="$enableval"], [enable_contact_maps="no"]) if test "x$enable_contact_maps" = "xyes"; then - if test "x$with_clutter" = "xno"; then - AC_MSG_ERROR([Clutter is required for maps in contacts. Use --with-clutter=yes to enable clutter.]) - fi - PKG_CHECK_MODULES([CHAMPLAIN], [champlain-gtk-0.12 >= champlain_minimum_version], [have_champlain=yes], [have_champlain=no]) AC_SUBST(CHAMPLAIN_CFLAGS) AC_SUBST(CHAMPLAIN_LIBS) @@ -1593,7 +1568,6 @@ fi echo " LDAP support: $msg_ldap - Clutter support: $with_clutter Contact Maps: $enable_contact_maps GNOME Online Accounts: $enable_goa Libnotify: $HAVE_LIBNOTIFY diff --git a/data/Makefile.am b/data/Makefile.am index 9790533cb2..a107daa950 100644 --- a/data/Makefile.am +++ b/data/Makefile.am @@ -39,30 +39,8 @@ convert_DATA = evolution.convert themedir = $(privdatadir)/theme dist_theme_DATA = \ - default.css \ webview.css \ - webview-print.css \ - tab-bar-background.png \ - tab-switcher.png \ - tab-switcher-hover.png \ - tab-switcher-close.png \ - tab-switcher-close-hover.png \ - tab-inactive-hover.png \ - tab-inactive.png \ - tab-active.png \ - tab-inactive-hover-private.png \ - tab-inactive-private.png \ - tab-active-private.png \ - close-on-tab.png \ - close-on-tab-hover.png \ - preview-tab-inactive.png \ - preview-tab-active.png \ - preview-tab-hover.png \ - preview-tab-inactive-private.png \ - preview-tab-active-private.png \ - preview-tab-hover-private.png \ - tab-add.png \ - tab-add-hover.png + webview-print.css if HAVE_KDE_APPLNK diff --git a/data/close-on-tab-hover.png b/data/close-on-tab-hover.png Binary files differdeleted file mode 100644 index 1d6687d280..0000000000 --- a/data/close-on-tab-hover.png +++ /dev/null diff --git a/data/close-on-tab.png b/data/close-on-tab.png Binary files differdeleted file mode 100644 index be9305fdeb..0000000000 --- a/data/close-on-tab.png +++ /dev/null diff --git a/data/default.css b/data/default.css deleted file mode 100644 index c21d57e5e4..0000000000 --- a/data/default.css +++ /dev/null @@ -1,111 +0,0 @@ -/* Tab picker */ -EMailTabPicker { - border-image: url('tab-bar-background.png') 0 0 5; - padding: 0 0 0 3; -} - -*#chooser-button { - border-image: url('tab-switcher.png') 9 6 5; - padding: 35 34 0 0; -} - -*#chooser-button:hover { - border-image: url('tab-switcher-hover.png') 9 6 5; -} - -*#chooser-close-button { - border-image: url('tab-switcher-close.png') 5 30 0 0; - padding: 32 33 0 0; -} - -*#chooser-close-button:hover { - border-image: url('tab-switcher-close-hover.png') 5 30 0 0; - padding: 32 33 0 0; -} - -*#tab-picker-preview { - padding: 4 0 4 3; -} - -/* Tabs */ -EMailTab:hover { - color: #ffffff; - border-image: url('tab-inactive-hover.png') 12 31 5 9; -} - -EMailTab { - color: #000000; - border-image: url('tab-inactive.png') 12 31 5 9; - padding: 8 10 4 14; -} - -EMailTab:checked, EMailTab:active { - color: #727272; - border-image: url('tab-active.png') 8 31 9 11; - padding: 6 10 6 14; -} - -*#private-tab:hover { - color: #ffffff; - border-image: url('tab-inactive-hover-private.png') 12 31 5 9; -} - -*#private-tab { - color: #000000; - border-image: url('tab-inactive-private.png') 12 31 5 9; - padding: 8 10 4 14; -} - -*#private-tab:checked, *#private-tab:active { - color: #727272; - border-image: url('tab-active-private.png') 8 31 9 11; - padding: 6 10 6 14; -} - -EMailTab MxLabel { - font-size: 13; -} - -*#tab-close-button { - border-image: url('close-on-tab.png') 0; - padding: 19 20 0 0; -} - -*#tab-close-button:hover { - border-image: url('close-on-tab-hover.png') 0; -} - -*#preview-tab { - border-image: url('preview-tab-inactive.png') 10; - padding: 7 10 7 14; -} - -*#preview-tab:checked, *#preview-tab:active { - border-image: url('preview-tab-active.png') 10; -} - -*#preview-tab:hover { - border-image: url('preview-tab-hover.png') 10; -} - -*#private-preview-tab { - border-image: url('preview-tab-inactive-private.png') 10; -} - -*#private-preview-tab:checked, *#private-preview-tab:active { - border-image: url('preview-tab-active-private.png') 10; -} - -*#private-preview-tab:hover { - border-image: url('preview-tab-hover-private.png') 10; -} - -*#new-tab { - border-image: url('tab-add.png') 9 6 5; - padding: 35 34 0 0; -} - -*#new-tab:hover { - border-image: url('tab-add-hover.png') 9 6 5; -} - diff --git a/data/preview-tab-active-private.png b/data/preview-tab-active-private.png Binary files differdeleted file mode 100644 index 53d1bf3c8b..0000000000 --- a/data/preview-tab-active-private.png +++ /dev/null diff --git a/data/preview-tab-active.png b/data/preview-tab-active.png Binary files differdeleted file mode 100644 index 53d1bf3c8b..0000000000 --- a/data/preview-tab-active.png +++ /dev/null diff --git a/data/preview-tab-hover-private.png b/data/preview-tab-hover-private.png Binary files differdeleted file mode 100644 index 9050caef39..0000000000 --- a/data/preview-tab-hover-private.png +++ /dev/null diff --git a/data/preview-tab-hover.png b/data/preview-tab-hover.png Binary files differdeleted file mode 100644 index 9050caef39..0000000000 --- a/data/preview-tab-hover.png +++ /dev/null diff --git a/data/preview-tab-inactive-private.png b/data/preview-tab-inactive-private.png Binary files differdeleted file mode 100644 index 6d9cfccf72..0000000000 --- a/data/preview-tab-inactive-private.png +++ /dev/null diff --git a/data/preview-tab-inactive.png b/data/preview-tab-inactive.png Binary files differdeleted file mode 100644 index 6d9cfccf72..0000000000 --- a/data/preview-tab-inactive.png +++ /dev/null diff --git a/data/tab-active-private.png b/data/tab-active-private.png Binary files differdeleted file mode 100644 index 19b629a9ea..0000000000 --- a/data/tab-active-private.png +++ /dev/null diff --git a/data/tab-active.png b/data/tab-active.png Binary files differdeleted file mode 100644 index d259da30de..0000000000 --- a/data/tab-active.png +++ /dev/null diff --git a/data/tab-add-hover.png b/data/tab-add-hover.png Binary files differdeleted file mode 100644 index dbc64e3b33..0000000000 --- a/data/tab-add-hover.png +++ /dev/null diff --git a/data/tab-add.png b/data/tab-add.png Binary files differdeleted file mode 100644 index 45fecb9041..0000000000 --- a/data/tab-add.png +++ /dev/null diff --git a/data/tab-bar-background.png b/data/tab-bar-background.png Binary files differdeleted file mode 100644 index c0d9085653..0000000000 --- a/data/tab-bar-background.png +++ /dev/null diff --git a/data/tab-inactive-hover-private.png b/data/tab-inactive-hover-private.png Binary files differdeleted file mode 100644 index 2736ca9ce1..0000000000 --- a/data/tab-inactive-hover-private.png +++ /dev/null diff --git a/data/tab-inactive-hover.png b/data/tab-inactive-hover.png Binary files differdeleted file mode 100644 index 2070661e95..0000000000 --- a/data/tab-inactive-hover.png +++ /dev/null diff --git a/data/tab-inactive-private.png b/data/tab-inactive-private.png Binary files differdeleted file mode 100644 index 14f9a6ecad..0000000000 --- a/data/tab-inactive-private.png +++ /dev/null diff --git a/data/tab-inactive.png b/data/tab-inactive.png Binary files differdeleted file mode 100644 index 1b21a1c1be..0000000000 --- a/data/tab-inactive.png +++ /dev/null diff --git a/data/tab-switcher-close-hover.png b/data/tab-switcher-close-hover.png Binary files differdeleted file mode 100644 index 58705ef973..0000000000 --- a/data/tab-switcher-close-hover.png +++ /dev/null diff --git a/data/tab-switcher-close.png b/data/tab-switcher-close.png Binary files differdeleted file mode 100644 index 8230319246..0000000000 --- a/data/tab-switcher-close.png +++ /dev/null diff --git a/data/tab-switcher-hover.png b/data/tab-switcher-hover.png Binary files differdeleted file mode 100644 index 4c1d88db8c..0000000000 --- a/data/tab-switcher-hover.png +++ /dev/null diff --git a/data/tab-switcher.png b/data/tab-switcher.png Binary files differdeleted file mode 100644 index e5d06b193e..0000000000 --- a/data/tab-switcher.png +++ /dev/null diff --git a/mail/Makefile.am b/mail/Makefile.am index 3cc30971f7..1995e642d7 100644 --- a/mail/Makefile.am +++ b/mail/Makefile.am @@ -112,13 +112,6 @@ mailinclude_HEADERS = \ mail-vfolder-ui.h \ message-list.h -if ENABLE_CLUTTER -mailinclude_HEADERS += \ - e-mail-tab.h \ - e-mail-tab-picker.h - -endif - libevolution_mail_la_SOURCES = \ e-http-request.c \ e-mail-account-manager.c \ @@ -193,12 +186,6 @@ libevolution_mail_la_SOURCES = \ mail-vfolder-ui.c \ message-list.c -if ENABLE_CLUTTER -libevolution_mail_la_SOURCES += \ - e-mail-tab.c \ - e-mail-tab-picker.c -endif - if ENABLE_SMIME SMIME_LIBS = \ $(top_builddir)/smime/lib/libessmime.la \ diff --git a/mail/e-mail-notebook-view.c b/mail/e-mail-notebook-view.c index 86b47f6b92..28e10dd3b2 100644 --- a/mail/e-mail-notebook-view.c +++ b/mail/e-mail-notebook-view.c @@ -36,15 +36,6 @@ #include <shell/e-shell-window-actions.h> -#if HAVE_CLUTTER -#include <clutter/clutter.h> -#include <mx/mx.h> -#include <clutter-gtk/clutter-gtk.h> -#include <math.h> - -#include "e-mail-tab-picker.h" -#endif - #define E_MAIL_NOTEBOOK_VIEW_GET_PRIVATE(obj) \ (G_TYPE_INSTANCE_GET_PRIVATE \ ((obj), E_TYPE_MAIL_NOTEBOOK_VIEW, EMailNotebookViewPrivate)) @@ -54,13 +45,6 @@ struct _EMailNotebookViewPrivate { EMailView *current_view; GHashTable *views; gboolean inited; - -#if HAVE_CLUTTER - EMailTabPicker *tab_picker; - GtkWidget *embed; - ClutterActor *actor; - ClutterActor *stage; -#endif }; enum { @@ -83,20 +67,6 @@ G_DEFINE_TYPE_WITH_CODE ( G_IMPLEMENT_INTERFACE ( E_TYPE_EXTENSIBLE, NULL)) -#if HAVE_CLUTTER -static void -mnv_set_current_tab (EMailNotebookView *view, - gint page) -{ - clutter_actor_set_opacity (view->priv->actor, 0); - gtk_notebook_set_current_page (view->priv->book, page); - - clutter_actor_animate ( - (ClutterActor *) view->priv->actor, - CLUTTER_EASE_IN_SINE, 500, "opacity", 255, NULL); -} -#endif - static gint emnv_get_page_num (EMailNotebookView *view, GtkWidget *widget) @@ -162,188 +132,6 @@ mnv_page_changed (GtkNotebook *book, g_object_unref (folder_tree); } -#if HAVE_CLUTTER -static void -fix_tab_picker_width (GtkWidget *widget, - GtkAllocation *allocation, - ClutterActor *actor) -{ - ClutterActor *stage = g_object_get_data ((GObject *)actor, "stage"); - - clutter_actor_set_size (actor, allocation->width - 1, -1); - clutter_actor_set_size (stage, allocation->width - 1, -1); -} - -static void -fix_height_cb (ClutterActor *actor, - GParamSpec *pspec, - ClutterActor *table) -{ - GtkWidget *embed = (GtkWidget *)g_object_get_data ((GObject *)actor, "embed"); - ClutterActor *stage = g_object_get_data ((GObject *)actor, "stage"); - - clutter_actor_set_height (stage, clutter_actor_get_height (actor)); - gtk_widget_set_size_request (embed, -1, (gint) clutter_actor_get_height (actor)); -} - -static void -chooser_clicked_cb (EMailTabPicker *picker, - EMailNotebookView *view) -{ - EMailNotebookViewPrivate *priv; - - gboolean preview_mode; - - priv = view->priv; - preview_mode = !e_mail_tab_picker_get_preview_mode (priv->tab_picker); - - e_mail_tab_picker_set_preview_mode (priv->tab_picker , preview_mode); -} - -static void -tab_picker_preview_mode_notify (EMailTabPicker *picker, - GParamSpec *pspec, - EMailNotebookView *view) -{ - GList *tabs, *t; - gboolean preview_mode = e_mail_tab_picker_get_preview_mode (picker); - - clutter_actor_set_name ( - CLUTTER_ACTOR (picker), - preview_mode ? "tab-picker-preview" : NULL); - - tabs = e_mail_tab_picker_get_tabs (picker); - for (t = tabs; t; t = t->next) { - EMailTab *tab; - ClutterActor *preview; - tab = E_MAIL_TAB (t->data); - - preview = e_mail_tab_get_preview_actor (tab); - - if (!preview) - continue; - - if (preview_mode) { - /* Show all pages so that the preview clones work correctly */ - clutter_actor_set_opacity (preview, 255); - clutter_actor_show (preview); - } else { - clutter_actor_hide (preview); - } - } - g_list_free (tabs); -} - -static void -mnv_tab_anim_frame_cb (ClutterTimeline *timeline, - gint frame_num, - EMailTab *tab) -{ - if (!clutter_actor_get_parent (CLUTTER_ACTOR (tab))) { - clutter_timeline_stop (timeline); - g_object_unref (timeline); - g_object_unref (tab); - - return; - } - - e_mail_tab_set_width (tab, 200 * clutter_timeline_get_progress (timeline)); -} - -static void -mnv_tab_anim_complete_cb (ClutterTimeline *timeline, - EMailTab *tab) -{ - e_mail_tab_set_width (tab, 200); - g_object_unref (tab); - g_object_unref (timeline); -} - -struct _tab_data { - gboolean select; - EMailNotebookView *view; - EMailTab *tab; -}; - -static void -mnv_tab_closed_cb (ClutterTimeline *timeline, - struct _tab_data *data) -{ - EMailView *page = g_object_get_data ((GObject *)data->tab, "page"); - EMailView *prev; - gint num; - - if (E_IS_MAIL_FOLDER_PANE (page)) { - CamelFolder *folder; - gchar *folder_uri; - - folder = e_mail_reader_get_folder (E_MAIL_READER (page)); - folder_uri = e_mail_folder_uri_from_folder (folder); - g_hash_table_remove (data->view->priv->views, folder_uri); - g_free (folder_uri); - } - - prev = e_mail_view_get_previous_view (page); - if (prev) { - num = emnv_get_page_num (data->view, (GtkWidget *) prev); - mnv_set_current_tab (data->view, num); - e_mail_tab_picker_set_current_tab (data->view->priv->tab_picker, num); - } - - e_mail_tab_picker_remove_tab (data->view->priv->tab_picker, data->tab); - gtk_notebook_remove_page (data->view->priv->book, - gtk_notebook_page_num (data->view->priv->book, (GtkWidget *) page)); - -} - -static void -mnv_tab_closed (EMailTab *tab, - EMailNotebookView *view) -{ - EMailNotebookViewPrivate *priv = view->priv; - gint page, cur; - gboolean select = FALSE; - ClutterTimeline *timeline; - struct _tab_data *data = g_new0 (struct _tab_data, 1); - - if (e_mail_tab_picker_get_n_tabs (priv->tab_picker) == 1) - return; - - page = e_mail_tab_picker_get_tab_no (priv->tab_picker, - tab); - cur = e_mail_tab_picker_get_current_tab (priv->tab_picker); - - if (cur == page) - select = TRUE; - - data->select = select; - data->tab = tab; - data->view = view; - - clutter_actor_set_reactive (CLUTTER_ACTOR (tab), FALSE); - timeline = clutter_timeline_new (150); - clutter_timeline_set_direction (timeline, CLUTTER_TIMELINE_BACKWARD); - g_signal_connect ( - timeline, "new-frame", - G_CALLBACK (mnv_tab_anim_frame_cb), tab); - g_signal_connect ( - timeline, "completed", - G_CALLBACK (mnv_tab_closed_cb), data); - clutter_timeline_start (timeline); -} - -static void -tab_activated_cb (EMailTabPicker *picker, - EMailTab *tab, - EMailNotebookView *view) -{ - EMailView *page = g_object_get_data ((GObject *)tab, "page"); - gint num = emnv_get_page_num (view, (GtkWidget *) page); - - mnv_set_current_tab (view, num); -} -#endif - static void tab_remove_gtk_cb (GtkWidget *button, EMailNotebookView *view) @@ -448,67 +236,6 @@ create_tab_label (EMailNotebookView *view, return container; } -#if HAVE_CLUTTER - -static ClutterActor * -create_gtk_actor (GtkWidget *vbox) -{ - GtkWidget *bin; - ClutterActor *gtk_actor; - - gtk_actor = gtk_clutter_actor_new (); - bin = gtk_clutter_actor_get_widget (GTK_CLUTTER_ACTOR (gtk_actor)); - - gtk_container_add (GTK_CONTAINER (bin), vbox); - - gtk_widget_show (bin); - gtk_widget_show (vbox); - return gtk_actor; -} - -static void -fix_clutter_embed_width (GtkWidget *widget, - GtkAllocation *allocation, - ClutterActor *actor) -{ - GtkWidget *embed = (GtkWidget *)g_object_get_data ((GObject *)actor, "embed"); - GtkAllocation galoc; - - gtk_widget_get_allocation (embed, &galoc); - clutter_actor_set_size (actor, allocation->width - 1, galoc.height); -} - -static GtkWidget * -create_under_clutter (GtkWidget *widget, - GtkWidget *paned) -{ - GtkWidget *embed; - ClutterActor *stage, *actor; - - embed = gtk_clutter_embed_new (); - gtk_widget_show (embed); - - actor = create_gtk_actor (widget); - clutter_actor_show (actor); - stage = gtk_clutter_embed_get_stage ((GtkClutterEmbed *) embed); - clutter_container_add_actor ((ClutterContainer *) stage, actor); - - g_object_set_data ((GObject *)actor, "embed", embed); - g_object_set_data ((GObject *)actor, "stage", stage); - g_object_set_data ((GObject *)actor, "widget", widget); - g_object_set_data ((GObject *)widget, "actor", actor); - g_object_set_data ((GObject *)embed, "actor", actor); - - g_signal_connect ( - paned, "size-allocate", - G_CALLBACK (fix_clutter_embed_width), actor); - clutter_actor_show (stage); - - return embed; -} - -#endif - static void mail_notebook_view_constructed (GObject *object) { @@ -516,103 +243,17 @@ mail_notebook_view_constructed (GObject *object) EShellView *shell_view; GtkWidget *container; GtkWidget *widget; -#if HAVE_CLUTTER - EMailTab *tab; - ClutterActor *stage, *clone; - ClutterTimeline *timeline; -#endif priv = E_MAIL_NOTEBOOK_VIEW_GET_PRIVATE (object); container = GTK_WIDGET (object); -#if HAVE_CLUTTER - widget = gtk_clutter_embed_new (); - gtk_widget_show (widget); - gtk_box_pack_start (GTK_BOX (container), widget, FALSE, FALSE, 0); - - stage = gtk_clutter_embed_get_stage ((GtkClutterEmbed *) widget); - clutter_actor_show (stage); - clutter_actor_set_reactive (stage, TRUE); - - priv->tab_picker = (EMailTabPicker *) e_mail_tab_picker_new (); - clutter_actor_show ((ClutterActor *) priv->tab_picker); - g_signal_connect ( - priv->tab_picker, "tab-activated", - G_CALLBACK (tab_activated_cb), object); - g_signal_connect ( - priv->tab_picker, "chooser-clicked", - G_CALLBACK (chooser_clicked_cb), object); - g_signal_connect ( - priv->tab_picker, "notify::preview-mode", - G_CALLBACK (tab_picker_preview_mode_notify), object); - g_signal_connect ( - priv->tab_picker, "notify::height", - G_CALLBACK (fix_height_cb), widget); - - clutter_container_add_actor ( - (ClutterContainer *) stage, - (ClutterActor *) priv->tab_picker); - - e_mail_tab_picker_enable_drop (priv->tab_picker, TRUE); - - g_object_set_data ((GObject *)priv->tab_picker, "embed", widget); - g_object_set_data ((GObject *)priv->tab_picker, "stage", stage); - - g_signal_connect ( - object, "size-allocate", - G_CALLBACK (fix_tab_picker_width), priv->tab_picker); - - clutter_actor_set_height ( - stage, clutter_actor_get_height ( - (ClutterActor *) priv->tab_picker)); - gtk_widget_set_size_request ( - widget, -1, (gint) clutter_actor_get_height ( - (ClutterActor *) priv->tab_picker)); - - tab = (EMailTab *) e_mail_tab_new_full ("", NULL, 1); - clone = e_mail_tab_new_full ("", NULL, 200); - - e_mail_tab_set_can_close ((EMailTab *) clone, FALSE); - clutter_actor_set_reactive (clone, FALSE); - clutter_actor_show (clone); - - e_mail_tab_set_preview_actor ((EMailTab *) tab, clone); - e_mail_tab_set_can_close (tab, TRUE); - - e_mail_tab_picker_add_tab (priv->tab_picker, tab, -1); - clutter_actor_show ((ClutterActor *) tab); - e_mail_tab_picker_set_current_tab (priv->tab_picker, 0); - e_mail_tab_enable_drag (tab, TRUE); - - g_object_ref (tab); - timeline = clutter_timeline_new (150); - g_signal_connect ( - timeline, "new-frame", - G_CALLBACK (mnv_tab_anim_frame_cb), tab); - g_signal_connect ( - timeline, "completed", - G_CALLBACK (mnv_tab_anim_complete_cb), tab); - clutter_timeline_start (timeline); -#endif - widget = gtk_notebook_new (); priv->book = (GtkNotebook *) widget; gtk_widget_show (widget); -#if HAVE_CLUTTER - priv->embed = create_under_clutter (widget, container); - gtk_box_pack_start (GTK_BOX (container), priv->embed, TRUE, TRUE, 0); - priv->actor = g_object_get_data((GObject *)priv->embed, "actor"); - priv->stage = g_object_get_data((GObject *)priv->actor, "stage"); -#else gtk_box_pack_start (GTK_BOX (container), widget, TRUE, TRUE, 0); -#endif -#if HAVE_CLUTTER - gtk_notebook_set_show_tabs ((GtkNotebook *) widget, FALSE); -#else gtk_notebook_set_scrollable ((GtkNotebook *) widget, TRUE); -#endif gtk_notebook_set_show_border ((GtkNotebook *) widget, FALSE); @@ -1022,21 +663,8 @@ mail_netbook_view_open_mail (EMailView *view, CamelMessageInfo *info; gint pos; -#if HAVE_CLUTTER - EMailTab *tab; - ClutterActor *clone; - ClutterTimeline *timeline; - GtkWidget *mlist; -#endif - priv = nview->priv; -#if HAVE_CLUTTER - e_mail_tab_set_active ( - e_mail_tab_picker_get_tab (priv->tab_picker, - e_mail_tab_picker_get_current_tab (priv->tab_picker)), FALSE); -#endif - shell_view = e_mail_view_get_shell_view (E_MAIL_VIEW (nview)); pos = emnv_get_page_num (nview, GTK_WIDGET (priv->current_view)); pane = e_mail_message_pane_new (shell_view); @@ -1055,50 +683,7 @@ mail_netbook_view_open_mail (EMailView *view, create_tab_label (nview, priv->current_view, camel_message_info_subject (info)), pos + 1); -#if HAVE_CLUTTER - mlist = e_mail_reader_get_message_list (E_MAIL_READER (pane)); - mnv_set_current_tab (nview, page); - g_object_set_data ((GObject *)priv->current_view, "stage", priv->stage); - g_object_set_data ((GObject *)mlist, "stage", priv->stage); - g_object_set_data ((GObject *)mlist, "preview-actor", priv->actor); -#else gtk_notebook_set_current_page (priv->book, page); -#endif - -#if HAVE_CLUTTER - tab = (EMailTab *) e_mail_tab_new_full ( - camel_message_info_subject (info), NULL, 1); - g_object_set_data ((GObject *)tab, "page", pane); - g_object_set_data ((GObject *)pane, "tab", tab); - - clutter_actor_show ((ClutterActor *) tab); - - clone = e_mail_tab_new_full (camel_message_info_subject (info), NULL, 200); - clutter_actor_set_reactive (clone, FALSE); - clutter_actor_show (clone); - - e_mail_tab_set_preview_actor (tab, clone); - e_mail_tab_set_can_close (tab, TRUE); - e_mail_tab_picker_add_tab (priv->tab_picker, tab, pos + 1); - e_mail_tab_enable_drag (tab, TRUE); - - page = e_mail_tab_picker_get_tab_no (priv->tab_picker, tab); - e_mail_tab_picker_set_current_tab (priv->tab_picker, page); - - g_signal_connect ( - tab , "closed", - G_CALLBACK (mnv_tab_closed), nview); - - g_object_ref (tab); - timeline = clutter_timeline_new (150); - g_signal_connect ( - timeline, "new-frame", - G_CALLBACK (mnv_tab_anim_frame_cb), tab); - g_signal_connect ( - timeline, "completed", - G_CALLBACK (mnv_tab_anim_complete_cb), tab); - clutter_timeline_start (timeline); -#endif g_signal_connect ( E_MAIL_READER(pane), "changed", @@ -1117,89 +702,6 @@ mail_netbook_view_open_mail (EMailView *view, camel_message_info_free (info); } -#if HAVE_CLUTTER -static ClutterActor * -build_histogram (GtkWidget *widget, - CamelFolder *folder) -{ - gint week_time = 60 * 60 * 24 * 7; - gint weeks[54]; - gint i; - GPtrArray *uids; - gint max = 1; - ClutterActor *texture; - cairo_t *cr; - gfloat ratio; - gint x = 0; - time_t now = time (NULL); - - for (i = 0; i < 54; i++) - weeks[i] = 0; - - uids = camel_folder_get_uids (folder); - camel_folder_summary_prepare_fetch_all (folder->summary, NULL); - for (i = 0; i < uids->len; i++) { - CamelMessageInfo *info; - - info = camel_folder_get_message_info (folder, uids->pdata[i]); - if (info) { - time_t dreceived = now - camel_message_info_date_received (info); - gint week; - - week = (dreceived / week_time) - 1; - if (week > 52) - weeks[53]++; - else - weeks[week]++; - - camel_message_info_free (info); - } - } - - for (i = 0; i< 53; i++) { - if (weeks[i] > max) - max = weeks[i]; - } - - ratio = 50.0 / max; - - camel_folder_free_uids (folder, uids); - - texture = clutter_cairo_texture_new (200, 50); - clutter_actor_set_size (texture, 200, 50); - cr = clutter_cairo_texture_create (CLUTTER_CAIRO_TEXTURE (texture)); - - clutter_actor_show_all (texture); - - cairo_save (cr); - cairo_new_path (cr); - cairo_move_to (cr, x, 50 - (weeks[52] * ratio)); - - cairo_set_source_rgba (cr, 0.3, 0.2, 0.4, 1.0); - - for (i = 51; i >= 0; i--) { - x+=3; - cairo_line_to (cr, x, 50 - (weeks[i]*ratio)); - - } - - cairo_stroke (cr); - cairo_restore (cr); - - cairo_save (cr); - - cairo_set_source_rgba (cr, 0.8, 0.5, 0.3, 1.0); - cairo_arc (cr, x, 50 - (weeks[0] * ratio), 3, 0, 2 *M_PI); - - cairo_fill (cr); - cairo_restore (cr); - - cairo_destroy (cr); - - return texture; -} -#endif - static void mail_notebook_view_set_folder (EMailReader *reader, CamelFolder *folder) @@ -1207,11 +709,6 @@ mail_notebook_view_set_folder (EMailReader *reader, EMailNotebookViewPrivate *priv; GtkWidget *new_view; gchar *folder_uri; -#if HAVE_CLUTTER - EMailTab *tab; - ClutterActor *clone; - ClutterTimeline *timeline; -#endif if (folder == NULL) return; @@ -1224,38 +721,15 @@ mail_notebook_view_set_folder (EMailReader *reader, if (new_view) { gint curr = emnv_get_page_num (E_MAIL_NOTEBOOK_VIEW (reader), new_view); -#if HAVE_CLUTTER - EMailTab *tab; - - if (curr == e_mail_tab_picker_get_current_tab (priv->tab_picker)) - return; - - e_mail_tab_set_active (e_mail_tab_picker_get_tab (priv->tab_picker, - e_mail_tab_picker_get_current_tab (priv->tab_picker)), - FALSE); -#endif priv->current_view = (EMailView *) new_view; -#if HAVE_CLUTTER - mnv_set_current_tab (E_MAIL_NOTEBOOK_VIEW (reader), curr); -#else gtk_notebook_set_current_page (priv->book, curr); -#endif - -#if HAVE_CLUTTER - tab = (EMailTab *)g_object_get_data ((GObject *)priv->current_view, "page"); - curr = e_mail_tab_picker_get_tab_no (priv->tab_picker, tab); - e_mail_tab_picker_set_current_tab (priv->tab_picker, curr); -#endif return; } /* FIXME Redundant NULL check. */ if (folder != NULL) { gint page; -#if HAVE_CLUTTER - GtkWidget *list; -#endif if (priv->inited) { EMailView *old_view = priv->current_view; @@ -1271,53 +745,8 @@ mail_notebook_view_set_folder (EMailReader *reader, E_MAIL_NOTEBOOK_VIEW (reader), priv->current_view, camel_folder_get_full_name (folder))); -#if HAVE_CLUTTER - mnv_set_current_tab (E_MAIL_NOTEBOOK_VIEW (reader), page); -#else gtk_notebook_set_current_page (priv->book, page); -#endif -#if HAVE_CLUTTER - e_mail_tab_set_active ( - e_mail_tab_picker_get_tab ( - priv->tab_picker, - e_mail_tab_picker_get_current_tab ( - priv->tab_picker)), - FALSE); - - tab = (EMailTab *) e_mail_tab_new_full ( - camel_folder_get_full_name (folder), NULL, 1); - g_object_set_data ((GObject *)tab, "page", priv->current_view); - g_object_set_data ((GObject *)priv->current_view, "page", tab); - g_object_set_data ((GObject *)priv->current_view, "tab", tab); - - clutter_actor_show ((ClutterActor *) tab); - - clone = build_histogram ((GtkWidget *) reader, folder); - clutter_actor_set_reactive (clone, FALSE); - clutter_actor_show (clone); - - e_mail_tab_set_preview_actor (tab, clone); - e_mail_tab_set_can_close (tab, TRUE); - e_mail_tab_set_preview_mode ( - tab, e_mail_tab_picker_get_preview_mode ( - priv->tab_picker)); - - e_mail_tab_picker_add_tab (priv->tab_picker, tab, -1); - page = e_mail_tab_picker_get_tab_no (priv->tab_picker, tab); - e_mail_tab_picker_set_current_tab (priv->tab_picker, page); - - e_mail_tab_enable_drag (tab, TRUE); - g_object_ref (tab); - timeline = clutter_timeline_new (150); - g_signal_connect ( - timeline, "new-frame", - G_CALLBACK (mnv_tab_anim_frame_cb), tab); - g_signal_connect ( - timeline, "completed", - G_CALLBACK (mnv_tab_anim_complete_cb), tab); - clutter_timeline_start (timeline); -#endif } else { priv->inited = TRUE; gtk_notebook_set_tab_label ( @@ -1327,34 +756,8 @@ mail_notebook_view_set_folder (EMailReader *reader, E_MAIL_NOTEBOOK_VIEW (reader), priv->current_view, camel_folder_get_full_name (folder))); - -#if HAVE_CLUTTER - tab = e_mail_tab_picker_get_tab ( - priv->tab_picker, - e_mail_tab_picker_get_current_tab ( - priv->tab_picker)); - g_object_set_data ((GObject *)tab, "page", priv->current_view); - g_object_set_data ((GObject *)priv->current_view, "page", tab); - g_object_set_data ((GObject *)priv->current_view, "tab", tab); - - e_mail_tab_set_text (tab, camel_folder_get_full_name (folder)); - clone = build_histogram ((GtkWidget *) reader, folder); - clutter_actor_set_reactive (clone, FALSE); - clutter_actor_show (clone); - e_mail_tab_set_preview_actor (tab, clone); -#endif } -#if HAVE_CLUTTER - list = e_mail_reader_get_message_list (E_MAIL_READER (priv->current_view)); - 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 = e_mail_folder_uri_from_folder (folder); @@ -1484,12 +887,7 @@ emnv_show_folder (EMailNotebookView *view, view, (GtkWidget *) E_MAIL_MESSAGE_PANE ( priv->current_view)->parent_folder_view); -#if HAVE_CLUTTER - e_mail_tab_picker_set_current_tab (priv->tab_picker, pos); - mnv_set_current_tab (E_MAIL_NOTEBOOK_VIEW (view), pos); -#else gtk_notebook_set_current_page (priv->book, pos); -#endif } @@ -1504,17 +902,9 @@ emnv_show_prevtab (EMailNotebookView *view, view, (GtkWidget *) E_MAIL_MESSAGE_PANE ( priv->current_view)->parent_folder_view); -#if HAVE_CLUTTER - pos = e_mail_tab_picker_get_current_tab (priv->tab_picker); - if (pos > 0) { - e_mail_tab_picker_set_current_tab (priv->tab_picker, pos - 1); - mnv_set_current_tab (E_MAIL_NOTEBOOK_VIEW (view), pos - 1); - } -#else pos = gtk_notebook_get_current_page (priv->book); if (pos > 0 ) gtk_notebook_set_current_page (priv->book, pos - 1); -#endif } @@ -1525,18 +915,9 @@ emnv_show_nexttab (EMailNotebookView *view, gint pos; EMailNotebookViewPrivate *priv = view->priv; -#if HAVE_CLUTTER - pos = e_mail_tab_picker_get_current_tab (priv->tab_picker); - - if (pos < (gtk_notebook_get_n_pages (priv->book) - 1)) { - e_mail_tab_picker_set_current_tab (priv->tab_picker, pos + 1); - mnv_set_current_tab (E_MAIL_NOTEBOOK_VIEW (view), pos + 1); - } -#else pos = gtk_notebook_get_current_page (priv->book); if (pos < (gtk_notebook_get_n_pages (priv->book) - 1)) gtk_notebook_set_current_page (priv->book, pos + 1); -#endif } @@ -1546,18 +927,10 @@ emnv_close_tab (EMailNotebookView *view, { EMailNotebookViewPrivate *priv = view->priv; -#if HAVE_CLUTTER - mnv_tab_closed ( - g_object_get_data ( - G_OBJECT (priv->current_view), "tab"), - view); -#else tab_remove_gtk_cb ( g_object_get_data ( G_OBJECT (priv->current_view), "close-button"), view); -#endif - } GtkWidget * diff --git a/mail/e-mail-reader.c b/mail/e-mail-reader.c index b90b77d160..33b604a017 100644 --- a/mail/e-mail-reader.c +++ b/mail/e-mail-reader.c @@ -62,12 +62,6 @@ #include <em-format/e-mail-parser.h> #include <em-format/e-mail-part-utils.h> -#if HAVE_CLUTTER -#include <clutter/clutter.h> -#include <mx/mx.h> -#include <clutter-gtk/clutter-gtk.h> -#endif - #define E_MAIL_READER_GET_PRIVATE(obj) \ ((EMailReaderPrivate *) g_object_get_qdata \ (G_OBJECT (obj), quark_private)) @@ -1040,9 +1034,6 @@ action_mail_next_cb (GtkAction *action, GtkWidget *message_list; MessageListSelectDirection direction; guint32 flags, mask; -#if HAVE_CLUTTER - ClutterActor *actor; -#endif direction = MESSAGE_LIST_SELECT_NEXT; flags = 0; @@ -1050,16 +1041,6 @@ action_mail_next_cb (GtkAction *action, message_list = e_mail_reader_get_message_list (reader); -#if HAVE_CLUTTER - actor = g_object_get_data (G_OBJECT (message_list), "preview-actor"); - if (actor != NULL) { - clutter_actor_set_opacity (actor, 0); - clutter_actor_animate ( - actor, CLUTTER_EASE_OUT_SINE, - 500, "opacity", 255, NULL); - } -#endif - message_list_select ( MESSAGE_LIST (message_list), direction, flags, mask); } diff --git a/mail/e-mail-tab-picker.c b/mail/e-mail-tab-picker.c deleted file mode 100644 index c5751ca90f..0000000000 --- a/mail/e-mail-tab-picker.c +++ /dev/null @@ -1,1347 +0,0 @@ -/* - * Borrowed from Moblin-Web-Browser: The web browser for Moblin - * Copyright (c) 2009, Intel Corporation. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms and conditions of the GNU Lesser General Public License, - * version 2.1, as published by the Free Software Foundation. - * - * This program is distributed in the hope it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - * License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include "e-mail-tab-picker.h" - -#define E_MAIL_TAB_PICKER_GET_PRIVATE(obj) \ - (G_TYPE_INSTANCE_GET_PRIVATE \ - ((obj), E_TYPE_MAIL_TAB_PICKER, EMailTabPickerPrivate)) - -static void mx_droppable_iface_init (MxDroppableIface *iface); -static gint e_mail_tab_picker_find_tab_cb (gconstpointer a, gconstpointer b); - -G_DEFINE_TYPE_WITH_CODE ( - EMailTabPicker, - e_mail_tab_picker, - MX_TYPE_WIDGET, - G_IMPLEMENT_INTERFACE ( - MX_TYPE_DROPPABLE, mx_droppable_iface_init)) - -#define TAB_PICKER_PRIVATE(o) \ - (G_TYPE_INSTANCE_GET_PRIVATE ((o), E_MAIL_TYPE_TAB_PICKER, EMailTabPickerPrivate)) - -enum -{ - PROP_0, - - PROP_PREVIEW_MODE, - PROP_DROP_ENABLED, -}; - -enum -{ - TAB_ACTIVATED, - CHOOSER_CLICKED, - - LAST_SIGNAL -}; - -static guint signals[LAST_SIGNAL] = { 0, }; - -typedef struct -{ - EMailTab *tab; - gfloat position; - gfloat width; - gboolean docking; - gboolean docked; -} EMailTabPickerProps; - -struct _EMailTabPickerPrivate -{ - GList *tabs; - gint n_tabs; - ClutterActor *chooser_button; - ClutterActor *close_button; - gint current_tab; - gboolean preview_mode; - gboolean drop_enabled; - gboolean in_drag; - gboolean drag_preview; - - gint width; - gint total_width; - gint max_offset; - gboolean docked_tabs; - - ClutterTimeline *scroll_timeline; - ClutterAlpha *scroll_alpha; - gint scroll_start; - gint scroll_end; - gint scroll_offset; - gboolean keep_current_visible; - MxAdjustment *scroll_adjustment; - ClutterActor *scroll_bar; - - ClutterTimeline *preview_timeline; - gfloat preview_progress; -}; - -static void -e_mail_tab_picker_over_in (MxDroppable *droppable, - MxDraggable *draggable) -{ -} - -static void -e_mail_tab_picker_over_out (MxDroppable *droppable, - MxDraggable *draggable) -{ -} - -static void -e_mail_tab_picker_drop (MxDroppable *droppable, - MxDraggable *draggable, - gfloat event_x, - gfloat event_y, - gint button, - ClutterModifierType modifiers) -{ - GList *t; - EMailTabPickerProps *tab; - ClutterActor *parent; - gint current_position, new_position; - - EMailTabPicker *picker = E_MAIL_TAB_PICKER (droppable); - EMailTabPickerPrivate *priv = picker->priv; - - /* Make sure this is a valid drop */ - if (!priv->drop_enabled) - return; - - if (!E_MAIL_IS_TAB (draggable)) - return; - - parent = clutter_actor_get_parent (CLUTTER_ACTOR (draggable)); - if (parent != (ClutterActor *) picker) - return; - - /* Get current position and property data structure */ - t = g_list_find_custom (priv->tabs, draggable, e_mail_tab_picker_find_tab_cb); - tab = (EMailTabPickerProps *) t->data; - if (!tab) { - g_warning ("Tab that's parented to a picker not actually in picker"); - return; - } - current_position = g_list_position (priv->tabs, t); - - /* Work out new position */ - for (new_position = 0, t = priv->tabs; t; t = t->next) { - EMailTabPickerProps *props = t->data; - - /* Ignore docked tabs */ - if (!props->docked) { - /* If the tab is beyond the dragged tab and not - * draggable, we don't want to drag past it. */ - if ((event_x >= props->position + priv->scroll_offset) && - (tab->position + tab->width <= props->position) && - !mx_draggable_is_enabled (MX_DRAGGABLE (props->tab))) { - new_position--; - break; - } - - /* The same check for dragging left instead of right */ - if ((event_x < props->position + props->width + priv->scroll_offset) && - (tab->position >= props->position) && - !mx_draggable_is_enabled (MX_DRAGGABLE (props->tab))) - break; - - /* If the tab-end position is after the drop position, - * break - we want to drop before here. */ - if (props->position + props->width + priv->scroll_offset > event_x) - break; - } - - /* Increment the position */ - new_position++; - } - - /* Re-order */ - e_mail_tab_picker_reorder (picker, current_position, new_position); -} - -static void -mx_droppable_iface_init (MxDroppableIface *iface) -{ - iface->over_in = e_mail_tab_picker_over_in; - iface->over_out = e_mail_tab_picker_over_out; - iface->drop = e_mail_tab_picker_drop; -} - -static void -e_mail_tab_picker_get_property (GObject *object, - guint property_id, - GValue *value, - GParamSpec *pspec) -{ - EMailTabPicker *tab_picker = E_MAIL_TAB_PICKER (object); - EMailTabPickerPrivate *priv = tab_picker->priv; - - switch (property_id) { - case PROP_PREVIEW_MODE: - g_value_set_boolean ( - value, e_mail_tab_picker_get_preview_mode ( - E_MAIL_TAB_PICKER (object))); - return; - - case PROP_DROP_ENABLED: - g_value_set_boolean (value, priv->drop_enabled); - return; - } - - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); -} - -static void -e_mail_tab_picker_set_property (GObject *object, - guint property_id, - const GValue *value, - GParamSpec *pspec) -{ - EMailTabPicker *tab_picker = E_MAIL_TAB_PICKER (object); - EMailTabPickerPrivate *priv = tab_picker->priv; - - switch (property_id) { - case PROP_PREVIEW_MODE: - e_mail_tab_picker_set_preview_mode ( - E_MAIL_TAB_PICKER (object), - g_value_get_boolean (value)); - return; - - case PROP_DROP_ENABLED: - priv->drop_enabled = g_value_get_boolean (value); - return; - } - - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); -} - -static void -e_mail_tab_picker_dispose (GObject *object) -{ - EMailTabPicker *picker = E_MAIL_TAB_PICKER (object); - EMailTabPickerPrivate *priv = picker->priv; - - if (priv->scroll_bar) { - clutter_actor_unparent (CLUTTER_ACTOR (priv->scroll_bar)); - priv->scroll_bar = NULL; - } - - if (priv->scroll_timeline) { - clutter_timeline_stop (priv->scroll_timeline); - g_object_unref (priv->scroll_alpha); - g_object_unref (priv->scroll_timeline); - priv->scroll_timeline = NULL; - priv->scroll_alpha = NULL; - } - - if (priv->preview_timeline) { - clutter_timeline_stop (priv->preview_timeline); - g_object_unref (priv->preview_timeline); - priv->preview_timeline = NULL; - } - - if (priv->chooser_button) { - clutter_actor_unparent (CLUTTER_ACTOR (priv->chooser_button)); - priv->chooser_button = NULL; - } - - if (priv->close_button) { - clutter_actor_unparent (CLUTTER_ACTOR (priv->close_button)); - priv->close_button = NULL; - } - - while (priv->tabs) { - EMailTabPickerProps *props = priv->tabs->data; - e_mail_tab_picker_remove_tab (picker, props->tab); - } - - /* Chain up to parent's dispose() method. */ - G_OBJECT_CLASS (e_mail_tab_picker_parent_class)->dispose (object); -} - -static void -e_mail_tab_picker_paint (ClutterActor *actor) -{ - GList *t; - gfloat width, height, offset; - EMailTabPickerPrivate *priv; - - priv = E_MAIL_TAB_PICKER_GET_PRIVATE (actor); - - CLUTTER_ACTOR_CLASS (e_mail_tab_picker_parent_class)->paint (actor); - - clutter_actor_get_size (actor, &width, &height); - - cogl_clip_push_rectangle (0, 0, width, height); - - offset = priv->scroll_offset; - cogl_translate (-priv->scroll_offset, 0, 0); - - /* Draw normal tabs */ - for (t = priv->tabs; t; t = t->next) { - EMailTabPickerProps *props = t->data; - - if (props->docked) - continue; - if (props->position + props->width < offset) - continue; - if (props->position > width + offset) - break; - - if (CLUTTER_ACTOR_IS_MAPPED (props->tab)) - clutter_actor_paint (CLUTTER_ACTOR (props->tab)); - } - - cogl_translate (priv->scroll_offset, 0, 0); - - /* Draw docked tabs */ - if (priv->docked_tabs) { - for (t = priv->tabs; t; t = t->next) { - EMailTabPickerProps *props = t->data; - - if (!props->docked) - continue; - - if (CLUTTER_ACTOR_IS_MAPPED (props->tab)) - clutter_actor_paint (CLUTTER_ACTOR (props->tab)); - } - } - - cogl_clip_pop (); - - /* Draw tab chooser button */ - if (CLUTTER_ACTOR_IS_MAPPED (priv->chooser_button)) - clutter_actor_paint (CLUTTER_ACTOR (priv->chooser_button)); - - /* Draw scrollbar */ - if (CLUTTER_ACTOR_IS_MAPPED (priv->scroll_bar)) { - gfloat height; - clutter_actor_get_preferred_height ( - CLUTTER_ACTOR (priv->close_button), - -1, NULL, &height); - height *= priv->preview_progress; - if (height >= 1.0) { - cogl_clip_push_rectangle (0, 0, width, height); - if (CLUTTER_ACTOR_IS_MAPPED (priv->close_button)) - clutter_actor_paint (CLUTTER_ACTOR (priv->close_button)); - clutter_actor_paint (CLUTTER_ACTOR (priv->scroll_bar)); - cogl_clip_pop (); - } - } -} - -static void -e_mail_tab_picker_pick (ClutterActor *actor, - const ClutterColor *color) -{ - EMailTabPickerPrivate *priv; - - priv = E_MAIL_TAB_PICKER_GET_PRIVATE (actor); - - /* Chain up to paint background */ - CLUTTER_ACTOR_CLASS (e_mail_tab_picker_parent_class)->pick (actor, color); - - if (!priv->in_drag) - e_mail_tab_picker_paint (actor); -} - -static void -e_mail_tab_picker_get_preferred_width (ClutterActor *actor, - gfloat for_height, - gfloat *min_width_p, - gfloat *natural_width_p) -{ - GList *t; - MxPadding padding; - EMailTabPickerPrivate *priv; - - priv = E_MAIL_TAB_PICKER_GET_PRIVATE (actor); - - clutter_actor_get_preferred_width ( - CLUTTER_ACTOR (priv->chooser_button), - for_height, min_width_p, natural_width_p); - - mx_widget_get_padding (MX_WIDGET (actor), &padding); - if (min_width_p) - *min_width_p += padding.left + padding.right; - if (natural_width_p) - *natural_width_p += padding.left + padding.right; - - for (t = priv->tabs; t; t = t->next) { - gfloat min_width, natural_width; - EMailTabPickerProps *props = t->data; - - clutter_actor_get_preferred_width ( - CLUTTER_ACTOR (props->tab), for_height, - &min_width, &natural_width); - - if (min_width_p && !t->prev) - *min_width_p += min_width; - if (natural_width_p) - *natural_width_p += natural_width; - } -} - -void -e_mail_tab_picker_get_preferred_height (EMailTabPicker *tab_picker, - gfloat for_width, - gfloat *min_height_p, - gfloat *natural_height_p, - gboolean with_previews) -{ - MxPadding padding; - - ClutterActor *actor = CLUTTER_ACTOR (tab_picker); - EMailTabPickerPrivate *priv = tab_picker->priv; - - clutter_actor_get_preferred_height ( - CLUTTER_ACTOR (priv->chooser_button), - for_width, min_height_p, natural_height_p); - - if (priv->tabs) { - gfloat min_height, natural_height, scroll_height; - EMailTabPickerProps *props = priv->tabs->data; - - /* Get the height of the first tab - it's assumed that - * tabs are fixed height. */ - if (with_previews) { - clutter_actor_get_preferred_height ( - CLUTTER_ACTOR (props->tab), - for_width, &min_height, - &natural_height); - - if (CLUTTER_ACTOR_IS_VISIBLE (priv->scroll_bar)) { - /* Add the height of the scrollbar-section */ - clutter_actor_get_preferred_height ( - CLUTTER_ACTOR (priv->close_button), - -1, NULL, &scroll_height); - scroll_height *= priv->preview_progress; - - min_height += scroll_height; - natural_height += scroll_height; - } - } else - e_mail_tab_get_height_no_preview ( - props->tab, for_width, - &min_height, &natural_height); - - if (min_height_p && (*min_height_p < min_height)) - *min_height_p = min_height; - if (natural_height_p && (*natural_height_p < natural_height)) - *natural_height_p = natural_height; - } - - mx_widget_get_padding (MX_WIDGET (actor), &padding); - if (min_height_p) - *min_height_p += padding.top + padding.bottom; - if (natural_height_p) - *natural_height_p += padding.top + padding.bottom; -} - -static void -_e_mail_tab_picker_get_preferred_height (ClutterActor *actor, - gfloat for_width, - gfloat *min_height_p, - gfloat *natural_height_p) -{ - e_mail_tab_picker_get_preferred_height ( - E_MAIL_TAB_PICKER (actor), for_width, - min_height_p, natural_height_p, TRUE); -} - -static void -e_mail_tab_picker_allocate_docked (EMailTabPicker *tab_picker, - const ClutterActorBox *picker_box_p, - const ClutterActorBox *chooser_box_p, - ClutterAllocationFlags flags) -{ - GList *t; - MxPadding padding; - ClutterActorBox picker_box, chooser_box, child_box; - gfloat offset, width, left, right, height; - - EMailTabPickerPrivate *priv = tab_picker->priv; - - if (!picker_box_p) { - clutter_actor_get_allocation_box ( - CLUTTER_ACTOR (tab_picker), &picker_box); - picker_box_p = &picker_box; - } - - if (!chooser_box_p) { - clutter_actor_get_allocation_box ( - CLUTTER_ACTOR (priv->chooser_button), &chooser_box); - chooser_box_p = &chooser_box; - } - - mx_widget_get_padding (MX_WIDGET (tab_picker), &padding); - - /* Calculate available width and height */ - width = picker_box_p->x2 - picker_box_p->x1 - padding.right; - - e_mail_tab_picker_get_preferred_height ( - tab_picker, -1, NULL, &height, FALSE); - child_box.y2 = picker_box_p->y2 - picker_box_p->y1 - padding.bottom; - child_box.y1 = child_box.y2 - height; - - /* Don't dock over the chooser button */ - width -= chooser_box_p->x2 - chooser_box_p->x1; - - offset = priv->scroll_offset; - - left = 0; - right = width; - priv->docked_tabs = FALSE; - - for (t = g_list_last (priv->tabs); t; t = t->prev) { - EMailTabPickerProps *props = t->data; - - props->docked = FALSE; - - if (!props->docking) - continue; - - if (props->position < offset) { - /* Dock left */ - priv->docked_tabs = TRUE; - props->docked = TRUE; - child_box.x1 = left; - child_box.x2 = child_box.x1 + props->width; - left += props->width; - } else if (props->position + props->width > width + offset) { - /* Dock right */ - priv->docked_tabs = TRUE; - props->docked = TRUE; - child_box.x2 = right; - child_box.x1 = child_box.x2 - props->width; - right -= props->width; - } else { - child_box.x1 = props->position; - child_box.x2 = child_box.x1 + props->width; - } - - clutter_actor_allocate ( - CLUTTER_ACTOR (props->tab), &child_box, flags); - } -} - -static void -e_mail_tab_picker_scroll_new_frame_cb (ClutterTimeline *timeline, - guint msecs, - EMailTabPicker *tab_picker) -{ - EMailTabPickerPrivate *priv = tab_picker->priv; - gdouble alpha = clutter_alpha_get_alpha (priv->scroll_alpha); - - priv->scroll_offset = - (priv->scroll_start * (1.0 - alpha)) + - (priv->scroll_end * alpha); - mx_adjustment_set_value (priv->scroll_adjustment, priv->scroll_offset); - e_mail_tab_picker_allocate_docked (tab_picker, NULL, NULL, 0); - clutter_actor_queue_redraw (CLUTTER_ACTOR (tab_picker)); -} - -static void -e_mail_tab_picker_scroll_completed_cb (ClutterTimeline *timeline, - EMailTabPicker *tab_picker) -{ - EMailTabPickerPrivate *priv = tab_picker->priv; - - priv->scroll_offset = priv->scroll_end; - mx_adjustment_set_value (priv->scroll_adjustment, priv->scroll_offset); - e_mail_tab_picker_allocate_docked (tab_picker, NULL, NULL, 0); - clutter_actor_queue_redraw (CLUTTER_ACTOR (tab_picker)); - - g_object_unref (priv->scroll_alpha); - g_object_unref (priv->scroll_timeline); - priv->scroll_alpha = NULL; - priv->scroll_timeline = NULL; -} - -static void -e_mail_tab_picker_scroll_to (EMailTabPicker *tab_picker, - gint destination, - guint duration) -{ - EMailTabPickerPrivate *priv = tab_picker->priv; - - priv->scroll_start = priv->scroll_offset; - priv->scroll_end = CLAMP (destination, 0, priv->max_offset); - - if (priv->scroll_timeline) { - clutter_timeline_stop (priv->scroll_timeline); - clutter_timeline_rewind (priv->scroll_timeline); - clutter_timeline_set_duration (priv->scroll_timeline, duration); - } else { - if (priv->scroll_end == priv->scroll_offset) - return; - - priv->scroll_timeline = clutter_timeline_new (duration); - priv->scroll_alpha = clutter_alpha_new_full ( - priv->scroll_timeline, CLUTTER_EASE_OUT_QUAD); - g_signal_connect ( - priv->scroll_timeline, "new_frame", - G_CALLBACK (e_mail_tab_picker_scroll_new_frame_cb), - tab_picker); - g_signal_connect ( - priv->scroll_timeline, "completed", - G_CALLBACK (e_mail_tab_picker_scroll_completed_cb), - tab_picker); - } - - clutter_timeline_start (priv->scroll_timeline); -} - -static void -e_mail_tab_picker_allocate (ClutterActor *actor, - const ClutterActorBox *box, - ClutterAllocationFlags flags) -{ - GList *t; - MxPadding padding; - gint old_max_offset, old_scroll_offset; - ClutterActorBox child_box, scroll_box; - gfloat width, total_width, height; - - EMailTabPicker *tab_picker = E_MAIL_TAB_PICKER (actor); - EMailTabPickerPrivate *priv = tab_picker->priv; - - mx_widget_get_padding (MX_WIDGET (actor), &padding); - - /* Allocate for scroll-bar and close button */ - clutter_actor_get_preferred_size ( - CLUTTER_ACTOR (priv->close_button), - NULL, NULL, &width, &height); - child_box.x1 = 0; - child_box.x2 = box->x2 - box->x1 - padding.right; - child_box.y1 = 0; - child_box.y2 = child_box.y1 + height; - clutter_actor_allocate ( - CLUTTER_ACTOR (priv->close_button), &child_box, flags); - - /* FIXME: Make this a property */ -#define SPACING 4.0 - /* Work out allocation for scroll-bar, but allocate it later */ - scroll_box = child_box; - scroll_box.x2 -= width + SPACING; - scroll_box.x1 += SPACING; - scroll_box.y1 += SPACING; - scroll_box.y2 -= SPACING; - - child_box.y1 += (height * priv->preview_progress) + padding.top; - - /* Allocate for tabs */ - total_width = 0; - child_box.x1 = padding.left; - e_mail_tab_picker_get_preferred_height ( - tab_picker, -1, NULL, &height, FALSE); - for (t = priv->tabs; t; t = t->next) { - EMailTabPickerProps *props = t->data; - ClutterActor *actor = CLUTTER_ACTOR (props->tab); - - clutter_actor_get_preferred_width ( - actor, child_box.y2, NULL, &width); - - /* Fill out data - note it's ok to fill out docking here - * as when it changes, the tab queues a relayout. */ - props->docking = e_mail_tab_get_docking (props->tab); - props->position = child_box.x1; - props->width = width; - - total_width += width; - - /* Don't stretch tabs without a preview to fit tabs - * with a preview. */ - if (e_mail_tab_get_preview_actor (props->tab)) - child_box.y2 = box->y2 - box->y1 - padding.bottom; - else - child_box.y2 = child_box.y1 + height; - - child_box.x2 = child_box.x1 + width; - clutter_actor_allocate (actor, &child_box, flags); - - child_box.x1 = child_box.x2; - } - - /* Allocate for the chooser button */ - clutter_actor_get_preferred_width ( - CLUTTER_ACTOR (priv->chooser_button), - box->y2 - box->y1, NULL, &width); - - child_box.x2 = box->x2 - box->x1 - padding.right; - child_box.x1 = child_box.x2 - width; - child_box.y1 = 0; - child_box.y2 = child_box.y1 + height; - clutter_actor_allocate ( - CLUTTER_ACTOR (priv->chooser_button), &child_box, flags); - - /* Cache some useful size values */ - priv->width = (gint)(box->x2 - box->x1); - - priv->total_width = (gint)(total_width + padding.left + padding.right); - - old_max_offset = priv->max_offset; - priv->max_offset = - priv->total_width - priv->width + - (gint) (child_box.x2 - child_box.x1); - if (priv->max_offset < 0) - priv->max_offset = 0; - - /* Allocate for tab picker */ - old_scroll_offset = priv->scroll_offset; - priv->scroll_offset = CLAMP (priv->scroll_offset, 0, priv->max_offset); - e_mail_tab_picker_allocate_docked (tab_picker, box, &child_box, flags); - - /* Chain up (store box) */ - CLUTTER_ACTOR_CLASS (e_mail_tab_picker_parent_class)-> - allocate (actor, box, flags); - - /* Sync up the scroll-bar properties */ - g_object_set ( - priv->scroll_adjustment, - "page-increment", (gdouble)(box->x2 - box->x1), - "page-size", (gdouble)(box->x2 - box->x1), - "upper", (gdouble)total_width, - NULL); - - if ((priv->max_offset != old_max_offset) || - (priv->scroll_offset != old_scroll_offset)) - mx_adjustment_set_value ( - priv->scroll_adjustment, - (gdouble) priv->scroll_offset); - - /* Allocate for scroll-bar */ - clutter_actor_allocate ( - CLUTTER_ACTOR (priv->scroll_bar), &scroll_box, flags); - - /* Keep current tab visible */ - if (priv->keep_current_visible) { - EMailTabPickerProps *current; - - current = g_list_nth_data (priv->tabs, priv->current_tab); - - if ((current->position < priv->scroll_offset) || - (current->position + current->width >= priv->max_offset)) - e_mail_tab_picker_scroll_to ( - tab_picker, current->position, 150); - } -} - -static void -e_mail_tab_picker_map (ClutterActor *actor) -{ - GList *t; - EMailTabPickerPrivate *priv; - - priv = E_MAIL_TAB_PICKER_GET_PRIVATE (actor); - - CLUTTER_ACTOR_CLASS (e_mail_tab_picker_parent_class)->map (actor); - - clutter_actor_map (CLUTTER_ACTOR (priv->chooser_button)); - clutter_actor_map (CLUTTER_ACTOR (priv->close_button)); - clutter_actor_map (CLUTTER_ACTOR (priv->scroll_bar)); - - for (t = priv->tabs; t; t = t->next) { - EMailTabPickerProps *props = t->data; - clutter_actor_map (CLUTTER_ACTOR (props->tab)); - } -} - -static void -e_mail_tab_picker_unmap (ClutterActor *actor) -{ - GList *t; - EMailTabPickerPrivate *priv; - - priv = E_MAIL_TAB_PICKER_GET_PRIVATE (actor); - - CLUTTER_ACTOR_CLASS (e_mail_tab_picker_parent_class)->unmap (actor); - - clutter_actor_unmap (CLUTTER_ACTOR (priv->chooser_button)); - clutter_actor_unmap (CLUTTER_ACTOR (priv->close_button)); - clutter_actor_unmap (CLUTTER_ACTOR (priv->scroll_bar)); - - for (t = priv->tabs; t; t = t->next) { - EMailTabPickerProps *props = t->data; - clutter_actor_unmap (CLUTTER_ACTOR (props->tab)); - } -} - -static void -e_mail_tab_picker_class_init (EMailTabPickerClass *class) -{ - GObjectClass *object_class = G_OBJECT_CLASS (class); - ClutterActorClass *actor_class = CLUTTER_ACTOR_CLASS (class); - - g_type_class_add_private (class, sizeof (EMailTabPickerPrivate)); - - object_class->get_property = e_mail_tab_picker_get_property; - object_class->set_property = e_mail_tab_picker_set_property; - object_class->dispose = e_mail_tab_picker_dispose; - - actor_class->paint = e_mail_tab_picker_paint; - actor_class->pick = e_mail_tab_picker_pick; - actor_class->get_preferred_width = e_mail_tab_picker_get_preferred_width; - actor_class->get_preferred_height = _e_mail_tab_picker_get_preferred_height; - actor_class->allocate = e_mail_tab_picker_allocate; - actor_class->map = e_mail_tab_picker_map; - actor_class->unmap = e_mail_tab_picker_unmap; - - g_object_class_install_property ( - object_class, - PROP_PREVIEW_MODE, - g_param_spec_boolean ( - "preview-mode", - "Preview mode", - "Whether to display " - "in preview mode.", - FALSE, - G_PARAM_READWRITE | - G_PARAM_STATIC_STRINGS)); - - g_object_class_override_property ( - object_class, - PROP_DROP_ENABLED, - "drop-enabled"); - - signals[TAB_ACTIVATED] = g_signal_new ( - "tab-activated", - G_TYPE_FROM_CLASS (class), - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (EMailTabPickerClass, tab_activated), - NULL, NULL, - g_cclosure_marshal_VOID__OBJECT, - G_TYPE_NONE, 1, - E_TYPE_MAIL_TAB); - - signals[CHOOSER_CLICKED] = g_signal_new ( - "chooser-clicked", - G_TYPE_FROM_CLASS (class), - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (EMailTabPickerClass, chooser_clicked), - NULL, NULL, - g_cclosure_marshal_VOID__VOID, - G_TYPE_NONE, 0); -} - -static void -e_mail_tab_picker_chooser_clicked_cb (ClutterActor *button, - EMailTabPicker *picker) -{ - g_signal_emit (picker, signals[CHOOSER_CLICKED], 0); -} - -static gboolean -e_mail_tab_picker_scroll_event_cb (ClutterActor *actor, - ClutterScrollEvent *event, - gpointer user_data) -{ - EMailTabPicker *picker = E_MAIL_TAB_PICKER (actor); - EMailTabPickerPrivate *priv = picker->priv; - - priv->keep_current_visible = FALSE; - - switch (event->direction) { - case CLUTTER_SCROLL_UP : - case CLUTTER_SCROLL_LEFT : - e_mail_tab_picker_scroll_to ( - picker, priv->scroll_end - 200, 150); - break; - - case CLUTTER_SCROLL_DOWN : - case CLUTTER_SCROLL_RIGHT : - e_mail_tab_picker_scroll_to ( - picker, priv->scroll_end + 200, 150); - break; - } - - return TRUE; -} - -static void -e_mail_tab_picker_scroll_value_cb (MxAdjustment *adjustment, - GParamSpec *pspec, - EMailTabPicker *picker) -{ - EMailTabPickerPrivate *priv = picker->priv; - gdouble value = mx_adjustment_get_value (adjustment); - - if ((gint) value != priv->scroll_offset) { - priv->keep_current_visible = FALSE; - priv->scroll_offset = (gint) value; - clutter_actor_queue_relayout (CLUTTER_ACTOR (picker)); - } -} - -static void -e_mail_tab_picker_init (EMailTabPicker *picker) -{ - picker->priv = E_MAIL_TAB_PICKER_GET_PRIVATE (picker); - - clutter_actor_set_reactive (CLUTTER_ACTOR (picker), TRUE); - - picker->priv->chooser_button = mx_button_new (); - clutter_actor_set_name ( - CLUTTER_ACTOR (picker->priv->chooser_button), - "chooser-button"); - clutter_actor_set_parent ( - CLUTTER_ACTOR (picker->priv->chooser_button), - CLUTTER_ACTOR (picker)); - - picker->priv->close_button = mx_button_new (); - clutter_actor_set_name ( - CLUTTER_ACTOR (picker->priv->close_button), - "chooser-close-button"); - clutter_actor_set_parent ( - CLUTTER_ACTOR (picker->priv->close_button), - CLUTTER_ACTOR (picker)); - clutter_actor_hide (CLUTTER_ACTOR (picker->priv->close_button)); - - picker->priv->scroll_adjustment = - mx_adjustment_new_with_values (0, 0, 0, 100, 200, 200); - picker->priv->scroll_bar = - mx_scroll_bar_new_with_adjustment ( - picker->priv->scroll_adjustment); - g_object_unref (picker->priv->scroll_adjustment); - clutter_actor_set_parent ( - CLUTTER_ACTOR (picker->priv->scroll_bar), - CLUTTER_ACTOR (picker)); - clutter_actor_hide (CLUTTER_ACTOR (picker->priv->scroll_bar)); - - g_signal_connect ( - picker->priv->chooser_button, "clicked", - G_CALLBACK (e_mail_tab_picker_chooser_clicked_cb), picker); - g_signal_connect ( - picker->priv->close_button, "clicked", - G_CALLBACK (e_mail_tab_picker_chooser_clicked_cb), picker); - g_signal_connect ( - picker, "scroll-event", - G_CALLBACK (e_mail_tab_picker_scroll_event_cb), NULL); -} - -static gint -e_mail_tab_picker_find_tab_cb (gconstpointer a, - gconstpointer b) -{ - EMailTabPickerProps *props = (EMailTabPickerProps *) a; - EMailTab *tab = (EMailTab *) b; - - return (props->tab == tab) ? 0 : -1; -} - -static void -e_mail_tab_picker_tab_clicked_cb (EMailTab *tab, - EMailTabPicker *picker) -{ - EMailTabPickerPrivate *priv = picker->priv; - EMailTab *old_tab; - GList *new_tab_link; - - old_tab = ((EMailTabPickerProps *) g_list_nth_data ( - priv->tabs, priv->current_tab))->tab; - new_tab_link = g_list_find_custom ( - priv->tabs, tab, e_mail_tab_picker_find_tab_cb); - - if (!new_tab_link) - return; - - priv->keep_current_visible = TRUE; - - /* If the same tab is clicked, make sure we remain active and return */ - if (tab == old_tab) { - e_mail_tab_set_active (tab, TRUE); - if (priv->preview_mode) - g_signal_emit (picker, signals[TAB_ACTIVATED], 0, tab); - return; - } - - /* Deselect old tab */ - e_mail_tab_set_active (old_tab, FALSE); - - /* Set new tab */ - priv->current_tab = g_list_position (priv->tabs, new_tab_link); - g_signal_emit (picker, signals[TAB_ACTIVATED], 0, tab); -} - -ClutterActor * -e_mail_tab_picker_new (void) -{ - return g_object_new (E_TYPE_MAIL_TAB_PICKER, NULL); -} - -static void -e_mail_tab_picker_tab_drag_begin_cb (MxDraggable *draggable, - gfloat event_x, - gfloat event_y, - gint event_button, - ClutterModifierType modifiers, - EMailTabPicker *picker) -{ - EMailTabPickerPrivate *priv = picker->priv; - priv->in_drag = TRUE; - - if (!priv->preview_mode) { - e_mail_tab_picker_set_preview_mode (picker, TRUE); - priv->drag_preview = TRUE; - } -} - -static void -e_mail_tab_picker_tab_drag_end_cb (MxDraggable *draggable, - gfloat event_x, - gfloat event_y, - EMailTabPicker *picker) -{ - EMailTabPickerPrivate *priv = picker->priv; - priv->in_drag = FALSE; - - if (priv->drag_preview) { - e_mail_tab_picker_set_preview_mode (picker, FALSE); - priv->drag_preview = FALSE; - } -} - -void -e_mail_tab_picker_add_tab (EMailTabPicker *picker, - EMailTab *tab, - gint position) -{ - EMailTabPickerProps *props; - EMailTabPickerPrivate *priv = picker->priv; - - if (priv->tabs && (priv->current_tab >= position)) - priv->current_tab++; - - props = g_slice_new (EMailTabPickerProps); - props->tab = tab; - priv->tabs = g_list_insert (priv->tabs, props, position); - priv->n_tabs++; - - clutter_actor_set_parent (CLUTTER_ACTOR (tab), CLUTTER_ACTOR (picker)); - mx_draggable_set_axis (MX_DRAGGABLE (tab), MX_DRAG_AXIS_X); - - g_signal_connect_after ( - tab, "clicked", - G_CALLBACK (e_mail_tab_picker_tab_clicked_cb), picker); - g_signal_connect ( - tab, "drag-begin", - G_CALLBACK (e_mail_tab_picker_tab_drag_begin_cb), picker); - g_signal_connect ( - tab, "drag-end", - G_CALLBACK (e_mail_tab_picker_tab_drag_end_cb), picker); - - e_mail_tab_set_preview_mode (tab, priv->preview_mode); - clutter_actor_queue_relayout (CLUTTER_ACTOR (picker)); -} - -void -e_mail_tab_picker_remove_tab (EMailTabPicker *picker, - EMailTab *tab) -{ - GList *tab_link; - EMailTabPickerPrivate *priv = picker->priv; - - tab_link = g_list_find_custom ( - priv->tabs, tab, e_mail_tab_picker_find_tab_cb); - - if (!tab_link) - return; - - g_signal_handlers_disconnect_by_func ( - tab, e_mail_tab_picker_tab_clicked_cb, picker); - g_signal_handlers_disconnect_by_func ( - tab, e_mail_tab_picker_tab_drag_begin_cb, picker); - g_signal_handlers_disconnect_by_func ( - tab, e_mail_tab_picker_tab_drag_end_cb, picker); - - /* We don't want to do this during dispose, checking if chooser_button - * exists is a way of checking if we're in dispose without keeping an - * extra variable around. */ - if (priv->chooser_button) { - gint position = g_list_position (priv->tabs, tab_link); - if (priv->current_tab) { - if (priv->current_tab > position) - priv->current_tab--; - else if (priv->current_tab == position) - e_mail_tab_picker_set_current_tab ( - picker, priv->current_tab - 1); - } else if (priv->tabs->next && (position == 0)) { - e_mail_tab_picker_set_current_tab ( - picker, priv->current_tab + 1); - priv->current_tab--; - } - } - - g_slice_free (EMailTabPickerProps, tab_link->data); - priv->tabs = g_list_delete_link (priv->tabs, tab_link); - clutter_actor_unparent (CLUTTER_ACTOR (tab)); - priv->n_tabs--; - - clutter_actor_queue_relayout (CLUTTER_ACTOR (picker)); -} - -GList * -e_mail_tab_picker_get_tabs (EMailTabPicker *picker) -{ - GList *tab_list, *t; - - EMailTabPickerPrivate *priv = picker->priv; - - tab_list = NULL; - for (t = g_list_last (priv->tabs); t; t = t->prev) { - EMailTabPickerProps *props = t->data; - tab_list = g_list_prepend (tab_list, props->tab); - } - - return tab_list; -} - -EMailTab * -e_mail_tab_picker_get_tab (EMailTabPicker *picker, - gint tab) -{ - EMailTabPickerProps *props = g_list_nth_data (picker->priv->tabs, tab); - return props->tab; -} - -gint -e_mail_tab_picker_get_tab_no (EMailTabPicker *picker, - EMailTab *tab) -{ - GList *tab_link; - - tab_link = g_list_find_custom ( - picker->priv->tabs, tab, - e_mail_tab_picker_find_tab_cb); - - return g_list_position (picker->priv->tabs, tab_link); -} - -gint -e_mail_tab_picker_get_current_tab (EMailTabPicker *picker) -{ - return picker->priv->current_tab; -} - -void -e_mail_tab_picker_set_current_tab (EMailTabPicker *picker, - gint tab_no) -{ - EMailTabPickerPrivate *priv = picker->priv; - EMailTabPickerProps *props; - - printf("OLD %d new %d\n", priv->current_tab, tab_no); - if (priv->n_tabs == 0) - return; - - if (ABS (tab_no) >= priv->n_tabs) - return; - - if (tab_no < 0) - tab_no = priv->n_tabs + tab_no; - - props = g_list_nth_data (priv->tabs, (guint) tab_no); - - if (props) { - e_mail_tab_picker_tab_clicked_cb (props->tab, picker); - e_mail_tab_set_active (props->tab, TRUE); - } -} - -void -e_mail_tab_picker_reorder (EMailTabPicker *picker, - gint old_position, - gint new_position) -{ - GList *link; - gpointer data; - - EMailTabPickerPrivate *priv = picker->priv; - - if (old_position == new_position) - return; - - if (!(link = g_list_nth (priv->tabs, old_position))) - return; - - data = link->data; - priv->tabs = g_list_delete_link (priv->tabs, link); - priv->tabs = g_list_insert (priv->tabs, data, new_position); - - if (priv->current_tab == old_position) { - if (new_position < 0) - priv->current_tab = priv->n_tabs - 1; - else - priv->current_tab = CLAMP ( - new_position, 0, priv->n_tabs - 1); - } else if ((priv->current_tab > old_position) && - (new_position >= priv->current_tab)) - priv->current_tab--; - else if ((priv->current_tab < old_position) && - (new_position <= priv->current_tab)) - priv->current_tab++; - - clutter_actor_queue_relayout (CLUTTER_ACTOR (picker)); -} - -gint -e_mail_tab_picker_get_n_tabs (EMailTabPicker *picker) -{ - return picker->priv->n_tabs; -} - -static void -preview_new_frame_cb (ClutterTimeline *timeline, - guint msecs, - EMailTabPicker *picker) -{ - picker->priv->preview_progress = - clutter_timeline_get_progress (timeline); - clutter_actor_queue_relayout (CLUTTER_ACTOR (picker)); -} - -static void -preview_completed_cb (ClutterTimeline *timeline, - EMailTabPicker *picker) -{ - EMailTabPickerPrivate *priv = picker->priv; - - if (priv->preview_timeline) { - g_object_unref (priv->preview_timeline); - priv->preview_timeline = NULL; - - if (priv->preview_mode) { - priv->preview_progress = 1.0; - clutter_actor_hide ( - CLUTTER_ACTOR (priv->chooser_button)); - } else { - priv->preview_progress = 0.0; - clutter_actor_hide (CLUTTER_ACTOR (priv->scroll_bar)); - clutter_actor_hide (CLUTTER_ACTOR (priv->close_button)); - } - - clutter_actor_queue_relayout (CLUTTER_ACTOR (picker)); - } -} - -void -e_mail_tab_picker_set_preview_mode (EMailTabPicker *picker, - gboolean preview) -{ - GList *t; - - EMailTabPickerPrivate *priv = picker->priv; - - if ((priv->preview_mode ? 1 : 0) == (preview ? 1 : 0)) - return; - - priv->preview_mode = preview; - - /* Put all tabs in preview mode */ - for (t = priv->tabs; t; t = t->next) { - EMailTabPickerProps *prop = t->data; - e_mail_tab_set_preview_mode (prop->tab, preview); - } - - /* Slide in the scroll-bar */ - if (!priv->preview_timeline) { - if (preview) - clutter_actor_show (CLUTTER_ACTOR (priv->scroll_bar)); - - priv->preview_timeline = clutter_timeline_new (150); - g_signal_connect ( - priv->preview_timeline, "new-frame", - G_CALLBACK (preview_new_frame_cb), picker); - g_signal_connect ( - priv->preview_timeline, "completed", - G_CALLBACK (preview_completed_cb), picker); - clutter_timeline_start (priv->preview_timeline); - } - - clutter_timeline_set_direction ( - priv->preview_timeline, - preview ? CLUTTER_TIMELINE_FORWARD : - CLUTTER_TIMELINE_BACKWARD); - - /* Connect/disconnect the scrollbar */ - if (preview) - g_signal_connect ( - priv->scroll_adjustment, "notify::value", - G_CALLBACK (e_mail_tab_picker_scroll_value_cb), picker); - else - g_signal_handlers_disconnect_by_func ( - priv->scroll_adjustment, - e_mail_tab_picker_scroll_value_cb, picker); - - if (preview) { - /* Fade out the chooser button show close button */ - clutter_actor_animate ( - CLUTTER_ACTOR (priv->chooser_button), - CLUTTER_EASE_IN_OUT_QUAD, 150, - "opacity", 0x00, NULL); - clutter_actor_show (CLUTTER_ACTOR (priv->close_button)); - } else { - /* Fade in the chooser button */ - clutter_actor_show (CLUTTER_ACTOR (priv->chooser_button)); - clutter_actor_animate ( - CLUTTER_ACTOR (priv->chooser_button), - CLUTTER_EASE_IN_OUT_QUAD, 150, - "opacity", 0xff, NULL); - } - - clutter_actor_set_reactive ( - CLUTTER_ACTOR (priv->chooser_button), !preview); - - /* Remove the hover state, which likely got stuck when we clicked it */ - if (!preview) - mx_stylable_set_style_pseudo_class ( - MX_STYLABLE (priv->chooser_button), NULL); - - g_object_notify (G_OBJECT (picker), "preview-mode"); -} - -gboolean -e_mail_tab_picker_get_preview_mode (EMailTabPicker *picker) -{ - EMailTabPickerPrivate *priv = picker->priv; - return priv->preview_mode; -} - -void -e_mail_tab_picker_enable_drop (EMailTabPicker *picker, - gboolean enable) -{ - EMailTabPickerPrivate *priv = picker->priv; - - if ((priv->drop_enabled ? 1 : 0) == (enable ? 1 : 0)) - return; - - priv->drop_enabled = enable; - if (enable) - mx_droppable_enable (MX_DROPPABLE (picker)); - else - mx_droppable_disable (MX_DROPPABLE (picker)); - - g_object_notify (G_OBJECT (picker), "enabled"); -} - diff --git a/mail/e-mail-tab-picker.h b/mail/e-mail-tab-picker.h deleted file mode 100644 index 56a9b4ac43..0000000000 --- a/mail/e-mail-tab-picker.h +++ /dev/null @@ -1,105 +0,0 @@ -/* - * Borrowed from Moblin-Web-Browser: The web browser for Moblin - * Copyright (c) 2009, Intel Corporation. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms and conditions of the GNU Lesser General Public License, - * version 2.1, as published by the Free Software Foundation. - * - * This program is distributed in the hope it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - * License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. - */ - -#ifndef E_MAIL_TAB_PICKER_H -#define E_MAIL_TAB_PICKER_H - -#include <clutter/clutter.h> -#include <mx/mx.h> -#include "e-mail-tab.h" - -/* Standard GObject macros */ -#define E_TYPE_MAIL_TAB_PICKER \ - (e_mail_tab_picker_get_type ()) -#define E_MAIL_TAB_PICKER(obj) \ - (G_TYPE_CHECK_INSTANCE_CAST \ - ((obj), E_TYPE_MAIL_TAB_PICKER, EMailTabPicker)) -#define E_MAIL_TAB_PICKER_CLASS(cls) \ - (G_TYPE_CHECK_CLASS_CAST \ - ((cls), E_TYPE_MAIL_TAB_PICKER, EMailTabPickerClass)) -#define E_MAIL_IS_TAB_PICKER(obj) \ - (G_TYPE_CHECK_INSTANCE_TYPE \ - ((obj), E_TYPE_MAIL_TAB_PICKER)) -#define E_MAIL_IS_TAB_PICKER_CLASS(cls) \ - (G_TYPE_CHECK_CLASS_TYPE \ - ((cls), E_TYPE_MAIL_TAB_PICKER)) -#define E_MAIL_TAB_PICKER_GET_CLASS(obj) \ - (G_TYPE_INSTANCE_GET_CLASS \ - ((obj), E_TYPE_MAIL_TAB_PICKER, EMailTabPickerClass)) - -G_BEGIN_DECLS - -typedef struct _EMailTabPicker EMailTabPicker; -typedef struct _EMailTabPickerClass EMailTabPickerClass; -typedef struct _EMailTabPickerPrivate EMailTabPickerPrivate; - -struct _EMailTabPicker { - MxWidget parent; - EMailTabPickerPrivate *priv; -}; - -struct _EMailTabPickerClass { - MxWidgetClass parent_class; - - void (*tab_activated) (EMailTabPicker *picker, - EMailTab *tab); - void (*chooser_clicked) (EMailTabPicker *picker); -}; - -GType e_mail_tab_picker_get_type (void) G_GNUC_CONST; -ClutterActor * e_mail_tab_picker_new (void); -void e_mail_tab_picker_add_tab (EMailTabPicker *picker, - EMailTab *tab, - gint position); -void e_mail_tab_picker_remove_tab (EMailTabPicker *picker, - EMailTab *tab); -GList * e_mail_tab_picker_get_tabs (EMailTabPicker *picker); -gint e_mail_tab_picker_get_n_tabs (EMailTabPicker *picker); -EMailTab * e_mail_tab_picker_get_tab (EMailTabPicker *picker, - gint tab); -gint e_mail_tab_picker_get_tab_no (EMailTabPicker *picker, - EMailTab *tab); -gint e_mail_tab_picker_get_current_tab - (EMailTabPicker *picker); -void e_mail_tab_picker_set_current_tab - (EMailTabPicker *picker, - gint tab); -void e_mail_tab_picker_reorder (EMailTabPicker *picker, - gint old_position, - gint new_position); -void e_mail_tab_picker_set_tab_width (EMailTabPicker *picker, - gint width); -gint e_mail_tab_picker_get_tab_width (EMailTabPicker *picker); -void e_mail_tab_picker_get_preferred_height - (EMailTabPicker *tab_picker, - gfloat for_width, - gfloat *min_height_p, - gfloat *natural_height_p, - gboolean with_previews); -void e_mail_tab_picker_set_preview_mode - (EMailTabPicker *picker, - gboolean preview); -gboolean e_mail_tab_picker_get_preview_mode - (EMailTabPicker *picker); -void e_mail_tab_picker_enable_drop (EMailTabPicker *picker, - gboolean enable); - -G_END_DECLS - -#endif /* E_MAIL_TAB_PICKER_H */ - diff --git a/mail/e-mail-tab.c b/mail/e-mail-tab.c deleted file mode 100644 index a2a80436d0..0000000000 --- a/mail/e-mail-tab.c +++ /dev/null @@ -1,1919 +0,0 @@ -/* - * Borrowed from Moblin-Web-Browser: The web browser for Moblin - * Copyright (c) 2009, Intel Corporation. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms and conditions of the GNU Lesser General Public License, - * version 2.1, as published by the Free Software Foundation. - * - * This program is distributed in the hope it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - * License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <math.h> -#include <string.h> -#include <gtk/gtk.h> -#include "e-mail-tab.h" - -#define E_MAIL_TAB_GET_PRIVATE(obj) \ - (G_TYPE_INSTANCE_GET_PRIVATE \ - ((obj), E_TYPE_MAIL_TAB, EMailTabPrivate)) - -#define E_MAIL_PIXBOUND(u) ((gfloat)((gint)(u))) - -static void mx_draggable_iface_init (MxDraggableIface *iface); - -G_DEFINE_TYPE_WITH_CODE ( - EMailTab, - e_mail_tab, - MX_TYPE_WIDGET, - G_IMPLEMENT_INTERFACE ( - MX_TYPE_DRAGGABLE, mx_draggable_iface_init)) - -enum { - PROP_0, - PROP_ICON, - PROP_TEXT, - PROP_CAN_CLOSE, - PROP_TAB_WIDTH, - PROP_DOCKING, - PROP_PREVIEW, - PROP_PREVIEW_MODE, - PROP_PREVIEW_DURATION, - PROP_SPACING, - PROP_PRIVATE, - PROP_ACTIVE, - PROP_DRAG_THRESHOLD, - PROP_DRAG_AXIS, - PROP_DRAG_CONTAINMENT_AREA, - PROP_DRAG_ENABLED, - PROP_DRAG_ACTOR, -}; - -enum { - CLICKED, - CLOSED, - TRANSITION_COMPLETE, - LAST_SIGNAL -}; - -/* Animation stage lengths */ -#define TAB_S1_ANIM 0.75 -#define TAB_S2_ANIM (1.0-TAB_S1_ANIM) - -static guint signals[LAST_SIGNAL] = { 0, }; - -static void e_mail_tab_close_clicked_cb (MxButton *button, EMailTab *self); - -struct _EMailTabPrivate { - ClutterActor *icon; - ClutterActor *default_icon; - ClutterActor *label; - ClutterActor *close_button; - gboolean can_close; - gint width; - gboolean docking; - gfloat spacing; - gboolean private; - guint alert_count; - guint alert_source; - gboolean has_text; - - guint active : 1; - guint pressed : 1; - guint hover : 1; - - ClutterActor *preview; - gboolean preview_mode; - ClutterTimeline *preview_timeline; - gdouble preview_height_progress; - guint anim_length; - - ClutterActor *old_bg; - - ClutterActor *drag_actor; - ClutterActorBox drag_area; - gboolean drag_enabled; - MxDragAxis drag_axis; - gint drag_threshold; - gulong drag_threshold_handler; - gfloat press_x; - gfloat press_y; - gboolean in_drag; -}; - -static void -e_mail_tab_drag_begin (MxDraggable *draggable, - gfloat event_x, - gfloat event_y, - gint event_button, - ClutterModifierType modifiers) -{ - EMailTabPrivate *priv; - ClutterActor *self = CLUTTER_ACTOR (draggable); - ClutterActor *actor = mx_draggable_get_drag_actor (draggable); - ClutterActor *stage = clutter_actor_get_stage (self); - gfloat x, y; - - priv = E_MAIL_TAB_GET_PRIVATE (draggable); - priv->in_drag = TRUE; - - clutter_actor_get_transformed_position (self, &x, &y); - clutter_actor_set_position (actor, x, y); - - /* Start up animation */ - if (CLUTTER_IS_TEXTURE (actor)) { - /* TODO: Some neat deformation effect? */ - } else { - /* Fade in */ - clutter_actor_set_opacity (actor, 0x00); - clutter_actor_animate ( - actor, CLUTTER_LINEAR, 150, - "opacity", 0xff, - NULL); - } - - clutter_container_add_actor (CLUTTER_CONTAINER (stage), actor); -} - -static void -e_mail_tab_drag_motion (MxDraggable *draggable, - gfloat delta_x, - gfloat delta_y) -{ - ClutterActor *actor = mx_draggable_get_drag_actor (draggable); - clutter_actor_move_by (actor, delta_x, delta_y); -} - -static void -e_mail_tab_drag_end_anim_cb (ClutterAnimation *animation, - EMailTab *tab) -{ - ClutterActor *actor = - CLUTTER_ACTOR (clutter_animation_get_object (animation)); - ClutterActor *parent = clutter_actor_get_parent (actor); - - if (parent) - clutter_container_remove_actor ( - CLUTTER_CONTAINER (parent), actor); -} - -static void -e_mail_tab_drag_end (MxDraggable *draggable, - gfloat event_x, - gfloat event_y) -{ - EMailTab *self = E_MAIL_TAB (draggable); - EMailTabPrivate *priv = self->priv; - - priv->in_drag = FALSE; - - if (priv->drag_actor) { - ClutterActor *parent = clutter_actor_get_parent (priv->drag_actor); - if (parent) { - /* Animate drop */ - if (CLUTTER_IS_TEXTURE (priv->drag_actor)) { - /* TODO: Some neat deformation effect? */ - clutter_container_remove_actor ( - CLUTTER_CONTAINER (parent), - priv->drag_actor); - } else { - clutter_actor_animate ( - priv->drag_actor, - CLUTTER_LINEAR, 150, - "opacity", 0x00, - "signal::completed", - G_CALLBACK (e_mail_tab_drag_end_anim_cb), - self, NULL); - } - } - - g_object_unref (priv->drag_actor); - priv->drag_actor = NULL; - } -} - -static void -mx_draggable_iface_init (MxDraggableIface *iface) -{ - iface->drag_begin = e_mail_tab_drag_begin; - iface->drag_motion = e_mail_tab_drag_motion; - iface->drag_end = e_mail_tab_drag_end; -} - -static void -e_mail_tab_get_property (GObject *object, - guint property_id, - GValue *value, - GParamSpec *pspec) -{ - EMailTab *tab = E_MAIL_TAB (object); - EMailTabPrivate *priv = tab->priv; - - switch (property_id) { - case PROP_ICON: - g_value_set_object (value, e_mail_tab_get_icon (tab)); - break; - - case PROP_TEXT: - g_value_set_string (value, e_mail_tab_get_text (tab)); - break; - - case PROP_CAN_CLOSE: - g_value_set_boolean (value, e_mail_tab_get_can_close (tab)); - break; - - case PROP_TAB_WIDTH: - g_value_set_int (value, e_mail_tab_get_width (tab)); - break; - - case PROP_DOCKING: - g_value_set_boolean (value, e_mail_tab_get_docking (tab)); - break; - - case PROP_PREVIEW: - g_value_set_object (value, e_mail_tab_get_preview_actor (tab)); - break; - - case PROP_PREVIEW_MODE: - g_value_set_boolean (value, e_mail_tab_get_preview_mode (tab)); - break; - - case PROP_PREVIEW_DURATION: - g_value_set_uint (value, e_mail_tab_get_preview_duration (tab)); - break; - - case PROP_SPACING: - g_value_set_float (value, e_mail_tab_get_spacing (tab)); - break; - - case PROP_PRIVATE: - g_value_set_boolean (value, e_mail_tab_get_private (tab)); - break; - - case PROP_ACTIVE: - g_value_set_boolean (value, e_mail_tab_get_active (tab)); - break; - - case PROP_DRAG_THRESHOLD: - g_value_set_uint (value, (guint) priv->drag_threshold); - break; - - case PROP_DRAG_AXIS: - g_value_set_enum (value, priv->drag_axis); - break; - - case PROP_DRAG_CONTAINMENT_AREA: - g_value_set_boxed (value, &priv->drag_area); - break; - - case PROP_DRAG_ENABLED: - g_value_set_boolean (value, priv->drag_enabled); - break; - - case PROP_DRAG_ACTOR: - if (!priv->drag_actor) - priv->drag_actor = g_object_ref_sink ( - clutter_clone_new (CLUTTER_ACTOR (tab))); - g_value_set_object (value, priv->drag_actor); - break; - - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); - } -} - -static void -e_mail_tab_set_property (GObject *object, - guint property_id, - const GValue *value, - GParamSpec *pspec) -{ - EMailTab *tab = E_MAIL_TAB (object); - EMailTabPrivate *priv = tab->priv; - - switch (property_id) { - case PROP_ICON: - e_mail_tab_set_icon ( - tab, g_value_get_object (value)); - break; - - case PROP_TEXT: - e_mail_tab_set_text ( - tab, g_value_get_string (value)); - break; - - case PROP_CAN_CLOSE: - e_mail_tab_set_can_close ( - tab, g_value_get_boolean (value)); - - case PROP_TAB_WIDTH: - e_mail_tab_set_width ( - tab, g_value_get_int (value)); - break; - - case PROP_DOCKING: - e_mail_tab_set_docking ( - tab, g_value_get_boolean (value)); - break; - - case PROP_PREVIEW: - e_mail_tab_set_preview_actor ( - tab, g_value_get_object (value)); - break; - - case PROP_PREVIEW_MODE: - e_mail_tab_set_preview_mode ( - tab, g_value_get_boolean (value)); - break; - - case PROP_PREVIEW_DURATION: - e_mail_tab_set_preview_duration ( - tab, g_value_get_uint (value)); - break; - - case PROP_SPACING: - e_mail_tab_set_spacing ( - tab, g_value_get_float (value)); - break; - - case PROP_PRIVATE: - e_mail_tab_set_private ( - tab, g_value_get_boolean (value)); - break; - - case PROP_ACTIVE: - e_mail_tab_set_active ( - tab, g_value_get_boolean (value)); - break; - - case PROP_DRAG_THRESHOLD: - break; - - case PROP_DRAG_AXIS: - priv->drag_axis = g_value_get_enum (value); - break; - - case PROP_DRAG_CONTAINMENT_AREA: - { - ClutterActorBox *box = g_value_get_boxed (value); - - if (box) - priv->drag_area = *box; - else - memset ( - &priv->drag_area, 0, - sizeof (ClutterActorBox)); - break; - } - - case PROP_DRAG_ENABLED: - priv->drag_enabled = g_value_get_boolean (value); - break; - - case PROP_DRAG_ACTOR: - { - ClutterActor *new_actor = g_value_get_object (value); - - if (priv->drag_actor) { - ClutterActor *parent; - - parent = clutter_actor_get_parent (priv->drag_actor); - - /* We know it's a container because we added it ourselves */ - if (parent) - clutter_container_remove_actor ( - CLUTTER_CONTAINER (parent), - priv->drag_actor); - - g_object_unref (priv->drag_actor); - priv->drag_actor = NULL; - } - - if (new_actor) - priv->drag_actor = g_object_ref_sink (new_actor); - - break; - } - - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); - } -} - -static void -e_mail_tab_dispose_old_bg (EMailTab *tab) -{ - EMailTabPrivate *priv = tab->priv; - - if (priv->old_bg) { - ClutterActor *parent; - - parent = clutter_actor_get_parent (priv->old_bg); - if (parent == (ClutterActor *) tab) - clutter_actor_unparent (priv->old_bg); - g_object_unref (priv->old_bg); - priv->old_bg = NULL; - } -} - -static void -e_mail_tab_dispose (GObject *object) -{ - EMailTab *tab = E_MAIL_TAB (object); - EMailTabPrivate *priv = tab->priv; - - e_mail_tab_dispose_old_bg (tab); - - if (priv->icon) { - clutter_actor_unparent (priv->icon); - priv->icon = NULL; - } - - if (priv->default_icon) { - g_object_unref (priv->default_icon); - priv->default_icon = NULL; - } - - if (priv->label) { - clutter_actor_unparent (CLUTTER_ACTOR (priv->label)); - priv->label = NULL; - } - - if (priv->close_button) { - clutter_actor_unparent (CLUTTER_ACTOR (priv->close_button)); - priv->close_button = NULL; - } - - if (priv->preview) { - clutter_actor_unparent (priv->preview); - priv->preview = NULL; - } - - if (priv->alert_source) { - g_source_remove (priv->alert_source); - priv->alert_source = 0; - } - - if (priv->drag_actor) { - ClutterActor *parent; - - parent = clutter_actor_get_parent (priv->drag_actor); - if (parent) - clutter_container_remove_actor ( - CLUTTER_CONTAINER (parent), - priv->drag_actor); - - g_object_unref (priv->drag_actor); - priv->drag_actor = NULL; - } - - if (priv->drag_threshold_handler) - g_signal_handler_disconnect ( - gtk_settings_get_default (), - priv->drag_threshold_handler); - priv->drag_threshold_handler = 0; - - G_OBJECT_CLASS (e_mail_tab_parent_class)->dispose (object); -} - -static void -e_mail_tab_get_preferred_width (ClutterActor *actor, - gfloat for_height, - gfloat *min_width_p, - gfloat *natural_width_p) -{ - EMailTabPrivate *priv; - MxPadding padding; - - priv = E_MAIL_TAB_GET_PRIVATE (actor); - - /* Get padding */ - mx_widget_get_padding (MX_WIDGET (actor), &padding); - if (min_width_p) - *min_width_p = padding.left + padding.right; - if (natural_width_p) - *natural_width_p = padding.left + padding.right; - - if (priv->width >= 0) { - if (natural_width_p) - *natural_width_p += priv->width; - } else { - gfloat min_width, nat_width, acc_min_width, acc_nat_width; - - acc_min_width = acc_nat_width = 0; - - if (priv->has_text) - clutter_actor_get_preferred_size ( - CLUTTER_ACTOR (priv->label), - &acc_min_width, NULL, - &acc_nat_width, NULL); - - if (priv->icon) - clutter_actor_get_preferred_size ( - priv->icon, - &min_width, NULL, - &nat_width, NULL); - acc_min_width += min_width; - acc_nat_width += nat_width; - - if (priv->can_close) - clutter_actor_get_preferred_size ( - CLUTTER_ACTOR (priv->close_button), - &min_width, NULL, - &nat_width, NULL); - acc_min_width += min_width; - acc_nat_width += nat_width; - - if (priv->preview && priv->preview_mode) { - clutter_actor_get_preferred_size ( - priv->preview, - &min_width, NULL, - &nat_width, NULL); - - if (min_width > acc_min_width) - acc_min_width = min_width; - if (nat_width > acc_nat_width) - acc_nat_width = nat_width; - } - - if (min_width_p) - *min_width_p += acc_min_width; - if (natural_width_p) - *natural_width_p += acc_nat_width; - } -} - -void -e_mail_tab_get_height_no_preview (EMailTab *tab, - gfloat for_width, - gfloat *min_height_p, - gfloat *natural_height_p) -{ - MxPadding padding; - gfloat min_height, nat_height, tmp_min_height, tmp_nat_height; - - ClutterActor *actor = CLUTTER_ACTOR (tab); - EMailTabPrivate *priv = tab->priv; - - /* Get padding */ - mx_widget_get_padding (MX_WIDGET (actor), &padding); - if (min_height_p) - *min_height_p = padding.top + padding.bottom; - if (natural_height_p) - *natural_height_p = padding.top + padding.bottom; - - min_height = nat_height = 0; - if (priv->has_text) - clutter_actor_get_preferred_height ( - CLUTTER_ACTOR (priv->label), -1, - &min_height, &nat_height); - - if (priv->icon) { - clutter_actor_get_preferred_height ( - priv->icon, -1, &tmp_min_height, &tmp_nat_height); - if (tmp_min_height > min_height) - min_height = tmp_min_height; - if (tmp_nat_height > nat_height) - nat_height = tmp_nat_height; - } - - if (priv->can_close) { - clutter_actor_get_preferred_height ( - CLUTTER_ACTOR (priv->close_button), - -1, &tmp_min_height, &tmp_nat_height); - - if (tmp_min_height > min_height) - min_height = tmp_min_height; - if (tmp_nat_height > nat_height) - nat_height = tmp_nat_height; - } - - if (min_height_p) - *min_height_p += min_height; - if (natural_height_p) - *natural_height_p += nat_height; -} - -static void -e_mail_tab_get_preferred_height (ClutterActor *actor, - gfloat for_width, - gfloat *min_height_p, - gfloat *natural_height_p) -{ - EMailTab *tab = E_MAIL_TAB (actor); - EMailTabPrivate *priv = tab->priv; - - e_mail_tab_get_height_no_preview ( - tab, for_width, min_height_p, natural_height_p); - - if (priv->preview) { - MxPadding padding; - gfloat min_height, nat_height; - gfloat label_min_height, label_nat_height; - - /* Get preview + padding height */ - mx_widget_get_padding (MX_WIDGET (actor), &padding); - - clutter_actor_get_preferred_height ( - priv->preview, - (gfloat) priv->width, - &min_height, &nat_height); - - /* Add label height */ - clutter_actor_get_preferred_height ( - CLUTTER_ACTOR (priv->label), -1, - &label_min_height, &label_nat_height); - - min_height = - (min_height * priv->preview_height_progress) + - padding.top + padding.bottom + priv->spacing + - label_min_height; - - nat_height = - (nat_height * priv->preview_height_progress) + - padding.top + padding.bottom + priv->spacing + - label_nat_height; - - /* Sometimes the preview's natural height will be nan due to - * keeping of the aspect ratio. This guards against that and - * stops Clutter from warning that the natural height is less - * than the minimum height. */ - if (isnan (nat_height)) - nat_height = min_height; - - if (min_height_p && (min_height > *min_height_p)) - *min_height_p = min_height; - if (natural_height_p && (nat_height > *natural_height_p)) - *natural_height_p = nat_height; - } -} - -static void -e_mail_tab_allocate (ClutterActor *actor, - const ClutterActorBox *box, - ClutterAllocationFlags flags) -{ - EMailTabPrivate *priv; - MxPadding padding; - ClutterActorBox child_box; - gfloat icon_width, icon_height; - gfloat label_width, label_height; - gfloat close_width, close_height; - gfloat preview_width, preview_height; - - priv = E_MAIL_TAB_GET_PRIVATE (actor); - - /* Chain up to store box */ - CLUTTER_ACTOR_CLASS (e_mail_tab_parent_class)->allocate (actor, box, flags); - - /* Possibly synchronise an axis if we're dragging */ - if (priv->in_drag) { - ClutterActor *drag_actor = - mx_draggable_get_drag_actor (MX_DRAGGABLE (actor)); - - if (drag_actor) { - gfloat x, y; - clutter_actor_get_transformed_position (actor, &x, &y); - - switch (mx_draggable_get_axis (MX_DRAGGABLE (actor))) { - case MX_DRAG_AXIS_X : - /* Synchronise y axis */ - clutter_actor_set_y (drag_actor, y); - break; - case MX_DRAG_AXIS_Y : - /* Synchronise x axis */ - clutter_actor_set_x (drag_actor, x); - break; - default: - break; - } - } - } - - /* Allocate old background texture */ - if (priv->old_bg) { - child_box.x1 = 0; - child_box.y1 = 0; - child_box.x2 = box->x2 - box->x1; - child_box.y2 = box->y2 - box->y1; - clutter_actor_allocate (priv->old_bg, &child_box, flags); - } - - mx_widget_get_padding (MX_WIDGET (actor), &padding); - - /* Get the preferred width/height of the icon, - * label and close-button first. */ - if (priv->icon) - clutter_actor_get_preferred_size ( - priv->icon, NULL, NULL, - &icon_width, &icon_height); - - clutter_actor_get_preferred_size ( - CLUTTER_ACTOR (priv->label), NULL, NULL, - &label_width, &label_height); - - if (priv->can_close) - clutter_actor_get_preferred_size ( - CLUTTER_ACTOR (priv->close_button), - NULL, NULL, &close_width, &close_height); - - /* Allocate for icon */ - if (priv->icon) { - child_box.x1 = padding.left; - child_box.x2 = child_box.x1 + icon_width; - child_box.y1 = E_MAIL_PIXBOUND ((box->y2 - box->y1) / 2 - icon_height / 2); - child_box.y2 = child_box.y1 + icon_height; - clutter_actor_allocate (priv->icon, &child_box, flags); - } - - /* Allocate for close button */ - if (priv->can_close) { - child_box.x2 = box->x2 - box->x1 - padding.right; - child_box.x1 = child_box.x2 - close_width; - child_box.y1 = E_MAIL_PIXBOUND ((box->y2 - box->y1) / 2 - close_height / 2); - child_box.y2 = child_box.y1 + close_height; - clutter_actor_allocate ( - CLUTTER_ACTOR (priv->close_button), - &child_box, flags); - } - - /* Allocate for preview widget */ - preview_height = 0; - if (priv->preview) { - preview_width = - (box->x2 - box->x1 - - padding.left - padding.right); - preview_height = - (box->y2 - box->y1 - - padding.top - padding.bottom - - priv->spacing - label_height); - - child_box.x1 = E_MAIL_PIXBOUND (padding.left); - child_box.y1 = E_MAIL_PIXBOUND (padding.top); - child_box.x2 = child_box.x1 + preview_width; - child_box.y2 = child_box.y1 + preview_height; - - clutter_actor_allocate (priv->preview, &child_box, flags); - } - - /* Allocate for label */ - if ((priv->preview_height_progress <= TAB_S1_ANIM) || (!priv->preview)) { - if (priv->icon) - child_box.x1 = E_MAIL_PIXBOUND ( - padding.left + icon_width + priv->spacing); - else - child_box.x1 = E_MAIL_PIXBOUND (padding.left); - child_box.x2 = (box->x2 - box->x1 - padding.right); - child_box.y1 = E_MAIL_PIXBOUND ( - (box->y2 - box->y1) / 2 - label_height / 2); - child_box.y2 = child_box.y1 + label_height; - - /* If close button is visible, don't overlap it */ - if (priv->can_close) - child_box.x2 -= close_width + priv->spacing; - } else { - /* Put label underneath preview */ - child_box.x1 = E_MAIL_PIXBOUND (padding.left); - child_box.x2 = (box->x2 - box->x1 - padding.right); - child_box.y1 = E_MAIL_PIXBOUND ( - padding.top + preview_height + priv->spacing); - child_box.y2 = child_box.y1 + label_height; - } - - clutter_actor_allocate (CLUTTER_ACTOR (priv->label), &child_box, flags); - - /* If we're in preview mode, re-allocate the background so it doesn't - * encompass the label. (A bit hacky?) - */ - if (priv->preview && CLUTTER_ACTOR_IS_VISIBLE (priv->preview)) { - gfloat max_height = padding.top + padding.bottom + preview_height; - if (box->y2 - box->y1 > max_height) { - MxWidget *widget = MX_WIDGET (actor); - ClutterActor *background = mx_widget_get_border_image (widget); - - if (!background) - background = mx_widget_get_background_image (widget); - - child_box.x1 = 0; - child_box.x2 = box->x2 - box->x1; - child_box.y1 = 0; - child_box.y2 = max_height; - - if (background) - clutter_actor_allocate ( - background, &child_box, flags); - - if (priv->old_bg && (priv->old_bg != background)) - clutter_actor_allocate ( - priv->old_bg, &child_box, flags); - } - } -} - -static void -e_mail_tab_paint (ClutterActor *actor) -{ - EMailTabPrivate *priv; - - priv = E_MAIL_TAB_GET_PRIVATE (actor); - - /* Chain up to paint background */ - CLUTTER_ACTOR_CLASS (e_mail_tab_parent_class)->paint (actor); - - if (priv->old_bg) - clutter_actor_paint (priv->old_bg); - - if (priv->icon) - clutter_actor_paint (priv->icon); - - clutter_actor_paint (CLUTTER_ACTOR (priv->label)); - - if (priv->can_close) - clutter_actor_paint (CLUTTER_ACTOR (priv->close_button)); - - if (priv->preview) - clutter_actor_paint (CLUTTER_ACTOR (priv->preview)); -} - -static void -e_mail_tab_pick (ClutterActor *actor, - const ClutterColor *c) -{ - CLUTTER_ACTOR_CLASS (e_mail_tab_parent_class)->pick (actor, c); - - if (clutter_actor_should_pick_paint (actor)) - e_mail_tab_paint (actor); -} - -static void -e_mail_tab_map (ClutterActor *actor) -{ - EMailTabPrivate *priv; - - priv = E_MAIL_TAB_GET_PRIVATE (actor); - - CLUTTER_ACTOR_CLASS (e_mail_tab_parent_class)->map (actor); - - clutter_actor_map (CLUTTER_ACTOR (priv->label)); - clutter_actor_map (CLUTTER_ACTOR (priv->close_button)); - - if (priv->icon) - clutter_actor_map (priv->icon); - if (priv->preview) - clutter_actor_map (priv->preview); - if (priv->old_bg) - clutter_actor_map (priv->old_bg); -} - -static void -e_mail_tab_unmap (ClutterActor *actor) -{ - EMailTabPrivate *priv; - - priv = E_MAIL_TAB_GET_PRIVATE (actor); - - CLUTTER_ACTOR_CLASS (e_mail_tab_parent_class)->unmap (actor); - - clutter_actor_unmap (CLUTTER_ACTOR (priv->label)); - clutter_actor_unmap (CLUTTER_ACTOR (priv->close_button)); - - if (priv->icon) - clutter_actor_unmap (priv->icon); - if (priv->preview) - clutter_actor_unmap (priv->preview); - if (priv->old_bg) - clutter_actor_unmap (priv->old_bg); -} - -static gboolean -e_mail_tab_button_press_event (ClutterActor *actor, - ClutterButtonEvent *event) -{ - EMailTabPrivate *priv; - - priv = E_MAIL_TAB_GET_PRIVATE (actor); - - if (event->button == 1) { - mx_stylable_set_style_pseudo_class ( - MX_STYLABLE (actor), "active"); - clutter_grab_pointer (actor); - priv->pressed = TRUE; - - priv->press_x = event->x; - priv->press_y = event->y; - } - - /* We have to always return false, or dragging won't work */ - return FALSE; -} - -static gboolean -e_mail_tab_button_release_event (ClutterActor *actor, - ClutterButtonEvent *event) -{ - EMailTab *tab = E_MAIL_TAB (actor); - EMailTabPrivate *priv = tab->priv; - - if (priv->pressed) { - clutter_ungrab_pointer (); - priv->pressed = FALSE; - - /* Note, no need to set the pseudo class here as clicking - * always results in being set active. */ - if (priv->hover) { - if (!priv->active) - e_mail_tab_set_active (tab, TRUE); - - g_signal_emit (actor, signals[CLICKED], 0); - } - } - - return FALSE; -} - -static gboolean -e_mail_tab_motion_event (ClutterActor *actor, - ClutterMotionEvent *event) -{ - EMailTab *tab = E_MAIL_TAB (actor); - EMailTabPrivate *priv = tab->priv; - - if (priv->pressed && priv->drag_enabled) { - if ((ABS (event->x - priv->press_x) >= priv->drag_threshold) || - (ABS (event->y - priv->press_y) >= priv->drag_threshold)) { - /* Ungrab the pointer so that the MxDraggable code can take over */ - clutter_ungrab_pointer (); - priv->pressed = FALSE; - if (!priv->active) { - if (priv->hover) - mx_stylable_set_style_pseudo_class ( - MX_STYLABLE (actor), "hover"); - else - mx_stylable_set_style_pseudo_class ( - MX_STYLABLE (actor), NULL); - } - } - } - - return FALSE; -} - -static gboolean -e_mail_tab_enter_event (ClutterActor *actor, - ClutterCrossingEvent *event) -{ - EMailTabPrivate *priv; - - priv = E_MAIL_TAB_GET_PRIVATE (actor); - - if (event->source != actor) - return FALSE; - - priv->hover = TRUE; - - if (priv->pressed) - mx_stylable_set_style_pseudo_class ( - MX_STYLABLE (actor), "active"); - else if (!priv->active) - mx_stylable_set_style_pseudo_class ( - MX_STYLABLE (actor), "hover"); - - return FALSE; -} - -static gboolean -e_mail_tab_leave_event (ClutterActor *actor, - ClutterCrossingEvent *event) -{ - EMailTabPrivate *priv; - - priv = E_MAIL_TAB_GET_PRIVATE (actor); - - if ((event->source != actor) || - (event->related == (ClutterActor *) priv->close_button)) - return FALSE; - - priv->hover = FALSE; - - if (!priv->active) - mx_stylable_set_style_pseudo_class (MX_STYLABLE (actor), NULL); - - return FALSE; -} - -static void -e_mail_tab_class_init (EMailTabClass *class) -{ - GObjectClass *object_class = G_OBJECT_CLASS (class); - ClutterActorClass *actor_class = CLUTTER_ACTOR_CLASS (class); - - g_type_class_add_private (class, sizeof (EMailTabPrivate)); - - object_class->get_property = e_mail_tab_get_property; - object_class->set_property = e_mail_tab_set_property; - object_class->dispose = e_mail_tab_dispose; - - actor_class->get_preferred_width = e_mail_tab_get_preferred_width; - actor_class->get_preferred_height = e_mail_tab_get_preferred_height; - actor_class->button_press_event = e_mail_tab_button_press_event; - actor_class->button_release_event = e_mail_tab_button_release_event; - actor_class->motion_event = e_mail_tab_motion_event; - actor_class->enter_event = e_mail_tab_enter_event; - actor_class->leave_event = e_mail_tab_leave_event; - actor_class->allocate = e_mail_tab_allocate; - actor_class->paint = e_mail_tab_paint; - actor_class->pick = e_mail_tab_pick; - actor_class->map = e_mail_tab_map; - actor_class->unmap = e_mail_tab_unmap; - - g_object_class_install_property ( - object_class, - PROP_ICON, - g_param_spec_object ( - "icon", - "Icon", - "Icon actor.", - CLUTTER_TYPE_ACTOR, - G_PARAM_READWRITE | - G_PARAM_STATIC_STRINGS)); - - g_object_class_install_property ( - object_class, - PROP_TEXT, - g_param_spec_string ( - "text", - "Text", - "Tab text.", - "", - G_PARAM_READWRITE | - G_PARAM_STATIC_STRINGS)); - - g_object_class_install_property ( - object_class, - PROP_CAN_CLOSE, - g_param_spec_boolean ( - "can-close", - "Can close", - "Whether the tab can " - "close.", - TRUE, - G_PARAM_READWRITE | - G_PARAM_STATIC_STRINGS)); - - g_object_class_install_property ( - object_class, - PROP_TAB_WIDTH, - g_param_spec_int ( - "tab-width", - "Tab width", - "Tab width.", - -1, G_MAXINT, -1, - G_PARAM_READWRITE | - G_PARAM_STATIC_STRINGS)); - - g_object_class_install_property ( - object_class, - PROP_DOCKING, - g_param_spec_boolean ( - "docking", - "Docking", - "Whether the tab should dock to edges when scrolled.", - FALSE, - G_PARAM_READWRITE | - G_PARAM_STATIC_STRINGS)); - - g_object_class_install_property ( - object_class, - PROP_PREVIEW, - g_param_spec_object ( - "preview", - "Preview actor", - "ClutterActor used " - "when in preview mode.", - CLUTTER_TYPE_ACTOR, - G_PARAM_READWRITE | - G_PARAM_STATIC_STRINGS)); - - g_object_class_install_property ( - object_class, - PROP_PREVIEW_MODE, - g_param_spec_boolean ( - "preview-mode", - "Preview mode", - "Whether to display " - "in preview mode.", - FALSE, - G_PARAM_READWRITE | - G_PARAM_STATIC_STRINGS)); - - g_object_class_install_property ( - object_class, - PROP_PREVIEW_DURATION, - g_param_spec_uint ( - "preview-duration", - "Preview duration", - "How long the transition " - "between preview mode " - "states lasts, in ms.", - 0, G_MAXUINT, 200, - G_PARAM_READWRITE | - G_PARAM_STATIC_STRINGS)); - - g_object_class_install_property ( - object_class, - PROP_SPACING, - g_param_spec_float ( - "spacing", - "Spacing", - "Spacing between " - "tab elements.", - 0, G_MAXFLOAT, - 6.0, - G_PARAM_READWRITE | - G_PARAM_STATIC_STRINGS)); - - g_object_class_install_property ( - object_class, - PROP_PRIVATE, - g_param_spec_boolean ( - "private", - "Private", - "Set if the tab is " - "'private'.", - FALSE, - G_PARAM_READWRITE | - G_PARAM_STATIC_STRINGS)); - - g_object_class_install_property ( - object_class, - PROP_ACTIVE, - g_param_spec_boolean ( - "active", - "Active", - "Set if the tab is " - "active.", - FALSE, - G_PARAM_READWRITE | - G_PARAM_STATIC_STRINGS)); - - g_object_class_override_property ( - object_class, - PROP_DRAG_THRESHOLD, - "drag-threshold"); - - g_object_class_override_property ( - object_class, - PROP_DRAG_AXIS, - "axis"); - - g_object_class_override_property ( - object_class, - PROP_DRAG_CONTAINMENT_AREA, - "containment-area"); - - g_object_class_override_property ( - object_class, - PROP_DRAG_ENABLED, - "drag-enabled"); - - g_object_class_override_property ( - object_class, - PROP_DRAG_ACTOR, - "drag-actor"); - - signals[CLICKED] = g_signal_new ( - "clicked", - G_TYPE_FROM_CLASS (class), - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (EMailTabClass, clicked), - NULL, NULL, - g_cclosure_marshal_VOID__VOID, - G_TYPE_NONE, 0); - - signals[CLOSED] = g_signal_new ( - "closed", - G_TYPE_FROM_CLASS (class), - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (EMailTabClass, closed), - NULL, NULL, - g_cclosure_marshal_VOID__VOID, - G_TYPE_NONE, 0); - - signals[TRANSITION_COMPLETE] = g_signal_new ( - "transition-complete", - G_TYPE_FROM_CLASS (class), - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (EMailTabClass, transition_complete), - NULL, NULL, - g_cclosure_marshal_VOID__VOID, - G_TYPE_NONE, 0); -} - -static void -e_mail_tab_close_clicked_cb (MxButton *button, - EMailTab *self) -{ - g_signal_emit (self, signals[CLOSED], 0); -} - -static void -e_mail_tab_anim_completed_cb (ClutterAnimation *animation, - EMailTab *tab) -{ - e_mail_tab_dispose_old_bg (tab); -} - -static void -e_mail_tab_style_changed_cb (MxWidget *widget) -{ - EMailTabPrivate *priv; - - priv = E_MAIL_TAB_GET_PRIVATE (widget); - - /* Don't transition on hover */ - if (g_strcmp0 (mx_stylable_get_style_pseudo_class ( - MX_STYLABLE (widget)), "hover") == 0) - return; - - if (priv->old_bg) { - if (!clutter_actor_get_parent (priv->old_bg)) { - ClutterActorBox box; - ClutterActor *background; - ClutterActor *actor = CLUTTER_ACTOR (widget); - - clutter_actor_set_parent (priv->old_bg, actor); - - /* Try to allocate the same size as the background - * widget, otherwise allocate the same size as the - * widget itself. */ - background = mx_widget_get_border_image (widget); - if (!background) - background = mx_widget_get_background_image (widget); - - if (background) - clutter_actor_get_allocation_box (background, &box); - else { - clutter_actor_get_allocation_box (actor, &box); - box.x2 -= box.x1; - box.y2 -= box.y1; - box.x1 = 0; - box.y1 = 0; - } - - clutter_actor_allocate (priv->old_bg, &box, 0); - } - - clutter_actor_animate ( - priv->old_bg, CLUTTER_LINEAR, 150, - "opacity", 0, "signal::completed", - G_CALLBACK (e_mail_tab_anim_completed_cb), - widget, NULL); - } -} - -static void -e_mail_tab_stylable_changed_cb (MxStylable *stylable) -{ - EMailTab *tab = E_MAIL_TAB (stylable); - EMailTabPrivate *priv = tab->priv; - - e_mail_tab_dispose_old_bg (tab); - - priv->old_bg = mx_widget_get_border_image (MX_WIDGET (tab)); - if (priv->old_bg) - g_object_ref (priv->old_bg); -} - -static void -e_mail_tab_dnd_notify_cb (GObject *settings, - GParamSpec *pspec, - EMailTab *tab) -{ - g_object_get ( - settings, - "gtk-dnd-drag-threshold", &tab->priv->drag_threshold, - NULL); -} - -static void -e_mail_tab_init (EMailTab *tab) -{ - ClutterActor *text; - GtkSettings *settings; - - tab->priv = E_MAIL_TAB_GET_PRIVATE (tab); - - tab->priv->width = -1; - tab->priv->anim_length = 200; - tab->priv->spacing = 6.0; - tab->priv->can_close = TRUE; - - tab->priv->label = mx_label_new (); - g_object_set (tab->priv->label, "clip-to-allocation", TRUE, NULL); - text = mx_label_get_clutter_text (MX_LABEL (tab->priv->label)); - clutter_text_set_ellipsize (CLUTTER_TEXT (text), PANGO_ELLIPSIZE_END); - clutter_actor_set_parent ( - CLUTTER_ACTOR (tab->priv->label), CLUTTER_ACTOR (tab)); - - tab->priv->close_button = mx_button_new (); - clutter_actor_set_name ( - CLUTTER_ACTOR (tab->priv->close_button), "tab-close-button"); - clutter_actor_set_parent ( - CLUTTER_ACTOR (tab->priv->close_button), CLUTTER_ACTOR (tab)); - - g_signal_connect ( - tab->priv->close_button, "clicked", - G_CALLBACK (e_mail_tab_close_clicked_cb), tab); - - /* Connect up styling signals */ - g_signal_connect ( - tab, "style-changed", - G_CALLBACK (e_mail_tab_style_changed_cb), NULL); - g_signal_connect ( - tab, "stylable-changed", - G_CALLBACK (e_mail_tab_stylable_changed_cb), NULL); - - clutter_actor_set_reactive (CLUTTER_ACTOR (tab), TRUE); - - settings = gtk_settings_get_default (); - tab->priv->drag_threshold_handler = g_signal_connect ( - settings, "notify::gtk-dnd-drag-threshold", - G_CALLBACK (e_mail_tab_dnd_notify_cb), tab); - g_object_get ( - G_OBJECT (settings), - "gtk-dnd-drag-threshold", &tab->priv->drag_threshold, - NULL); -} - -ClutterActor * -e_mail_tab_new (void) -{ - return g_object_new (E_TYPE_MAIL_TAB, NULL); -} - -ClutterActor * -e_mail_tab_new_full (const gchar *text, - ClutterActor *icon, - gint width) -{ - return g_object_new ( - E_TYPE_MAIL_TAB, - "text", text, - "icon", icon, - "tab-width", width, - NULL); -} - -void -e_mail_tab_set_text (EMailTab *tab, - const gchar *text) -{ - EMailTabPrivate *priv = tab->priv; - - if (!text) - text = ""; - - priv->has_text = (text[0] != '\0'); - - if (priv->label) - mx_label_set_text (MX_LABEL (priv->label), text); - - g_object_notify (G_OBJECT (tab), "text"); -} - -void -e_mail_tab_set_default_icon (EMailTab *tab, - ClutterActor *icon) -{ - EMailTabPrivate *priv = tab->priv; - gboolean changed = !priv->icon || (priv->icon == priv->default_icon); - - if (icon) - g_object_ref_sink (icon); - - if (priv->default_icon) - g_object_unref (priv->default_icon); - - priv->default_icon = icon; - - if (changed) - e_mail_tab_set_icon (tab, NULL); -} - -void -e_mail_tab_set_icon (EMailTab *tab, - ClutterActor *icon) -{ - EMailTabPrivate *priv = tab->priv; - - /* passing NULL for icon will use default icon if available */ - - if (priv->icon) - clutter_actor_unparent (priv->icon); - - if (icon) - priv->icon = icon; - else - priv->icon = priv->default_icon; - - if (priv->icon) - clutter_actor_set_parent (priv->icon, CLUTTER_ACTOR (tab)); - - clutter_actor_queue_relayout (CLUTTER_ACTOR (tab)); - - g_object_notify (G_OBJECT (tab), "icon"); -} - -const gchar * -e_mail_tab_get_text (EMailTab *tab) -{ - EMailTabPrivate *priv = tab->priv; - - if (priv->label) - return mx_label_get_text (MX_LABEL (priv->label)); - else - return NULL; -} - -ClutterActor * -e_mail_tab_get_icon (EMailTab *tab) -{ - EMailTabPrivate *priv = tab->priv; - return priv->icon == priv->default_icon ? NULL : priv->icon; -} - -void -e_mail_tab_set_can_close (EMailTab *tab, - gboolean can_close) -{ - EMailTabPrivate *priv = tab->priv; - - if ((priv->can_close ? 1 : 0) == (can_close ? 1 : 0)) - return; - - priv->can_close = can_close; - - clutter_actor_queue_relayout (CLUTTER_ACTOR (tab)); - - g_object_notify (G_OBJECT (tab), "can-close"); -} - -gboolean -e_mail_tab_get_can_close (EMailTab *tab) -{ - return tab->priv->can_close; -} - -void -e_mail_tab_set_width (EMailTab *tab, - gint width) -{ - EMailTabPrivate *priv = tab->priv; - - if (priv->width == width) - return; - - priv->width = width; - - clutter_actor_queue_relayout (CLUTTER_ACTOR (tab)); - - g_object_notify (G_OBJECT (tab), "tab-width"); -} - -gint -e_mail_tab_get_width (EMailTab *tab) -{ - EMailTabPrivate *priv = tab->priv; - return priv->width; -} - -void -e_mail_tab_set_docking (EMailTab *tab, - gboolean docking) -{ - EMailTabPrivate *priv = tab->priv; - - if ((priv->docking ? 1 : 0) == (docking ? 1 : 0)) - return; - - priv->docking = docking; - - clutter_actor_queue_relayout (CLUTTER_ACTOR (tab)); - - g_object_notify (G_OBJECT (tab), "docking"); -} - -gboolean -e_mail_tab_get_docking (EMailTab *tab) -{ - EMailTabPrivate *priv = tab->priv; - return priv->docking; -} - -void -e_mail_tab_set_preview_actor (EMailTab *tab, - ClutterActor *actor) -{ - EMailTabPrivate *priv = tab->priv; - - if (priv->preview) - clutter_actor_unparent (priv->preview); - - priv->preview = actor; - - if (actor) { - clutter_actor_set_parent (actor, CLUTTER_ACTOR (tab)); - - clutter_actor_set_opacity ( - actor, priv->preview_mode ? 0xff : 0x00); - if (!priv->preview_mode) - clutter_actor_hide (actor); - } - - clutter_actor_queue_relayout (CLUTTER_ACTOR (tab)); - - g_object_notify (G_OBJECT (tab), "preview"); -} - -ClutterActor * -e_mail_tab_get_preview_actor (EMailTab *tab) -{ - EMailTabPrivate *priv = tab->priv; - return priv->preview; -} - -static void -preview_new_frame_cb (ClutterTimeline *timeline, - guint msecs, - EMailTab *tab) -{ - gboolean forwards; - EMailTabPrivate *priv = tab->priv; - - forwards = - (clutter_timeline_get_direction (timeline) == - CLUTTER_TIMELINE_FORWARD); - if (priv->preview_mode) - forwards = !forwards; - - priv->preview_height_progress = - clutter_timeline_get_progress (timeline); - if (forwards) - priv->preview_height_progress = - 1.0 - priv->preview_height_progress; - - if (priv->preview) - clutter_actor_queue_relayout (CLUTTER_ACTOR (tab)); -} - -static void -preview_completed_cb (ClutterTimeline *timeline, - EMailTab *tab) -{ - EMailTabPrivate *priv = tab->priv; - - if (priv->preview_timeline) { - clutter_timeline_stop (priv->preview_timeline); - g_object_unref (priv->preview_timeline); - priv->preview_timeline = NULL; - - if (priv->preview_mode) - priv->preview_height_progress = 1.0; - else { - priv->preview_height_progress = 0.0; - if (priv->preview) - clutter_actor_hide (priv->preview); - if (priv->can_close) - clutter_actor_set_reactive ( - CLUTTER_ACTOR (priv->close_button), - TRUE); - } - - /* Remove style hint if we're not in preview mode */ - if (priv->preview) { - if (!priv->preview_mode) - clutter_actor_set_name ( - CLUTTER_ACTOR (tab), - priv->private ? "private-tab" : NULL); - } else { - /* If there's no preview actor, disable the tab */ - clutter_actor_set_reactive ( - CLUTTER_ACTOR (tab), !priv->preview_mode); - } - - if (priv->preview) - clutter_actor_queue_relayout (CLUTTER_ACTOR (tab)); - - g_signal_emit (tab, signals[TRANSITION_COMPLETE], 0); - } -} - -static void -preview_s1_started_cb (ClutterTimeline *timeline, - EMailTab *tab) -{ - EMailTabPrivate *priv = tab->priv; - - if (!priv->preview) - clutter_actor_animate_with_timeline ( - CLUTTER_ACTOR (priv->label), - CLUTTER_EASE_IN_OUT_QUAD, - timeline, - "opacity", 0xff, - NULL); -} - -static void -preview_s2_started_cb (ClutterTimeline *timeline, - EMailTab *tab) -{ - EMailTabPrivate *priv = tab->priv; - - if (priv->preview) - clutter_actor_animate_with_timeline ( - CLUTTER_ACTOR (priv->label), - CLUTTER_EASE_IN_OUT_QUAD, - timeline, - "opacity", 0xff, - NULL); -} - -void -e_mail_tab_set_preview_mode (EMailTab *tab, - gboolean preview) -{ - EMailTabPrivate *priv = tab->priv; - - if (priv->preview_mode != preview) { - ClutterTimeline *timeline, *timeline2; - gdouble progress, total_duration, duration1, duration2; - - priv->preview_mode = preview; - - /* Disable the close button in preview mode */ - if (preview && priv->can_close) - clutter_actor_set_reactive (CLUTTER_ACTOR (priv->close_button), FALSE); - -#define DEBUG_MULT 1 - if (priv->preview_timeline) { - progress = 1.0 - clutter_timeline_get_progress ( - priv->preview_timeline); - clutter_timeline_stop (priv->preview_timeline); - g_object_unref (priv->preview_timeline); - } else - progress = 0.0; - - total_duration = priv->anim_length * (1.0 - progress) * DEBUG_MULT; - duration1 = total_duration * TAB_S1_ANIM; - duration2 = total_duration * TAB_S2_ANIM; - - priv->preview_timeline = - clutter_timeline_new (priv->anim_length * DEBUG_MULT); - clutter_timeline_skip ( - priv->preview_timeline, clutter_timeline_get_duration ( - priv->preview_timeline) * progress); - - g_signal_connect ( - priv->preview_timeline, "completed", - G_CALLBACK (preview_completed_cb), tab); - - clutter_timeline_start (priv->preview_timeline); - - if (!priv->preview) { - clutter_actor_animate_with_timeline ( - CLUTTER_ACTOR (tab), - CLUTTER_EASE_IN_OUT_QUAD, - priv->preview_timeline, - "opacity", preview ? 0x00 : 0xff, - NULL); - return; - } - - g_signal_connect ( - priv->preview_timeline, "new-frame", - G_CALLBACK (preview_new_frame_cb), tab); - - timeline = clutter_timeline_new ((guint) duration1); - timeline2 = clutter_timeline_new ((guint) duration2); - - g_signal_connect ( - timeline, "started", - G_CALLBACK (preview_s1_started_cb), tab); - g_signal_connect ( - timeline2, "started", - G_CALLBACK (preview_s2_started_cb), tab); - - if (preview) - clutter_timeline_set_delay (timeline2, duration1); - else - clutter_timeline_set_delay (timeline, duration2); - - /* clutter_actor_animate_with_timeline will start the timelines */ - clutter_actor_animate_with_timeline ( - CLUTTER_ACTOR (priv->label), - CLUTTER_EASE_IN_OUT_QUAD, - preview ? timeline : timeline2, - "opacity", 0x00, NULL); - - if (priv->icon) - clutter_actor_animate_with_timeline ( - priv->icon, - CLUTTER_EASE_IN_OUT_QUAD, - timeline, - "opacity", preview ? 0x00 : 0xff, - NULL); - - if (priv->can_close) - clutter_actor_animate_with_timeline ( - CLUTTER_ACTOR (priv->close_button), - CLUTTER_EASE_IN_OUT_QUAD, - timeline, - "opacity", preview ? 0x00 : 0xff, - NULL); - - if (priv->preview) - clutter_actor_show (priv->preview); - clutter_actor_animate_with_timeline ( - priv->preview, - CLUTTER_EASE_IN_OUT_QUAD, - timeline2, - "opacity", preview ? 0xff : 0x00, - NULL); - - /* The animations have references on these, drop ours */ - g_object_unref (timeline); - g_object_unref (timeline2); - - /* Add an actor name, for style */ - clutter_actor_set_name ( - CLUTTER_ACTOR (tab), - priv->private ? "private-preview-tab" : - "preview-tab"); - } -} - -gboolean -e_mail_tab_get_preview_mode (EMailTab *tab) -{ - EMailTabPrivate *priv = tab->priv; - return priv->preview_mode; -} - -void -e_mail_tab_set_preview_duration (EMailTab *tab, - guint duration) -{ - EMailTabPrivate *priv = tab->priv; - - if (priv->anim_length != duration) { - priv->anim_length = duration; - g_object_notify (G_OBJECT (tab), "preview-duration"); - } -} - -guint -e_mail_tab_get_preview_duration (EMailTab *tab) -{ - EMailTabPrivate *priv = tab->priv; - return priv->anim_length; -} - -void -e_mail_tab_set_spacing (EMailTab *tab, - gfloat spacing) -{ - EMailTabPrivate *priv = tab->priv; - - if (priv->spacing != spacing) { - priv->spacing = spacing; - g_object_notify (G_OBJECT (tab), "spacing"); - clutter_actor_queue_relayout (CLUTTER_ACTOR (tab)); - } -} - -gfloat -e_mail_tab_get_spacing (EMailTab *tab) -{ - EMailTabPrivate *priv = tab->priv; - return priv->spacing; -} - -void -e_mail_tab_set_private (EMailTab *tab, - gboolean private) -{ - EMailTabPrivate *priv = tab->priv; - - if ((priv->private ? 1 : 0) == (private ? 1 : 0)) - return; - - priv->private = private; - - if (!priv->preview_mode) - clutter_actor_set_name ( - CLUTTER_ACTOR (tab), private ? "private-tab" : NULL); - - g_object_notify (G_OBJECT (tab), "private"); -} - -gboolean -e_mail_tab_get_private (EMailTab *tab) -{ - EMailTabPrivate *priv = tab->priv; - return priv->private; -} - -void -e_mail_tab_set_active (EMailTab *tab, - gboolean active) -{ - EMailTabPrivate *priv = tab->priv; - - if ((priv->active ? 1 : 0) == (active ? 1 : 0)) - return; - - priv->active = active; - - g_object_notify (G_OBJECT (tab), "active"); - - if (active) - mx_stylable_set_style_pseudo_class (MX_STYLABLE (tab), "active"); - else if (!priv->pressed) { - if (priv->hover) - mx_stylable_set_style_pseudo_class (MX_STYLABLE (tab), "hover"); - else - mx_stylable_set_style_pseudo_class (MX_STYLABLE (tab), NULL); - } -} - -gboolean -e_mail_tab_get_active (EMailTab *tab) -{ - EMailTabPrivate *priv = tab->priv; - return priv->active; -} - -static gboolean -e_mail_tab_alert_cb (EMailTab *tab) -{ - const gchar *name; - EMailTabPrivate *priv = tab->priv; - - /* FIXME: Work in preview mode */ - - /* Alternate between private mode and non-private to alert */ - name = (priv->private ^ (priv->alert_count % 2)) ? NULL : "private-tab"; - if (!priv->preview_mode) - clutter_actor_set_name (CLUTTER_ACTOR (tab), name); - priv->alert_count++; - - if (priv->alert_count < 4) - return TRUE; - - priv->alert_source = 0; - - return FALSE; -} - -void -e_mail_tab_alert (EMailTab *tab) -{ - EMailTabPrivate *priv = tab->priv; - - priv->alert_count = 0; - if (!priv->alert_source) - priv->alert_source = - g_timeout_add_full (G_PRIORITY_HIGH, - 500, - (GSourceFunc) e_mail_tab_alert_cb, - tab, - NULL); -} - -void -e_mail_tab_enable_drag (EMailTab *tab, - gboolean enable) -{ - EMailTabPrivate *priv = tab->priv; - - if (priv->drag_enabled == enable) - return; - - priv->drag_enabled = enable; - if (enable) - mx_draggable_enable (MX_DRAGGABLE (tab)); - else - mx_draggable_disable (MX_DRAGGABLE (tab)); -} - diff --git a/mail/e-mail-tab.h b/mail/e-mail-tab.h deleted file mode 100644 index 5f3f8666b8..0000000000 --- a/mail/e-mail-tab.h +++ /dev/null @@ -1,115 +0,0 @@ -/* - * Borrowed from Moblin-Web-Browser: The web browser for Moblin - * Copyright (c) 2009, Intel Corporation. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms and conditions of the GNU Lesser General Public License, - * version 2.1, as published by the Free Software Foundation. - * - * This program is distributed in the hope it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - * License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. - */ - -#ifndef E_MAIL_TAB_H -#define E_MAIL_TAB_H - -#include <clutter/clutter.h> -#include <mx/mx.h> - -/* Standard GObject macros */ -#define E_TYPE_MAIL_TAB \ - (e_mail_tab_get_type ()) -#define E_MAIL_TAB(obj) \ - (G_TYPE_CHECK_INSTANCE_CAST \ - ((obj), E_TYPE_MAIL_TAB, EMailTab)) -#define E_MAIL_TAB_CLASS(cls) \ - (G_TYPE_CHECK_CLASS_CAST \ - ((cls), E_TYPE_MAIL_TAB, EMailTabClass)) -#define E_MAIL_IS_TAB(obj) \ - (G_TYPE_CHECK_INSTANCE_TYPE \ - ((obj), E_TYPE_MAIL_TAB)) -#define E_MAIL_IS_TAB_CLASS(cls) \ - (G_TYPE_CHECK_CLASS_TYPE \ - ((cls), E_TYPE_MAIL_TAB)) -#define E_MAIL_TAB_GET_CLASS(obj) \ - (G_TYPE_INSTANCE_GET_CLASS ( \ - (obj), E_TYPE_MAIL_TAB, EMailTabClass)) - -G_BEGIN_DECLS - -typedef struct _EMailTab EMailTab; -typedef struct _EMailTabClass EMailTabClass; -typedef struct _EMailTabPrivate EMailTabPrivate; - -struct _EMailTab { - MxWidget parent; - EMailTabPrivate *priv; -}; - -struct _EMailTabClass { - MxWidgetClass parent_class; - - void (*clicked) (EMailTab *tab); - void (*closed) (EMailTab *tab); - void (*transition_complete) (EMailTab *tab); -}; - -GType e_mail_tab_get_type (void) G_GNUC_CONST; -ClutterActor * e_mail_tab_new (void); -ClutterActor * e_mail_tab_new_full (const gchar *text, - ClutterActor *icon, - gint width); -void e_mail_tab_set_text (EMailTab *tab, - const gchar *text); -void e_mail_tab_set_default_icon (EMailTab *tab, - ClutterActor *icon); -void e_mail_tab_set_icon (EMailTab *tab, - ClutterActor *icon); -void e_mail_tab_set_can_close (EMailTab *tab, - gboolean can_close); -void e_mail_tab_set_width (EMailTab *tab, - gint width); -void e_mail_tab_set_docking (EMailTab *tab, - gboolean docking); -void e_mail_tab_set_preview_actor (EMailTab *tab, - ClutterActor *actor); -void e_mail_tab_set_preview_mode (EMailTab *tab, - gboolean preview); -void e_mail_tab_set_preview_duration (EMailTab *tab, - guint duration); -void e_mail_tab_set_spacing (EMailTab *tab, - gfloat spacing); -void e_mail_tab_set_private (EMailTab *tab, - gboolean private_); -void e_mail_tab_set_active (EMailTab *tab, - gboolean active); -const gchar * e_mail_tab_get_text (EMailTab *tab); -ClutterActor * e_mail_tab_get_icon (EMailTab *tab); -gboolean e_mail_tab_get_can_close (EMailTab *tab); -gint e_mail_tab_get_width (EMailTab *tab); -gboolean e_mail_tab_get_docking (EMailTab *tab); -ClutterActor * e_mail_tab_get_preview_actor (EMailTab *tab); -gboolean e_mail_tab_get_preview_mode (EMailTab *tab); -void e_mail_tab_get_height_no_preview - (EMailTab *tab, - gfloat for_width, - gfloat *min_height_p, - gfloat *natural_height_p); -guint e_mail_tab_get_preview_duration (EMailTab *tab); -gfloat e_mail_tab_get_spacing (EMailTab *tab); -gboolean e_mail_tab_get_private (EMailTab *tab); -gboolean e_mail_tab_get_active (EMailTab *tab); -void e_mail_tab_alert (EMailTab *tab); -void e_mail_tab_enable_drag (EMailTab *tab, - gboolean enable); - -G_END_DECLS - -#endif /* E_MAIL_TAB_H */ - diff --git a/mail/message-list.c b/mail/message-list.c index 9e2a31acc8..3a6f6efee5 100644 --- a/mail/message-list.c +++ b/mail/message-list.c @@ -69,12 +69,6 @@ #include "mail/em-utils.h" #include "mail/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 @@ -126,11 +120,6 @@ 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 { @@ -2568,11 +2557,6 @@ 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, @@ -4376,58 +4360,6 @@ 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_swapped ( - ml->priv->timeline, "started", - G_CALLBACK (clutter_actor_show), texture); - g_signal_connect ( - ml->priv->timeline, "paused", - G_CALLBACK (clutter_actor_hide), 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; @@ -4440,11 +4372,6 @@ message_list_set_search (MessageList *ml, ml->thread_tree = NULL; } -#if HAVE_CLUTTER - if (ml->priv->timeline) - clutter_timeline_start (ml->priv->timeline); -#endif - if (ml->frozen == 0) mail_regen_list (ml, search, NULL, NULL, TRUE); else { @@ -4944,22 +4871,6 @@ 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 (m->ml->priv->timeline && clutter_timeline_is_playing (m->ml->priv->timeline)) { - clutter_timeline_pause (m->ml->priv->timeline); - clutter_actor_hide (m->ml->priv->search_texture); - } 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 diff --git a/shell/main.c b/shell/main.c index a19614d76c..93b22b1701 100644 --- a/shell/main.c +++ b/shell/main.c @@ -30,11 +30,6 @@ #include <glib-unix.h> #endif -#if HAVE_CLUTTER -#include <clutter-gtk/clutter-gtk.h> -#include <mx/mx.h> -#endif - #ifdef G_OS_WIN32 #define WIN32_LEAN_AND_MEAN #ifdef DATADIR @@ -505,20 +500,10 @@ main (gint argc, return 0; } -#if HAVE_CLUTTER - gtk_clutter_init_with_args ( - &argc, &argv, - _("- The Evolution PIM and Email Client"), - entries, (gchar *) GETTEXT_PACKAGE, &error); - mx_style_load_from_file ( - mx_style_get_default (), - EVOLUTION_MX_THEMEDIR "/default.css", NULL); -#else gtk_init_with_args ( &argc, &argv, _("- The Evolution PIM and Email Client"), entries, (gchar *) GETTEXT_PACKAGE, &error); -#endif if (error != NULL) { g_printerr ("%s\n", error->message); g_error_free (error); |