[evolution/wip/gsettings] Remove account from EMFolderTreeModelStoreInfo.



commit 63d86c794e104a40e729cedea51d3929f10b0cb9
Author: Matthew Barnes <mbarnes redhat com>
Date:   Sat May 28 09:36:33 2011 -0400

    Remove account from EMFolderTreeModelStoreInfo.
    
    The struct already has a CamelStore, and the CamelStore UID is the same
    as the EAccount UID, so it's easy to lookup the corresponding EAccount.

 mail/em-folder-tree-model.c |   16 ++++++++++------
 mail/em-folder-tree-model.h |    1 -
 2 files changed, 10 insertions(+), 7 deletions(-)
---
diff --git a/mail/em-folder-tree-model.c b/mail/em-folder-tree-model.c
index 0609bb9..b6b8833 100644
--- a/mail/em-folder-tree-model.c
+++ b/mail/em-folder-tree-model.c
@@ -632,6 +632,7 @@ em_folder_tree_model_set_folder_info (EMFolderTreeModel *model,
 	GtkTreeStore *tree_store;
 	MailFolderCache *folder_cache;
 	EMailSession *session;
+	EAccount *account;
 	guint unread;
 	GtkTreePath *path;
 	GtkTreeIter sub;
@@ -640,6 +641,7 @@ em_folder_tree_model_set_folder_info (EMFolderTreeModel *model,
 	gboolean is_templates = FALSE;
 	CamelFolder *folder;
 	gboolean emitted = FALSE;
+	const gchar *uid;
 	const gchar *icon_name;
 	const gchar *display_name;
 	guint32 flags, add_flags = 0;
@@ -655,6 +657,9 @@ em_folder_tree_model_set_folder_info (EMFolderTreeModel *model,
 	session = em_folder_tree_model_get_session (model);
 	folder_cache = e_mail_session_get_folder_cache (session);
 
+	uid = camel_service_get_uid (CAMEL_SERVICE (si->store));
+	account = e_get_account_by_uid (uid);
+
 	if (!fully_loaded)
 		load = (fi->child == NULL) && !(fi->flags &
 			(CAMEL_FOLDER_NOCHILDREN | CAMEL_FOLDER_NOINFERIORS));
@@ -723,17 +728,17 @@ em_folder_tree_model_set_folder_info (EMFolderTreeModel *model,
 		}
 	}
 
-	if (si->account && (flags & CAMEL_FOLDER_TYPE_MASK) == 0) {
-		if (!is_drafts && si->account->drafts_folder_uri) {
+	if (account != NULL && (flags & CAMEL_FOLDER_TYPE_MASK) == 0) {
+		if (!is_drafts && account->drafts_folder_uri != NULL) {
 			is_drafts = e_mail_folder_uri_equal (
 				CAMEL_SESSION (session), uri,
-				si->account->drafts_folder_uri);
+				account->drafts_folder_uri);
 		}
 
-		if (si->account->sent_folder_uri) {
+		if (account->sent_folder_uri != NULL) {
 			if (e_mail_folder_uri_equal (
 				CAMEL_SESSION (session), uri,
-				si->account->sent_folder_uri)) {
+				account->sent_folder_uri)) {
 				add_flags = CAMEL_FOLDER_TYPE_SENT;
 			}
 		}
@@ -1039,7 +1044,6 @@ em_folder_tree_model_add_store (EMFolderTreeModel *model,
 
 	si = g_new (EMFolderTreeModelStoreInfo, 1);
 	si->store = g_object_ref (store);
-	si->account = account;
 	si->row = gtk_tree_row_reference_copy (reference);
 	si->full_hash = g_hash_table_new_full (
 		g_str_hash, g_str_equal,
diff --git a/mail/em-folder-tree-model.h b/mail/em-folder-tree-model.h
index 367f90d..419323a 100644
--- a/mail/em-folder-tree-model.h
+++ b/mail/em-folder-tree-model.h
@@ -82,7 +82,6 @@ struct _EMFolderTreeModelStoreInfo {
 
 	/* CamelFolderInfo::full_name -> GtkTreeRowReference */
 	GHashTable *full_hash;
-	EAccount *account;
 
 	guint created_id;
 	guint deleted_id;



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