aboutsummaryrefslogtreecommitdiffstats
path: root/mail
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2010-07-26 23:15:44 +0800
committerMatthew Barnes <mbarnes@redhat.com>2010-07-27 00:26:55 +0800
commit36b9debed099b1ad0b5d6a8af792f620bf7f124a (patch)
tree797f5587b1a6503ca0751c0243989a21eafab700 /mail
parent9279429501af7858716b0e317810a264192bb763 (diff)
downloadgsoc2013-evolution-36b9debed099b1ad0b5d6a8af792f620bf7f124a.tar
gsoc2013-evolution-36b9debed099b1ad0b5d6a8af792f620bf7f124a.tar.gz
gsoc2013-evolution-36b9debed099b1ad0b5d6a8af792f620bf7f124a.tar.bz2
gsoc2013-evolution-36b9debed099b1ad0b5d6a8af792f620bf7f124a.tar.lz
gsoc2013-evolution-36b9debed099b1ad0b5d6a8af792f620bf7f124a.tar.xz
gsoc2013-evolution-36b9debed099b1ad0b5d6a8af792f620bf7f124a.tar.zst
gsoc2013-evolution-36b9debed099b1ad0b5d6a8af792f620bf7f124a.zip
More code cleanup.
Diffstat (limited to 'mail')
-rw-r--r--mail/e-mail-backend.c1
-rw-r--r--mail/e-mail-folder-pane.c69
-rw-r--r--mail/e-mail-folder-pane.h3
-rw-r--r--mail/e-mail-message-pane.c75
-rw-r--r--mail/e-mail-message-pane.h2
-rw-r--r--mail/e-mail-notebook-view.c354
-rw-r--r--mail/e-mail-notebook-view.h4
-rw-r--r--mail/e-mail-paned-view.c332
-rw-r--r--mail/e-mail-paned-view.h4
-rw-r--r--mail/e-mail-reader.c10
-rw-r--r--mail/e-mail-view.c225
-rw-r--r--mail/e-mail-view.h27
-rw-r--r--mail/em-format-html.c2
-rw-r--r--mail/message-list.c23
14 files changed, 455 insertions, 676 deletions
diff --git a/mail/e-mail-backend.c b/mail/e-mail-backend.c
index 4d2038a73c..b2e22e397d 100644
--- a/mail/e-mail-backend.c
+++ b/mail/e-mail-backend.c
@@ -374,6 +374,7 @@ mail_backend_constructed (GObject *object)
EShell *shell;
EShellBackend *shell_backend;
MailFolderCache *folder_cache;
+ const gchar *data_dir;
shell_backend = E_SHELL_BACKEND (object);
shell = e_shell_backend_get_shell (shell_backend);
diff --git a/mail/e-mail-folder-pane.c b/mail/e-mail-folder-pane.c
index 3d9dfc2ea9..d12cc48acf 100644
--- a/mail/e-mail-folder-pane.c
+++ b/mail/e-mail-folder-pane.c
@@ -49,60 +49,23 @@ struct _EMailFolderPanePrivate {
gint placeholder;
};
-enum {
- PROP_0,
- PROP_PREVIEW_VISIBLE
-};
-
G_DEFINE_TYPE (EMailFolderPane, e_mail_folder_pane, E_TYPE_MAIL_PANED_VIEW)
-static void
-folder_pane_set_preview_visible (EMailView *view,
- gboolean preview_visible)
-{
-}
-
static gboolean
folder_pane_get_preview_visible (EMailView *view)
{
-
return FALSE;
}
static void
-mail_folder_pane_get_property (GObject *object,
- guint property_id,
- GValue *value,
- GParamSpec *pspec)
-{
- switch (property_id) {
- case PROP_PREVIEW_VISIBLE:
- g_value_set_boolean (
- value,
- FALSE);
- return;
-
- }
-
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
-}
-
-static void
-mail_folder_pane_set_property (GObject *object,
- guint property_id,
- const GValue *value,
- GParamSpec *pspec)
+folder_pane_set_preview_visible (EMailView *view,
+ gboolean preview_visible)
{
- switch (property_id) {
- case PROP_PREVIEW_VISIBLE:
- return;
- }
-
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+ /* Ignore the request. */
}
static guint
-mfp_open_selected_mail (EMailPanedView *view)
+mail_paned_view_open_selected_mail (EMailPanedView *view)
{
GPtrArray *uids;
gint i;
@@ -182,27 +145,17 @@ mfp_open_selected_mail (EMailPanedView *view)
static void
e_mail_folder_pane_class_init (EMailFolderPaneClass *class)
{
- GObjectClass *object_class;
EMailViewClass *mail_view_class;
EMailPanedViewClass *mail_paned_view_class;
g_type_class_add_private (class, sizeof (EMailFolderPanePrivate));
- object_class = G_OBJECT_CLASS (class);
- object_class->set_property = mail_folder_pane_set_property;
- object_class->get_property = mail_folder_pane_get_property;
-
mail_view_class = E_MAIL_VIEW_CLASS (class);
- mail_view_class->set_preview_visible = folder_pane_set_preview_visible;
mail_view_class->get_preview_visible = folder_pane_get_preview_visible;
+ mail_view_class->set_preview_visible = folder_pane_set_preview_visible;
mail_paned_view_class = E_MAIL_PANED_VIEW_CLASS (class);
- mail_paned_view_class->open_selected_mail = mfp_open_selected_mail;
-
- g_object_class_override_property (
- object_class,
- PROP_PREVIEW_VISIBLE,
- "preview-visible");
+ mail_paned_view_class->open_selected_mail = mail_paned_view_open_selected_mail;
}
static void
@@ -211,15 +164,13 @@ e_mail_folder_pane_init (EMailFolderPane *browser)
browser->priv = E_MAIL_FOLDER_PANE_GET_PRIVATE (browser);
}
-GtkWidget *
-e_mail_folder_pane_new (EShellContent *content)
+EMailView *
+e_mail_folder_pane_new (EShellView *shell_view)
{
- g_return_val_if_fail (E_IS_SHELL_CONTENT (content), NULL);
+ g_return_val_if_fail (E_IS_SHELL_VIEW (shell_view), NULL);
return g_object_new (
E_TYPE_MAIL_FOLDER_PANE,
- "shell-content", content,
- "preview-visible", FALSE,
- NULL);
+ "shell-view", shell_view, NULL);
}
diff --git a/mail/e-mail-folder-pane.h b/mail/e-mail-folder-pane.h
index a7a84a5edb..e9d9ee0858 100644
--- a/mail/e-mail-folder-pane.h
+++ b/mail/e-mail-folder-pane.h
@@ -22,7 +22,6 @@
#ifndef E_MAIL_FOLDER_PANE_H
#define E_MAIL_FOLDER_PANE_H
-#include <shell/e-shell-content.h>
#include <mail/e-mail-paned-view.h>
/* Standard GObject macros */
@@ -60,7 +59,7 @@ struct _EMailFolderPaneClass {
};
GType e_mail_folder_pane_get_type (void);
-GtkWidget * e_mail_folder_pane_new (EShellContent *content);
+EMailView * e_mail_folder_pane_new (EShellView *shell_view);
G_END_DECLS
diff --git a/mail/e-mail-message-pane.c b/mail/e-mail-message-pane.c
index 8ca6802639..8df46a1a39 100644
--- a/mail/e-mail-message-pane.c
+++ b/mail/e-mail-message-pane.c
@@ -36,46 +36,8 @@ struct _EMailMessagePanePrivate {
gint placeholder;
};
-enum {
- PROP_0,
- PROP_PREVIEW_VISIBLE
-};
-
G_DEFINE_TYPE (EMailMessagePane, e_mail_message_pane, E_TYPE_MAIL_PANED_VIEW)
-/* This is too trivial to put in a file.
- * It gets merged with the EMailReader UI. */
-static void
-mail_message_pane_set_property (GObject *object,
- guint property_id,
- const GValue *value,
- GParamSpec *pspec)
-{
- switch (property_id) {
- case PROP_PREVIEW_VISIBLE:
- return;
- }
-
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
-}
-
-static void
-mail_message_pane_get_property (GObject *object,
- guint property_id,
- GValue *value,
- GParamSpec *pspec)
-{
- switch (property_id) {
- case PROP_PREVIEW_VISIBLE:
- g_value_set_boolean (
- value,
- TRUE);
- return;
- }
-
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
-}
-
static void
mail_message_pane_constructed (GObject *object)
{
@@ -90,19 +52,17 @@ mail_message_pane_constructed (GObject *object)
e_mail_paned_view_hide_message_list_pane (E_MAIL_PANED_VIEW(object), FALSE);
}
-static void
-message_pane_set_preview_visible (EMailView *view,
- gboolean preview_visible)
+static gboolean
+mail_message_pane_get_preview_visible (EMailView *view)
{
- /* Chain up to parent's set_preview_visible() method. */
- E_MAIL_VIEW_CLASS (e_mail_message_pane_parent_class)->
- set_preview_visible (view, TRUE);
+ return TRUE;
}
-static gboolean
-message_pane_get_preview_visible (EMailView *view)
+static void
+mail_message_pane_set_preview_visible (EMailView *view,
+ gboolean preview_visible)
{
- return TRUE;
+ /* Ignore the request. */
}
static void
@@ -114,18 +74,11 @@ e_mail_message_pane_class_init (EMailMessagePaneClass *class)
g_type_class_add_private (class, sizeof (EMailMessagePanePrivate));
object_class = G_OBJECT_CLASS (class);
- object_class->set_property = mail_message_pane_set_property;
- object_class->get_property = mail_message_pane_get_property;
object_class->constructed = mail_message_pane_constructed;
mail_view_class = E_MAIL_VIEW_CLASS (class);
- mail_view_class->set_preview_visible = message_pane_set_preview_visible;
- mail_view_class->get_preview_visible = message_pane_get_preview_visible;
-
- g_object_class_override_property (
- object_class,
- PROP_PREVIEW_VISIBLE,
- "preview-visible");
+ mail_view_class->get_preview_visible = mail_message_pane_get_preview_visible;
+ mail_view_class->set_preview_visible = mail_message_pane_set_preview_visible;
}
static void
@@ -134,14 +87,12 @@ e_mail_message_pane_init (EMailMessagePane *browser)
browser->priv = E_MAIL_MESSAGE_PANE_GET_PRIVATE (browser);
}
-GtkWidget *
-e_mail_message_pane_new (EShellContent *content)
+EMailView *
+e_mail_message_pane_new (EShellView *shell_view)
{
- g_return_val_if_fail (E_IS_SHELL_CONTENT (content), NULL);
+ g_return_val_if_fail (E_IS_SHELL_VIEW (shell_view), NULL);
return g_object_new (
E_TYPE_MAIL_MESSAGE_PANE,
- "shell-content", content,
- "preview-visible", TRUE,
- NULL);
+ "shell-view", shell_view, NULL);
}
diff --git a/mail/e-mail-message-pane.h b/mail/e-mail-message-pane.h
index f947f79cdf..82cee3a13d 100644
--- a/mail/e-mail-message-pane.h
+++ b/mail/e-mail-message-pane.h
@@ -59,7 +59,7 @@ struct _EMailMessagePaneClass {
};
GType e_mail_message_pane_get_type (void);
-GtkWidget * e_mail_message_pane_new (EShellContent *content);
+EMailView * e_mail_message_pane_new (EShellView *shell_view);
G_END_DECLS
diff --git a/mail/e-mail-notebook-view.c b/mail/e-mail-notebook-view.c
index 436804de06..fa6d340f52 100644
--- a/mail/e-mail-notebook-view.c
+++ b/mail/e-mail-notebook-view.c
@@ -70,13 +70,18 @@ enum {
#define E_SHELL_WINDOW_ACTION_GROUP_MAIL(window) \
E_SHELL_WINDOW_ACTION_GROUP ((window), "mail")
-static EMailViewClass *parent_class;
-static GType mail_notebook_view_type;
+/* Forward Declarations */
+static void e_mail_notebook_view_reader_init (EMailReaderIface *iface);
+
+G_DEFINE_TYPE_WITH_CODE (
+ EMailNotebookView, e_mail_notebook_view, E_TYPE_MAIL_VIEW,
+ G_IMPLEMENT_INTERFACE (
+ E_TYPE_MAIL_READER, e_mail_notebook_view_reader_init))
#if HAVE_CLUTTER
static void
mnv_set_current_tab (EMailNotebookView *view,
- gint page)
+ gint page)
{
ClutterAnimation *animation;
@@ -91,7 +96,7 @@ mnv_set_current_tab (EMailNotebookView *view,
static gint
emnv_get_page_num (EMailNotebookView *view,
- GtkWidget *widget)
+ GtkWidget *widget)
{
EMailNotebookViewPrivate *priv = view->priv;
gint i, n;
@@ -108,32 +113,45 @@ emnv_get_page_num (EMailNotebookView *view,
}
static void
-mnv_page_changed (GtkNotebook *book, GtkWidget *page,
- guint page_num, EMailNotebookView *view)
+mnv_page_changed (GtkNotebook *book,
+ GtkWidget *page,
+ guint page_num,
+ EMailView *view)
{
- EMailView *mview = (EMailView *)gtk_notebook_get_nth_page (book, page_num);
- EShellContent *content = E_MAIL_VIEW(view)->content;
- EShellView *shell_view = e_shell_content_get_shell_view (content);
- EShellSidebar *sidebar = e_shell_view_get_shell_sidebar (shell_view);
- EMFolderTree *tree;
- const gchar *uri = e_mail_reader_get_folder_uri (E_MAIL_READER(mview));
-
- g_object_get (sidebar, "folder-tree", &tree, NULL);
+ EMailNotebookViewPrivate *priv;
+ EShellView *shell_view;
+ EShellSidebar *shell_sidebar;
+ EMFolderTree *folder_tree;
+ EMailView *mview;
+ const gchar *uri;
+
+ priv = E_MAIL_NOTEBOOK_VIEW_GET_PRIVATE (view);
+
+ shell_view = e_mail_view_get_shell_view (view);
+ shell_sidebar = e_shell_view_get_shell_sidebar (shell_view);
+
+ page = gtk_notebook_get_nth_page (book, page_num);
+ uri = e_mail_reader_get_folder_uri (E_MAIL_READER (page));
+ mview = E_MAIL_VIEW (page);
+
+ g_object_get (shell_sidebar, "folder-tree", &folder_tree, NULL);
+
if (uri && E_IS_MAIL_FOLDER_PANE (mview))
- em_folder_tree_set_selected (tree, uri, FALSE);
+ em_folder_tree_set_selected (folder_tree, uri, FALSE);
- if (mview != view->priv->current_view) {
- mview->prev = view->priv->current_view;
- view->priv->current_view = mview;
+ if (mview != priv->current_view) {
+ mview->prev = priv->current_view;
+ priv->current_view = mview;
}
- /* For EMailReader related changes to EShellView*/
+ /* For EMailReader related changes to EShellView */
g_signal_emit_by_name (view, "changed");
g_signal_emit_by_name (view, "folder-loaded");
/* For EMailShellContent related changes */
g_signal_emit_by_name (view, "view-changed");
+ g_object_unref (folder_tree);
}
#if HAVE_CLUTTER
@@ -412,8 +430,10 @@ create_under_clutter (GtkWidget *widget, GtkWidget *paned)
static void
mail_notebook_view_constructed (GObject *object)
{
- GtkWidget *widget, *container;
EMailNotebookViewPrivate *priv;
+ EShellView *shell_view;
+ GtkWidget *container;
+ GtkWidget *widget;
#if HAVE_CLUTTER
EMailTab *tab;
ClutterActor *stage, *clone;
@@ -505,18 +525,20 @@ mail_notebook_view_constructed (GObject *object)
#endif
gtk_notebook_set_show_border ((GtkNotebook *)widget, FALSE);
- g_signal_connect (widget, "switch-page",
- G_CALLBACK(mnv_page_changed), object);
- priv->current_view = (EMailView *)e_mail_folder_pane_new (E_MAIL_VIEW(object)->content);
+ shell_view = e_mail_view_get_shell_view (E_MAIL_VIEW (object));
+ priv->current_view = e_mail_folder_pane_new (shell_view);
e_mail_view_set_preview_visible (priv->current_view, FALSE);
- gtk_widget_show ((GtkWidget *)priv->current_view);
+ gtk_widget_show (GTK_WIDGET (priv->current_view));
- gtk_notebook_append_page (priv->book, (GtkWidget *)priv->current_view,
- create_tab_label (E_MAIL_NOTEBOOK_VIEW(object),
- priv->current_view,
- _("Please select a folder")));
+ gtk_notebook_append_page (
+ priv->book, GTK_WIDGET (priv->current_view),
+ create_tab_label (E_MAIL_NOTEBOOK_VIEW (object),
+ priv->current_view, _("Please select a folder")));
+ g_signal_connect (
+ priv->book, "switch-page",
+ G_CALLBACK (mnv_page_changed), object);
}
static void
@@ -555,27 +577,6 @@ mail_notebook_view_get_property (GObject *object,
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
}
-static EShellSearchbar *
-mail_notebook_view_get_searchbar (EMailView *view)
-{
- EShellView *shell_view;
- EShellContent *shell_content;
- GtkWidget *widget;
-
- g_return_val_if_fail (
- E_IS_MAIL_NOTEBOOK_VIEW (view), NULL);
-
- shell_content = E_MAIL_VIEW (view)->content;
- shell_view = e_shell_content_get_shell_view (shell_content);
- widget = e_shell_view_get_searchbar (shell_view);
-
- return E_SHELL_SEARCHBAR (widget);
-/*
- if (!E_MAIL_NOTEBOOK_VIEW(view)->priv->current_view)
- return NULL;
- return e_mail_view_get_searchbar (E_MAIL_NOTEBOOK_VIEW(view)->priv->current_view); */
-}
-
static void
mail_notebook_view_set_search_strings (EMailView *view,
GSList *search_strings)
@@ -625,20 +626,6 @@ mail_notebook_view_get_orientation (EMailView *view)
return e_mail_view_get_orientation (priv->current_view);
}
-static void
-mail_notebook_view_set_show_deleted (EMailView *view,
- gboolean show_deleted)
-{
- EMailNotebookViewPrivate *priv;
-
- priv = E_MAIL_NOTEBOOK_VIEW_GET_PRIVATE (view);
-
- if (!priv->current_view)
- return;
-
- e_mail_view_set_show_deleted (priv->current_view, show_deleted);
-}
-
static gboolean
mail_notebook_view_get_show_deleted (EMailView *view)
{
@@ -653,8 +640,8 @@ mail_notebook_view_get_show_deleted (EMailView *view)
}
static void
-mail_notebook_view_set_preview_visible (EMailView *view,
- gboolean preview_visible)
+mail_notebook_view_set_show_deleted (EMailView *view,
+ gboolean show_deleted)
{
EMailNotebookViewPrivate *priv;
@@ -663,7 +650,7 @@ mail_notebook_view_set_preview_visible (EMailView *view,
if (!priv->current_view)
return;
- e_mail_view_set_preview_visible (priv->current_view, preview_visible);
+ e_mail_view_set_show_deleted (priv->current_view, show_deleted);
}
static gboolean
@@ -680,89 +667,28 @@ mail_notebook_view_get_preview_visible (EMailView *view)
}
static void
-mail_notebook_view_class_init (EMailNotebookViewClass *class)
-{
- GObjectClass *object_class;
- EMailViewClass *mail_view_class;
-
- parent_class = g_type_class_peek_parent (class);
- g_type_class_add_private (class, sizeof (EMailNotebookViewPrivate));
-
- object_class = G_OBJECT_CLASS (class);
- object_class->constructed = mail_notebook_view_constructed;
- object_class->set_property = mail_notebook_view_set_property;
- object_class->get_property = mail_notebook_view_get_property;
-
- mail_view_class = E_MAIL_VIEW_CLASS (class);
- mail_view_class->get_searchbar = mail_notebook_view_get_searchbar;
- mail_view_class->set_search_strings = mail_notebook_view_set_search_strings;
- mail_view_class->get_view_instance = mail_notebook_view_get_view_instance;
- mail_view_class->update_view_instance = mail_notebook_view_update_view_instance;
- mail_view_class->set_orientation = mail_notebook_view_set_orientation;
- mail_view_class->get_orientation = mail_notebook_view_get_orientation;
- mail_view_class->set_show_deleted = mail_notebook_view_set_show_deleted;
- mail_view_class->get_show_deleted = mail_notebook_view_get_show_deleted;
- mail_view_class->set_preview_visible = mail_notebook_view_set_preview_visible;
- mail_view_class->get_preview_visible = mail_notebook_view_get_preview_visible;
-
- /* Inherited from EMailReader */
- g_object_class_override_property (
- object_class,
- PROP_GROUP_BY_THREADS,
- "group-by-threads");
-/*
- g_object_class_install_property (
- object_class,
- PROP_PREVIEW_VISIBLE,
- g_param_spec_boolean (
- "preview-visible",
- "Preview is Visible",
- "Whether the preview pane is visible",
- TRUE,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (
- object_class,
- PROP_SHOW_DELETED,
- g_param_spec_boolean (
- "show-deleted",
- "Show Deleted",
- NULL,
- FALSE,
- G_PARAM_READWRITE));
-
- g_object_class_override_property (
- object_class, PROP_ORIENTATION, "orientation"); */
-}
-
-static void
-mail_notebook_view_init (EMailNotebookView *view)
+mail_notebook_view_set_preview_visible (EMailView *view,
+ gboolean preview_visible)
{
- view->priv = E_MAIL_NOTEBOOK_VIEW_GET_PRIVATE (view);
+ EMailNotebookViewPrivate *priv;
- view->priv->inited = FALSE;
- view->priv->views = g_hash_table_new (g_str_hash, g_str_equal);
-}
+ priv = E_MAIL_NOTEBOOK_VIEW_GET_PRIVATE (view);
-GtkWidget *
-e_mail_notebook_view_new (EShellContent *content)
-{
- g_return_val_if_fail (E_IS_SHELL_CONTENT (content), NULL);
+ if (!priv->current_view)
+ return;
- return g_object_new (
- E_TYPE_MAIL_NOTEBOOK_VIEW,
- "shell-content", content, NULL);
+ e_mail_view_set_preview_visible (priv->current_view, preview_visible);
}
static GtkActionGroup *
mail_notebook_view_get_action_group (EMailReader *reader)
{
- EShellContent *shell_content;
+ EMailView *view;
EShellWindow *shell_window;
EShellView *shell_view;
- shell_content = E_MAIL_VIEW (reader)->content;
- shell_view = e_shell_content_get_shell_view (shell_content);
+ view = E_MAIL_VIEW (reader);
+ shell_view = e_mail_view_get_shell_view (view);
shell_window = e_shell_view_get_shell_window (shell_view);
return E_SHELL_WINDOW_ACTION_GROUP_MAIL (shell_window);
@@ -815,11 +741,11 @@ mail_notebook_view_get_popup_menu (EMailReader *reader)
static EShellBackend *
mail_notebook_view_get_shell_backend (EMailReader *reader)
{
- EShellContent *shell_content;
+ EMailView *view;
EShellView *shell_view;
- shell_content = E_MAIL_VIEW (reader)->content;
- shell_view = e_shell_content_get_shell_view (shell_content);
+ view = E_MAIL_VIEW (reader);
+ shell_view = e_mail_view_get_shell_view (view);
return e_shell_view_get_shell_backend (shell_view);
}
@@ -827,12 +753,12 @@ mail_notebook_view_get_shell_backend (EMailReader *reader)
static GtkWindow *
mail_notebook_view_get_window (EMailReader *reader)
{
- EShellContent *shell_content;
+ EMailView *view;
EShellWindow *shell_window;
EShellView *shell_view;
- shell_content = E_MAIL_VIEW (reader)->content;
- shell_view = e_shell_content_get_shell_view (shell_content);
+ view = E_MAIL_VIEW (reader);
+ shell_view = e_mail_view_get_shell_view (view);
shell_window = e_shell_view_get_shell_window (shell_view);
return GTK_WINDOW (shell_window);
@@ -845,19 +771,23 @@ reconnect_changed_event (EMailReader *child, EMailReader *parent)
}
static void
-reconnect_folder_loaded_event (EMailReader *child, EMailReader *parent)
+reconnect_folder_loaded_event (EMailReader *child,
+ EMailReader *parent)
{
g_signal_emit_by_name (parent, "folder-loaded");
}
static void
-mail_netbook_view_open_mail (EMailView *view, const gchar *uid, EMailNotebookView *nview)
+mail_netbook_view_open_mail (EMailView *view,
+ const gchar *uid,
+ EMailNotebookView *nview)
{
+ EMailNotebookViewPrivate *priv;
+ EShellView *shell_view;
const gchar *folder_uri;
CamelFolder *folder;
- GtkWidget *pane;
+ EMailView *pane;
gint page;
- EMailNotebookViewPrivate *priv = E_MAIL_NOTEBOOK_VIEW (nview)->priv;
CamelMessageInfo *info;
GtkWidget *preview;
gint pos;
@@ -867,17 +797,23 @@ mail_netbook_view_open_mail (EMailView *view, const gchar *uid, EMailNotebookVie
ClutterActor *clone;
ClutterTimeline *timeline;
GtkWidget *mlist;
+#endif
- 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);
+ priv = E_MAIL_NOTEBOOK_VIEW_GET_PRIVATE (nview);
+
+#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
- pos = emnv_get_page_num (nview, (GtkWidget *)priv->current_view);
- pane = e_mail_message_pane_new (E_MAIL_VIEW(nview)->content);
- E_MAIL_VIEW(pane)->prev = priv->current_view;
- priv->current_view = (EMailView *)pane;
- gtk_widget_show (pane);
+ 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);
+ pane->prev = priv->current_view;
+ priv->current_view = pane;
+
+ gtk_widget_show (GTK_WIDGET (pane));
preview = e_mail_paned_view_get_preview (E_MAIL_PANED_VIEW(pane));
@@ -886,11 +822,10 @@ mail_netbook_view_open_mail (EMailView *view, const gchar *uid, EMailNotebookVie
info = camel_folder_get_message_info (folder, uid);
- page = gtk_notebook_insert_page (priv->book, pane,
- create_tab_label (nview,
- priv->current_view,
- camel_message_info_subject(info)),
- pos+1);
+ page = gtk_notebook_insert_page (
+ priv->book, GTK_WIDGET (pane),
+ 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));
@@ -1000,8 +935,10 @@ mail_notebook_view_set_folder (EMailReader *reader,
if (priv->inited) {
EMailView *old_view = priv->current_view;
+ EShellView *shell_view;
- priv->current_view = (EMailView *)e_mail_folder_pane_new (E_MAIL_VIEW(reader)->content);
+ shell_view = e_mail_view_get_shell_view (E_MAIL_VIEW (reader));
+ priv->current_view = e_mail_folder_pane_new (shell_view);
gtk_widget_show ((GtkWidget *)priv->current_view);
priv->current_view->prev = old_view;
page = gtk_notebook_append_page (
@@ -1082,14 +1019,15 @@ mail_notebook_view_set_folder (EMailReader *reader,
#endif
e_mail_reader_set_folder (E_MAIL_READER(priv->current_view), folder, folder_uri);
g_hash_table_insert (priv->views, g_strdup(folder_uri), priv->current_view);
- g_signal_connect ( E_MAIL_READER(priv->current_view), "changed",
- G_CALLBACK (reconnect_changed_event),
- reader);
- g_signal_connect ( E_MAIL_READER (priv->current_view), "folder-loaded",
- G_CALLBACK (reconnect_folder_loaded_event),
- reader);
- g_signal_connect ( priv->current_view, "open-mail",
- G_CALLBACK (mail_netbook_view_open_mail), reader);
+ g_signal_connect (
+ priv->current_view, "changed",
+ G_CALLBACK (reconnect_changed_event), reader);
+ g_signal_connect (
+ priv->current_view, "folder-loaded",
+ G_CALLBACK (reconnect_folder_loaded_event), reader);
+ g_signal_connect (
+ priv->current_view, "open-mail",
+ G_CALLBACK (mail_netbook_view_open_mail), reader);
}
}
@@ -1113,7 +1051,38 @@ mail_notebook_view_open_selected_mail (EMailReader *reader)
}
static void
-mail_notebook_view_reader_init (EMailReaderIface *iface)
+e_mail_notebook_view_class_init (EMailNotebookViewClass *class)
+{
+ GObjectClass *object_class;
+ EMailViewClass *mail_view_class;
+
+ g_type_class_add_private (class, sizeof (EMailNotebookViewPrivate));
+
+ object_class = G_OBJECT_CLASS (class);
+ object_class->constructed = mail_notebook_view_constructed;
+ object_class->set_property = mail_notebook_view_set_property;
+ object_class->get_property = mail_notebook_view_get_property;
+
+ mail_view_class = E_MAIL_VIEW_CLASS (class);
+ mail_view_class->set_search_strings = mail_notebook_view_set_search_strings;
+ mail_view_class->get_view_instance = mail_notebook_view_get_view_instance;
+ mail_view_class->update_view_instance = mail_notebook_view_update_view_instance;
+ mail_view_class->set_orientation = mail_notebook_view_set_orientation;
+ mail_view_class->get_orientation = mail_notebook_view_get_orientation;
+ mail_view_class->get_show_deleted = mail_notebook_view_get_show_deleted;
+ mail_view_class->set_show_deleted = mail_notebook_view_set_show_deleted;
+ mail_view_class->get_preview_visible = mail_notebook_view_get_preview_visible;
+ mail_view_class->set_preview_visible = mail_notebook_view_set_preview_visible;
+
+ /* Inherited from EMailReader */
+ g_object_class_override_property (
+ object_class,
+ PROP_GROUP_BY_THREADS,
+ "group-by-threads");
+}
+
+static void
+e_mail_notebook_view_reader_init (EMailReaderIface *iface)
{
iface->get_action_group = mail_notebook_view_get_action_group;
iface->get_formatter = mail_notebook_view_get_formatter;
@@ -1127,40 +1096,21 @@ mail_notebook_view_reader_init (EMailReaderIface *iface)
iface->open_selected_mail = mail_notebook_view_open_selected_mail;
}
-GType
-e_mail_notebook_view_get_type (void)
+static void
+e_mail_notebook_view_init (EMailNotebookView *view)
{
- return mail_notebook_view_type;
+ view->priv = E_MAIL_NOTEBOOK_VIEW_GET_PRIVATE (view);
+
+ view->priv->inited = FALSE;
+ view->priv->views = g_hash_table_new (g_str_hash, g_str_equal);
}
-void
-e_mail_notebook_view_register_type (GTypeModule *type_module)
+GtkWidget *
+e_mail_notebook_view_new (EShellView *shell_view)
{
- static const GTypeInfo type_info = {
- sizeof (EMailNotebookViewClass),
- (GBaseInitFunc) NULL,
- (GBaseFinalizeFunc) NULL,
- (GClassInitFunc) mail_notebook_view_class_init,
- (GClassFinalizeFunc) NULL,
- NULL, /* class_data */
- sizeof (EMailNotebookView),
- 0, /* n_preallocs */
- (GInstanceInitFunc) mail_notebook_view_init,
- NULL /* value_table */
- };
-
- static const GInterfaceInfo reader_info = {
- (GInterfaceInitFunc) mail_notebook_view_reader_init,
- (GInterfaceFinalizeFunc) NULL,
- NULL /* interface_data */
- };
-
- mail_notebook_view_type = g_type_module_register_type (
- type_module, E_TYPE_MAIL_VIEW,
- "EMailNotebookView", &type_info, 0);
-
- g_type_module_add_interface (
- type_module, mail_notebook_view_type,
- E_TYPE_MAIL_READER, &reader_info);
-}
+ g_return_val_if_fail (E_IS_SHELL_VIEW (shell_view), NULL);
+ return g_object_new (
+ E_TYPE_MAIL_NOTEBOOK_VIEW,
+ "shell-view", shell_view, NULL);
+}
diff --git a/mail/e-mail-notebook-view.h b/mail/e-mail-notebook-view.h
index cdc341ec4a..04b0bd4152 100644
--- a/mail/e-mail-notebook-view.h
+++ b/mail/e-mail-notebook-view.h
@@ -62,9 +62,7 @@ struct _EMailNotebookViewClass {
};
GType e_mail_notebook_view_get_type (void);
-void e_mail_notebook_view_register_type
- (GTypeModule *type_module);
-GtkWidget * e_mail_notebook_view_new (EShellContent *content);
+GtkWidget * e_mail_notebook_view_new (EShellView *shell_view);
EShellSearchbar *
e_mail_notebook_view_get_searchbar
(EMailNotebookView *view);
diff --git a/mail/e-mail-paned-view.c b/mail/e-mail-paned-view.c
index cf13ac5514..342dc39c7b 100644
--- a/mail/e-mail-paned-view.c
+++ b/mail/e-mail-paned-view.c
@@ -63,7 +63,6 @@ struct _EMailPanedViewPrivate {
EMFormatHTMLDisplay *formatter;
GalViewInstance *view_instance;
- GtkOrientation orientation;
/* ETable scrolling hack */
gdouble default_scrollbar_position;
@@ -72,40 +71,37 @@ struct _EMailPanedViewPrivate {
/* Signal handler IDs */
guint message_list_built_id;
-
- guint preview_visible : 1;
- guint show_deleted : 1;
};
enum {
PROP_0,
- PROP_GROUP_BY_THREADS,
- PROP_ORIENTATION,
- PROP_PREVIEW_VISIBLE,
- PROP_SHOW_DELETED
+ PROP_GROUP_BY_THREADS
};
#define STATE_KEY_GROUP_BY_THREADS "GroupByThreads"
#define STATE_KEY_SELECTED_MESSAGE "SelectedMessage"
#define STATE_KEY_PREVIEW_VISIBLE "PreviewVisible"
-static EMailViewClass *parent_class;
-static GType mail_paned_view_type;
+/* Forward Declarations */
+static void e_mail_paned_view_reader_init (EMailReaderIface *iface);
+
+G_DEFINE_TYPE_WITH_CODE (
+ EMailPanedView, e_mail_paned_view, E_TYPE_MAIL_VIEW,
+ G_IMPLEMENT_INTERFACE (
+ E_TYPE_MAIL_READER, e_mail_paned_view_reader_init))
static void
-mail_paned_view_save_boolean (EMailPanedView *view,
+mail_paned_view_save_boolean (EMailView *view,
const gchar *key,
gboolean value)
{
EShellView *shell_view;
- EShellContent *shell_content;
EMailReader *reader;
GKeyFile *key_file;
const gchar *folder_uri;
gchar *group_name;
- shell_content = E_MAIL_VIEW (view)->content;
- shell_view = e_shell_content_get_shell_view (shell_content);
+ shell_view = e_mail_view_get_shell_view (view);
key_file = e_shell_view_get_state_key_file (shell_view);
reader = E_MAIL_READER (view);
@@ -122,21 +118,21 @@ mail_paned_view_save_boolean (EMailPanedView *view,
}
static void
-mail_paned_view_message_list_built_cb (EMailPanedView *view,
+mail_paned_view_message_list_built_cb (EMailView *view,
MessageList *message_list)
{
- EMailPanedViewPrivate *priv = view->priv;
+ EMailPanedViewPrivate *priv;
EShellView *shell_view;
EShellWindow *shell_window;
- EShellContent *shell_content;
GKeyFile *key_file;
+ priv = E_MAIL_PANED_VIEW_GET_PRIVATE (view);
+
g_signal_handler_disconnect (
message_list, priv->message_list_built_id);
priv->message_list_built_id = 0;
- shell_content = E_MAIL_VIEW (view)->content;
- shell_view = e_shell_content_get_shell_view (shell_content);
+ shell_view = e_mail_view_get_shell_view (view);
shell_window = e_shell_view_get_shell_window (shell_view);
key_file = e_shell_view_get_state_key_file (shell_view);
@@ -170,11 +166,10 @@ mail_paned_view_message_list_built_cb (EMailPanedView *view,
}
static void
-mail_paned_view_message_selected_cb (EMailPanedView *view,
+mail_paned_view_message_selected_cb (EMailView *view,
const gchar *message_uid,
MessageList *message_list)
{
- EShellContent *shell_content;
EShellView *shell_view;
GKeyFile *key_file;
const gchar *folder_uri;
@@ -189,8 +184,7 @@ mail_paned_view_message_selected_cb (EMailPanedView *view,
if (folder_uri == NULL)
return;
- shell_content = E_MAIL_VIEW (view)->content;
- shell_view = e_shell_content_get_shell_view (shell_content);
+ shell_view = e_mail_view_get_shell_view (view);
key_file = e_shell_view_get_state_key_file (shell_view);
key = STATE_KEY_SELECTED_MESSAGE;
@@ -216,7 +210,7 @@ mail_paned_view_restore_state_cb (EShellWindow *shell_window,
GObject *object;
const gchar *key;
- priv = view->priv;
+ priv = E_MAIL_PANED_VIEW_GET_PRIVATE (view);
/* Bind GObject properties to GConf keys. */
@@ -255,7 +249,7 @@ mail_paned_view_notify_group_by_threads_cb (EMailReader *reader)
group_by_threads = e_mail_reader_get_group_by_threads (reader);
mail_paned_view_save_boolean (
- E_MAIL_PANED_VIEW (reader),
+ E_MAIL_VIEW (reader),
STATE_KEY_GROUP_BY_THREADS, group_by_threads);
}
@@ -271,24 +265,6 @@ mail_paned_view_set_property (GObject *object,
E_MAIL_READER (object),
g_value_get_boolean (value));
return;
-
- case PROP_ORIENTATION:
- e_mail_view_set_orientation (
- E_MAIL_VIEW (object),
- g_value_get_enum (value));
- return;
-
- case PROP_PREVIEW_VISIBLE:
- e_mail_view_set_preview_visible (
- E_MAIL_VIEW (object),
- g_value_get_boolean (value));
- return;
-
- case PROP_SHOW_DELETED:
- e_mail_view_set_show_deleted (
- E_MAIL_VIEW (object),
- g_value_get_boolean (value));
- return;
}
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
@@ -307,27 +283,6 @@ mail_paned_view_get_property (GObject *object,
e_mail_reader_get_group_by_threads (
E_MAIL_READER (object)));
return;
-
- case PROP_ORIENTATION:
- g_value_set_enum (
- value,
- e_mail_view_get_orientation (
- E_MAIL_VIEW (object)));
- return;
-
- case PROP_PREVIEW_VISIBLE:
- g_value_set_boolean (
- value,
- e_mail_view_get_preview_visible (
- E_MAIL_VIEW (object)));
- return;
-
- case PROP_SHOW_DELETED:
- g_value_set_boolean (
- value,
- e_mail_view_get_show_deleted (
- E_MAIL_VIEW (object)));
- return;
}
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
@@ -338,7 +293,7 @@ mail_paned_view_dispose (GObject *object)
{
EMailPanedViewPrivate *priv;
- priv = E_MAIL_PANED_VIEW (object)->priv;
+ priv = E_MAIL_PANED_VIEW_GET_PRIVATE (object);
if (priv->paned != NULL) {
g_object_unref (priv->paned);
@@ -371,18 +326,18 @@ mail_paned_view_dispose (GObject *object)
}
/* Chain up to parent's dispose() method. */
- G_OBJECT_CLASS (parent_class)->dispose (object);
+ G_OBJECT_CLASS (e_mail_paned_view_parent_class)->dispose (object);
}
static GtkActionGroup *
mail_paned_view_get_action_group (EMailReader *reader)
{
- EShellContent *shell_content;
- EShellWindow *shell_window;
+ EMailView *view;
EShellView *shell_view;
+ EShellWindow *shell_window;
- shell_content = E_MAIL_VIEW (reader)->content;
- shell_view = e_shell_content_get_shell_view (shell_content);
+ view = E_MAIL_VIEW (reader);
+ shell_view = e_mail_view_get_shell_view (view);
shell_window = e_shell_view_get_shell_window (shell_view);
return E_SHELL_WINDOW_ACTION_GROUP_MAIL (shell_window);
@@ -393,7 +348,7 @@ mail_paned_view_get_formatter (EMailReader *reader)
{
EMailPanedViewPrivate *priv;
- priv = E_MAIL_PANED_VIEW (reader)->priv;
+ priv = E_MAIL_PANED_VIEW_GET_PRIVATE (reader);
return EM_FORMAT_HTML (priv->formatter);
}
@@ -409,7 +364,7 @@ mail_paned_view_get_message_list (EMailReader *reader)
{
EMailPanedViewPrivate *priv;
- priv = E_MAIL_PANED_VIEW (reader)->priv;
+ priv = E_MAIL_PANED_VIEW_GET_PRIVATE (reader);
return priv->message_list;
}
@@ -417,14 +372,14 @@ mail_paned_view_get_message_list (EMailReader *reader)
static GtkMenu *
mail_paned_view_get_popup_menu (EMailReader *reader)
{
+ EMailView *view;
EShellView *shell_view;
EShellWindow *shell_window;
- EShellContent *shell_content;
GtkUIManager *ui_manager;
GtkWidget *widget;
- shell_content = E_MAIL_VIEW (reader)->content;
- shell_view = e_shell_content_get_shell_view (shell_content);
+ view = E_MAIL_VIEW (reader);
+ shell_view = e_mail_view_get_shell_view (view);
shell_window = e_shell_view_get_shell_window (shell_view);
ui_manager = e_shell_window_get_ui_manager (shell_window);
@@ -436,11 +391,11 @@ mail_paned_view_get_popup_menu (EMailReader *reader)
static EShellBackend *
mail_paned_view_get_shell_backend (EMailReader *reader)
{
- EShellContent *shell_content;
+ EMailView *view;
EShellView *shell_view;
- shell_content = E_MAIL_VIEW (reader)->content;
- shell_view = e_shell_content_get_shell_view (shell_content);
+ view = E_MAIL_VIEW (reader);
+ shell_view = e_mail_view_get_shell_view (view);
return e_shell_view_get_shell_backend (shell_view);
}
@@ -448,12 +403,12 @@ mail_paned_view_get_shell_backend (EMailReader *reader)
static GtkWindow *
mail_paned_view_get_window (EMailReader *reader)
{
- EShellContent *shell_content;
- EShellWindow *shell_window;
+ EMailView *view;
EShellView *shell_view;
+ EShellWindow *shell_window;
- shell_content = E_MAIL_VIEW (reader)->content;
- shell_view = e_shell_content_get_shell_view (shell_content);
+ view = E_MAIL_VIEW (reader);
+ shell_view = e_mail_view_get_shell_view (view);
shell_window = e_shell_view_get_shell_window (shell_view);
return GTK_WINDOW (shell_window);
@@ -461,15 +416,15 @@ mail_paned_view_get_window (EMailReader *reader)
static void
mail_paned_view_set_folder (EMailReader *reader,
- CamelFolder *folder,
- const gchar *folder_uri)
+ CamelFolder *folder,
+ const gchar *folder_uri)
{
+ EMailPanedViewPrivate *priv;
+ EMailView *view;
EShell *shell;
EShellView *shell_view;
EShellWindow *shell_window;
- EShellContent *shell_content;
EShellSettings *shell_settings;
- EMailPanedViewPrivate *priv;
EMailReaderIface *default_iface;
GtkWidget *message_list;
GKeyFile *key_file;
@@ -478,10 +433,10 @@ mail_paned_view_set_folder (EMailReader *reader,
gboolean value;
GError *error = NULL;
- priv = E_MAIL_PANED_VIEW (reader)->priv;
+ priv = E_MAIL_PANED_VIEW_GET_PRIVATE (reader);
- shell_content = E_MAIL_VIEW (reader)->content;
- shell_view = e_shell_content_get_shell_view (shell_content);
+ view = E_MAIL_VIEW (reader);
+ shell_view = e_mail_view_get_shell_view (view);
shell_window = e_shell_view_get_shell_window (shell_view);
shell = e_shell_window_get_shell (shell_window);
@@ -553,7 +508,7 @@ mail_paned_view_show_search_bar (EMailReader *reader)
{
EMailPanedViewPrivate *priv;
- priv = E_MAIL_PANED_VIEW (reader)->priv;
+ priv = E_MAIL_PANED_VIEW_GET_PRIVATE (reader);
gtk_widget_show (priv->search_bar);
}
@@ -561,10 +516,6 @@ mail_paned_view_show_search_bar (EMailReader *reader)
static guint
mail_paned_view_reader_open_selected_mail (EMailReader *reader)
{
- EMailPanedViewPrivate *priv;
-
- priv = E_MAIL_PANED_VIEW (reader)->priv;
-
return E_MAIL_PANED_VIEW_CLASS (G_OBJECT_GET_CLASS (reader))->open_selected_mail (E_MAIL_PANED_VIEW (reader));
}
@@ -572,22 +523,22 @@ static void
mail_paned_view_constructed (GObject *object)
{
EMailPanedViewPrivate *priv;
- EShellContent *shell_content;
EShellBackend *shell_backend;
EShellWindow *shell_window;
EShellView *shell_view;
ESearchBar *search_bar;
EMailReader *reader;
+ EMailView *view;
GtkWidget *message_list;
GtkWidget *container;
GtkWidget *widget;
EWebView *web_view;
- priv = E_MAIL_PANED_VIEW (object)->priv;
+ priv = E_MAIL_PANED_VIEW_GET_PRIVATE (object);
priv->formatter = em_format_html_display_new ();
- shell_content = E_MAIL_VIEW (object)->content;
- shell_view = e_shell_content_get_shell_view (shell_content);
+ view = E_MAIL_VIEW (object);
+ shell_view = e_mail_view_get_shell_view (view);
shell_window = e_shell_view_get_shell_window (shell_view);
shell_backend = e_shell_view_get_shell_backend (shell_view);
@@ -666,20 +617,10 @@ mail_paned_view_constructed (GObject *object)
object);
e_mail_reader_connect_headers (reader);
-}
-
-static EShellSearchbar *
-mail_paned_view_get_searchbar (EMailView *view)
-{
- EShellView *shell_view;
- EShellContent *shell_content;
- GtkWidget *widget;
- shell_content = view->content;
- shell_view = e_shell_content_get_shell_view (shell_content);
- widget = e_shell_view_get_searchbar (shell_view);
-
- return E_SHELL_SEARCHBAR (widget);
+ /* Do this after creating the message list. Our
+ * set_preview_visible() method relies on it. */
+ e_mail_view_set_preview_visible (view, TRUE);
}
static void
@@ -723,7 +664,6 @@ mail_paned_view_update_view_instance (EMailView *view)
EMailPanedViewPrivate *priv;
EMailReader *reader;
EShell *shell;
- EShellContent *shell_content;
EShellView *shell_view;
EShellWindow *shell_window;
EShellViewClass *shell_view_class;
@@ -740,8 +680,7 @@ mail_paned_view_update_view_instance (EMailView *view)
priv = E_MAIL_PANED_VIEW_GET_PRIVATE (view);
- shell_content = view->content;
- shell_view = e_shell_content_get_shell_view (shell_content);
+ shell_view = e_mail_view_get_shell_view (view);
shell_view_class = E_SHELL_VIEW_GET_CLASS (shell_view);
view_collection = shell_view_class->view_collection;
@@ -873,63 +812,10 @@ mail_paned_view_update_view_instance (EMailView *view)
}
static void
-mail_paned_view_set_orientation (EMailView *view,
- GtkOrientation orientation)
-{
- EMailPanedViewPrivate *priv;
-
- priv = E_MAIL_PANED_VIEW_GET_PRIVATE (view);
-
- priv->orientation = orientation;
-
- g_object_notify (G_OBJECT (view), "orientation");
-
- e_mail_view_update_view_instance (view);
-}
-
-static GtkOrientation
-mail_paned_view_get_orientation (EMailView *view)
-{
- EMailPanedViewPrivate *priv;
-
- priv = E_MAIL_PANED_VIEW_GET_PRIVATE (view);
-
- return priv->orientation;
-}
-
-static void
-mail_paned_view_set_show_deleted (EMailView *view,
- gboolean show_deleted)
-{
- EMailPanedViewPrivate *priv;
-
- priv = E_MAIL_PANED_VIEW_GET_PRIVATE (view);
-
- priv->show_deleted = show_deleted;
-
- g_object_notify (G_OBJECT (view), "show-deleted");
-}
-
-static gboolean
-mail_paned_view_get_show_deleted (EMailView *view)
-{
- EMailPanedViewPrivate *priv;
-
- priv = E_MAIL_PANED_VIEW_GET_PRIVATE (view);
-
- return priv->show_deleted;
-}
-
-static void
mail_paned_view_set_preview_visible (EMailView *view,
gboolean preview_visible)
{
- EMailPanedViewPrivate *priv;
-
- priv = E_MAIL_PANED_VIEW_GET_PRIVATE (view);
-
- if (preview_visible == priv->preview_visible)
- return;
+ EMailViewClass *parent_class;
/* If we're showing the preview, tell EMailReader to reload the
* selected message. This should force it to download the full
@@ -947,23 +833,13 @@ mail_paned_view_set_preview_visible (EMailView *view,
e_mail_reader_set_message (reader, cursor_uid);
}
- priv->preview_visible = preview_visible;
-
mail_paned_view_save_boolean (
- E_MAIL_PANED_VIEW (view),
+ E_MAIL_VIEW (view),
STATE_KEY_PREVIEW_VISIBLE, preview_visible);
- g_object_notify (G_OBJECT (view), "preview-visible");
-}
-
-static gboolean
-mail_paned_view_get_preview_visible (EMailView *view)
-{
- EMailPanedViewPrivate *priv;
-
- priv = E_MAIL_PANED_VIEW_GET_PRIVATE (view);
-
- return priv->preview_visible;
+ /* Chain up to parent's set_preview_visible() method. */
+ parent_class = E_MAIL_VIEW_CLASS (e_mail_paned_view_parent_class);
+ parent_class->set_preview_visible (view, preview_visible);
}
static guint
@@ -973,12 +849,11 @@ mail_paned_view_open_selected_mail (EMailPanedView *view)
}
static void
-mail_paned_view_class_init (EMailPanedViewClass *class)
+e_mail_paned_view_class_init (EMailPanedViewClass *class)
{
GObjectClass *object_class;
EMailViewClass *mail_view_class;
- parent_class = g_type_class_peek_parent (class);
g_type_class_add_private (class, sizeof (EMailPanedViewPrivate));
object_class = G_OBJECT_CLASS (class);
@@ -988,17 +863,11 @@ mail_paned_view_class_init (EMailPanedViewClass *class)
object_class->get_property = mail_paned_view_get_property;
mail_view_class = E_MAIL_VIEW_CLASS (class);
- mail_view_class->get_searchbar = mail_paned_view_get_searchbar;
mail_view_class->set_search_strings = mail_paned_view_set_search_strings;
mail_view_class->get_view_instance = mail_paned_view_get_view_instance;
mail_view_class->update_view_instance = mail_paned_view_update_view_instance;
- mail_view_class->set_orientation = mail_paned_view_set_orientation;
- mail_view_class->get_orientation = mail_paned_view_get_orientation;
- mail_view_class->set_show_deleted = mail_paned_view_set_show_deleted;
- mail_view_class->get_show_deleted = mail_paned_view_get_show_deleted;
mail_view_class->set_preview_visible = mail_paned_view_set_preview_visible;
- mail_view_class->get_preview_visible = mail_paned_view_get_preview_visible;
class->open_selected_mail = mail_paned_view_open_selected_mail;
@@ -1007,33 +876,10 @@ mail_paned_view_class_init (EMailPanedViewClass *class)
object_class,
PROP_GROUP_BY_THREADS,
"group-by-threads");
-
- g_object_class_install_property (
- object_class,
- PROP_PREVIEW_VISIBLE,
- g_param_spec_boolean (
- "preview-visible",
- "Preview is Visible",
- "Whether the preview pane is visible",
- TRUE,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (
- object_class,
- PROP_SHOW_DELETED,
- g_param_spec_boolean (
- "show-deleted",
- "Show Deleted",
- NULL,
- FALSE,
- G_PARAM_READWRITE));
-
- g_object_class_override_property (
- object_class, PROP_ORIENTATION, "orientation");
}
static void
-mail_paned_view_reader_init (EMailReaderIface *iface)
+e_mail_paned_view_reader_init (EMailReaderIface *iface)
{
iface->get_action_group = mail_paned_view_get_action_group;
iface->get_formatter = mail_paned_view_get_formatter;
@@ -1048,73 +894,24 @@ mail_paned_view_reader_init (EMailReaderIface *iface)
}
static void
-mail_paned_view_init (EMailPanedView *view)
+e_mail_paned_view_init (EMailPanedView *view)
{
view->priv = E_MAIL_PANED_VIEW_GET_PRIVATE (view);
- view->priv->preview_visible = TRUE;
-
g_signal_connect (
view, "notify::group-by-threads",
G_CALLBACK (mail_paned_view_notify_group_by_threads_cb),
NULL);
}
-GType
-e_mail_paned_view_get_type (void)
-{
- return mail_paned_view_type;
-}
-
-void
-e_mail_paned_view_register_type (GTypeModule *type_module)
-{
- static const GTypeInfo type_info = {
- sizeof (EMailPanedViewClass),
- (GBaseInitFunc) NULL,
- (GBaseFinalizeFunc) NULL,
- (GClassInitFunc) mail_paned_view_class_init,
- (GClassFinalizeFunc) NULL,
- NULL, /* class_data */
- sizeof (EMailPanedView),
- 0, /* n_preallocs */
- (GInstanceInitFunc) mail_paned_view_init,
- NULL /* value_table */
- };
-#if 0
- static const GInterfaceInfo orientable_info = {
- (GInterfaceInitFunc) NULL,
- (GInterfaceFinalizeFunc) NULL,
- NULL /* interface_data */
- };
-#endif
- static const GInterfaceInfo reader_info = {
- (GInterfaceInitFunc) mail_paned_view_reader_init,
- (GInterfaceFinalizeFunc) NULL,
- NULL /* interface_data */
- };
-
- mail_paned_view_type = g_type_module_register_type (
- type_module, E_TYPE_MAIL_VIEW,
- "EMailPanedView", &type_info, 0);
-#if 0
- g_type_module_add_interface (
- type_module, mail_paned_view_type,
- GTK_TYPE_ORIENTABLE, &orientable_info);
-#endif
- g_type_module_add_interface (
- type_module, mail_paned_view_type,
- E_TYPE_MAIL_READER, &reader_info);
-}
-
GtkWidget *
-e_mail_paned_view_new (EShellContent *content)
+e_mail_paned_view_new (EShellView *shell_view)
{
- g_return_val_if_fail (E_IS_SHELL_CONTENT (content), NULL);
+ g_return_val_if_fail (E_IS_SHELL_VIEW (shell_view), NULL);
return g_object_new (
E_TYPE_MAIL_PANED_VIEW,
- "shell-content", content, NULL);
+ "shell-view", shell_view, NULL);
}
void
@@ -1127,7 +924,6 @@ e_mail_paned_view_hide_message_list_pane (EMailPanedView *view,
gtk_widget_show (view->priv->scrolled_window);
else
gtk_widget_hide (view->priv->scrolled_window);
-
}
GtkWidget *
diff --git a/mail/e-mail-paned-view.h b/mail/e-mail-paned-view.h
index 09d2299a4f..9be60a854f 100644
--- a/mail/e-mail-paned-view.h
+++ b/mail/e-mail-paned-view.h
@@ -25,7 +25,6 @@
#include <mail/e-mail-view.h>
-#include <shell/e-shell-content.h>
#include <shell/e-shell-searchbar.h>
#include <shell/e-shell-view.h>
@@ -68,8 +67,7 @@ struct _EMailPanedViewClass {
};
GType e_mail_paned_view_get_type (void);
-void e_mail_paned_view_register_type (GTypeModule *type_module);
-GtkWidget * e_mail_paned_view_new (EShellContent *content);
+GtkWidget * e_mail_paned_view_new (EShellView *shell_view);
void e_mail_paned_view_hide_message_list_pane
(EMailPanedView *view,
gboolean visible);
diff --git a/mail/e-mail-reader.c b/mail/e-mail-reader.c
index adf56fac7e..ff6245eb69 100644
--- a/mail/e-mail-reader.c
+++ b/mail/e-mail-reader.c
@@ -686,15 +686,17 @@ action_mail_next_cb (GtkAction *action,
mask = 0;
message_list = e_mail_reader_get_message_list (reader);
+
#if HAVE_CLUTTER
- actor = g_object_get_data ((GObject *)message_list, "preview-actor");
- if (actor) {
+ 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);
}
@@ -2190,8 +2192,8 @@ mail_reader_message_selected_timeout_cb (EMailReader *reader)
string = g_strdup_printf (
_("Retrieving message '%s'"), cursor_uid);
#if HAVE_CLUTTER
- if (!e_shell_get_express_mode(e_shell_get_default()))
- e_web_view_load_string (web_view, string);
+ if (!e_shell_get_express_mode (e_shell_get_default ()))
+ e_web_view_load_string (web_view, string);
#else
e_web_view_load_string (web_view, string);
#endif
diff --git a/mail/e-mail-view.c b/mail/e-mail-view.c
index a3a642ab7f..909f38b33d 100644
--- a/mail/e-mail-view.c
+++ b/mail/e-mail-view.c
@@ -33,7 +33,11 @@
((obj), E_TYPE_MAIL_VIEW, EMailViewPrivate))
struct _EMailViewPrivate {
- gint placeholder;
+ EShellView *shell_view;
+ GtkOrientation orientation;
+
+ guint preview_visible : 1;
+ guint show_deleted : 1;
};
enum {
@@ -45,7 +49,10 @@ enum {
enum {
PROP_0,
- PROP_SHELL_VIEW
+ PROP_ORIENTATION,
+ PROP_PREVIEW_VISIBLE,
+ PROP_SHELL_VIEW,
+ PROP_SHOW_DELETED
};
static guint signals[LAST_SIGNAL];
@@ -53,15 +60,44 @@ static guint signals[LAST_SIGNAL];
G_DEFINE_TYPE (EMailView, e_mail_view, GTK_TYPE_VBOX)
static void
+mail_view_set_shell_view (EMailView *view,
+ EShellView *shell_view)
+{
+ g_return_if_fail (E_IS_SHELL_VIEW (shell_view));
+ g_return_if_fail (view->priv->shell_view == NULL);
+
+ view->priv->shell_view = g_object_ref (shell_view);
+}
+
+static void
mail_view_set_property (GObject *object,
guint property_id,
const GValue *value,
GParamSpec *pspec)
{
switch (property_id) {
+ case PROP_ORIENTATION:
+ e_mail_view_set_orientation (
+ E_MAIL_VIEW (object),
+ g_value_get_enum (value));
+ return;
+
+ case PROP_PREVIEW_VISIBLE:
+ e_mail_view_set_preview_visible (
+ E_MAIL_VIEW (object),
+ g_value_get_boolean (value));
+ return;
+
case PROP_SHELL_VIEW:
- E_MAIL_VIEW(object)->content =
- g_value_get_object (value);
+ mail_view_set_shell_view (
+ E_MAIL_VIEW (object),
+ g_value_get_object (value));
+ return;
+
+ case PROP_SHOW_DELETED:
+ e_mail_view_set_show_deleted (
+ E_MAIL_VIEW (object),
+ g_value_get_boolean (value));
return;
}
@@ -75,9 +111,28 @@ mail_view_get_property (GObject *object,
GParamSpec *pspec)
{
switch (property_id) {
+ case PROP_ORIENTATION:
+ g_value_set_enum (
+ value, e_mail_view_get_orientation (
+ E_MAIL_VIEW (object)));
+ return;
+
+ case PROP_PREVIEW_VISIBLE:
+ g_value_set_boolean (
+ value, e_mail_view_get_preview_visible (
+ E_MAIL_VIEW (object)));
+ return;
+
case PROP_SHELL_VIEW:
g_value_set_object (
- value, E_MAIL_VIEW(object)->content);
+ value, e_mail_view_get_shell_view (
+ E_MAIL_VIEW (object)));
+ return;
+
+ case PROP_SHOW_DELETED:
+ g_value_set_boolean (
+ value, e_mail_view_get_show_deleted (
+ E_MAIL_VIEW (object)));
return;
}
@@ -85,6 +140,69 @@ mail_view_get_property (GObject *object,
}
static void
+mail_view_dispose (GObject *object)
+{
+ EMailViewPrivate *priv;
+
+ priv = E_MAIL_VIEW_GET_PRIVATE (object);
+
+ if (priv->shell_view != NULL) {
+ g_object_unref (priv->shell_view);
+ priv->shell_view = NULL;
+ }
+
+ /* Chain up to parent's dispose() method. */
+ G_OBJECT_CLASS (e_mail_view_parent_class)->dispose (object);
+}
+
+static GtkOrientation
+mail_view_get_orientation (EMailView *view)
+{
+ return view->priv->orientation;
+}
+
+static void
+mail_view_set_orientation (EMailView *view,
+ GtkOrientation orientation)
+{
+ view->priv->orientation = orientation;
+
+ g_object_notify (G_OBJECT (view), "orientation");
+
+ e_mail_view_update_view_instance (view);
+}
+
+static gboolean
+mail_view_get_preview_visible (EMailView *view)
+{
+ return view->priv->preview_visible;
+}
+
+static void
+mail_view_set_preview_visible (EMailView *view,
+ gboolean preview_visible)
+{
+ view->priv->preview_visible = preview_visible;
+
+ g_object_notify (G_OBJECT (view), "preview-visible");
+}
+
+static gboolean
+mail_view_get_show_deleted (EMailView *view)
+{
+ return view->priv->show_deleted;
+}
+
+static void
+mail_view_set_show_deleted (EMailView *view,
+ gboolean show_deleted)
+{
+ view->priv->show_deleted = show_deleted;
+
+ g_object_notify (G_OBJECT (view), "show-deleted");
+}
+
+static void
e_mail_view_class_init (EMailViewClass *class)
{
GObjectClass *object_class;
@@ -94,6 +212,14 @@ e_mail_view_class_init (EMailViewClass *class)
object_class = G_OBJECT_CLASS (class);
object_class->set_property = mail_view_set_property;
object_class->get_property = mail_view_get_property;
+ object_class->dispose = mail_view_dispose;
+
+ class->get_orientation = mail_view_get_orientation;
+ class->set_orientation = mail_view_set_orientation;
+ class->get_preview_visible = mail_view_get_preview_visible;
+ class->set_preview_visible = mail_view_set_preview_visible;
+ class->get_show_deleted = mail_view_get_show_deleted;
+ class->set_show_deleted = mail_view_set_show_deleted;
signals[PANE_CLOSE] = g_signal_new (
"pane-close",
@@ -122,21 +248,47 @@ e_mail_view_class_init (EMailViewClass *class)
g_cclosure_marshal_VOID__STRING,
G_TYPE_NONE, 1, G_TYPE_STRING);
- /**
- * EMailView:shell-content
- *
- * The #EShellContent to which the widget belongs.
- **/
+ g_object_class_install_property (
+ object_class,
+ PROP_ORIENTATION,
+ g_param_spec_enum (
+ "orientation",
+ "Orientation",
+ NULL,
+ GTK_TYPE_ORIENTATION,
+ GTK_ORIENTATION_HORIZONTAL,
+ G_PARAM_READWRITE));
+
+ g_object_class_install_property (
+ object_class,
+ PROP_PREVIEW_VISIBLE,
+ g_param_spec_boolean (
+ "preview-visible",
+ "Preview Visible",
+ NULL,
+ FALSE,
+ G_PARAM_READWRITE));
+
g_object_class_install_property (
object_class,
PROP_SHELL_VIEW,
g_param_spec_object (
- "shell-content",
+ "shell-view",
+ "Shell View",
NULL,
- NULL,
- E_TYPE_SHELL_CONTENT,
+ E_TYPE_SHELL_VIEW,
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY));
+
+ g_object_class_install_property (
+ object_class,
+ PROP_SHOW_DELETED,
+ g_param_spec_boolean (
+ "show-deleted",
+ "Show Deleted",
+ NULL,
+ FALSE,
+ G_PARAM_READWRITE));
}
static void
@@ -145,6 +297,14 @@ e_mail_view_init (EMailView *view)
view->priv = E_MAIL_VIEW_GET_PRIVATE (view);
}
+EShellView *
+e_mail_view_get_shell_view (EMailView *view)
+{
+ g_return_val_if_fail (E_IS_MAIL_VIEW (view), NULL);
+
+ return view->priv->shell_view;
+}
+
void
e_mail_view_update_view_instance (EMailView *view)
{
@@ -185,17 +345,17 @@ e_mail_view_set_search_strings (EMailView *view,
class->set_search_strings (view, search_strings);
}
-EShellSearchbar *
-e_mail_view_get_searchbar (EMailView *view)
+GtkOrientation
+e_mail_view_get_orientation (EMailView *view)
{
EMailViewClass *class;
- g_return_val_if_fail (E_IS_MAIL_VIEW (view), NULL);
+ g_return_val_if_fail (E_IS_MAIL_VIEW (view), 0);
class = E_MAIL_VIEW_GET_CLASS (view);
- g_return_val_if_fail (class->get_searchbar != NULL, NULL);
+ g_return_val_if_fail (class->get_orientation != NULL, 0);
- return class->get_searchbar (view);
+ return class->get_orientation (view);
}
void
@@ -212,17 +372,17 @@ e_mail_view_set_orientation (EMailView *view,
class->set_orientation (view, orientation);
}
-GtkOrientation
-e_mail_view_get_orientation (EMailView *view)
+gboolean
+e_mail_view_get_preview_visible (EMailView *view)
{
EMailViewClass *class;
- g_return_val_if_fail (E_IS_MAIL_VIEW (view), 0);
+ g_return_val_if_fail (E_IS_MAIL_VIEW (view), FALSE);
class = E_MAIL_VIEW_GET_CLASS (view);
- g_return_val_if_fail (class->get_orientation != NULL, 0);
+ g_return_val_if_fail (class->get_preview_visible != NULL, FALSE);
- return class->get_orientation (view);
+ return class->get_preview_visible (view);
}
void
@@ -240,16 +400,16 @@ e_mail_view_set_preview_visible (EMailView *view,
}
gboolean
-e_mail_view_get_preview_visible (EMailView *view)
+e_mail_view_get_show_deleted (EMailView *view)
{
EMailViewClass *class;
g_return_val_if_fail (E_IS_MAIL_VIEW (view), FALSE);
class = E_MAIL_VIEW_GET_CLASS (view);
- g_return_val_if_fail (class->get_preview_visible != NULL, FALSE);
+ g_return_val_if_fail (class->get_show_deleted != NULL, FALSE);
- return class->get_preview_visible (view);
+ return class->get_show_deleted (view);
}
void
@@ -265,16 +425,3 @@ e_mail_view_set_show_deleted (EMailView *view,
class->set_show_deleted (view, show_deleted);
}
-
-gboolean
-e_mail_view_get_show_deleted (EMailView *view)
-{
- EMailViewClass *class;
-
- g_return_val_if_fail (E_IS_MAIL_VIEW (view), FALSE);
-
- class = E_MAIL_VIEW_GET_CLASS (view);
- g_return_val_if_fail (class->get_show_deleted != NULL, FALSE);
-
- return class->get_show_deleted (view);
-}
diff --git a/mail/e-mail-view.h b/mail/e-mail-view.h
index 5c6e6a42b2..da4e5e2688 100644
--- a/mail/e-mail-view.h
+++ b/mail/e-mail-view.h
@@ -20,12 +20,12 @@
*
*/
-#ifndef _E_MAIL_VIEW_H_
-#define _E_MAIL_VIEW_H_
+#ifndef E_MAIL_VIEW_H
+#define E_MAIL_VIEW_H
-#include <shell/e-shell-content.h>
+#include <shell/e-shell-view.h>
#include <shell/e-shell-searchbar.h>
-#include "widgets/menus/gal-view-instance.h"
+#include <menus/gal-view-instance.h>
/* Standard GObject macros */
#define E_TYPE_MAIL_VIEW \
@@ -54,39 +54,38 @@ typedef struct _EMailViewPrivate EMailViewPrivate;
struct _EMailView {
GtkVBox parent;
-
EMailViewPrivate *priv;
- EShellContent *content;
EMailView *prev;
};
struct _EMailViewClass {
GtkVBoxClass parent_class;
+ /* Signals */
void (*pane_close) (EMailView *view);
void (*view_changed) (EMailView *view);
void (*open_mail) (EMailView *view,
- const gchar *);
+ const gchar *uid);
- EShellSearchbar *
- (*get_searchbar) (EMailView *view);
+ /* Methods */
void (*set_search_strings) (EMailView *view,
GSList *search_strings);
GalViewInstance *
(*get_view_instance) (EMailView *view);
void (*update_view_instance) (EMailView *view);
+ GtkOrientation (*get_orientation) (EMailView *view);
void (*set_orientation) (EMailView *view,
GtkOrientation orientation);
- GtkOrientation (*get_orientation) (EMailView *view);
+ gboolean (*get_preview_visible) (EMailView *view);
void (*set_preview_visible) (EMailView *view,
gboolean visible);
- gboolean (*get_preview_visible) (EMailView *view);
+ gboolean (*get_show_deleted) (EMailView *view);
void (*set_show_deleted) (EMailView *view,
gboolean show_deleted);
- gboolean (*get_show_deleted) (EMailView *view);
};
GType e_mail_view_get_type (void);
+EShellView * e_mail_view_get_shell_view (EMailView *view);
void e_mail_view_update_view_instance(EMailView *view);
GalViewInstance *
e_mail_view_get_view_instance (EMailView *view);
@@ -98,11 +97,9 @@ GtkOrientation e_mail_view_get_orientation (EMailView *);
void e_mail_view_set_preview_visible (EMailView *view,
gboolean visible);
gboolean e_mail_view_get_preview_visible (EMailView *view);
+gboolean e_mail_view_get_show_deleted (EMailView *view);
void e_mail_view_set_show_deleted (EMailView *view,
gboolean show_deleted);
-gboolean e_mail_view_get_show_deleted (EMailView *view);
-EShellSearchbar *
- e_mail_view_get_searchbar (EMailView *view);
G_END_DECLS
diff --git a/mail/em-format-html.c b/mail/em-format-html.c
index 302d5afc67..a7e4c03ab5 100644
--- a/mail/em-format-html.c
+++ b/mail/em-format-html.c
@@ -50,7 +50,7 @@
#include "e-util/e-extensible.h"
#include "misc/e-web-view.h"
-#include "shell/e-shell.h"
+#include <shell/e-shell.h>
#include <gtkhtml/gtkhtml.h>
#include <gtkhtml/gtkhtml-stream.h>
diff --git a/mail/message-list.c b/mail/message-list.c
index 0a2a5d446d..8296ea8143 100644
--- a/mail/message-list.c
+++ b/mail/message-list.c
@@ -4120,20 +4120,6 @@ message_list_set_hidedeleted (MessageList *ml, gboolean hidedeleted)
}
}
-#if HAVE_CLUTTER
-static void
-on_timeline_started (ClutterTimeline *timeline, ClutterActor *actor)
-{
- clutter_actor_show(actor);
-}
-
-static void
-on_timeline_stopped (ClutterTimeline *timeline, ClutterActor *actor)
-{
- clutter_actor_hide(actor);
-}
-#endif
-
void
message_list_set_search (MessageList *ml, const gchar *search)
{
@@ -4175,9 +4161,12 @@ message_list_set_search (MessageList *ml, const gchar *search)
clutter_behaviour_apply (behaviour, texture);
clutter_timeline_set_loop (ml->priv->timeline, TRUE);
- g_signal_connect(ml->priv->timeline, "started", G_CALLBACK(on_timeline_started), texture);
- g_signal_connect(ml->priv->timeline, "paused", G_CALLBACK(on_timeline_stopped), texture);
- //g_signal_connect(ml->priv->timeline, "completed", G_CALLBACK(on_timeline_stopped), texture);
+ 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);