diff options
-rw-r--r-- | mail/e-mail-browser.c | 32 | ||||
-rw-r--r-- | mail/e-mail-notebook-view.c | 36 | ||||
-rw-r--r-- | mail/e-mail-paned-view.c | 51 | ||||
-rw-r--r-- | mail/e-mail-paned-view.h | 1 | ||||
-rw-r--r-- | mail/e-mail-reader.c | 23 | ||||
-rw-r--r-- | mail/e-mail-reader.h | 3 | ||||
-rw-r--r-- | modules/mail/e-mail-shell-content.c | 105 |
7 files changed, 135 insertions, 116 deletions
diff --git a/mail/e-mail-browser.c b/mail/e-mail-browser.c index 29ddf3df09..dbc2500713 100644 --- a/mail/e-mail-browser.c +++ b/mail/e-mail-browser.c @@ -64,7 +64,7 @@ struct _EMailBrowserPrivate { GtkWidget *main_toolbar; GtkWidget *message_list; GtkWidget *alert_bar; - GtkWidget *search_bar; + GtkWidget *preview_pane; GtkWidget *statusbar; guint show_deleted : 1; @@ -529,9 +529,9 @@ mail_browser_dispose (GObject *object) priv->alert_bar = NULL; } - if (priv->search_bar != NULL) { - g_object_unref (priv->search_bar); - priv->search_bar = NULL; + if (priv->preview_pane != NULL) { + g_object_unref (priv->preview_pane); + priv->preview_pane = NULL; } if (priv->statusbar != NULL) { @@ -705,10 +705,10 @@ mail_browser_constructed (GObject *object) widget = e_preview_pane_new (web_view); gtk_box_pack_start (GTK_BOX (container), widget, TRUE, TRUE, 0); + browser->priv->preview_pane = g_object_ref (widget); gtk_widget_show (widget); search_bar = e_preview_pane_get_search_bar (E_PREVIEW_PANE (widget)); - browser->priv->search_bar = g_object_ref (search_bar); g_signal_connect_swapped ( search_bar, "changed", @@ -854,6 +854,16 @@ mail_browser_get_popup_menu (EMailReader *reader) return GTK_MENU (widget); } +static EPreviewPane * +mail_browser_get_preview_pane (EMailReader *reader) +{ + EMailBrowser *browser; + + browser = E_MAIL_BROWSER (reader); + + return E_PREVIEW_PANE (browser->priv->preview_pane); +} + static GtkWindow * mail_browser_get_window (EMailReader *reader) { @@ -889,16 +899,6 @@ mail_browser_set_message (EMailReader *reader, } static void -mail_browser_show_search_bar (EMailReader *reader) -{ - EMailBrowser *browser; - - browser = E_MAIL_BROWSER (reader); - - gtk_widget_show (browser->priv->search_bar); -} - -static void e_mail_browser_class_init (EMailBrowserClass *class) { GObjectClass *object_class; @@ -982,9 +982,9 @@ e_mail_browser_reader_init (EMailReaderInterface *interface) interface->get_hide_deleted = mail_browser_get_hide_deleted; interface->get_message_list = mail_browser_get_message_list; interface->get_popup_menu = mail_browser_get_popup_menu; + interface->get_preview_pane = mail_browser_get_preview_pane; interface->get_window = mail_browser_get_window; interface->set_message = mail_browser_set_message; - interface->show_search_bar = mail_browser_show_search_bar; } static void diff --git a/mail/e-mail-notebook-view.c b/mail/e-mail-notebook-view.c index 2e515f7315..0232b92423 100644 --- a/mail/e-mail-notebook-view.c +++ b/mail/e-mail-notebook-view.c @@ -968,6 +968,23 @@ mail_notebook_view_get_popup_menu (EMailReader *reader) return e_mail_reader_get_popup_menu (reader); } +static EPreviewPane * +mail_notebook_view_get_preview_pane (EMailReader *reader) +{ + EMailNotebookView *notebook_view; + EMailView *current_view; + + notebook_view = E_MAIL_NOTEBOOK_VIEW (reader); + current_view = notebook_view->priv->current_view; + + if (current_view == NULL) + return NULL; + + reader = E_MAIL_READER (current_view); + + return e_mail_reader_get_preview_pane (reader); +} + static GtkWindow * mail_notebook_view_get_window (EMailReader *reader) { @@ -1351,23 +1368,6 @@ mail_notebook_view_set_folder (EMailReader *reader, } } -static void -mail_notebook_view_show_search_bar (EMailReader *reader) -{ - EMailNotebookView *notebook_view; - EMailView *current_view; - - notebook_view = E_MAIL_NOTEBOOK_VIEW (reader); - current_view = notebook_view->priv->current_view; - - if (current_view == NULL) - return; - - reader = E_MAIL_READER (current_view); - - e_mail_reader_show_search_bar (reader); -} - static gboolean mail_notebook_view_enable_show_folder (EMailReader *reader) { @@ -1455,9 +1455,9 @@ e_mail_notebook_view_reader_init (EMailReaderInterface *interface) interface->get_hide_deleted = mail_notebook_view_get_hide_deleted; interface->get_message_list = mail_notebook_view_get_message_list; interface->get_popup_menu = mail_notebook_view_get_popup_menu; + interface->get_preview_pane = mail_notebook_view_get_preview_pane; interface->get_window = mail_notebook_view_get_window; interface->set_folder = mail_notebook_view_set_folder; - interface->show_search_bar = mail_notebook_view_show_search_bar; interface->open_selected_mail = mail_notebook_view_open_selected_mail; interface->enable_show_folder = mail_notebook_view_enable_show_folder; } diff --git a/mail/e-mail-paned-view.c b/mail/e-mail-paned-view.c index 542a15d420..d1811394de 100644 --- a/mail/e-mail-paned-view.c +++ b/mail/e-mail-paned-view.c @@ -57,8 +57,7 @@ struct _EMailPanedViewPrivate { GtkWidget *paned; GtkWidget *scrolled_window; GtkWidget *message_list; - GtkWidget *search_bar; - GtkWidget *preview; + GtkWidget *preview_pane; EMFormatHTMLDisplay *formatter; GalViewInstance *view_instance; @@ -348,9 +347,9 @@ mail_paned_view_dispose (GObject *object) priv->message_list = NULL; } - if (priv->search_bar != NULL) { - g_object_unref (priv->search_bar); - priv->search_bar = NULL; + if (priv->preview_pane != NULL) { + g_object_unref (priv->preview_pane); + priv->preview_pane = NULL; } if (priv->formatter != NULL) { @@ -467,6 +466,16 @@ mail_paned_view_get_popup_menu (EMailReader *reader) return GTK_MENU (widget); } +static EPreviewPane * +mail_paned_view_get_preview_pane (EMailReader *reader) +{ + EMailPanedView *paned_view; + + paned_view = E_MAIL_PANED_VIEW (reader); + + return E_PREVIEW_PANE (paned_view->priv->preview_pane); +} + static GtkWindow * mail_paned_view_get_window (EMailReader *reader) { @@ -574,16 +583,6 @@ exit: message_list_thaw (MESSAGE_LIST (message_list)); } -static void -mail_paned_view_show_search_bar (EMailReader *reader) -{ - EMailPanedView *paned_view; - - paned_view = E_MAIL_PANED_VIEW (reader); - - gtk_widget_show (paned_view->priv->search_bar); -} - static guint mail_paned_view_reader_open_selected_mail (EMailReader *reader) { @@ -685,8 +684,8 @@ mail_paned_view_constructed (GObject *object) gtk_widget_show (GTK_WIDGET (web_view)); widget = e_preview_pane_new (web_view); - priv->preview = widget; gtk_paned_pack2 (GTK_PANED (container), widget, FALSE, FALSE); + priv->preview_pane = g_object_ref (widget); gtk_widget_show (widget); g_object_bind_property ( @@ -695,7 +694,6 @@ mail_paned_view_constructed (GObject *object) G_BINDING_SYNC_CREATE); search_bar = e_preview_pane_get_search_bar (E_PREVIEW_PANE (widget)); - priv->search_bar = g_object_ref (search_bar); g_signal_connect_swapped ( search_bar, "changed", @@ -740,13 +738,14 @@ static void mail_paned_view_set_search_strings (EMailView *view, GSList *search_strings) { - EMailPanedView *paned_view; + EMailReader *reader; + EPreviewPane *preview_pane; ESearchBar *search_bar; ESearchingTokenizer *tokenizer; - paned_view = E_MAIL_PANED_VIEW (view); - - search_bar = E_SEARCH_BAR (paned_view->priv->search_bar); + reader = E_MAIL_READER (view); + preview_pane = e_mail_reader_get_preview_pane (reader); + search_bar = e_preview_pane_get_search_bar (preview_pane); tokenizer = e_search_bar_get_tokenizer (search_bar); e_searching_tokenizer_set_secondary_case_sensitivity (tokenizer, FALSE); @@ -1015,9 +1014,9 @@ e_mail_paned_view_reader_init (EMailReaderInterface *interface) interface->get_hide_deleted = mail_paned_view_get_hide_deleted; interface->get_message_list = mail_paned_view_get_message_list; interface->get_popup_menu = mail_paned_view_get_popup_menu; + interface->get_preview_pane = mail_paned_view_get_preview_pane; interface->get_window = mail_paned_view_get_window; interface->set_folder = mail_paned_view_set_folder; - interface->show_search_bar = mail_paned_view_show_search_bar; interface->open_selected_mail = mail_paned_view_reader_open_selected_mail; interface->enable_show_folder = mail_paned_view_enable_show_folder; } @@ -1056,14 +1055,6 @@ e_mail_paned_view_hide_message_list_pane (EMailPanedView *view, gtk_widget_hide (view->priv->scrolled_window); } -GtkWidget * -e_mail_paned_view_get_preview (EMailPanedView *view) -{ - g_return_val_if_fail (E_IS_MAIL_PANED_VIEW (view), NULL); - - return view->priv->preview; -} - void e_mail_paned_view_set_enable_show_folder (EMailPanedView *view, gboolean set) diff --git a/mail/e-mail-paned-view.h b/mail/e-mail-paned-view.h index 5e6879ae94..3226b394f1 100644 --- a/mail/e-mail-paned-view.h +++ b/mail/e-mail-paned-view.h @@ -71,7 +71,6 @@ GtkWidget * e_mail_paned_view_new (EShellView *shell_view); void e_mail_paned_view_hide_message_list_pane (EMailPanedView *view, gboolean visible); -GtkWidget * e_mail_paned_view_get_preview (EMailPanedView *view); void e_mail_paned_view_set_enable_show_folder (EMailPanedView *view, gboolean set); diff --git a/mail/e-mail-reader.c b/mail/e-mail-reader.c index 38cef30889..7e475014a9 100644 --- a/mail/e-mail-reader.c +++ b/mail/e-mail-reader.c @@ -2961,6 +2961,15 @@ mail_reader_message_seen (EMailReader *reader, } static void +mail_reader_show_search_bar (EMailReader *reader) +{ + EPreviewPane *preview_pane; + + preview_pane = e_mail_reader_get_preview_pane (reader); + e_preview_pane_show_search_bar (preview_pane); +} + +static void mail_reader_update_actions (EMailReader *reader, guint32 state) { @@ -3395,6 +3404,7 @@ e_mail_reader_default_init (EMailReaderInterface *interface) interface->folder_loaded = mail_reader_folder_loaded; interface->message_loaded = mail_reader_message_loaded; interface->message_seen = mail_reader_message_seen; + interface->show_search_bar = mail_reader_show_search_bar; interface->update_actions = mail_reader_update_actions; g_object_interface_install_property ( @@ -4122,6 +4132,19 @@ e_mail_reader_get_popup_menu (EMailReader *reader) return interface->get_popup_menu (reader); } +EPreviewPane * +e_mail_reader_get_preview_pane (EMailReader *reader) +{ + EMailReaderInterface *interface; + + g_return_val_if_fail (E_IS_MAIL_READER (reader), NULL); + + interface = E_MAIL_READER_GET_INTERFACE (reader); + g_return_val_if_fail (interface->get_preview_pane != NULL, NULL); + + return interface->get_preview_pane (reader); +} + GPtrArray * e_mail_reader_get_selected_uids (EMailReader *reader) { diff --git a/mail/e-mail-reader.h b/mail/e-mail-reader.h index 696bca65c3..9e362631cc 100644 --- a/mail/e-mail-reader.h +++ b/mail/e-mail-reader.h @@ -32,6 +32,7 @@ #include <e-util/e-alert-sink.h> #include <mail/e-mail-backend.h> #include <mail/em-format-html.h> +#include <misc/e-preview-pane.h> /* Standard GObject macros */ #define E_TYPE_MAIL_READER \ @@ -99,6 +100,7 @@ struct _EMailReaderInterface { gboolean (*get_hide_deleted) (EMailReader *reader); GtkWidget * (*get_message_list) (EMailReader *reader); GtkMenu * (*get_popup_menu) (EMailReader *reader); + EPreviewPane * (*get_preview_pane) (EMailReader *reader); GPtrArray * (*get_selected_uids) (EMailReader *reader); GtkWindow * (*get_window) (EMailReader *reader); @@ -145,6 +147,7 @@ GtkWidget * e_mail_reader_get_message_list (EMailReader *reader); guint e_mail_reader_open_selected_mail (EMailReader *reader); GtkMenu * e_mail_reader_get_popup_menu (EMailReader *reader); +EPreviewPane * e_mail_reader_get_preview_pane (EMailReader *reader); GPtrArray * e_mail_reader_get_selected_uids (EMailReader *reader); GtkWindow * e_mail_reader_get_window (EMailReader *reader); CamelFolder * e_mail_reader_get_folder (EMailReader *reader); diff --git a/modules/mail/e-mail-shell-content.c b/modules/mail/e-mail-shell-content.c index 7918930736..ed94b45af3 100644 --- a/modules/mail/e-mail-shell-content.c +++ b/modules/mail/e-mail-shell-content.c @@ -46,6 +46,10 @@ #include "e-mail-shell-backend.h" #include "e-mail-shell-view-actions.h" +#define E_MAIL_SHELL_CONTENT_GET_PRIVATE(obj) \ + (G_TYPE_INSTANCE_GET_PRIVATE \ + ((obj), E_TYPE_MAIL_SHELL_CONTENT, EMailShellContentPrivate)) + struct _EMailShellContentPrivate { EMailView *mail_view; }; @@ -153,7 +157,7 @@ mail_shell_content_dispose (GObject *object) { EMailShellContentPrivate *priv; - priv = E_MAIL_SHELL_CONTENT (object)->priv; + priv = E_MAIL_SHELL_CONTENT_GET_PRIVATE (object); if (priv->mail_view != NULL) { g_object_unref (priv->mail_view); @@ -173,7 +177,7 @@ mail_shell_content_constructed (GObject *object) GtkWidget *container; GtkWidget *widget; - priv = E_MAIL_SHELL_CONTENT (object)->priv; + priv = E_MAIL_SHELL_CONTENT_GET_PRIVATE (object); /* Chain up to parent's constructed () method. */ G_OBJECT_CLASS (parent_class)->constructed (object); @@ -209,14 +213,14 @@ mail_shell_content_constructed (GObject *object) static guint32 mail_shell_content_check_state (EShellContent *shell_content) { - EMailShellContentPrivate *priv; + EMailShellContent *mail_shell_content; EMailReader *reader; - priv = E_MAIL_SHELL_CONTENT (shell_content)->priv; + mail_shell_content = E_MAIL_SHELL_CONTENT (shell_content); /* Forward this to our internal EMailView, which * also implements the EMailReader interface. */ - reader = E_MAIL_READER (priv->mail_view); + reader = E_MAIL_READER (mail_shell_content->priv->mail_view); return e_mail_reader_check_state (reader); } @@ -224,13 +228,13 @@ mail_shell_content_check_state (EShellContent *shell_content) static void mail_shell_content_focus_search_results (EShellContent *shell_content) { - EMailShellContentPrivate *priv; + EMailShellContent *mail_shell_content; GtkWidget *message_list; EMailReader *reader; - priv = E_MAIL_SHELL_CONTENT (shell_content)->priv; + mail_shell_content = E_MAIL_SHELL_CONTENT (shell_content); - reader = E_MAIL_READER (priv->mail_view); + reader = E_MAIL_READER (mail_shell_content->priv->mail_view); message_list = e_mail_reader_get_message_list (reader); gtk_widget_grab_focus (message_list); @@ -239,13 +243,13 @@ mail_shell_content_focus_search_results (EShellContent *shell_content) static guint mail_shell_content_open_selected_mail (EMailReader *reader) { - EMailShellContentPrivate *priv; + EMailShellContent *mail_shell_content; - priv = E_MAIL_SHELL_CONTENT (reader)->priv; + mail_shell_content = E_MAIL_SHELL_CONTENT (reader); /* Forward this to our internal EMailView, which * also implements the EMailReader interface. */ - reader = E_MAIL_READER (priv->mail_view); + reader = E_MAIL_READER (mail_shell_content->priv->mail_view); return e_mail_reader_open_selected_mail (reader); } @@ -280,13 +284,13 @@ mail_shell_content_get_action_group (EMailReader *reader, static EAlertSink * mail_shell_content_get_alert_sink (EMailReader *reader) { - EMailShellContentPrivate *priv; + EMailShellContent *mail_shell_content; - priv = E_MAIL_SHELL_CONTENT (reader)->priv; + mail_shell_content = E_MAIL_SHELL_CONTENT (reader); /* Forward this to our internal EMailView, which * also implements the EMailReader interface. */ - reader = E_MAIL_READER (priv->mail_view); + reader = E_MAIL_READER (mail_shell_content->priv->mail_view); return e_mail_reader_get_alert_sink (reader); } @@ -294,13 +298,13 @@ mail_shell_content_get_alert_sink (EMailReader *reader) static EMailBackend * mail_shell_content_get_backend (EMailReader *reader) { - EMailShellContentPrivate *priv; + EMailShellContent *mail_shell_content; - priv = E_MAIL_SHELL_CONTENT (reader)->priv; + mail_shell_content = E_MAIL_SHELL_CONTENT (reader); /* Forward this to our internal EMailView, which * also implements the EMailReader interface. */ - reader = E_MAIL_READER (priv->mail_view); + reader = E_MAIL_READER (mail_shell_content->priv->mail_view); return e_mail_reader_get_backend (reader); } @@ -308,13 +312,13 @@ mail_shell_content_get_backend (EMailReader *reader) static EMFormatHTML * mail_shell_content_get_formatter (EMailReader *reader) { - EMailShellContentPrivate *priv; + EMailShellContent *mail_shell_content; - priv = E_MAIL_SHELL_CONTENT (reader)->priv; + mail_shell_content = E_MAIL_SHELL_CONTENT (reader); /* Forward this to our internal EMailView, which * also implements the EMailReader interface. */ - reader = E_MAIL_READER (priv->mail_view); + reader = E_MAIL_READER (mail_shell_content->priv->mail_view); return e_mail_reader_get_formatter (reader); } @@ -322,13 +326,13 @@ mail_shell_content_get_formatter (EMailReader *reader) static gboolean mail_shell_content_get_hide_deleted (EMailReader *reader) { - EMailShellContentPrivate *priv; + EMailShellContent *mail_shell_content; - priv = E_MAIL_SHELL_CONTENT (reader)->priv; + mail_shell_content = E_MAIL_SHELL_CONTENT (reader); /* Forward this to our internal EMailView, which * also implements the EMailReader interface. */ - reader = E_MAIL_READER (priv->mail_view); + reader = E_MAIL_READER (mail_shell_content->priv->mail_view); return e_mail_reader_get_hide_deleted (reader); } @@ -336,13 +340,13 @@ mail_shell_content_get_hide_deleted (EMailReader *reader) static GtkWidget * mail_shell_content_get_message_list (EMailReader *reader) { - EMailShellContentPrivate *priv; + EMailShellContent *mail_shell_content; - priv = E_MAIL_SHELL_CONTENT (reader)->priv; + mail_shell_content = E_MAIL_SHELL_CONTENT (reader); /* Forward this to our internal EMailView, which * also implements the EMailReader interface. */ - reader = E_MAIL_READER (priv->mail_view); + reader = E_MAIL_READER (mail_shell_content->priv->mail_view); return e_mail_reader_get_message_list (reader); } @@ -350,58 +354,58 @@ mail_shell_content_get_message_list (EMailReader *reader) static GtkMenu * mail_shell_content_get_popup_menu (EMailReader *reader) { - EMailShellContentPrivate *priv; + EMailShellContent *mail_shell_content; - priv = E_MAIL_SHELL_CONTENT (reader)->priv; + mail_shell_content = E_MAIL_SHELL_CONTENT (reader); /* Forward this to our internal EMailView, which * also implements the EMailReader interface. */ - reader = E_MAIL_READER (priv->mail_view); + reader = E_MAIL_READER (mail_shell_content->priv->mail_view); return e_mail_reader_get_popup_menu (reader); } -static GtkWindow * -mail_shell_content_get_window (EMailReader *reader) +static EPreviewPane * +mail_shell_content_get_preview_pane (EMailReader *reader) { - EMailShellContentPrivate *priv; + EMailShellContent *mail_shell_content; - priv = E_MAIL_SHELL_CONTENT (reader)->priv; + mail_shell_content = E_MAIL_SHELL_CONTENT (reader); /* Forward this to our internal EMailView, which * also implements the EMailReader interface. */ - reader = E_MAIL_READER (priv->mail_view); + reader = E_MAIL_READER (mail_shell_content->priv->mail_view); - return e_mail_reader_get_window (reader); + return e_mail_reader_get_preview_pane (reader); } -static void -mail_shell_content_set_folder (EMailReader *reader, - CamelFolder *folder) +static GtkWindow * +mail_shell_content_get_window (EMailReader *reader) { - EMailShellContentPrivate *priv; + EMailShellContent *mail_shell_content; - priv = E_MAIL_SHELL_CONTENT (reader)->priv; + mail_shell_content = E_MAIL_SHELL_CONTENT (reader); /* Forward this to our internal EMailView, which * also implements the EMailReader interface. */ - reader = E_MAIL_READER (priv->mail_view); + reader = E_MAIL_READER (mail_shell_content->priv->mail_view); - return e_mail_reader_set_folder (reader, folder); + return e_mail_reader_get_window (reader); } static void -mail_shell_content_show_search_bar (EMailReader *reader) +mail_shell_content_set_folder (EMailReader *reader, + CamelFolder *folder) { - EMailShellContentPrivate *priv; + EMailShellContent *mail_shell_content; - priv = E_MAIL_SHELL_CONTENT (reader)->priv; + mail_shell_content = E_MAIL_SHELL_CONTENT (reader); /* Forward this to our internal EMailView, which * also implements the EMailReader interface. */ - reader = E_MAIL_READER (priv->mail_view); + reader = E_MAIL_READER (mail_shell_content->priv->mail_view); - e_mail_reader_show_search_bar (reader); + return e_mail_reader_set_folder (reader, folder); } static void @@ -456,9 +460,8 @@ mail_shell_content_class_init (EMailShellContentClass *class) static void mail_shell_content_init (EMailShellContent *mail_shell_content) { - mail_shell_content->priv = G_TYPE_INSTANCE_GET_PRIVATE ( - mail_shell_content, E_TYPE_MAIL_SHELL_CONTENT, - EMailShellContentPrivate); + mail_shell_content->priv = + E_MAIL_SHELL_CONTENT_GET_PRIVATE (mail_shell_content); /* Postpone widget construction until we have a shell view. */ } @@ -479,9 +482,9 @@ mail_shell_content_reader_init (EMailReaderInterface *interface) interface->get_hide_deleted = mail_shell_content_get_hide_deleted; interface->get_message_list = mail_shell_content_get_message_list; interface->get_popup_menu = mail_shell_content_get_popup_menu; + interface->get_preview_pane = mail_shell_content_get_preview_pane; interface->get_window = mail_shell_content_get_window; interface->set_folder = mail_shell_content_set_folder; - interface->show_search_bar = mail_shell_content_show_search_bar; interface->open_selected_mail = mail_shell_content_open_selected_mail; } |