diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2011-11-22 02:20:08 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2011-11-22 13:12:36 +0800 |
commit | 2b8701fa2b3925ab94231884e211bbcdada5359f (patch) | |
tree | 95dabbabe0f0cb62a865339d28bf4725cf669852 /mail | |
parent | 451179909849e4e4058180f095e6ae889d97b797 (diff) | |
download | gsoc2013-evolution-2b8701fa2b3925ab94231884e211bbcdada5359f.tar gsoc2013-evolution-2b8701fa2b3925ab94231884e211bbcdada5359f.tar.gz gsoc2013-evolution-2b8701fa2b3925ab94231884e211bbcdada5359f.tar.bz2 gsoc2013-evolution-2b8701fa2b3925ab94231884e211bbcdada5359f.tar.lz gsoc2013-evolution-2b8701fa2b3925ab94231884e211bbcdada5359f.tar.xz gsoc2013-evolution-2b8701fa2b3925ab94231884e211bbcdada5359f.tar.zst gsoc2013-evolution-2b8701fa2b3925ab94231884e211bbcdada5359f.zip |
EPreviewPane: Implement EAlertSink.
Means EMailBrowser no longer has to.
Also, EMailReader now provides a default implementation for
get_alert_sink() which just calls get_preview_pane() and casts.
Diffstat (limited to 'mail')
-rw-r--r-- | mail/e-mail-browser.c | 58 | ||||
-rw-r--r-- | mail/e-mail-reader.c | 11 |
2 files changed, 11 insertions, 58 deletions
diff --git a/mail/e-mail-browser.c b/mail/e-mail-browser.c index dbc2500713..e9c837206f 100644 --- a/mail/e-mail-browser.c +++ b/mail/e-mail-browser.c @@ -30,12 +30,10 @@ #include "e-util/e-util.h" #include "e-util/e-plugin-ui.h" -#include "e-util/e-alert-dialog.h" #include "e-util/gconf-bridge.h" #include "shell/e-shell.h" #include "shell/e-shell-utils.h" #include "shell/e-shell-settings.h" -#include "widgets/misc/e-alert-bar.h" #include "widgets/misc/e-popup-action.h" #include "widgets/misc/e-preview-pane.h" @@ -63,7 +61,6 @@ struct _EMailBrowserPrivate { GtkWidget *main_menu; GtkWidget *main_toolbar; GtkWidget *message_list; - GtkWidget *alert_bar; GtkWidget *preview_pane; GtkWidget *statusbar; @@ -106,8 +103,6 @@ static const gchar *ui = " </menubar>" "</ui>"; -static void e_mail_browser_alert_sink_init - (EAlertSinkInterface *interface); static void e_mail_browser_reader_init (EMailReaderInterface *interface); @@ -116,8 +111,6 @@ G_DEFINE_TYPE_WITH_CODE ( e_mail_browser, GTK_TYPE_WINDOW, G_IMPLEMENT_INTERFACE ( - E_TYPE_ALERT_SINK, e_mail_browser_alert_sink_init) - G_IMPLEMENT_INTERFACE ( E_TYPE_MAIL_READER, e_mail_browser_reader_init) G_IMPLEMENT_INTERFACE ( E_TYPE_EXTENSIBLE, NULL)) @@ -524,11 +517,6 @@ mail_browser_dispose (GObject *object) priv->message_list = NULL; } - if (priv->alert_bar != NULL) { - g_object_unref (priv->alert_bar); - priv->alert_bar = NULL; - } - if (priv->preview_pane != NULL) { g_object_unref (priv->preview_pane); priv->preview_pane = NULL; @@ -696,11 +684,6 @@ mail_browser_constructed (GObject *object) gtk_widget_get_style_context (widget), GTK_STYLE_CLASS_PRIMARY_TOOLBAR); - widget = e_alert_bar_new (); - gtk_box_pack_start (GTK_BOX (container), widget, FALSE, FALSE, 0); - browser->priv->alert_bar = g_object_ref (widget); - /* EAlertBar controls its own visibility. */ - gtk_widget_show (GTK_WIDGET (web_view)); widget = e_preview_pane_new (web_view); @@ -746,34 +729,6 @@ mail_browser_key_press_event (GtkWidget *widget, key_press_event (widget, event); } -static void -mail_browser_submit_alert (EAlertSink *alert_sink, - EAlert *alert) -{ - EMailBrowser *browser; - EAlertBar *alert_bar; - GtkWidget *dialog; - GtkWindow *parent; - - browser = E_MAIL_BROWSER (alert_sink); - alert_bar = E_ALERT_BAR (browser->priv->alert_bar); - - switch (e_alert_get_message_type (alert)) { - case GTK_MESSAGE_INFO: - case GTK_MESSAGE_WARNING: - case GTK_MESSAGE_ERROR: - e_alert_bar_add_alert (alert_bar, alert); - break; - - default: - parent = GTK_WINDOW (alert_sink); - dialog = e_alert_dialog_new (parent, alert); - gtk_dialog_run (GTK_DIALOG (dialog)); - gtk_widget_destroy (dialog); - break; - } -} - static GtkActionGroup * mail_browser_get_action_group (EMailReader *reader, EMailReaderActionGroup group) @@ -794,12 +749,6 @@ mail_browser_get_action_group (EMailReader *reader, return g_object_get_data (G_OBJECT (reader), group_name); } -static EAlertSink * -mail_browser_get_alert_sink (EMailReader *reader) -{ - return E_ALERT_SINK (reader); -} - static EMailBackend * mail_browser_get_backend (EMailReader *reader) { @@ -967,16 +916,9 @@ e_mail_browser_class_init (EMailBrowserClass *class) } static void -e_mail_browser_alert_sink_init (EAlertSinkInterface *interface) -{ - interface->submit_alert = mail_browser_submit_alert; -} - -static void e_mail_browser_reader_init (EMailReaderInterface *interface) { interface->get_action_group = mail_browser_get_action_group; - interface->get_alert_sink = mail_browser_get_alert_sink; interface->get_backend = mail_browser_get_backend; interface->get_formatter = mail_browser_get_formatter; interface->get_hide_deleted = mail_browser_get_hide_deleted; diff --git a/mail/e-mail-reader.c b/mail/e-mail-reader.c index 7e475014a9..b38a2c2220 100644 --- a/mail/e-mail-reader.c +++ b/mail/e-mail-reader.c @@ -2766,6 +2766,16 @@ mail_reader_emit_folder_loaded (EMailReader *reader) g_signal_emit (reader, signals[FOLDER_LOADED], 0); } +static EAlertSink * +mail_reader_get_alert_sink (EMailReader *reader) +{ + EPreviewPane *preview_pane; + + preview_pane = e_mail_reader_get_preview_pane (reader); + + return E_ALERT_SINK (preview_pane); +} + static GPtrArray * mail_reader_get_selected_uids (EMailReader *reader) { @@ -3395,6 +3405,7 @@ e_mail_reader_default_init (EMailReaderInterface *interface) { quark_private = g_quark_from_static_string ("e-mail-reader-private"); + interface->get_alert_sink = mail_reader_get_alert_sink; interface->get_selected_uids = mail_reader_get_selected_uids; interface->get_folder = mail_reader_get_folder; interface->enable_show_folder = mail_reader_get_enable_show_folder; |