Re: brian please help me...



On 2001.07.16 13:06:47 +0100 Riccardo Persichetti wrote:
> Hi Brian,

> ok, i decided to give a look anyway to the sources...
> I've faound the place where i should include the
> progress stuff (not very difficult, in libbalsa/send.c.
> it was marked by you as: /* XXX - update the progress bar here */)
> Ok now we have to update the progress bar with something
> like:
> 
> 
>   gfloat percent;
> 
>   [...]
> 
> case SMTP_EV_MESSAGEDATA:
>   message = va_arg (ap, smtp_message_t);
> 
>   percent = (gfloat) message->XXXXXXXXXX /
>     (gfloat) message->YYYYYYYYYY;
> 
> /* where XXXXXXXXXX are the bytes already sent, *
>  * and YYYYYYYYYY is the message size...        *
>  *                                              *
>  * i think YYYYYYYYYY could be size_estimate    *
>  * but i don't have idea of what XXXXXXXXXX     *
>  * is...                                        */
> 
>   if (percent > 1.0 || percent < 0.0) {
>     if (balsa_app.debug)
>       fprintf(stderr, "progress bar percentage out of range %f\n",
>         percent);
>     percent = 1.0;
>   }
>   if (send_dialog && GTK_IS_WIDGET(send_dialog))
>     gtk_progress_bar_update(GTK_PROGRESS_BAR
>       (send_dialog_bar), percent);
> 
>   [...]
> 
> Ok, Brian, this is the best i could do, please
> help me to complete this small patch, then i'll
> test it and if it works i'll post it back to the
> list...
> 
> ...and i'll get my name on the ChangeLog!!! ;-)
> 
> cheers,
> 
>   Riccardo!

OK, your approach is basically correct, however the call to
gtk_progress_bar_update() needs to go somewhere in the main balsa code
rather than the libbalsa module.  Putting code like this in send.c causes
Xlib errors as I remember.  Probably something to do with gtk and threads.

A little more work is needed to get the percentage calculation done in
send.c, mainly to get at the size estimate value.  libESMTP structures
are opaque to the application, so you can't use code like message->xxx.
Also, to limit the number of API functions a lot of the data written into
a libESMTP structure can't be read back.  Basically you need to use the
smtp_xxx_set/get_application_data APIs to attach one of the libbalsa
structures to a libESMTP structure to carry the extra information around.

I can easily write this code because I started to do that code a few
weeks ago, then had to break off because of the problems in libESMTP 0.8.2.
However I will need to leave it to you to trace out the communications
mechanism balsa uses between libbalsa threads and the main application
code and find out how to get the percent value from libbalsa to the
code in src/ that updates the dialog box.  I did do this a while ago
but I've forgotten the details since :-(

Hope this helps some.

Brian




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