[evolution-exchange] Bug #597400 - Folder flags get lost



commit 168b51da3fc57cfb8e4051709c70de2758ce6662
Author: Milan Crha <mcrha redhat com>
Date:   Mon Oct 5 13:43:36 2009 +0200

    Bug #597400 - Folder flags get lost

 camel/camel-exchange-store.c         |   10 +++++-----
 eplugin/exchange-folder-permission.c |   25 +++++++++++++++----------
 2 files changed, 20 insertions(+), 15 deletions(-)
---
diff --git a/camel/camel-exchange-store.c b/camel/camel-exchange-store.c
index 6d53f9c..a52cccb 100644
--- a/camel/camel-exchange-store.c
+++ b/camel/camel-exchange-store.c
@@ -588,13 +588,13 @@ make_folder_info (CamelExchangeStore *exch, gchar *name, const gchar *uri,
 	if (flags & CAMEL_FOLDER_SYSTEM)
 		info->flags |= CAMEL_FOLDER_SYSTEM;
 
-	if (flags & CAMEL_FOLDER_TYPE_INBOX)
+	if ((flags & CAMEL_FOLDER_TYPE_MASK) == CAMEL_FOLDER_TYPE_INBOX)
 		info->flags |= CAMEL_FOLDER_TYPE_INBOX;
 
-	if (flags & CAMEL_FOLDER_TYPE_TRASH)
+	if ((flags & CAMEL_FOLDER_TYPE_MASK) == CAMEL_FOLDER_TYPE_TRASH)
 		info->flags |= CAMEL_FOLDER_TYPE_TRASH;
 
-	if (flags & CAMEL_FOLDER_TYPE_SENT)
+	if ((flags & CAMEL_FOLDER_TYPE_MASK) == CAMEL_FOLDER_TYPE_SENT)
 		info->flags |= CAMEL_FOLDER_TYPE_SENT;
 
 	if (flags & CAMEL_FOLDER_SUBSCRIBED) {
@@ -679,8 +679,8 @@ exchange_get_folder_info (CamelStore *store, const gchar *top, guint32 flags, Ca
 	for (i = 0; i < folder_names->len; i++) {
 		info = make_folder_info (exch, folder_names->pdata[i],
 					 folder_uris->pdata[i],
-					 g_array_index (unread_counts, int, i),
-					 g_array_index (folder_flags, int, i));
+					 g_array_index (unread_counts, gint, i),
+					 g_array_index (folder_flags, gint, i));
 		if (info)
 			g_ptr_array_add (folders, info);
 	}
diff --git a/eplugin/exchange-folder-permission.c b/eplugin/exchange-folder-permission.c
index 200eea8..f9b3cb7 100644
--- a/eplugin/exchange-folder-permission.c
+++ b/eplugin/exchange-folder-permission.c
@@ -98,25 +98,16 @@ static gboolean
 is_eex_folder_selected (EShellView *shell_view, gchar **puri)
 {
 	ExchangeAccount *account = NULL;
-	gint mode;
 	EShellSidebar *shell_sidebar;
 	EMFolderTree *folder_tree = NULL;
 	GtkTreeSelection *selection;
 	GtkTreeModel *model = NULL;
 	GtkTreeIter iter;
-	gboolean is_store = FALSE, res;
+	gboolean is_store = FALSE, res = FALSE;
 	gchar *uri = NULL;
 
 	g_return_val_if_fail (shell_view != NULL, FALSE);
 
-	account = exchange_operations_get_exchange_account ();
-	if (!account)
-		return FALSE;
-
-	exchange_account_is_offline (account, &mode);
-	if (mode == OFFLINE_MODE)
-		return FALSE;
-
 	shell_sidebar = e_shell_view_get_shell_sidebar (shell_view);
 	g_object_get (shell_sidebar, "folder-tree", &folder_tree, NULL);
 	g_return_val_if_fail (folder_tree != NULL, FALSE);
@@ -135,6 +126,20 @@ is_eex_folder_selected (EShellView *shell_view, gchar **puri)
 	res = !is_store && uri && g_ascii_strncasecmp (uri, "exchange://", 11) == 0;
 
 	if (res) {
+		gint mode;
+
+		/* check for the account later, as it is connecting to the server for the first time */
+		account = exchange_operations_get_exchange_account ();
+		if (!account) {
+			res = FALSE;
+		} else {
+			exchange_account_is_offline (account, &mode);
+			if (mode == OFFLINE_MODE)
+				res = FALSE;
+		}
+	}
+
+	if (res) {
 		const gchar *path;
 
 		path = uri + strlen ("exchange://") + strlen (account->account_filename);



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