[Evolution-hackers] EDS: Trying to implement expunge function in camel-spool-folder.c



Hi List,

In January this year, I emailed the list asking about implementing an
expunge function for CamelSpoolFolder. Philip Van Hoof helpfully replied
with some information about how to go about this. That conversation is
here:

http://www.mail-archive.com/evolution-hackers gnome org/msg01404.html

I've only just managed to find time to work on this (family life,
necessity of earning a living, etc, etc...)

I'm having trouble getting my skeleton expunge function to run. I
modified camel_spool_folder_class_init() in camel_spool_folder.c like
this, following Philip Van Hoof's advice:

----8<--8<-------------------------------------------- 
static void
camel_spool_folder_class_init(CamelSpoolFolderClass *camel_spool_folder_class)
{
        d(printf ("%s called\n", __FUNCTION__));
        /* Modified, somewhat as suggested by Philip Van Hoof */

        CamelFolderClass *camel_folder_class = CAMEL_FOLDER_CLASS(camel_spool_folder_class);
        CamelLocalFolderClass *lklass = (CamelLocalFolderClass *)camel_spool_folder_class;

        /* virtual method overload */
        camel_folder_class->expunge = spool_expunge;

        lklass->create_summary = spool_create_summary;
        lklass->lock = spool_lock;
        lklass->unlock = spool_unlock;
}

/* Then implement */
static void
spool_expunge(CamelFolder *folder, CamelException *ex)
{
        printf ("In %s to expunge!\n", __FUNCTION__);
        return;
}
----8<--8<--------------------------------------------

All I'm trying to do to start with is get a message to print out on
stdout. In the function camel_spool_folder_class_init() I create a
CamelFolderClass pointer to the CamelSpoolFolderClass passed in, so that
I can then replace the expunge function pointer in that
class/structure. 

When I run evolution, and try to expunge the spool based inbox by
right-clicking on the Trash folder and selecting "Empty
Wastebasket" (that might read "Empty Trash" for a US locale), then a
debugging message that I placed in camel-folder.c tells me this:

camel-folder.c(562): camel_folder_expunge called for folder->name
'Trash', with parent_store->parent_service name 'Local mail
file /home/seb/.evolution/mail/local/', path
'mbox/home/seb/.evolution/mail/local'

What this is saying is that eds is not trying to call the
CamelSpoolFolderClass version of expunge, instead it is calling the
expunge which relates to the local mail file mentioned. This means that
eds then goes on to call camel_folder_sync for all the local folders,
instead of calling the CamelSpoolFolderClass implementation of expunge.

Can anyone tell me how to get the CamelLocalFolder/CamelSpoolFolder
expunge to be called? How come the trash icon that gets placed next to
my spool INBOX doesn't cause a spool based expunge to be called?



I'm also having trouble debugging eds using gdb and the edsdebug script
that I got from the evolution website. If I try to break on
camel_folder_sync, gdb tells me it doesn't know where it is...

(gdb) b camel_folder_expunge
Function "camel_folder_expunge" not defined.
Make breakpoint pending on future shared library load? (y or [n])

But some camel functions are available:

(gdb) b camel_f[TAB]
camel_file_util_decode_fixed_int32  camel_file_util_decode_uint32 [snip
rest of camel_file_ functions]

Can anyone tell me what I'm doing wrong here?



with best regards,

Seb James





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