Index: camel/camel-exchange-folder.c
===================================================================
--- camel/camel-exchange-folder.c	(revision 1516)
+++ camel/camel-exchange-folder.c	(working copy)
@@ -48,6 +48,10 @@
 
 static CamelOfflineFolderClass *parent_class = NULL;
 
+static CamelProperty exchange_property_list[] = {
+	{ CAMEL_EXCHANGE_FOLDER_CHECK_FOLDER, "check_folder", N_("Always check for new mail in this folder") },
+};
+
 /* Returns the class for a CamelFolder */
 #define CF_CLASS(so) CAMEL_FOLDER_CLASS (CAMEL_OBJECT_GET_CLASS(so))
 
@@ -84,6 +88,9 @@
 static void refresh_info (CamelFolder *folder, CamelException *ex);
 static void exchange_sync (CamelFolder *folder, gboolean expunge, CamelException *ex);
 
+static int exchange_getv (CamelObject *object, CamelException *ex, CamelArgGetV *args);
+static int exchange_setv (CamelObject *object, CamelException *ex, CamelArgV *args);
+
 static void
 class_init (CamelFolderClass *camel_folder_class)
 {
@@ -100,6 +107,9 @@
 	camel_folder_class->transfer_messages_to = transfer_messages_to;
 	camel_folder_class->refresh_info = refresh_info;
 	camel_folder_class->sync = exchange_sync;
+
+ 	((CamelObjectClass *)camel_folder_class)->getv = exchange_getv;
+	((CamelObjectClass *)camel_folder_class)->setv = exchange_setv;
 }
 
 #define CAMEL_EXCHANGE_SERVER_FLAGS \
@@ -141,6 +151,8 @@
 	static CamelType camel_exchange_folder_type = CAMEL_INVALID_TYPE;
 
 	if (camel_exchange_folder_type == CAMEL_INVALID_TYPE) {
+		int i;
+
 		camel_exchange_folder_type = camel_type_register (
 			camel_offline_folder_get_type (),
 			"CamelExchangeFolder",
@@ -150,6 +162,10 @@
 			NULL,
 			(CamelObjectInitFunc) init,
 			(CamelObjectFinalizeFunc) finalize );
+
+		/* only localize here, do not create GSList, we do not want to leak */
+		for (i = 0; i < sizeof (exchange_property_list)/sizeof (exchange_property_list [0]); i++)
+			exchange_property_list [i].description = _(exchange_property_list [i].description);
 	}
 
 	return camel_exchange_folder_type;
@@ -1169,3 +1185,78 @@
 
 	camel_folder_summary_save (folder->summary);
 }
+
+static int
+exchange_getv (CamelObject *object, CamelException *ex, CamelArgGetV *args)
+{
+	int i, count=0;
+	guint32 tag;
+
+	for (i = 0; i < args->argc; i++) {
+		CamelArgGet *arg = &args->argv[i];
+
+		tag = arg->tag;
+
+		switch (tag & CAMEL_ARG_TAG) {
+		case CAMEL_OBJECT_ARG_PERSISTENT_PROPERTIES:
+		case CAMEL_FOLDER_ARG_PROPERTIES: {
+			CamelArgGetV props;
+			int i;
+
+			props.argc = 1;
+			props.argv[0] = *arg;
+			((CamelObjectClass *)parent_class)->getv(object, ex, &props);
+
+			for (i = 0; i < sizeof (exchange_property_list)/sizeof (exchange_property_list [0]); i++)
+				*arg->ca_ptr = g_slist_append (*arg->ca_ptr, &exchange_property_list[i]);
+			break; }
+			/* exchange args */
+		case CAMEL_EXCHANGE_FOLDER_ARG_CHECK_FOLDER:
+			*arg->ca_int = ((CamelExchangeFolder *)object)->check_folder;
+			break;
+		default:
+			count++;
+			continue;
+		}
+
+		arg->tag = (tag & CAMEL_ARG_TYPE) | CAMEL_ARG_IGNORE;
+	}
+
+	if (count)
+		return ((CamelObjectClass *)parent_class)->getv (object, ex, args);
+
+	return 0;
+}
+
+static int
+exchange_setv (CamelObject *object, CamelException *ex, CamelArgV *args)
+{
+	int save = 0;
+	int i;
+	guint32 tag;
+
+	for (i = 0; i < args->argc; i++) {
+		CamelArg *arg = &args->argv[i];
+
+		tag = arg->tag;
+
+		switch (tag & CAMEL_ARG_TAG) {
+		case CAMEL_EXCHANGE_FOLDER_ARG_CHECK_FOLDER:
+			if (((CamelExchangeFolder *)object)->check_folder != arg->ca_int) {
+				((CamelExchangeFolder *)object)->check_folder = arg->ca_int;
+				save = 1;
+			}
+			break;
+		default:
+			continue;
+		}
+
+		arg->tag = (tag & CAMEL_ARG_TYPE) | CAMEL_ARG_IGNORE;
+	}
+
+	if (save)
+		camel_object_state_write (object);
+
+	return ((CamelObjectClass *)parent_class)->setv (object, ex, args);
+}
+
Index: camel/camel-exchange-folder.h
===================================================================
--- camel/camel-exchange-folder.h	(revision 1516)
+++ camel/camel-exchange-folder.h	(working copy)
@@ -24,6 +24,15 @@
 #define CAMEL_EXCHANGE_FOLDER_CLASS(k) (CAMEL_CHECK_CLASS_CAST ((k), CAMEL_EXCHANGE_FOLDER_TYPE, CamelExchangeFolderClass))
 #define CAMEL_IS_EXCHANGE_FOLDER(o)    (CAMEL_CHECK_TYPE((o), CAMEL_EXCHANGE_FOLDER_TYPE))
 
+enum {
+	CAMEL_EXCHANGE_FOLDER_ARG_CHECK_FOLDER = CAMEL_OFFLINE_FOLDER_ARG_LAST,
+	CAMEL_EXCHANGE_FOLDER_ARG_LAST = CAMEL_OFFLINE_FOLDER_ARG_LAST + 0x100
+};
+
+enum {
+	CAMEL_EXCHANGE_FOLDER_CHECK_FOLDER = CAMEL_EXCHANGE_FOLDER_ARG_CHECK_FOLDER | CAMEL_ARG_BOO,
+};
+
 typedef struct {
 	CamelOfflineFolder parent_object;
 
@@ -33,6 +42,7 @@
 	char *source;
 
 	GHashTable *thread_index_to_message_id;
+	unsigned int check_folder:1;
 } CamelExchangeFolder;
 
 typedef struct {
Index: camel/camel-exchange-store.c
===================================================================
--- camel/camel-exchange-store.c	(revision 1516)
+++ camel/camel-exchange-store.c	(working copy)
@@ -81,6 +81,7 @@
 static void 		exchange_unsubscribe_folder (CamelStore *store,
 						const char *folder_name,
 						CamelException *ex);
+static gboolean exchange_can_refresh_folder (CamelStore *store, CamelFolderInfo *info, CamelException *ex);
 
 static void stub_notification (CamelObject *object, gpointer event_data, gpointer user_data);
 
@@ -112,6 +113,7 @@
 	camel_store_class->folder_subscribed = exchange_folder_subscribed;
 	camel_store_class->subscribe_folder = exchange_subscribe_folder;
 	camel_store_class->unsubscribe_folder = exchange_unsubscribe_folder;
+	camel_store_class->can_refresh_folder = exchange_can_refresh_folder;
 }
 
 static void
@@ -1142,3 +1144,22 @@
 		break;
 	}
 }
+
+static gboolean
+exchange_can_refresh_folder (CamelStore *store, CamelFolderInfo *info, CamelException *ex)
+{
+	gboolean res;
+
+	res = CAMEL_STORE_CLASS(parent_class)->can_refresh_folder (store, info, ex) ||
+	      (camel_url_get_param (((CamelService *)store)->url, "check_all") != NULL);
+
+	if (!res && !camel_exception_is_set (ex)) {
+		CamelFolder *folder;
+
+		folder = camel_store_get_folder (store, info->full_name, 0, ex);
+		if (folder && CAMEL_IS_EXCHANGE_FOLDER (folder))
+			res = CAMEL_EXCHANGE_FOLDER (folder)->check_folder;
+	}
+
+	return res;
+}
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 1516)
+++ ChangeLog	(working copy)
@@ -1,3 +1,20 @@
+2007-12-10  Milan Crha  <mcrha@redhat.com>
+
+	** Fix for bug #336074
+
+	* camel/camel-exchange-folder.h: (struct CamelExchangeFolder):
+	* camel/camel-exchange-folder.c: (exchange_property_list),
+	(exchange_getv), (exchange_setv), (class_init),
+	(camel_exchange_folder_get_type): New property of Exchange folder,
+	check_folder, to let user setup for each folder to check for new mail
+	here or not, but only if not enabled 'check_all' for the store.
+	* camel/camel-exchange-store.c: (exchange_can_refresh_folder),
+	(class_init): Implements its own CamelStore::can_refresh_folder
+	function - Exchange folder has a property if it should be refreshed
+	always or not, so depends on this property in case parent class
+	doesn't permit refresh of the folder or the store doesn't have
+	enabled 'check_all' property.
+
 2007-12-03  Srinivasa Ragavan  <sragavan@novell.com>
 
 	* NEWS, configure.in: Evolution Exchange 2.21.3 release.
