diff options
-rw-r--r-- | mail/e-mail-notebook-view.c | 10 | ||||
-rw-r--r-- | mail/e-mail-view.c | 70 | ||||
-rw-r--r-- | mail/e-mail-view.h | 4 | ||||
-rw-r--r-- | modules/mail/e-mail-shell-content.c | 329 | ||||
-rw-r--r-- | modules/mail/e-mail-shell-content.h | 19 | ||||
-rw-r--r-- | modules/mail/e-mail-shell-view-actions.c | 127 | ||||
-rw-r--r-- | modules/mail/e-mail-shell-view-private.c | 100 | ||||
-rw-r--r-- | modules/mail/e-mail-shell-view.c | 25 |
8 files changed, 435 insertions, 249 deletions
diff --git a/mail/e-mail-notebook-view.c b/mail/e-mail-notebook-view.c index a10c37031c..41cab950bc 100644 --- a/mail/e-mail-notebook-view.c +++ b/mail/e-mail-notebook-view.c @@ -140,7 +140,7 @@ mnv_page_changed (GtkNotebook *book, em_folder_tree_set_selected (folder_tree, uri, FALSE); if (mview != priv->current_view) { - mview->prev = priv->current_view; + e_mail_view_set_previous_view (mview, priv->current_view); priv->current_view = mview; } @@ -268,7 +268,7 @@ mnv_tab_closed_cb (ClutterTimeline *timeline, if (E_IS_MAIL_FOLDER_PANE (page)) g_hash_table_remove (data->view->priv->views, folder_uri); - prev = page->prev; + 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); @@ -343,7 +343,7 @@ tab_remove_gtk_cb (GtkWidget *button, if (E_IS_MAIL_FOLDER_PANE (page)) g_hash_table_remove (view->priv->views, folder_uri); - prev = page->prev; + prev = e_mail_view_get_previous_view (page); if (prev) { num = emnv_get_page_num (view, (GtkWidget *)prev); gtk_notebook_set_current_page (view->priv->book, num); @@ -865,7 +865,7 @@ mail_netbook_view_open_mail (EMailView *view, 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; + e_mail_view_set_previous_view (pane, priv->current_view); E_MAIL_MESSAGE_PANE(pane)->parent_folder_view = priv->current_view; priv->current_view = pane; @@ -1086,7 +1086,7 @@ mail_notebook_view_set_folder (EMailReader *reader, 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; + e_mail_view_set_previous_view (priv->current_view, old_view); page = gtk_notebook_append_page ( priv->book, (GtkWidget *)priv->current_view, create_tab_label ( diff --git a/mail/e-mail-view.c b/mail/e-mail-view.c index 909f38b33d..62e0b0c733 100644 --- a/mail/e-mail-view.c +++ b/mail/e-mail-view.c @@ -35,26 +35,28 @@ struct _EMailViewPrivate { EShellView *shell_view; GtkOrientation orientation; + EMailView *previous_view; guint preview_visible : 1; guint show_deleted : 1; }; enum { - PANE_CLOSE, - VIEW_CHANGED, - OPEN_MAIL, - LAST_SIGNAL -}; - -enum { PROP_0, PROP_ORIENTATION, PROP_PREVIEW_VISIBLE, + PROP_PREVIOUS_VIEW, PROP_SHELL_VIEW, PROP_SHOW_DELETED }; +enum { + PANE_CLOSE, + VIEW_CHANGED, + OPEN_MAIL, + LAST_SIGNAL +}; + static guint signals[LAST_SIGNAL]; G_DEFINE_TYPE (EMailView, e_mail_view, GTK_TYPE_VBOX) @@ -88,6 +90,12 @@ mail_view_set_property (GObject *object, g_value_get_boolean (value)); return; + case PROP_PREVIOUS_VIEW: + e_mail_view_set_previous_view ( + E_MAIL_VIEW (object), + g_value_get_object (value)); + return; + case PROP_SHELL_VIEW: mail_view_set_shell_view ( E_MAIL_VIEW (object), @@ -123,6 +131,12 @@ mail_view_get_property (GObject *object, E_MAIL_VIEW (object))); return; + case PROP_PREVIOUS_VIEW: + g_value_set_object ( + value, e_mail_view_get_previous_view ( + E_MAIL_VIEW (object))); + return; + case PROP_SHELL_VIEW: g_value_set_object ( value, e_mail_view_get_shell_view ( @@ -151,6 +165,11 @@ mail_view_dispose (GObject *object) priv->shell_view = NULL; } + if (priv->previous_view != NULL) { + g_object_unref (priv->previous_view); + priv->previous_view = NULL; + } + /* Chain up to parent's dispose() method. */ G_OBJECT_CLASS (e_mail_view_parent_class)->dispose (object); } @@ -271,6 +290,16 @@ e_mail_view_class_init (EMailViewClass *class) g_object_class_install_property ( object_class, + PROP_PREVIOUS_VIEW, + g_param_spec_object ( + "previous-view", + "Previous View", + NULL, + E_TYPE_MAIL_VIEW, + G_PARAM_READWRITE)); + + g_object_class_install_property ( + object_class, PROP_SHELL_VIEW, g_param_spec_object ( "shell-view", @@ -399,6 +428,33 @@ e_mail_view_set_preview_visible (EMailView *view, class->set_preview_visible (view, visible); } +EMailView * +e_mail_view_get_previous_view (EMailView *view) +{ + g_return_val_if_fail (E_IS_MAIL_VIEW (view), NULL); + + return view->priv->previous_view; +} + +void +e_mail_view_set_previous_view (EMailView *view, + EMailView *previous_view) +{ + g_return_if_fail (E_IS_MAIL_VIEW (view)); + + if (previous_view != NULL) { + g_return_if_fail (E_IS_MAIL_VIEW (previous_view)); + g_object_ref (previous_view); + } + + if (view->priv->previous_view != NULL) + g_object_unref (view->priv->previous_view); + + view->priv->previous_view = previous_view; + + g_object_notify (G_OBJECT (view), "previous-view"); +} + gboolean e_mail_view_get_show_deleted (EMailView *view) { diff --git a/mail/e-mail-view.h b/mail/e-mail-view.h index da4e5e2688..6c697bda44 100644 --- a/mail/e-mail-view.h +++ b/mail/e-mail-view.h @@ -55,7 +55,6 @@ typedef struct _EMailViewPrivate EMailViewPrivate; struct _EMailView { GtkVBox parent; EMailViewPrivate *priv; - EMailView *prev; }; struct _EMailViewClass { @@ -97,6 +96,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); +EMailView * e_mail_view_get_previous_view (EMailView *view); +void e_mail_view_set_previous_view (EMailView *view, + EMailView *previous_view); gboolean e_mail_view_get_show_deleted (EMailView *view); void e_mail_view_set_show_deleted (EMailView *view, gboolean show_deleted); diff --git a/modules/mail/e-mail-shell-content.c b/modules/mail/e-mail-shell-content.c index 8dc2619bfa..6ba52737ba 100644 --- a/modules/mail/e-mail-shell-content.c +++ b/modules/mail/e-mail-shell-content.c @@ -38,7 +38,6 @@ #include "mail-ops.h" #include "message-list.h" -#include "e-mail-view.h" #include "e-mail-paned-view.h" #include "e-mail-notebook-view.h" #include "e-mail-reader.h" @@ -51,32 +50,19 @@ ((obj), E_TYPE_MAIL_SHELL_CONTENT, EMailShellContentPrivate)) struct _EMailShellContentPrivate { - gint temp; + EMailView *mail_view; }; enum { PROP_0, PROP_GROUP_BY_THREADS, - PROP_ORIENTATION, - PROP_PREVIEW_VISIBLE, - PROP_SHOW_DELETED + PROP_MAIL_VIEW }; static gpointer parent_class; static GType mail_shell_content_type; static void -mail_shell_content_dispose (GObject *object) -{ - EMailShellContentPrivate *priv; - - priv = E_MAIL_SHELL_CONTENT_GET_PRIVATE (object); - - /* Chain up to parent's dispose() method. */ - G_OBJECT_CLASS (parent_class)->dispose (object); -} - -static void reconnect_changed_event (EMailReader *child, EMailReader *parent) { g_signal_emit_by_name (parent, "changed"); @@ -94,13 +80,66 @@ mail_shell_content_view_changed_cb (EMailView *view, { g_object_freeze_notify (G_OBJECT (content)); g_object_notify (G_OBJECT (content), "group-by-threads"); - g_object_notify (G_OBJECT (content), "show-deleted"); - g_object_notify (G_OBJECT (content), "preview-visible"); - g_object_notify (G_OBJECT (content), "orientation"); g_object_thaw_notify (G_OBJECT (content)); } static void +mail_shell_content_set_property (GObject *object, + guint property_id, + const GValue *value, + GParamSpec *pspec) +{ + switch (property_id) { + case PROP_GROUP_BY_THREADS: + e_mail_reader_set_group_by_threads ( + E_MAIL_READER (object), + g_value_get_boolean (value)); + return; + } + + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); +} + +static void +mail_shell_content_get_property (GObject *object, + guint property_id, + GValue *value, + GParamSpec *pspec) +{ + switch (property_id) { + case PROP_GROUP_BY_THREADS: + g_value_set_boolean ( + value, e_mail_reader_get_group_by_threads ( + E_MAIL_READER (object))); + return; + + case PROP_MAIL_VIEW: + g_value_set_object ( + value, e_mail_shell_content_get_mail_view ( + E_MAIL_SHELL_CONTENT (object))); + return; + } + + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); +} + +static void +mail_shell_content_dispose (GObject *object) +{ + EMailShellContentPrivate *priv; + + priv = E_MAIL_SHELL_CONTENT_GET_PRIVATE (object); + + if (priv->mail_view != NULL) { + g_object_unref (priv->mail_view); + priv->mail_view = NULL; + } + + /* Chain up to parent's dispose() method. */ + G_OBJECT_CLASS (parent_class)->dispose (object); +} + +static void mail_shell_content_constructed (GObject *object) { EMailShellContentPrivate *priv; @@ -113,7 +152,7 @@ mail_shell_content_constructed (GObject *object) priv = E_MAIL_SHELL_CONTENT_GET_PRIVATE (object); - /* Chain up to parent's constructed() method. */ + /* Chain up to parent's constructed () method. */ G_OBJECT_CLASS (parent_class)->constructed (object); shell_content = E_SHELL_CONTENT (object); @@ -125,7 +164,7 @@ mail_shell_content_constructed (GObject *object) container = GTK_WIDGET (object); - if (e_shell_get_express_mode(e_shell_get_default ())) { + if (e_shell_get_express_mode (e_shell_get_default ())) { widget = e_mail_notebook_view_new (shell_view); g_signal_connect ( widget, "view-changed", @@ -134,8 +173,8 @@ mail_shell_content_constructed (GObject *object) } else widget = e_mail_paned_view_new (shell_view); - E_MAIL_SHELL_CONTENT(object)->view = (EMailView *)widget; gtk_container_add (GTK_CONTAINER (container), widget); + priv->mail_view = g_object_ref (widget); gtk_widget_show (widget); g_signal_connect ( @@ -150,23 +189,45 @@ mail_shell_content_constructed (GObject *object) static guint32 mail_shell_content_check_state (EShellContent *shell_content) { - return e_mail_reader_check_state (E_MAIL_READER (E_MAIL_SHELL_CONTENT(shell_content)->view)); + EMailShellContentPrivate *priv; + EMailReader *reader; + + priv = E_MAIL_SHELL_CONTENT_GET_PRIVATE (shell_content); + + /* Forward this to our internal EMailView, which + * also implements the EMailReader interface. */ + reader = E_MAIL_READER (priv->mail_view); + + return e_mail_reader_check_state (reader); } static void mail_shell_content_focus_search_results (EShellContent *shell_content) { EMailShellContentPrivate *priv; + GtkWidget *message_list; + EMailReader *reader; priv = E_MAIL_SHELL_CONTENT_GET_PRIVATE (shell_content); - gtk_widget_grab_focus (e_mail_reader_get_message_list(E_MAIL_READER (E_MAIL_SHELL_CONTENT(shell_content)->view))); + reader = E_MAIL_READER (priv->mail_view); + message_list = e_mail_reader_get_message_list (reader); + + gtk_widget_grab_focus (message_list); } static guint mail_shell_content_open_selected_mail (EMailReader *reader) { - return e_mail_reader_open_selected_mail (E_MAIL_READER(E_MAIL_SHELL_CONTENT(reader)->view)); + EMailShellContentPrivate *priv; + + priv = E_MAIL_SHELL_CONTENT_GET_PRIVATE (reader); + + /* Forward this to our internal EMailView, which + * also implements the EMailReader interface. */ + reader = E_MAIL_READER (priv->mail_view); + + return e_mail_reader_open_selected_mail (reader); } static GtkActionGroup * @@ -186,37 +247,85 @@ mail_shell_content_get_action_group (EMailReader *reader) static EMFormatHTML * mail_shell_content_get_formatter (EMailReader *reader) { - return e_mail_reader_get_formatter (E_MAIL_READER(E_MAIL_SHELL_CONTENT(reader)->view)); + EMailShellContentPrivate *priv; + + priv = E_MAIL_SHELL_CONTENT_GET_PRIVATE (reader); + + /* Forward this to our internal EMailView, which + * also implements the EMailReader interface. */ + reader = E_MAIL_READER (priv->mail_view); + + return e_mail_reader_get_formatter (reader); } static gboolean mail_shell_content_get_hide_deleted (EMailReader *reader) { - return e_mail_reader_get_hide_deleted (E_MAIL_READER(E_MAIL_SHELL_CONTENT(reader)->view)); + EMailShellContentPrivate *priv; + + priv = E_MAIL_SHELL_CONTENT_GET_PRIVATE (reader); + + /* Forward this to our internal EMailView, which + * also implements the EMailReader interface. */ + reader = E_MAIL_READER (priv->mail_view); + + return e_mail_reader_get_hide_deleted (reader); } static GtkWidget * mail_shell_content_get_message_list (EMailReader *reader) { - return e_mail_reader_get_message_list (E_MAIL_READER(E_MAIL_SHELL_CONTENT(reader)->view)); + EMailShellContentPrivate *priv; + + priv = E_MAIL_SHELL_CONTENT_GET_PRIVATE (reader); + + /* Forward this to our internal EMailView, which + * also implements the EMailReader interface. */ + reader = E_MAIL_READER (priv->mail_view); + + return e_mail_reader_get_message_list (reader); } static GtkMenu * mail_shell_content_get_popup_menu (EMailReader *reader) { - return e_mail_reader_get_popup_menu (E_MAIL_READER(E_MAIL_SHELL_CONTENT(reader)->view)); + EMailShellContentPrivate *priv; + + priv = E_MAIL_SHELL_CONTENT_GET_PRIVATE (reader); + + /* Forward this to our internal EMailView, which + * also implements the EMailReader interface. */ + reader = E_MAIL_READER (priv->mail_view); + + return e_mail_reader_get_popup_menu (reader); } static EShellBackend * mail_shell_content_get_shell_backend (EMailReader *reader) { - return e_mail_reader_get_shell_backend (E_MAIL_READER(E_MAIL_SHELL_CONTENT(reader)->view)); + EMailShellContentPrivate *priv; + + priv = E_MAIL_SHELL_CONTENT_GET_PRIVATE (reader); + + /* Forward this to our internal EMailView, which + * also implements the EMailReader interface. */ + reader = E_MAIL_READER (priv->mail_view); + + return e_mail_reader_get_shell_backend (reader); } static GtkWindow * mail_shell_content_get_window (EMailReader *reader) { - return e_mail_reader_get_window (E_MAIL_READER(E_MAIL_SHELL_CONTENT(reader)->view)); + EMailShellContentPrivate *priv; + + priv = E_MAIL_SHELL_CONTENT_GET_PRIVATE (reader); + + /* Forward this to our internal EMailView, which + * also implements the EMailReader interface. */ + reader = E_MAIL_READER (priv->mail_view); + + return e_mail_reader_get_window (reader); } static void @@ -224,93 +333,29 @@ mail_shell_content_set_folder (EMailReader *reader, CamelFolder *folder, const gchar *folder_uri) { - return e_mail_reader_set_folder (E_MAIL_READER(E_MAIL_SHELL_CONTENT(reader)->view), - folder, - folder_uri); -} - -static void -mail_shell_content_show_search_bar (EMailReader *reader) -{ - e_mail_reader_show_search_bar (E_MAIL_READER(E_MAIL_SHELL_CONTENT(reader)->view)); -} - -static void -mail_shell_content_set_property (GObject *object, - guint property_id, - const GValue *value, - GParamSpec *pspec) -{ - switch (property_id) { - case PROP_GROUP_BY_THREADS: - g_object_set ( - E_MAIL_READER (E_MAIL_SHELL_CONTENT(object)->view), - "group-by-threads", - g_value_get_boolean (value), - NULL); - return; + EMailShellContentPrivate *priv; - case PROP_ORIENTATION: - e_mail_view_set_orientation ( - E_MAIL_SHELL_CONTENT(object)->view, - g_value_get_enum (value)); - return; + priv = E_MAIL_SHELL_CONTENT_GET_PRIVATE (reader); - case PROP_PREVIEW_VISIBLE: - e_mail_view_set_preview_visible ( - E_MAIL_SHELL_CONTENT(object)->view, - g_value_get_boolean (value)); - return; + /* Forward this to our internal EMailView, which + * also implements the EMailReader interface. */ + reader = E_MAIL_READER (priv->mail_view); - case PROP_SHOW_DELETED: - e_mail_view_set_show_deleted ( - E_MAIL_SHELL_CONTENT(object)->view, - g_value_get_boolean (value)); - return; - } - - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); + return e_mail_reader_set_folder (reader, folder, folder_uri); } static void -mail_shell_content_get_property (GObject *object, - guint property_id, - GValue *value, - GParamSpec *pspec) +mail_shell_content_show_search_bar (EMailReader *reader) { - switch (property_id) { - case PROP_GROUP_BY_THREADS: { - gboolean thr; - - g_object_get ((GObject *)E_MAIL_SHELL_CONTENT(object)->view, "group-by-threads", &thr, NULL); - g_value_set_boolean ( - value, - thr); - return; - } - case PROP_ORIENTATION: - g_value_set_enum ( - value, - e_mail_view_get_orientation ( - E_MAIL_SHELL_CONTENT(object)->view)); - return; + EMailShellContentPrivate *priv; - case PROP_PREVIEW_VISIBLE: - g_value_set_boolean ( - value, - e_mail_view_get_preview_visible ( - E_MAIL_SHELL_CONTENT(object)->view)); - return; + priv = E_MAIL_SHELL_CONTENT_GET_PRIVATE (reader); - case PROP_SHOW_DELETED: - g_value_set_boolean ( - value, - e_mail_view_get_show_deleted ( - E_MAIL_SHELL_CONTENT(object)->view)); - return; - } + /* Forward this to our internal EMailView, which + * also implements the EMailReader interface. */ + reader = E_MAIL_READER (priv->mail_view); - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); + e_mail_reader_show_search_bar (reader); } static void @@ -323,10 +368,10 @@ mail_shell_content_class_init (EMailShellContentClass *class) g_type_class_add_private (class, sizeof (EMailShellContentPrivate)); object_class = G_OBJECT_CLASS (class); - object_class->dispose = mail_shell_content_dispose; - object_class->constructed = mail_shell_content_constructed; object_class->set_property = mail_shell_content_set_property; object_class->get_property = mail_shell_content_get_property; + object_class->dispose = mail_shell_content_dispose; + object_class->constructed = mail_shell_content_constructed; shell_content_class = E_SHELL_CONTENT_CLASS (class); shell_content_class->check_state = mail_shell_content_check_state; @@ -339,26 +384,13 @@ mail_shell_content_class_init (EMailShellContentClass *class) 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", + PROP_MAIL_VIEW, + g_param_spec_object ( + "mail-view", + "Mail View", NULL, - FALSE, - G_PARAM_READWRITE)); - - g_object_class_override_property ( - object_class, PROP_ORIENTATION, "orientation"); + E_TYPE_MAIL_VIEW, + G_PARAM_READABLE)); } static void @@ -413,12 +445,6 @@ e_mail_shell_content_register_type (GTypeModule *type_module) NULL /* interface_data */ }; - static const GInterfaceInfo orientable_info = { - (GInterfaceInitFunc) NULL, - (GInterfaceFinalizeFunc) NULL, - NULL /* interface_data */ - }; - mail_shell_content_type = g_type_module_register_type ( type_module, E_TYPE_SHELL_CONTENT, "EMailShellContent", &type_info, 0); @@ -426,10 +452,6 @@ e_mail_shell_content_register_type (GTypeModule *type_module) g_type_module_add_interface ( type_module, mail_shell_content_type, E_TYPE_MAIL_READER, &reader_info); - - g_type_module_add_interface ( - type_module, mail_shell_content_type, - GTK_TYPE_ORIENTABLE, &orientable_info); } GtkWidget * @@ -442,6 +464,15 @@ e_mail_shell_content_new (EShellView *shell_view) "shell-view", shell_view, NULL); } +EMailView * +e_mail_shell_content_get_mail_view (EMailShellContent *mail_shell_content) +{ + g_return_val_if_fail ( + E_IS_MAIL_SHELL_CONTENT (mail_shell_content), NULL); + + return mail_shell_content->priv->mail_view; +} + EShellSearchbar * e_mail_shell_content_get_searchbar (EMailShellContent *mail_shell_content) { @@ -458,23 +489,3 @@ e_mail_shell_content_get_searchbar (EMailShellContent *mail_shell_content) return E_SHELL_SEARCHBAR (searchbar); } - -void -e_mail_shell_content_set_search_strings (EMailShellContent *mail_shell_content, - GSList *search_strings) -{ - e_mail_view_set_search_strings (mail_shell_content->view, search_strings); -} - -GalViewInstance * -e_mail_shell_content_get_view_instance (EMailShellContent *mail_shell_content) -{ - return e_mail_view_get_view_instance (mail_shell_content->view); -} - -void -e_mail_shell_content_update_view_instance (EMailShellContent *mail_shell_content) -{ - e_mail_view_update_view_instance (mail_shell_content->view); -} - diff --git a/modules/mail/e-mail-shell-content.h b/modules/mail/e-mail-shell-content.h index b0a89361cb..6e2c721d59 100644 --- a/modules/mail/e-mail-shell-content.h +++ b/modules/mail/e-mail-shell-content.h @@ -55,7 +55,6 @@ typedef struct _EMailShellContentPrivate EMailShellContentPrivate; struct _EMailShellContent { EShellContent parent; - EMailView *view; EMailShellContentPrivate *priv; }; @@ -67,27 +66,11 @@ GType e_mail_shell_content_get_type (void); void e_mail_shell_content_register_type (GTypeModule *type_module); GtkWidget * e_mail_shell_content_new(EShellView *shell_view); -gboolean e_mail_shell_content_get_preview_visible +EMailView * e_mail_shell_content_get_mail_view (EMailShellContent *mail_shell_content); -void e_mail_shell_content_set_preview_visible - (EMailShellContent *mail_shell_content, - gboolean preview_visible); EShellSearchbar * e_mail_shell_content_get_searchbar (EMailShellContent *mail_shell_content); -gboolean e_mail_shell_content_get_show_deleted - (EMailShellContent *mail_shell_content); -void e_mail_shell_content_set_show_deleted - (EMailShellContent *mail_shell_content, - gboolean show_deleted); -GalViewInstance * - e_mail_shell_content_get_view_instance - (EMailShellContent *mail_shell_content); -void e_mail_shell_content_set_search_strings - (EMailShellContent *mail_shell_content, - GSList *search_strings); -void e_mail_shell_content_update_view_instance - (EMailShellContent *mail_shell_content); G_END_DECLS diff --git a/modules/mail/e-mail-shell-view-actions.c b/modules/mail/e-mail-shell-view-actions.c index 009b0c1bcd..da8b0d729c 100644 --- a/modules/mail/e-mail-shell-view-actions.c +++ b/modules/mail/e-mail-shell-view-actions.c @@ -28,6 +28,7 @@ action_gal_save_custom_view_cb (GtkAction *action, { EMailShellContent *mail_shell_content; EShellView *shell_view; + EMailView *mail_view; GalViewInstance *view_instance; /* All shell views repond to the activation of this action, @@ -38,7 +39,9 @@ action_gal_save_custom_view_cb (GtkAction *action, return; mail_shell_content = mail_shell_view->priv->mail_shell_content; - view_instance = e_mail_shell_content_get_view_instance (mail_shell_content); + mail_view = e_mail_shell_content_get_mail_view (mail_shell_content); + view_instance = e_mail_view_get_view_instance (mail_view); + gal_view_instance_save_as (view_instance); } @@ -87,6 +90,7 @@ action_mail_create_search_folder_cb (GtkAction *action, EShellSearchbar *searchbar; EFilterRule *search_rule; EMVFolderRule *vfolder_rule; + EMailView *mail_view; const gchar *folder_uri; const gchar *search_text; gchar *rule_name; @@ -98,13 +102,14 @@ action_mail_create_search_folder_cb (GtkAction *action, g_return_if_fail (search_rule != NULL); mail_shell_content = mail_shell_view->priv->mail_shell_content; + mail_view = e_mail_shell_content_get_mail_view (mail_shell_content); searchbar = e_mail_shell_content_get_searchbar (mail_shell_content); - search_text = e_shell_searchbar_get_search_text (searchbar); + search_text = e_shell_searchbar_get_search_text (searchbar); if (search_text == NULL || *search_text == '\0') search_text = "''"; - reader = E_MAIL_READER (mail_shell_content->view); + reader = E_MAIL_READER (mail_view); folder_uri = e_mail_reader_get_folder_uri (reader); search_rule = vfolder_clone_rule (search_rule); @@ -212,13 +217,15 @@ static void action_mail_folder_mark_all_as_read_cb (GtkAction *action, EMailShellView *mail_shell_view) { - EMailReader *reader; - EShellWindow *shell_window; EShellView *shell_view; + EShellWindow *shell_window; + EMailShellContent *mail_shell_content; + EMailReader *reader; + EMailView *mail_view; CamelFolder *folder; GtkWindow *parent; MailFolderCache *cache; - MessageList *message_list; + GtkWidget *message_list; GPtrArray *uids; const gchar *key; const gchar *prompt; @@ -228,7 +235,10 @@ action_mail_folder_mark_all_as_read_cb (GtkAction *action, shell_window = e_shell_view_get_shell_window (shell_view); parent = GTK_WINDOW (shell_window); - reader = E_MAIL_READER (mail_shell_view->priv->mail_shell_content->view); + mail_shell_content = mail_shell_view->priv->mail_shell_content; + mail_view = e_mail_shell_content_get_mail_view (mail_shell_content); + + reader = E_MAIL_READER (mail_view); folder = e_mail_reader_get_folder (reader); g_return_if_fail (folder != NULL); @@ -243,10 +253,10 @@ action_mail_folder_mark_all_as_read_cb (GtkAction *action, if (!em_utils_prompt_user (parent, key, prompt, NULL)) return; - message_list = MESSAGE_LIST (e_mail_reader_get_message_list (reader)); + message_list = e_mail_reader_get_message_list (reader); g_return_if_fail (message_list != NULL); - uids = message_list_get_uids (message_list); + uids = message_list_get_uids (MESSAGE_LIST (message_list)); camel_folder_freeze (folder); for (ii = 0; ii < uids->len; ii++) @@ -364,10 +374,15 @@ static void action_mail_folder_select_thread_cb (GtkAction *action, EMailShellView *mail_shell_view) { + EMailShellContent *mail_shell_content; GtkWidget *message_list; EMailReader *reader; + EMailView *mail_view; + + mail_shell_content = mail_shell_view->priv->mail_shell_content; + mail_view = e_mail_shell_content_get_mail_view (mail_shell_content); - reader = E_MAIL_READER (mail_shell_view->priv->mail_shell_content->view); + reader = E_MAIL_READER (mail_view); message_list = e_mail_reader_get_message_list (reader); message_list_select_thread (MESSAGE_LIST (message_list)); @@ -377,10 +392,15 @@ static void action_mail_folder_select_subthread_cb (GtkAction *action, EMailShellView *mail_shell_view) { + EMailShellContent *mail_shell_content; GtkWidget *message_list; EMailReader *reader; + EMailView *mail_view; + + mail_shell_content = mail_shell_view->priv->mail_shell_content; + mail_view = e_mail_shell_content_get_mail_view (mail_shell_content); - reader = E_MAIL_READER (mail_shell_view->priv->mail_shell_content->view); + reader = E_MAIL_READER (mail_view); message_list = e_mail_reader_get_message_list (reader); message_list_select_subthread (MESSAGE_LIST (message_list)); @@ -419,7 +439,9 @@ static void action_mail_label_cb (GtkToggleAction *action, EMailShellView *mail_shell_view) { + EMailShellContent *mail_shell_content; EMailReader *reader; + EMailView *mail_view; CamelFolder *folder; GPtrArray *uids; const gchar *tag; @@ -428,7 +450,10 @@ action_mail_label_cb (GtkToggleAction *action, tag = g_object_get_data (G_OBJECT (action), "tag"); g_return_if_fail (tag != NULL); - reader = E_MAIL_READER (mail_shell_view->priv->mail_shell_content->view); + mail_shell_content = mail_shell_view->priv->mail_shell_content; + mail_view = e_mail_shell_content_get_mail_view (mail_shell_content); + + reader = E_MAIL_READER (mail_view); folder = e_mail_reader_get_folder (reader); uids = e_mail_reader_get_selected_uids (reader); @@ -452,12 +477,14 @@ action_mail_label_new_cb (GtkAction *action, EMailShellView *mail_shell_view) { EShell *shell; - EShellSettings *shell_settings; - EShellWindow *shell_window; EShellView *shell_view; + EShellWindow *shell_window; + EShellSettings *shell_settings; + EMailShellContent *mail_shell_content; EMailLabelDialog *label_dialog; EMailLabelListStore *store; EMailReader *reader; + EMailView *mail_view; CamelFolder *folder; GtkTreeModel *model; GtkTreeIter iter; @@ -502,7 +529,10 @@ action_mail_label_new_cb (GtkAction *action, gtk_tree_model_iter_nth_child (model, &iter, NULL, n_children - 1); label_tag = e_mail_label_list_store_get_tag (store, &iter); - reader = E_MAIL_READER (mail_shell_view->priv->mail_shell_content->view); + mail_shell_content = mail_shell_view->priv->mail_shell_content; + mail_view = e_mail_shell_content_get_mail_view (mail_shell_content); + + reader = E_MAIL_READER (mail_view); folder = e_mail_reader_get_folder (reader); uids = e_mail_reader_get_selected_uids (reader); @@ -524,9 +554,11 @@ action_mail_label_none_cb (GtkAction *action, { EShell *shell; EShellView *shell_view; - EShellSettings *shell_settings; EShellWindow *shell_window; + EShellSettings *shell_settings; + EMailShellContent *mail_shell_content; EMailReader *reader; + EMailView *mail_view; GtkTreeModel *tree_model; CamelFolder *folder; GtkTreeIter iter; @@ -542,7 +574,10 @@ action_mail_label_none_cb (GtkAction *action, tree_model = e_shell_settings_get_object ( shell_settings, "mail-label-list-store"); - reader = E_MAIL_READER (mail_shell_view->priv->mail_shell_content->view); + mail_shell_content = mail_shell_view->priv->mail_shell_content; + mail_view = e_mail_shell_content_get_mail_view (mail_shell_content); + + reader = E_MAIL_READER (mail_view); folder = e_mail_reader_get_folder (reader); uids = e_mail_reader_get_selected_uids (reader); @@ -573,11 +608,16 @@ static void action_mail_show_deleted_cb (GtkToggleAction *action, EMailShellView *mail_shell_view) { + EMailShellContent *mail_shell_content; GtkWidget *message_list; EMailReader *reader; + EMailView *mail_view; gboolean active; - reader = E_MAIL_READER (mail_shell_view->priv->mail_shell_content->view); + mail_shell_content = mail_shell_view->priv->mail_shell_content; + mail_view = e_mail_shell_content_get_mail_view (mail_shell_content); + + reader = E_MAIL_READER (mail_view); message_list = e_mail_reader_get_message_list (reader); active = gtk_toggle_action_get_active (action); @@ -592,10 +632,12 @@ action_mail_smart_backward_cb (GtkAction *action, EShellView *shell_view; EShellWindow *shell_window; EShellSettings *shell_settings; + EMailShellContent *mail_shell_content; EMailShellSidebar *mail_shell_sidebar; EMFolderTree *folder_tree; EMFormatHTML *formatter; EMailReader *reader; + EMailView *mail_view; GtkWidget *message_list; GtkToggleAction *toggle_action; EWebView *web_view; @@ -609,10 +651,13 @@ action_mail_smart_backward_cb (GtkAction *action, shell = e_shell_window_get_shell (shell_window); shell_settings = e_shell_get_shell_settings (shell); + mail_shell_content = mail_shell_view->priv->mail_shell_content; + mail_view = e_mail_shell_content_get_mail_view (mail_shell_content); + mail_shell_sidebar = mail_shell_view->priv->mail_shell_sidebar; folder_tree = e_mail_shell_sidebar_get_folder_tree (mail_shell_sidebar); - reader = E_MAIL_READER (mail_shell_view->priv->mail_shell_content->view); + reader = E_MAIL_READER (mail_view); formatter = e_mail_reader_get_formatter (reader); message_list = e_mail_reader_get_message_list (reader); @@ -658,10 +703,12 @@ action_mail_smart_forward_cb (GtkAction *action, EShellView *shell_view; EShellWindow *shell_window; EShellSettings *shell_settings; + EMailShellContent *mail_shell_content; EMailShellSidebar *mail_shell_sidebar; EMFolderTree *folder_tree; EMFormatHTML *formatter; EMailReader *reader; + EMailView *mail_view; GtkWidget *message_list; GtkToggleAction *toggle_action; EWebView *web_view; @@ -675,10 +722,13 @@ action_mail_smart_forward_cb (GtkAction *action, shell = e_shell_window_get_shell (shell_window); shell_settings = e_shell_get_shell_settings (shell); + mail_shell_content = mail_shell_view->priv->mail_shell_content; + mail_view = e_mail_shell_content_get_mail_view (mail_shell_content); + mail_shell_sidebar = mail_shell_view->priv->mail_shell_sidebar; folder_tree = e_mail_shell_sidebar_get_folder_tree (mail_shell_sidebar); - reader = E_MAIL_READER (mail_shell_view->priv->mail_shell_content->view); + reader = E_MAIL_READER (mail_view); formatter = e_mail_reader_get_formatter (reader); message_list = e_mail_reader_get_message_list (reader); @@ -727,10 +777,15 @@ static void action_mail_threads_collapse_all_cb (GtkAction *action, EMailShellView *mail_shell_view) { + EMailShellContent *mail_shell_content; GtkWidget *message_list; EMailReader *reader; + EMailView *mail_view; + + mail_shell_content = mail_shell_view->priv->mail_shell_content; + mail_view = e_mail_shell_content_get_mail_view (mail_shell_content); - reader = E_MAIL_READER (mail_shell_view->priv->mail_shell_content->view); + reader = E_MAIL_READER (mail_view); message_list = e_mail_reader_get_message_list (reader); message_list_set_threaded_collapse_all (MESSAGE_LIST (message_list)); @@ -740,10 +795,15 @@ static void action_mail_threads_expand_all_cb (GtkAction *action, EMailShellView *mail_shell_view) { + EMailShellContent *mail_shell_content; GtkWidget *message_list; EMailReader *reader; + EMailView *mail_view; - reader = E_MAIL_READER (mail_shell_view->priv->mail_shell_content->view); + mail_shell_content = mail_shell_view->priv->mail_shell_content; + mail_view = e_mail_shell_content_get_mail_view (mail_shell_content); + + reader = E_MAIL_READER (mail_view); message_list = e_mail_reader_get_message_list (reader); message_list_set_threaded_expand_all (MESSAGE_LIST (message_list)); @@ -793,11 +853,11 @@ action_mail_view_cb (GtkRadioAction *action, EMailShellView *mail_shell_view) { EMailShellContent *mail_shell_content; - GtkOrientable *orientable; GtkOrientation orientation; + EMailView *mail_view; mail_shell_content = mail_shell_view->priv->mail_shell_content; - orientable = GTK_ORIENTABLE (mail_shell_content); + mail_view = e_mail_shell_content_get_mail_view (mail_shell_content); switch (gtk_radio_action_get_current_value (action)) { case 0: @@ -810,7 +870,7 @@ action_mail_view_cb (GtkRadioAction *action, g_return_if_reached (); } - gtk_orientable_set_orientation (orientable, orientation); + e_mail_view_set_orientation (mail_view, orientation); } static GtkActionEntry mail_entries[] = { @@ -1289,6 +1349,7 @@ e_mail_shell_view_actions_init (EMailShellView *mail_shell_view) EShell *shell; EShellSearchbar *searchbar; EActionComboBox *combo_box; + EMailView *mail_view; GtkActionGroup *action_group; GtkAction *action; GConfBridge *bridge; @@ -1302,6 +1363,7 @@ e_mail_shell_view_actions_init (EMailShellView *mail_shell_view) shell = e_shell_window_get_shell (shell_window); mail_shell_content = mail_shell_view->priv->mail_shell_content; + mail_view = e_mail_shell_content_get_mail_view (mail_shell_content); searchbar = e_mail_shell_content_get_searchbar (mail_shell_content); /* Mail Actions */ @@ -1371,7 +1433,7 @@ e_mail_shell_view_actions_init (EMailShellView *mail_shell_view) e_mutual_binding_new ( ACTION (MAIL_PREVIEW), "active", - mail_shell_content, "preview-visible"); + mail_view, "preview-visible"); e_mutual_binding_new ( ACTION (MAIL_THREADS_GROUP_BY), "active", @@ -1387,7 +1449,7 @@ e_mail_shell_view_actions_init (EMailShellView *mail_shell_view) e_mutual_binding_new ( ACTION (MAIL_SHOW_DELETED), "active", - mail_shell_content, "show-deleted"); + mail_view, "show-deleted"); /* Keep the sensitivity of "Create Search Folder from Search" * in sync with "Save Search" so that its only selectable when @@ -1464,10 +1526,12 @@ void e_mail_shell_view_update_popup_labels (EMailShellView *mail_shell_view) { EShell *shell; - EShellSettings *shell_settings; - EShellWindow *shell_window; EShellView *shell_view; + EShellWindow *shell_window; + EShellSettings *shell_settings; + EMailShellContent *mail_shell_content; EMailReader *reader; + EMailView *mail_view; GtkUIManager *ui_manager; GtkActionGroup *action_group; GtkTreeModel *tree_model; @@ -1498,7 +1562,10 @@ e_mail_shell_view_update_popup_labels (EMailShellView *mail_shell_view) gtk_ui_manager_remove_ui (ui_manager, merge_id); e_action_group_remove_all_actions (action_group); - reader = E_MAIL_READER (mail_shell_view->priv->mail_shell_content->view); + mail_shell_content = mail_shell_view->priv->mail_shell_content; + mail_view = e_mail_shell_content_get_mail_view (mail_shell_content); + + reader = E_MAIL_READER (mail_view); uids = e_mail_reader_get_selected_uids (reader); valid = gtk_tree_model_get_iter_first (tree_model, &iter); diff --git a/modules/mail/e-mail-shell-view-private.c b/modules/mail/e-mail-shell-view-private.c index b1fcc726f8..a794329501 100644 --- a/modules/mail/e-mail-shell-view-private.c +++ b/modules/mail/e-mail-shell-view-private.c @@ -32,12 +32,18 @@ mail_shell_view_folder_tree_selected_cb (EMailShellView *mail_shell_view, guint32 flags, EMFolderTree *folder_tree) { + EMailShellContent *mail_shell_content; EShellView *shell_view; EMailReader *reader; + EMailView *mail_view; gboolean folder_selected; shell_view = E_SHELL_VIEW (mail_shell_view); - reader = E_MAIL_READER (mail_shell_view->priv->mail_shell_content->view); + + mail_shell_content = mail_shell_view->priv->mail_shell_content; + mail_view = e_mail_shell_content_get_mail_view (mail_shell_content); + + reader = E_MAIL_READER (mail_view); folder_selected = !(flags & CAMEL_FOLDER_NOSELECT) && @@ -55,9 +61,13 @@ static gboolean mail_shell_view_folder_tree_key_press_event_cb (EMailShellView *mail_shell_view, GdkEventKey *event) { - EMailReader *reader; + EMailShellContent *mail_shell_content; + EMailView *mail_view; gboolean handled = FALSE; + mail_shell_content = mail_shell_view->priv->mail_shell_content; + mail_view = e_mail_shell_content_get_mail_view (mail_shell_content); + if ((event->state & GDK_CONTROL_MASK) != 0) goto ctrl; @@ -89,8 +99,7 @@ ctrl: emit: /* Forward the key press to the EMailReader interface. */ - reader = E_MAIL_READER (mail_shell_view->priv->mail_shell_content->view); - g_signal_emit_by_name (reader, "key-press-event", event, &handled); + g_signal_emit_by_name (mail_view, "key-press-event", event, &handled); exit: return handled; @@ -100,19 +109,24 @@ static void mail_shell_view_folder_tree_selection_done_cb (EMailShellView *mail_shell_view, GtkWidget *menu) { + EMailShellContent *mail_shell_content; EMailShellSidebar *mail_shell_sidebar; EMFolderTree *folder_tree; GtkWidget *message_list; EMailReader *reader; + EMailView *mail_view; const gchar *list_uri; gchar *tree_uri; - reader = E_MAIL_READER (mail_shell_view->priv->mail_shell_content->view); - message_list = e_mail_reader_get_message_list (reader); + mail_shell_content = mail_shell_view->priv->mail_shell_content; + mail_view = e_mail_shell_content_get_mail_view (mail_shell_content); mail_shell_sidebar = mail_shell_view->priv->mail_shell_sidebar; folder_tree = e_mail_shell_sidebar_get_folder_tree (mail_shell_sidebar); + reader = E_MAIL_READER (mail_view); + message_list = e_mail_reader_get_message_list (reader); + /* Don't use e_mail_reader_get_folder_uri() here. The fact that * the method gets the folder URI from the message list is supposed * to be a hidden implementation detail, and we want to explicitly @@ -223,17 +237,22 @@ mail_shell_view_popup_event_cb (EMailShellView *mail_shell_view, GdkEventButton *event, const gchar *uri) { + EMailShellContent *mail_shell_content; EShellView *shell_view; EMailReader *reader; + EMailView *mail_view; GtkMenu *menu; if (uri != NULL) return FALSE; - shell_view = E_SHELL_VIEW (mail_shell_view); - reader = E_MAIL_READER (mail_shell_view->priv->mail_shell_content->view); + mail_shell_content = mail_shell_view->priv->mail_shell_content; + mail_view = e_mail_shell_content_get_mail_view (mail_shell_content); + + reader = E_MAIL_READER (mail_view); menu = e_mail_reader_get_popup_menu (reader); + shell_view = E_SHELL_VIEW (mail_shell_view); e_shell_view_update_actions (shell_view); if (event == NULL) @@ -259,7 +278,9 @@ mail_shell_view_scroll_cb (EMailShellView *mail_shell_view, EShellView *shell_view; EShellWindow *shell_window; EShellSettings *shell_settings; + EMailShellContent *mail_shell_content; EMailReader *reader; + EMailView *mail_view; EWebView *web_view; GtkWidget *message_list; gboolean magic_spacebar; @@ -283,7 +304,10 @@ mail_shell_view_scroll_cb (EMailShellView *mail_shell_view, if (!magic_spacebar) return; - reader = E_MAIL_READER (mail_shell_view->priv->mail_shell_content->view); + mail_shell_content = mail_shell_view->priv->mail_shell_content; + mail_view = e_mail_shell_content_get_mail_view (mail_shell_content); + + reader = E_MAIL_READER (mail_view); message_list = e_mail_reader_get_message_list (reader); if (scroll_type == GTK_SCROLL_PAGE_FORWARD) @@ -372,17 +396,22 @@ static void mail_shell_view_prepare_for_quit_cb (EMailShellView *mail_shell_view, EActivity *activity) { + EMailShellContent *mail_shell_content; CamelFolder *folder; EMailReader *reader; + EMailView *mail_view; GtkWidget *message_list; /* If we got here, it means the application is shutting down * and this is the last EMailShellView instance. Synchronize * the currently selected folder before we terminate. */ - reader = E_MAIL_READER (mail_shell_view->priv->mail_shell_content->view); - message_list = e_mail_reader_get_message_list (reader); + mail_shell_content = mail_shell_view->priv->mail_shell_content; + mail_view = e_mail_shell_content_get_mail_view (mail_shell_content); + + reader = E_MAIL_READER (mail_view); folder = e_mail_reader_get_folder (reader); + message_list = e_mail_reader_get_message_list (reader); message_list_save_state (MESSAGE_LIST (message_list)); @@ -427,10 +456,13 @@ mail_shell_view_notify_view_id_cb (EMailShellView *mail_shell_view) { EMailShellContent *mail_shell_content; GalViewInstance *view_instance; + EMailView *mail_view; const gchar *view_id; mail_shell_content = mail_shell_view->priv->mail_shell_content; - view_instance = e_mail_shell_content_get_view_instance (mail_shell_content); + mail_view = e_mail_shell_content_get_mail_view (mail_shell_content); + + view_instance = e_mail_view_get_view_instance (mail_view); view_id = e_shell_view_get_view_id (E_SHELL_VIEW (mail_shell_view)); /* A NULL view ID implies we're in a custom view. But you can @@ -481,6 +513,7 @@ e_mail_shell_view_private_constructed (EMailShellView *mail_shell_view) GtkUIManager *ui_manager; GtkWidget *message_list; EMailReader *reader; + EMailView *mail_view; EWebView *web_view; const gchar *source; guint merge_id; @@ -513,19 +546,21 @@ e_mail_shell_view_private_constructed (EMailShellView *mail_shell_view) priv->mail_shell_content = g_object_ref (shell_content); priv->mail_shell_sidebar = g_object_ref (shell_sidebar); - reader = E_MAIL_READER (E_MAIL_SHELL_CONTENT(shell_content)->view); - formatter = e_mail_reader_get_formatter (reader); - message_list = e_mail_reader_get_message_list (reader); - mail_shell_sidebar = E_MAIL_SHELL_SIDEBAR (shell_sidebar); folder_tree = e_mail_shell_sidebar_get_folder_tree (mail_shell_sidebar); - em_folder_tree_set_selectable_widget (folder_tree, message_list); selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (folder_tree)); mail_shell_content = E_MAIL_SHELL_CONTENT (shell_content); + mail_view = e_mail_shell_content_get_mail_view (mail_shell_content); searchbar = e_mail_shell_content_get_searchbar (mail_shell_content); combo_box = e_shell_searchbar_get_scope_combo_box (searchbar); + reader = E_MAIL_READER (shell_content); + formatter = e_mail_reader_get_formatter (reader); + message_list = e_mail_reader_get_message_list (reader); + + em_folder_tree_set_selectable_widget (folder_tree, message_list); + /* The folder tree and scope combo box are both insensitive * when searching beyond the currently selected folder. */ e_mutual_binding_new ( @@ -571,8 +606,8 @@ e_mail_shell_view_private_constructed (EMailShellView *mail_shell_view) g_signal_connect_object ( reader, "folder-loaded", - G_CALLBACK (e_mail_shell_content_update_view_instance), - shell_content, G_CONNECT_SWAPPED); + G_CALLBACK (e_mail_view_update_view_instance), + mail_view, G_CONNECT_SWAPPED); /* Use the same callback as "changed". */ g_signal_connect_object ( @@ -634,6 +669,11 @@ e_mail_shell_view_private_constructed (EMailShellView *mail_shell_view) e_mail_shell_view_actions_init (mail_shell_view); e_mail_shell_view_update_search_filter (mail_shell_view); + /* This binding must come after e_mail_reader_init(). */ + e_mutual_binding_new ( + shell_content, "group-by-threads", + mail_view, "group-by-threads"); + /* Populate built-in rules for search entry popup menu. * Keep the assertions, please. If the conditions aren't * met we're going to crash anyway, just more mysteriously. */ @@ -707,6 +747,7 @@ e_mail_shell_view_restore_state (EMailShellView *mail_shell_view) EMailShellContent *mail_shell_content; EShellSearchbar *searchbar; EMailReader *reader; + EMailView *mail_view; CamelFolder *folder; CamelVeeFolder *vee_folder; const gchar *old_state_group; @@ -718,9 +759,10 @@ e_mail_shell_view_restore_state (EMailShellView *mail_shell_view) g_return_if_fail (E_IS_MAIL_SHELL_VIEW (mail_shell_view)); mail_shell_content = mail_shell_view->priv->mail_shell_content; + mail_view = e_mail_shell_content_get_mail_view (mail_shell_content); searchbar = e_mail_shell_content_get_searchbar (mail_shell_content); - reader = E_MAIL_READER (mail_shell_content->view); + reader = E_MAIL_READER (mail_view); folder = e_mail_reader_get_folder (reader); folder_uri = e_mail_reader_get_folder_uri (reader); @@ -774,7 +816,9 @@ void e_mail_shell_view_create_filter_from_selected (EMailShellView *mail_shell_view, gint filter_type) { + EMailShellContent *mail_shell_content; EMailReader *reader; + EMailView *mail_view; CamelFolder *folder; const gchar *filter_source; const gchar *folder_uri; @@ -787,7 +831,10 @@ e_mail_shell_view_create_filter_from_selected (EMailShellView *mail_shell_view, g_return_if_fail (E_IS_MAIL_SHELL_VIEW (mail_shell_view)); - reader = E_MAIL_READER (mail_shell_view->priv->mail_shell_content->view); + mail_shell_content = mail_shell_view->priv->mail_shell_content; + mail_view = e_mail_shell_content_get_mail_view (mail_shell_content); + + reader = E_MAIL_READER (mail_view); folder = e_mail_reader_get_folder (reader); folder_uri = e_mail_reader_get_folder_uri (reader); uids = e_mail_reader_get_selected_uids (reader); @@ -837,7 +884,9 @@ void e_mail_shell_view_create_vfolder_from_selected (EMailShellView *mail_shell_view, gint vfolder_type) { + EMailShellContent *mail_shell_content; EMailReader *reader; + EMailView *mail_view; CamelFolder *folder; const gchar *folder_uri; GPtrArray *uids; @@ -849,7 +898,10 @@ e_mail_shell_view_create_vfolder_from_selected (EMailShellView *mail_shell_view, g_return_if_fail (E_IS_MAIL_SHELL_VIEW (mail_shell_view)); - reader = E_MAIL_READER (mail_shell_view->priv->mail_shell_content->view); + mail_shell_content = mail_shell_view->priv->mail_shell_content; + mail_view = e_mail_shell_content_get_mail_view (mail_shell_content); + + reader = E_MAIL_READER (mail_view); folder = e_mail_reader_get_folder (reader); folder_uri = e_mail_reader_get_folder_uri (reader); uids = e_mail_reader_get_selected_uids (reader); @@ -875,6 +927,7 @@ e_mail_shell_view_update_sidebar (EMailShellView *mail_shell_view) EShellSidebar *shell_sidebar; EShellView *shell_view; EMailReader *reader; + EMailView *mail_view; CamelStore *local_store; CamelStore *parent_store; CamelFolder *folder; @@ -893,11 +946,12 @@ e_mail_shell_view_update_sidebar (EMailShellView *mail_shell_view) g_return_if_fail (E_IS_MAIL_SHELL_VIEW (mail_shell_view)); mail_shell_content = mail_shell_view->priv->mail_shell_content; + mail_view = e_mail_shell_content_get_mail_view (mail_shell_content); shell_view = E_SHELL_VIEW (mail_shell_view); shell_sidebar = e_shell_view_get_shell_sidebar (shell_view); - reader = E_MAIL_READER (mail_shell_content->view); + reader = E_MAIL_READER (mail_view); folder = e_mail_reader_get_folder (reader); folder_uri = e_mail_reader_get_folder_uri (reader); diff --git a/modules/mail/e-mail-shell-view.c b/modules/mail/e-mail-shell-view.c index 12e0c0b0f1..18db5e2373 100644 --- a/modules/mail/e-mail-shell-view.c +++ b/modules/mail/e-mail-shell-view.c @@ -119,10 +119,15 @@ mail_shell_view_show_search_results_folder (EMailShellView *mail_shell_view, CamelFolder *folder, const gchar *folder_uri) { + EMailShellContent *mail_shell_content; GtkWidget *message_list; + EMailView *mail_view; EMailReader *reader; - reader = E_MAIL_READER (mail_shell_view->priv->mail_shell_content->view); + mail_shell_content = mail_shell_view->priv->mail_shell_content; + mail_view = e_mail_shell_content_get_mail_view (mail_shell_content); + reader = E_MAIL_READER (mail_view); + message_list = e_mail_reader_get_message_list (reader); message_list_freeze (MESSAGE_LIST (message_list)); @@ -177,10 +182,14 @@ mail_shell_view_toggled (EShellView *shell_view) basename = E_MAIL_READER_UI_DEFINITION; if (view_is_active && priv->merge_id == 0) { + EMailView *mail_view; + priv->merge_id = e_ui_manager_add_ui_from_file ( E_UI_MANAGER (ui_manager), basename); + mail_view = e_mail_shell_content_get_mail_view ( + priv->mail_shell_content); e_mail_reader_create_charset_menu ( - E_MAIL_READER (priv->mail_shell_content->view), + E_MAIL_READER (mail_view), ui_manager, priv->merge_id); } else if (!view_is_active && priv->merge_id != 0) { gtk_ui_manager_remove_ui (ui_manager, priv->merge_id); @@ -210,6 +219,7 @@ mail_shell_view_execute_search (EShellView *shell_view) GtkWidget *message_list; EFilterRule *rule; EMailReader *reader; + EMailView *mail_view; CamelVeeFolder *search_folder; CamelFolder *folder; CamelStore *store; @@ -242,13 +252,14 @@ mail_shell_view_execute_search (EShellView *shell_view) shell_settings = e_shell_get_shell_settings (shell); mail_shell_content = E_MAIL_SHELL_CONTENT (shell_content); + mail_view = e_mail_shell_content_get_mail_view (mail_shell_content); searchbar = e_mail_shell_content_get_searchbar (mail_shell_content); mail_shell_sidebar = E_MAIL_SHELL_SIDEBAR (shell_sidebar); folder_tree = e_mail_shell_sidebar_get_folder_tree (mail_shell_sidebar); selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (folder_tree)); - reader = E_MAIL_READER (E_MAIL_SHELL_CONTENT (shell_content)->view); + reader = E_MAIL_READER (mail_view); folder = e_mail_reader_get_folder (reader); folder_uri = e_mail_reader_get_folder_uri (reader); message_list = e_mail_reader_get_message_list (reader); @@ -698,8 +709,7 @@ execute: message_list_set_search (MESSAGE_LIST (message_list), query); - e_mail_shell_content_set_search_strings ( - mail_shell_content, search_strings); + e_mail_view_set_search_strings (mail_view, search_strings); g_slist_foreach (search_strings, (GFunc) g_free, NULL); g_slist_free (search_strings); @@ -769,6 +779,7 @@ mail_shell_view_update_actions (EShellView *shell_view) EShellWindow *shell_window; EMFolderTree *folder_tree; EMailReader *reader; + EMailView *mail_view; EAccount *account = NULL; GtkAction *action; const gchar *label; @@ -795,7 +806,9 @@ mail_shell_view_update_actions (EShellView *shell_view) shell_window = e_shell_view_get_shell_window (shell_view); mail_shell_content = mail_shell_view->priv->mail_shell_content; - reader = E_MAIL_READER (mail_shell_content->view); + mail_view = e_mail_shell_content_get_mail_view (mail_shell_content); + + reader = E_MAIL_READER (mail_view); state = e_mail_reader_check_state (reader); e_mail_reader_update_actions (reader, state); |