From 0439c01a9ab20875796c8ecae855627424742bf4 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Sat, 19 Jun 2010 11:39:49 -0400 Subject: Bug 616724 - Initialize message window with threaded state of main window --- mail/e-mail-browser.c | 19 +++++++++++++++++++ mail/e-mail-reader-utils.c | 3 +++ mail/e-mail-reader.c | 47 ++++++++++++++++++++++++++++++++++++++++++++++ mail/e-mail-reader.h | 5 +++++ 4 files changed, 74 insertions(+) (limited to 'mail') diff --git a/mail/e-mail-browser.c b/mail/e-mail-browser.c index e076585755..062623124d 100644 --- a/mail/e-mail-browser.c +++ b/mail/e-mail-browser.c @@ -63,6 +63,7 @@ struct _EMailBrowserPrivate { enum { PROP_0, PROP_FOCUS_TRACKER, + PROP_GROUP_BY_THREADS, PROP_SHELL_BACKEND, PROP_SHOW_DELETED, PROP_UI_MANAGER @@ -348,6 +349,12 @@ mail_browser_set_property (GObject *object, 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; + case PROP_SHELL_BACKEND: mail_browser_set_shell_backend ( E_MAIL_BROWSER (object), @@ -377,6 +384,12 @@ mail_browser_get_property (GObject *object, E_MAIL_BROWSER (object))); return; + case PROP_GROUP_BY_THREADS: + g_value_set_boolean ( + value, e_mail_reader_get_group_by_threads ( + E_MAIL_READER (object))); + return; + case PROP_SHELL_BACKEND: g_value_set_object ( value, e_mail_reader_get_shell_backend ( @@ -770,6 +783,12 @@ mail_browser_class_init (EMailBrowserClass *class) E_TYPE_FOCUS_TRACKER, G_PARAM_READABLE)); + /* 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_SHELL_BACKEND, diff --git a/mail/e-mail-reader-utils.c b/mail/e-mail-reader-utils.c index 566d2e7ac2..539f9274b1 100644 --- a/mail/e-mail-reader-utils.c +++ b/mail/e-mail-reader-utils.c @@ -264,6 +264,9 @@ e_mail_reader_open_selected (EMailReader *reader) e_mail_reader_set_folder ( E_MAIL_READER (browser), folder, folder_uri); e_mail_reader_set_message (E_MAIL_READER (browser), uid); + e_mail_reader_set_group_by_threads ( + E_MAIL_READER (browser), + e_mail_reader_get_group_by_threads (reader)); gtk_widget_show (browser); } diff --git a/mail/e-mail-reader.c b/mail/e-mail-reader.c index 502ee0d2d7..abfbf3b0ab 100644 --- a/mail/e-mail-reader.c +++ b/mail/e-mail-reader.c @@ -76,6 +76,8 @@ struct _EMailReaderPrivate { * happen when the -user- selects a message. */ guint folder_was_just_selected : 1; guint restoring_message_selection : 1; + + guint group_by_threads : 1; }; enum { @@ -2487,6 +2489,15 @@ mail_reader_class_init (EMailReaderIface *iface) iface->set_message = mail_reader_set_message; iface->update_actions = mail_reader_update_actions; + g_object_interface_install_property ( + iface, + g_param_spec_boolean ( + "group-by-threads", + "Group by Threads", + "Whether to group messages by threads", + FALSE, + G_PARAM_READWRITE)); + signals[CHANGED] = g_signal_new ( "changed", G_OBJECT_CLASS_TYPE (iface), @@ -3100,6 +3111,42 @@ e_mail_reader_set_message (EMailReader *reader, iface->set_message (reader, uid); } +gboolean +e_mail_reader_get_group_by_threads (EMailReader *reader) +{ + EMailReaderPrivate *priv; + + g_return_val_if_fail (E_IS_MAIL_READER (reader), FALSE); + + priv = E_MAIL_READER_GET_PRIVATE (reader); + + return priv->group_by_threads; +} + +void +e_mail_reader_set_group_by_threads (EMailReader *reader, + gboolean group_by_threads) +{ + EMailReaderPrivate *priv; + GtkWidget *message_list; + + g_return_if_fail (E_IS_MAIL_READER (reader)); + + priv = E_MAIL_READER_GET_PRIVATE (reader); + + if (group_by_threads == priv->group_by_threads) + return; + + priv->group_by_threads = group_by_threads; + + /* XXX MessageList should define a property for this. */ + message_list = e_mail_reader_get_message_list (reader); + message_list_set_threaded ( + MESSAGE_LIST (message_list), group_by_threads); + + g_object_notify (G_OBJECT (reader), "group-by-threads"); +} + void e_mail_reader_create_charset_menu (EMailReader *reader, GtkUIManager *ui_manager, diff --git a/mail/e-mail-reader.h b/mail/e-mail-reader.h index b493cff98f..53fcd09a26 100644 --- a/mail/e-mail-reader.h +++ b/mail/e-mail-reader.h @@ -130,6 +130,11 @@ void e_mail_reader_set_folder_uri (EMailReader *reader, const gchar *folder_uri); void e_mail_reader_set_message (EMailReader *reader, const gchar *uid); +gboolean e_mail_reader_get_group_by_threads + (EMailReader *reader); +void e_mail_reader_set_group_by_threads + (EMailReader *reader, + gboolean group_by_threads); void e_mail_reader_create_charset_menu (EMailReader *reader, GtkUIManager *ui_manager, -- cgit