Re: Mailbox/MailboxNodes



Am Mit, 08 Dez 1999 17:30:23 David Pickens Sie:
> I haven't really done anything with this side of things, but I assume
> you've looked at the struct for Mailbox:
> struct _Mailbox
> {
>   GtkObject ojbect;
> 
>   gboolean ismbnode; /* is also in MailboxNode... used to tell them apart
> */
>   MailboxType type;
>   gchar *name;
>   void *private;
>   guint open_ref;
> ...

> I have no idea whether anything's done with that boolean, but at least it
> exists.  :)

Sure I had a look at it. But actually it seems, that ismbnode is never set at
any point in the code, but when creating a new mailbox (=false) or a new 
mailboxnode (=true) (see misc.h in balsa/libbalsa on that). Now while reading
the mailboxes from hd if a directory is detected (containing mbox'es) a mail
box node is created from it and added to a nodelist, a mailbox is added via 
MailboxNode with its member mailbox set to the related mailbox.

Later from that nodelist a ctree is generated (balsa-mblist AFAIR) and either
a mailbox is added or a mailboxnode. So in that function I pointed out in my
last mail (..button_press_cb), I cant see any chance to determine wether its
a mailbox or a node other than that a casting beetween a MailboxNode and a Mailbox
would work, which seems to be not possible as the MailboxNode is defined as

struct _MailboxNode
  {
    gboolean ismbnode;
    gchar *name;
    Mailbox *mailbox;
    gint IsDir;
    gint expanded;
  };

Though I do not know much about type casting, I would think that at least the basic
structure has to be the same (which means that GtkObject would have to come later in
member list of struct _Mailbox as well as MailboxType). On the other side I changed the
member order for both to start with ismbnode which did not work as well - in the former
case it worked at least sometimes, to detect type by ismbnode (which I guess is only by random)

-Knut

--------------------------------------------------------------------------------
Knut Neumann                                     knut.neumann@uni-duesseldorf.de
--------------------------------------------------------------------------------



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