[evolution] EMailAccountStore: Avoid a bogus runtime warning.



commit 2c9b8c191d7ccf82c4d0c6df4c5acbe11cfa8701
Author: Matthew Barnes <mbarnes redhat com>
Date:   Sat Dec 31 08:39:29 2011 -0500

    EMailAccountStore: Avoid a bogus runtime warning.
    
    If the number of SortOrder items in sortorder.ini disagrees with the
    number of services in the EMailAccountStore, silently revert to the
    default ordering rather than emitting a runtime warning.

 mail/e-mail-account-store.c |   11 ++++++-----
 1 files changed, 6 insertions(+), 5 deletions(-)
---
diff --git a/mail/e-mail-account-store.c b/mail/e-mail-account-store.c
index 824a521..e0bd90e 100644
--- a/mail/e-mail-account-store.c
+++ b/mail/e-mail-account-store.c
@@ -1267,7 +1267,6 @@ e_mail_account_store_reorder_services (EMailAccountStore *store,
 	gint *new_order;
 	gint n_children;
 	gint new_pos = 0;
-	guint length;
 
 	g_return_if_fail (E_IS_MAIL_ACCOUNT_STORE (store));
 
@@ -1278,13 +1277,15 @@ e_mail_account_store_reorder_services (EMailAccountStore *store,
 	if (ordered_services != NULL && g_queue_is_empty (ordered_services))
 		ordered_services = NULL;
 
-	use_default_order = (ordered_services == NULL);
-
+	/* If the length of the custom ordering disagrees with the
+	 * number of rows in the store, revert to default ordering. */
 	if (ordered_services != NULL) {
-		length = g_queue_get_length (ordered_services);
-		g_return_if_fail (length == n_children);
+		if (g_queue_get_length (ordered_services) != n_children)
+			ordered_services = NULL;
 	}
 
+	use_default_order = (ordered_services == NULL);
+
 	/* Build a queue of CamelServices in the order they appear in
 	 * the list store.  We'll use this to construct the mapping to
 	 * pass to gtk_list_store_reorder(). */



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]