From e01e6e3c5535ea63493385a1a8f22438f64ba9e3 Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Tue, 12 Aug 2008 12:37:10 +0000 Subject: ** Fix for bug #519292 2008-08-12 Milan Crha ** Fix for bug #519292 * message-list.c: (read_boolean_with_default), (message_list_construct): Read 'thread_expand' and 'thread_latest' safely with TRUE as default if key doesn't exist. svn path=/trunk/; revision=35968 --- mail/ChangeLog | 8 ++++++++ mail/message-list.c | 27 +++++++++++++++++++++++---- 2 files changed, 31 insertions(+), 4 deletions(-) (limited to 'mail') diff --git a/mail/ChangeLog b/mail/ChangeLog index 84dff3cac6..917ee5ddb4 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,3 +1,11 @@ +2008-08-12 Milan Crha + + ** Fix for bug #519292 + + * message-list.c: (read_boolean_with_default), + (message_list_construct): Read 'thread_expand' and 'thread_latest' + safely with TRUE as default if key doesn't exist. + 2008-08-11 Matthew Barnes ** Fixes part of bug #546892 diff --git a/mail/message-list.c b/mail/message-list.c index 3f43f58cb6..4382b0bd82 100644 --- a/mail/message-list.c +++ b/mail/message-list.c @@ -2373,6 +2373,25 @@ message_list_class_init (MessageListClass *message_list_class) message_list_init_images (); } +static gboolean +read_boolean_with_default (GConfClient *gconf, const char *key, gboolean def_value) +{ + GConfValue *value; + gboolean res; + + g_return_val_if_fail (gconf != NULL, def_value); + g_return_val_if_fail (key != NULL, def_value); + + value = gconf_client_get (gconf, key, NULL); + if (!value) + return def_value; + + res = gconf_value_get_bool (value); + gconf_value_free (value); + + return res; +} + static void message_list_construct (MessageList *message_list) { @@ -2406,11 +2425,11 @@ message_list_construct (MessageList *message_list) message_list); e_tree_memory_set_expanded_default(E_TREE_MEMORY(message_list->model), - gconf_client_get_bool (gconf, - "/apps/evolution/mail/display/thread_expand", - NULL)); + read_boolean_with_default (gconf, + "/apps/evolution/mail/display/thread_expand", + TRUE)); - message_list->priv->thread_latest = gconf_client_get_bool (gconf, "/apps/evolution/mail/display/thread_latest", NULL); + message_list->priv->thread_latest = read_boolean_with_default (gconf, "/apps/evolution/mail/display/thread_latest", TRUE); /* * The etree -- cgit