Re: [Evolution-hackers] EPlugin, export mail folder, Update!



On Fri, 2005-02-11 at 19:55 +0100, smurfd wrote:
>Using the mail-mt stuff is good since it does some of the setup work
>for you, and lets you setup 4 callbacks, one to say what you're doing,
>one to do the work in the other thread, one to do any work back in the
>gui thread, and one to clean up.  You also have a little control over
>scheduling - i.e. should it run in a new thread or just use one of the
>thread queues, so you don't get too much thrashing.

Ah okey, well i have been into using that sollution a couple of times,
but well i still havent really got it to work as i wanted it.

Today i realised Why i havent got it to work as i wanted it.
 
well i have 3 functions in that struct that gets executed, and thought
that a 4th could be used to run the compression part there.
so i got 'a__desc', 'a__exp', 'a__cpio', 'a__free' so the thought here
was to get __exp to deliver the mails to the location where i wanted it,
say /home/smurfd/backup/ and then to run the compression on That
folder. 

Why you ask, why not just run the compression on the right-clicked
folder? Well ive been heavily debating this (with myself) and after many
debates, i came up with that running it on the exported directory would
be better, since than i wouldnt have to care about if the user
right-clicks a non-local folder, say IMAP or whatever for the
compression part.

sounds sane?

That way, i need to have the "exportion" part to be finished Before the
compression part takes place.
Easy, just have the compression part take place in the __cpio function,
right?
NO, that wont work, and after serious thinking, serious headsmashing, i
realised Why that is...

Thats because in the __exp i have 'mail_get_folder()' wich itself spawns
a new thread, and that way, the __exp thinks its work is done, before it
"really" is...
Well, you should be running the whole shooting match in another thread already?  You are right?

Then you don't use mail_get_folder() at all, you can just use the camel calls directly, or the mail helper, mail_tools_uri_to_folder().  You then use camel_operation to pass any status to the main ui, if you need to.

You could also perhaps do mail_msg_wait() on the return of mail_get_folder(), although it would be simpler to avoid all that extra thread stuff entirely.

So im gonna have to borrow some more code i guess... and make small
modifications on it to fit my needs.

Better to re-use, than to re-invent i guess. :)

Best regards
/Nicklas




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