[Evolution-hackers] camel_operation_cancel_check() not working?



Hi,

I have a big and potentially slow loop running when updating the folder
summaries. I'm basically initializing a CamelOperation like this:


CamelOperation *cop = camel_operation_registered();
if (!cop) {
	cop = camel_operation_new (NULL, NULL);
	if (!cop) 
		return;
	
	camel_operation_register(cop);
	cop_unreg = TRUE;
}
camel_operation_start(cop, _("Fetching folder summary information"));
camel_operation_progress(cop, 0);


Then in the loop I do like this:

do {
	if (camel_operation_cancel_check(cop)) {
		d("Cancelled");
		camel_exception_set(ex,
				    CAMEL_EXCEPTION_USER_CANCEL,
				    _("Fetching folder summary information canceled"));
		goto cancelled;
	}
	<do lots of stuff>
cancelled:
	camel_operation_progress(cop, 100);
	camel_operation_end(cop);
	if (cop_unreg)
		camel_operation_unregister(cop);
	camel_operation_unref(cop);
	break;
} while (TRUE);

Now I expect that I'm able to press cancel after pressing f9 and have my
loop exit gracefully. 

In what way do I err?

Thanks,
  jules







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