Re: [evolution-patches] =?utf-8?q?Bug_329692_=E2=80=93_=09attachment_?= =?utf-8?q?size_in_composer_not=09shown_when_reopening?=



On Fri, 2008-01-11 at 10:39 +0100, Jean-Christophe BEGUE wrote:
> Hello,
> 
> This bug implies both evolution and evolution-data-server. I added a
> function called 
> camel_mime_part_get_content_size () to
> evolution-data-server/camel/mime-part.c and 
> used it in evolution/widget/misc/attachment.c.
> 
> There's still a problem: the size displayed is bigger than the real
> file size because 
> camel_data_wrapper_decode_to_stream () (used with an null stream to
> get the size) returns
> size of encoded data. How could i fix it? 


comment below

> 
> This is my first patch, I hope i did everything right.(Please tell me
> what i did wrong.)

your patch looks pretty good :)
> 
> Sorry for my english.
> 
> Regards,
> 
> Jean-Christophe BEGUE 
> 
> 
> 
> 
> 
> 
> differences
> between files
> attachment
> (evolution329692.diff)
> 
> 
> 
> 
> 
> 
> 
> differences
> between files
> attachment
> (evolution-data-server-329692.diff)
> 
> Index: camel/camel-mime-part.c
> ===================================================================
> --- camel/camel-mime-part.c     (révision 8343)
> +++ camel/camel-mime-part.c     (copie de travail)
> @@ -1060,3 +1060,25 @@
>                 medium->content = NULL;
>         }
>  }
> +
> +/**
> + * camel_mime_part_get_content_size

add a ':' at the end of 'camel_mime_part_get_content_size' so that the
gtk-docs stuff can parse it

> + * @mime_part: a #CamelMimePart object
> + *
> + * Function used to get the size of the mime part provided data.

 *
 * Returns the size of the MIME part's content in bytes.

> + **/
> +
> +ssize_t
> +camel_mime_part_get_content_size (CamelMimePart *mime_part)
> +{
> +       ssize_t written;        
> +       CamelStreamNull *nstream;
> +       CamelMedium *medium = CAMEL_MEDIUM (mime_part);
> +       CamelDataWrapper *dw = camel_medium_get_content_object
> (medium);
> +       
> +       nstream =  camel_stream_null_new ();
> +       written = camel_data_wrapper_write_to_stream (dw, nstream);

in order to get the size of the decoded content, you'll want to use
camel_data_wrapper_decode_to_stream()

> +       camel_object_unref (nstream);
> +
> +       return written;
> +}

I'll make the corrections I mentioned above and commit the patch.
Thanks!

Jeff




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