diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2011-11-22 01:42:34 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2011-11-22 13:12:36 +0800 |
commit | 5fabd29bd2580bbe479034634b405abfa36bb500 (patch) | |
tree | 1ed5bb5fed2f74e3fd2d831ac84b929d55ab5ca9 /mail | |
parent | f9ffebc2f7a6fb285e686133dcccf17766c2ba79 (diff) | |
download | gsoc2013-evolution-5fabd29bd2580bbe479034634b405abfa36bb500.tar.gz gsoc2013-evolution-5fabd29bd2580bbe479034634b405abfa36bb500.tar.zst gsoc2013-evolution-5fabd29bd2580bbe479034634b405abfa36bb500.zip |
Add EMailReader.get_preview_pane() method.
Also give EMailReader::show-search-bar signal a default implementation,
since it can now dig up the search bar widget itself.
Diffstat (limited to 'mail')
-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 |
6 files changed, 81 insertions, 65 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); |