Re: [Evolution-hackers] Patch proposal to e-msg-composer and -attachment-bar



The reason i had the get_attachment_size_string() function in another
source file is this, when i either put the function, or the code the
function represents in e-msg-composer.c i get this error : 

e-msg-composer.c:2304: error: dereferencing pointer to incomplete type

wich refers to the line : 

2304)    for (p = bar->priv->attachments; p != NULL; p = p->next)	
And since i tried to remove the "bar->priv->attachments" part of it, 
then it worked, i realised it had to do with the "priv" part of it. 

Okey, so i should probably have asked before thinking i could have
solved it, though i Thought it looked like there was no other way out. I
Looked for differenct functions solving my problem, but i didnt found
any...

Best regards
/Nicklas

sön 2005-06-26 klockan 10:04 -0400 skrev Jeffrey Stedfast:
> please use diff -up next time
> 
> On Sun, 2005-06-26 at 16:40 +0200, smurfd wrote:
> > Hey!
> > 
> > Using the cvs diff function, was indeed easy.
> > 
> > Im hoping the sewage has atleast turned into a small fork or
> > something ;)
> > 
> > I choosed to keep the get_attachment_size_string() function, due to the
> > fact that when trying to access a bar->priv->attachments in
> > e-msg-composer.c (even though, e-msg-composer-attachment-bar.h is
> > included in it) i did get some error complaining that i couldnt do that
> > way... dont remember exactly what the errormessage was...
> > 
> > I did a "patch -p0 < file.patch" in my evolution/ source dir, all went
> > fine. Updated from anon cvs a couple of hours ago, so it Should apply
> > cleanily.
> > 
> > regards 
> > /Nicklas
> > 
> > ---- patch ----
> > ? composer/.e-msg-composer.c.swp
> > ? composer/mail-composer.error
> > Index: composer/e-msg-composer-attachment-bar.c
> > ===================================================================
> > RCS
> > file: /cvs/gnome/evolution/composer/e-msg-composer-attachment-bar.c,v
> > retrieving revision 1.99
> > diff -r1.99 e-msg-composer-attachment-bar.c
> > 403a404,413
> > > gchar* get_attachment_size_string (EMsgComposerAttachmentBar *bar) {
> 
> please don't use this style. This should be:
> 
> char *
> get_attachment_size_string (EMsgComposerAttachmentBar *bar)
> {
> 
> however, if this is going to be a public function, it needs to be
> properly namespaced. However, I don't see why it has to be public - in
> fact I'd say with certainty that it should not be.
> 
> > >       GList *p;
> > >       gulong size = 0;
> > >
> > >       for (p = bar->priv->attachments; p != NULL; p = p->next)
> > >               size = size + E_MSG_COMPOSER_ATTACHMENT(p->data)->size;
> > >
> > >       return size_to_string(size);
> > > }
> > >
> > Index: composer/e-msg-composer-attachment-bar.h
> > ===================================================================
> > RCS
> > file: /cvs/gnome/evolution/composer/e-msg-composer-attachment-bar.h,v
> > retrieving revision 1.18
> > diff -r1.18 e-msg-composer-attachment-bar.h
> > 74c74
> > <
> > ---
> > > gchar* get_attachment_size_string (EMsgComposerAttachmentBar *bar);
> > Index: composer/e-msg-composer.c
> > ===================================================================
> > RCS file: /cvs/gnome/evolution/composer/e-msg-composer.c,v
> > retrieving revision 1.512
> > diff -r1.512 e-msg-composer.c
> > 122a123
> > > #include "e-msg-composer-attachment.h"
> > 2303d2303
> > <
> > 2305a2306,2307
> > >       GList *p;
> > >
> > 2308,2311c2310,2315
> > <                       ngettext ("<b>%d</b> Attachment", "<b>%d</b>
> > Attachments", attachment_num),
> > <                       attachment_num);
> > <               gtk_label_set_markup (GTK_LABEL
> > (composer->attachment_expander_num),
> > <                                     num_text);
> > ---
> > >                       ngettext ("<b>%d</b> Attachment, %s",
> > >                       "<b>%d</b> Attachments, %s total",
> > >
> > attachment_num),attachment_num,get_attachment_size_string(bar));
> > >               gtk_label_set_markup (GTK_LABEL(
> > >                       composer->attachment_expander_num),num_text);
> 
> why not put the code for get_attachment_size_string() right here? Why is
> it even in another source file when it's never used anywhere else but
> here?
> 
> Jeff
> 
> _______________________________________________
> evolution-hackers maillist  -  evolution-hackers lists ximian com
> http://lists.ximian.com/mailman/listinfo/evolution-hackers




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