From 169c9aea03c1ba03d327af2a4f0fb8bb3aabd593 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Fri, 14 Jun 2013 11:48:39 -0400 Subject: MessageList: Add a "thread-latest" property. Bind this to the "thread-latest" GSettings key. --- mail/message-list.c | 54 +++++++++++++++++++++++++++++++++++++++++++++++------ mail/message-list.h | 3 +++ 2 files changed, 51 insertions(+), 6 deletions(-) (limited to 'mail') diff --git a/mail/message-list.c b/mail/message-list.c index bf04cd2c37..2619ebf6de 100644 --- a/mail/message-list.c +++ b/mail/message-list.c @@ -152,6 +152,7 @@ enum { PROP_COPY_TARGET_LIST, PROP_PASTE_TARGET_LIST, PROP_SESSION, + PROP_THREAD_LATEST, PROP_THREAD_SUBJECT }; @@ -2645,6 +2646,12 @@ message_list_set_property (GObject *object, g_value_get_object (value)); return; + case PROP_THREAD_LATEST: + message_list_set_thread_latest ( + MESSAGE_LIST (object), + g_value_get_boolean (value)); + return; + case PROP_THREAD_SUBJECT: message_list_set_thread_subject ( MESSAGE_LIST (object), @@ -2683,6 +2690,13 @@ message_list_get_property (GObject *object, MESSAGE_LIST (object))); return; + case PROP_THREAD_LATEST: + g_value_set_boolean ( + value, + message_list_get_thread_latest ( + MESSAGE_LIST (object))); + return; + case PROP_THREAD_SUBJECT: g_value_set_boolean ( value, @@ -2860,6 +2874,18 @@ message_list_class_init (MessageListClass *class) G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS)); + g_object_class_install_property ( + object_class, + PROP_THREAD_LATEST, + g_param_spec_boolean ( + "thread-latest", + "Thread Latest", + "Sort threads by latest message", + TRUE, + G_PARAM_READWRITE | + G_PARAM_CONSTRUCT | + G_PARAM_STATIC_STRINGS)); + g_object_class_install_property ( object_class, PROP_THREAD_SUBJECT, @@ -2907,12 +2933,6 @@ message_list_construct (MessageList *message_list) AtkObject *a11y; gboolean constructed; gchar *etspecfile; - GSettings *settings; - - settings = g_settings_new ("org.gnome.evolution.mail"); - message_list->priv->thread_latest = - g_settings_get_boolean (settings, "thread-latest"); - g_object_unref (settings); /* * The etree @@ -3882,6 +3902,28 @@ message_list_get_paste_target_list (MessageList *message_list) return message_list->priv->paste_target_list; } +gboolean +message_list_get_thread_latest (MessageList *message_list) +{ + g_return_val_if_fail (IS_MESSAGE_LIST (message_list), FALSE); + + return message_list->priv->thread_latest; +} + +void +message_list_set_thread_latest (MessageList *message_list, + gboolean thread_latest) +{ + g_return_if_fail (IS_MESSAGE_LIST (message_list)); + + if (thread_latest == message_list->priv->thread_latest) + return; + + message_list->priv->thread_latest = thread_latest; + + g_object_notify (G_OBJECT (message_list), "thread-latest"); +} + gboolean message_list_get_thread_subject (MessageList *message_list) { diff --git a/mail/message-list.h b/mail/message-list.h index d4571e31d8..829e3c9c21 100644 --- a/mail/message-list.h +++ b/mail/message-list.h @@ -173,6 +173,9 @@ GtkTargetList * message_list_get_copy_target_list (MessageList *message_list); GtkTargetList * message_list_get_paste_target_list (MessageList *message_list); +gboolean message_list_get_thread_latest (MessageList *message_list); +void message_list_set_thread_latest (MessageList *message_list, + gboolean thread_latest); gboolean message_list_get_thread_subject (MessageList *message_list); void message_list_set_thread_subject (MessageList *message_list, gboolean thread_subject); -- cgit