diff options
-rw-r--r-- | calendar/gui/alarm-notify/alarm-notify.h | 2 | ||||
-rw-r--r-- | e-util/e-plugin.c | 1 | ||||
-rw-r--r-- | e-util/e-profile-event.c | 1 | ||||
-rw-r--r-- | em-format/em-format-quote.c | 12 | ||||
-rw-r--r-- | em-format/em-format.c | 205 | ||||
-rw-r--r-- | em-format/em-format.h | 50 | ||||
-rw-r--r-- | mail/e-searching-tokenizer.c | 57 | ||||
-rw-r--r-- | mail/em-config.c | 1 | ||||
-rw-r--r-- | mail/em-event.c | 1 | ||||
-rw-r--r-- | mail/em-format-hook.h | 7 | ||||
-rw-r--r-- | mail/em-format-html-display.c | 1 | ||||
-rw-r--r-- | mail/em-format-html.c | 180 | ||||
-rw-r--r-- | mail/em-format-html.h | 16 | ||||
-rw-r--r-- | mail/em-subscribe-editor.c | 51 | ||||
-rw-r--r-- | mail/mail-folder-cache.c | 41 |
15 files changed, 321 insertions, 305 deletions
diff --git a/calendar/gui/alarm-notify/alarm-notify.h b/calendar/gui/alarm-notify/alarm-notify.h index 00936c41ed..b3fb47990a 100644 --- a/calendar/gui/alarm-notify/alarm-notify.h +++ b/calendar/gui/alarm-notify/alarm-notify.h @@ -26,7 +26,7 @@ #ifndef ALARM_NOTIFY_H #define ALARM_NOTIFY_H -#include <libedataserver/e-msgport.h> +#include <libecal/e-cal.h> /* Standard GObject macros */ #define TYPE_ALARM_NOTIFY \ diff --git a/e-util/e-plugin.c b/e-util/e-plugin.c index 0716ff79d4..dff49d4e3f 100644 --- a/e-util/e-plugin.c +++ b/e-util/e-plugin.c @@ -25,7 +25,6 @@ #include <gconf/gconf-client.h> -#include <libedataserver/e-msgport.h> #include <libedataserver/e-data-server-util.h> #include <libedataserver/e-xml-utils.h> diff --git a/e-util/e-profile-event.c b/e-util/e-profile-event.c index 297fcf5739..4134ea95e4 100644 --- a/e-util/e-profile-event.c +++ b/e-util/e-profile-event.c @@ -30,7 +30,6 @@ #include <glib.h> #include "e-profile-event.h" -#include "libedataserver/e-msgport.h" static GObjectClass *eme_parent; static EProfileEvent *e_profile_event; diff --git a/em-format/em-format-quote.c b/em-format/em-format-quote.c index 4bbe977918..c329769976 100644 --- a/em-format/em-format-quote.c +++ b/em-format/em-format-quote.c @@ -389,7 +389,7 @@ emfq_format_headers (EMFormatQuote *emfq, CamelStream *stream, CamelMedium *part EMFormat *emf = (EMFormat *) emfq; CamelContentType *ct; const gchar *charset; - EMFormatHeader *h; + GList *link; if (!part) return; @@ -399,10 +399,12 @@ emfq_format_headers (EMFormatQuote *emfq, CamelStream *stream, CamelMedium *part charset = camel_iconv_charset_name (charset); /* dump selected headers */ - h = (EMFormatHeader *) emf->header_list.head; - while (h->next) { - emfq_format_header (emf, stream, part, h->name, h->flags, charset); - h = h->next; + link = g_queue_peek_head_link (&emf->header_list); + while (link != NULL) { + EMFormatHeader *h = link->data; + emfq_format_header ( + emf, stream, part, h->name, h->flags, charset); + link = g_list_next (link); } camel_stream_printf(stream, "<br>\n"); diff --git a/em-format/em-format.c b/em-format/em-format.c index 9d3cb7c1f9..3308763ee5 100644 --- a/em-format/em-format.c +++ b/em-format/em-format.c @@ -31,7 +31,6 @@ #include <glib/gi18n.h> #include <gio/gio.h> -#include <libedataserver/e-msgport.h> #include <camel/camel-stream.h> #include <camel/camel-stream-mem.h> #include <camel/camel-multipart.h> @@ -179,7 +178,7 @@ emf_init (EMFormat *emf) (GDestroyNotify) emf_free_cache); emf->composer = FALSE; emf->print = FALSE; - e_dlist_init(&emf->header_list); + g_queue_init (&emf->header_list); em_format_default_headers(emf); emf->part_id = g_string_new(""); emf->validity_found = 0; @@ -392,7 +391,11 @@ em_format_fallback_handler(EMFormat *emf, const gchar *mime_type) * are resolved by forgetting the old PURI in the global index. **/ EMFormatPURI * -em_format_add_puri(EMFormat *emf, gsize size, const gchar *cid, CamelMimePart *part, EMFormatPURIFunc func) +em_format_add_puri (EMFormat *emf, + gsize size, + const gchar *cid, + CamelMimePart *part, + EMFormatPURIFunc func) { EMFormatPURI *puri; const gchar *tmp; @@ -450,11 +453,11 @@ em_format_add_puri(EMFormat *emf, gsize size, const gchar *cid, CamelMimePart *p g_return_val_if_fail (emf->pending_uri_level != NULL, NULL); g_return_val_if_fail (emf->pending_uri_table != NULL, NULL); - e_dlist_addtail(&emf->pending_uri_level->uri_list, (EDListNode *)puri); + g_queue_push_tail (emf->pending_uri_level->data, puri); if (puri->uri) - g_hash_table_insert(emf->pending_uri_table, puri->uri, puri); - g_hash_table_insert(emf->pending_uri_table, puri->cid, puri); + g_hash_table_insert (emf->pending_uri_table, puri->uri, puri); + g_hash_table_insert (emf->pending_uri_table, puri->cid, puri); return puri; } @@ -470,21 +473,20 @@ em_format_add_puri(EMFormat *emf, gsize size, const gchar *cid, CamelMimePart *p * the base location. **/ void -em_format_push_level(EMFormat *emf) +em_format_push_level (EMFormat *emf) { - struct _EMFormatPURITree *purilist; - - d(printf("em_format_push_level\n")); - purilist = g_malloc0(sizeof(*purilist)); - e_dlist_init(&purilist->children); - e_dlist_init(&purilist->uri_list); - purilist->parent = emf->pending_uri_level; - if (emf->pending_uri_tree == NULL) { - emf->pending_uri_tree = purilist; - } else { - e_dlist_addtail(&emf->pending_uri_level->children, (EDListNode *)purilist); - } - emf->pending_uri_level = purilist; + GNode *node; + + g_return_if_fail (EM_IS_FORMAT (emf)); + + node = g_node_new (g_queue_new ()); + + if (emf->pending_uri_tree == NULL) + emf->pending_uri_tree = node; + else + g_node_append (emf->pending_uri_tree, node); + + emf->pending_uri_level = node; } /** @@ -495,9 +497,11 @@ em_format_push_level(EMFormat *emf) * no PURI values are actually freed. **/ void -em_format_pull_level(EMFormat *emf) +em_format_pull_level (EMFormat *emf) { - d(printf("em_format_pull_level\n")); + g_return_if_fail (EM_IS_FORMAT (emf)); + g_return_if_fail (emf->pending_uri_level != NULL); + emf->pending_uri_level = emf->pending_uri_level->parent; } @@ -512,23 +516,35 @@ em_format_pull_level(EMFormat *emf) * Return value: **/ EMFormatPURI * -em_format_find_visible_puri(EMFormat *emf, const gchar *uri) +em_format_find_visible_puri (EMFormat *emf, + const gchar *uri) { - EMFormatPURI *pw; - struct _EMFormatPURITree *ptree; + GNode *node; + + g_return_val_if_fail (EM_IS_FORMAT (emf), NULL); + g_return_val_if_fail (uri != NULL, NULL); - d(printf("checking for visible uri '%s'\n", uri)); + node = emf->pending_uri_level; - ptree = emf->pending_uri_level; - while (ptree) { - pw = (EMFormatPURI *)ptree->uri_list.head; - while (pw->next) { - d(printf(" pw->uri = '%s' pw->cid = '%s\n", pw->uri?pw->uri:"", pw->cid)); - if ((pw->uri && !strcmp(pw->uri, uri)) || !strcmp(pw->cid, uri)) + while (node != NULL) { + GQueue *queue = node->data; + GList *link; + + link = g_queue_peek_head_link (queue); + + while (link != NULL) { + EMFormatPURI *pw = link->data; + + if (g_strcmp0 (pw->uri, uri) == 0) return pw; - pw = pw->next; + + if (g_strcmp0 (pw->cid, uri) == 0) + return pw; + + link = g_list_next (link); } - ptree = ptree->parent; + + node = node->parent; } return NULL; @@ -545,50 +561,36 @@ em_format_find_visible_puri(EMFormat *emf, const gchar *uri) * Return value: **/ EMFormatPURI * - -em_format_find_puri(EMFormat *emf, const gchar *uri) +em_format_find_puri (EMFormat *emf, + const gchar *uri) { - return g_hash_table_lookup(emf->pending_uri_table, uri); -} + g_return_val_if_fail (EM_IS_FORMAT (emf), NULL); + g_return_val_if_fail (uri != NULL, NULL); -static void -emf_clear_puri_node(struct _EMFormatPURITree *node) -{ - { - EMFormatPURI *pw, *pn; - - /* clear puri's at this level */ - pw = (EMFormatPURI *)node->uri_list.head; - pn = pw->next; - while (pn) { - d(printf ("freeing pw %p format:%p\n", pw, pw->format)); - if (pw->free) - pw->free(pw); - g_free(pw->uri); - g_free(pw->cid); - g_free(pw->part_id); - if (pw->part) - camel_object_unref(pw->part); - g_free(pw); - pw = pn; - pn = pn->next; - } - } + g_return_val_if_fail (emf->pending_uri_table != NULL, NULL); - { - struct _EMFormatPURITree *cw, *cn; + return g_hash_table_lookup (emf->pending_uri_table, uri); +} - /* clear child nodes */ - cw = (struct _EMFormatPURITree *)node->children.head; - cn = cw->next; - while (cn) { - emf_clear_puri_node(cw); - cw = cn; - cn = cn->next; - } +static gboolean +emf_clear_puri_node (GNode *node) +{ + GQueue *queue = node->data; + EMFormatPURI *pn; + + while ((pn = g_queue_pop_head (queue)) != NULL) { + d(printf ("freeing pw %p format:%p\n", pw, pw->format)); + if (pn->free) + pn->free(pn); + g_free(pn->uri); + g_free(pn->cid); + g_free(pn->part_id); + if (pn->part) + camel_object_unref(pn->part); + g_free(pn); } - g_free(node); + return FALSE; } /** @@ -601,16 +603,24 @@ emf_clear_puri_node(struct _EMFormatPURITree *node) void em_format_clear_puri_tree(EMFormat *emf) { - d(printf("clearing pending uri's\n")); + if (emf->pending_uri_table == NULL) + emf->pending_uri_table = + g_hash_table_new (g_str_hash, g_str_equal); + + else { + g_hash_table_remove_all (emf->pending_uri_table); + + g_node_traverse ( + emf->pending_uri_tree, + G_IN_ORDER, G_TRAVERSE_ALL, -1, + (GNodeTraverseFunc) emf_clear_puri_node, NULL); + g_node_destroy (emf->pending_uri_tree); - if (emf->pending_uri_table) { - g_hash_table_destroy(emf->pending_uri_table); - emf_clear_puri_node(emf->pending_uri_tree); - emf->pending_uri_level = NULL; emf->pending_uri_tree = NULL; + emf->pending_uri_level = NULL; } - emf->pending_uri_table = g_hash_table_new(g_str_hash, g_str_equal); - em_format_push_level(emf); + + em_format_push_level (emf); } /* use mime_type == NULL to force showing as application/octet-stream */ @@ -719,7 +729,7 @@ emf_format_clone(EMFormat *emf, CamelFolder *folder, const gchar *uid, CamelMime if (emf != emfsource) { g_hash_table_remove_all(emf->inline_table); if (emfsource) { - struct _EMFormatHeader *h; + GList *link; /* We clone the current state here */ g_hash_table_foreach(emfsource->inline_table, emf_clone_inlines, emf); @@ -730,8 +740,13 @@ emf_format_clone(EMFormat *emf, CamelFolder *folder, const gchar *uid, CamelMime emf->default_charset = g_strdup (emfsource->default_charset); em_format_clear_headers(emf); - for (h = (struct _EMFormatHeader *)emfsource->header_list.head; h->next; h = h->next) - em_format_add_header(emf, h->name, h->flags); + + link = g_queue_peek_head_link (&emfsource->header_list); + while (link != NULL) { + struct _EMFormatHeader *h = link->data; + em_format_add_header (emf, h->name, h->flags); + link = g_list_next (link); + } } } @@ -928,12 +943,12 @@ em_format_set_default_charset(EMFormat *emf, const gchar *charset) * be shown. **/ void -em_format_clear_headers(EMFormat *emf) +em_format_clear_headers (EMFormat *emf) { EMFormatHeader *eh; - while ((eh = (EMFormatHeader *)e_dlist_remhead(&emf->header_list))) - g_free(eh); + while ((eh = g_queue_pop_head (&emf->header_list)) != NULL) + g_free (eh); } /* note: also copied in em-mailer-prefs.c */ @@ -988,7 +1003,7 @@ void em_format_add_header(EMFormat *emf, const gchar *name, guint32 flags) h = g_malloc(sizeof(*h) + strlen(name)); h->flags = flags; strcpy(h->name, name); - e_dlist_addtail(&emf->header_list, (EDListNode *)h); + g_queue_push_tail (&emf->header_list, h); } /** @@ -1553,8 +1568,7 @@ emf_multipart_related(EMFormat *emf, CamelStream *stream, CamelMimePart *part, c const gchar *start; gint i, nparts, partidlen, displayid = 0; gchar *oldpartid; - struct _EMFormatPURITree *ptree; - EMFormatPURI *puri, *purin; + GList *link; if (!CAMEL_IS_MULTIPART(mp)) { em_format_format_source(emf, stream, part); @@ -1601,6 +1615,8 @@ emf_multipart_related(EMFormat *emf, CamelStream *stream, CamelMimePart *part, c for (i = 0; i < nparts; i++) { body_part = camel_multipart_get_part(mp, i); if (body_part != display_part) { + EMFormatPURI *puri; + /* set the partid since add_puri uses it */ g_string_append_printf(emf->part_id, ".related.%d", i); puri = em_format_add_puri(emf, sizeof(EMFormatPURI), NULL, body_part, emf_write_related); @@ -1614,10 +1630,11 @@ emf_multipart_related(EMFormat *emf, CamelStream *stream, CamelMimePart *part, c g_string_truncate(emf->part_id, partidlen); camel_stream_flush(stream); - ptree = emf->pending_uri_level; - puri = (EMFormatPURI *)ptree->uri_list.head; - purin = puri->next; - while (purin) { + link = g_queue_peek_head_link (emf->pending_uri_level->data); + + while (link->next != NULL) { + EMFormatPURI *puri = link->data; + if (puri->use_count == 0) { d(printf("part '%s' '%s' used '%d'\n", puri->uri?puri->uri:"", puri->cid, puri->use_count)); if (puri->func == emf_write_related) { @@ -1627,8 +1644,8 @@ emf_multipart_related(EMFormat *emf, CamelStream *stream, CamelMimePart *part, c d(printf("unreferenced uri generated by format code: %s\n", puri->uri?puri->uri:puri->cid)); } } - puri = purin; - purin = purin->next; + + link = g_list_next (link); } g_string_printf(emf->part_id, "%s", oldpartid); diff --git a/em-format/em-format.h b/em-format/em-format.h index d3a331b6d6..4d8beaa228 100644 --- a/em-format/em-format.h +++ b/em-format/em-format.h @@ -36,7 +36,6 @@ #include <camel/camel-mime-part.h> #include <camel/camel-mime-message.h> #include <camel/camel-cipher-context.h> -#include <libedataserver/e-msgport.h> /* Standard GObject macros */ #define EM_TYPE_FORMAT \ @@ -89,7 +88,7 @@ struct _EMFormatHandler { EMFormatFunc handler; guint32 flags; - struct _EMFormatHandler *old; + EMFormatHandler *old; }; /** @@ -112,8 +111,6 @@ typedef void (*EMFormatPURIFunc)(EMFormat *md, CamelStream *stream, EMFormatPURI /** * struct _EMFormatPURI - Pending URI object. * - * @next: Double-linked list header. - * @prev: Double-linked list header. * @free: May be set by allocator and will be called when no longer needed. * @format: * @uri: Calculated URI of the part, if the part has one in its @@ -133,11 +130,8 @@ typedef void (*EMFormatPURIFunc)(EMFormat *md, CamelStream *stream, EMFormatPURI * This object may be subclassed as a struct. **/ struct _EMFormatPURI { - struct _EMFormatPURI *next; - struct _EMFormatPURI *prev; - - void (*free)(struct _EMFormatPURI *p); /* optional callback for freeing user-fields */ - struct _EMFormat *format; + void (*free)(EMFormatPURI *p); /* optional callback for freeing user-fields */ + EMFormat *format; gchar *uri; /* will be the location of the part, may be empty */ gchar *cid; /* will always be set, a fake one created if needed */ @@ -149,31 +143,7 @@ struct _EMFormatPURI { guint use_count; /* used by multipart/related to see if it was accessed */ }; -/** - * struct _EMFormatPURITree - Pending URI visibility tree. - * - * @next: Double-linked list header. - * @prev: Double-linked list header. - * @parent: Parent in tree. - * @uri_list: List of EMFormatPURI objects at this level. - * @children: Child nodes of EMFormatPURITree. - * - * This structure is used internally to form a visibility tree of - * parts in the current formatting stream. This is to implement the - * part resolution rules for RFC2387 to implement multipart/related. - **/ -struct _EMFormatPURITree { - struct _EMFormatPURITree *next; - struct _EMFormatPURITree *prev; - struct _EMFormatPURITree *parent; - - EDList uri_list; - EDList children; -}; - struct _EMFormatHeader { - struct _EMFormatHeader *next, *prev; - guint32 flags; /* E_FORMAT_HEADER_* */ gchar name[1]; }; @@ -226,7 +196,7 @@ struct _EMFormat { GString *part_id; /* current part id prefix, for identifying parts directly */ - EDList header_list; /* if empty, then all */ + GQueue header_list; /* if empty, then all */ CamelSession *session; /* session, used for authentication when required */ CamelURL *base; /* content-base header or absolute content-location, for any part */ @@ -245,10 +215,12 @@ struct _EMFormat { /* global lookup table for message */ GHashTable *pending_uri_table; - /* visibility tree, also stores every puri permanently */ - struct _EMFormatPURITree *pending_uri_tree; + /* This structure is used internally to form a visibility tree of + * parts in the current formatting stream. This is to implement the + * part resolution rules for RFC2387 to implement multipart/related. */ + GNode *pending_uri_tree; /* current level to search from */ - struct _EMFormatPURITree *pending_uri_level; + GNode *pending_uri_level; em_format_mode_t mode; /* source/headers/etc */ gchar *charset; /* charset override */ @@ -272,7 +244,7 @@ struct _EMFormatClass { void (*format_error)(EMFormat *, CamelStream *, const gchar *msg); /* use for external structured parts */ - void (*format_attachment)(EMFormat *, CamelStream *, CamelMimePart *, const gchar *mime_type, const struct _EMFormatHandler *info); + void (*format_attachment)(EMFormat *, CamelStream *, CamelMimePart *, const gchar *mime_type, const EMFormatHandler *info); /* use for unparsable content */ void (*format_source)(EMFormat *, CamelStream *, CamelMimePart *); @@ -367,7 +339,7 @@ void em_format_format_attachment (EMFormat *emf, CamelStream *stream, CamelMimePart *mime_part, const gchar *mime_type, - const struct _EMFormatHandler *info); + const EMFormatHandler *info); void em_format_format_error (EMFormat *emf, CamelStream *stream, const gchar *format, diff --git a/mail/e-searching-tokenizer.c b/mail/e-searching-tokenizer.c index b9a00cddf3..aac8a0a34f 100644 --- a/mail/e-searching-tokenizer.c +++ b/mail/e-searching-tokenizer.c @@ -34,7 +34,6 @@ #include "e-searching-tokenizer.h" #include "libedataserver/e-memory.h" -#include "libedataserver/e-msgport.h" #define d(x) @@ -353,8 +352,8 @@ struct _searcher { gint matchcount; - EDList input; /* pending 'input' tokens, processed but might match */ - EDList output; /* output tokens ready for source */ + GQueue input; /* pending 'input' tokens, processed but might match */ + GQueue output; /* output tokens ready for source */ struct _token *current; /* for token output memory management */ @@ -392,8 +391,8 @@ searcher_new (gint flags, gint argc, guchar **argv, const gchar *tags, const gch s->state = &s->t->root; s->matchcount = 0; - e_dlist_init(&s->input); - e_dlist_init(&s->output); + g_queue_init (&s->input); + g_queue_init (&s->output); s->current = NULL; s->offset = 0; @@ -420,9 +419,9 @@ searcher_free (struct _searcher *s) { struct _token *t; - while ((t = (struct _token *)e_dlist_remhead (&s->input))) + while ((t = g_queue_pop_head (&s->input)) != NULL) g_free (t); - while ((t = (struct _token *)e_dlist_remhead (&s->output))) + while ((t = g_queue_pop_head (&s->output)) != NULL) g_free (t); g_free (s->tags); g_free (s->tage); @@ -431,8 +430,9 @@ searcher_free (struct _searcher *s) free_trie (s->t); g_free (s); } + static struct _token * -append_token(EDList *list, const gchar *tok, gint len) +append_token (GQueue *queue, const gchar *tok, gint len) { struct _token *token; @@ -442,7 +442,7 @@ append_token(EDList *list, const gchar *tok, gint len) token->offset = 0; /* set by caller when required */ memcpy(token->tok, tok, len); token->tok[len] = 0; - e_dlist_addtail(list, (EDListNode *)token); + g_queue_push_tail (queue, token); return token; } @@ -458,7 +458,7 @@ output_token(struct _searcher *s, struct _token *token) if (token->tok[0] == TAG_ESCAPE) { if (token->offset >= s->offout) { d (printf("moving tag token '%s' from input to output\n", token->tok[0]==TAG_ESCAPE?token->tok+1:token->tok)); - e_dlist_addtail(&s->output, (EDListNode *)token); + g_queue_push_tail (&s->output, token); } else { d (printf("discarding tag token '%s' from input\n", token->tok[0]==TAG_ESCAPE?token->tok+1:token->tok)); free_token(token); @@ -472,7 +472,7 @@ output_token(struct _searcher *s, struct _token *token) memmove (token->tok, token->tok+pre, left+1); d (printf("adding partial remaining/failed '%s'\n", token->tok[0]==TAG_ESCAPE?token->tok+1:token->tok)); s->offout = offend; - e_dlist_addtail(&s->output, (EDListNode *)token); + g_queue_push_tail (&s->output, token); } else { d (printf("discarding whole token '%s'\n", token->tok[0]==TAG_ESCAPE?token->tok+1:token->tok)); free_token(token); @@ -483,14 +483,17 @@ output_token(struct _searcher *s, struct _token *token) static struct _token * find_token(struct _searcher *s, gint start) { - register struct _token *token; + GList *link; /* find token which is start token, from end of list back */ - token = (struct _token *)s->input.tailpred; - while (token->prev) { + link = g_queue_peek_tail_link (&s->input); + while (link != NULL) { + struct _token *token = link->data; + if (token->offset <= start) return token; - token = token->prev; + + link = g_list_previous (link); } return NULL; @@ -517,8 +520,8 @@ output_match(struct _searcher *s, guint start, guint end) d (printf("end in token '%s'\n", endtoken->tok[0]==TAG_ESCAPE?endtoken->tok+1:endtoken->tok)); /* output pending stuff that didn't match afterall */ - while ((struct _token *)s->input.head != starttoken) { - token = (struct _token *)e_dlist_remhead (&s->input); + while ((struct _token *) g_queue_peek_head (&s->input) != starttoken) { + token = g_queue_pop_head (&s->input); d (printf("appending failed match '%s'\n", token->tok[0]==TAG_ESCAPE?token->tok+1:token->tok)); output_token(s, token); } @@ -540,8 +543,8 @@ output_match(struct _searcher *s, guint start, guint end) /* output match node (s) */ if (starttoken != endtoken) { - while ((struct _token *)s->input.head != endtoken) { - token = (struct _token *)e_dlist_remhead (&s->input); + while ((struct _token *) g_queue_peek_head (&s->input) != endtoken) { + token = g_queue_pop_head (&s->input); d (printf("appending (partial) match node (head) '%s'\n", token->tok[0]==TAG_ESCAPE?token->tok+1:token->tok)); output_token(s, token); } @@ -622,7 +625,7 @@ output_pending (struct _searcher *s) { struct _token *token; - while ( (token = (struct _token *)e_dlist_remhead (&s->input)) ) + while ((token = g_queue_pop_head (&s->input)) != NULL) output_token(s, token); } @@ -645,8 +648,8 @@ flush_extra(struct _searcher *s) if (starttoken == NULL) return; - while ((struct _token *)s->input.head != starttoken) { - token = (struct _token *)e_dlist_remhead (&s->input); + while ((struct _token *) g_queue_peek_head (&s->input) != starttoken) { + token = g_queue_pop_head (&s->input); output_token(s, token); } } @@ -662,7 +665,7 @@ searcher_next_token(struct _searcher *s) gint offstart, offend; guint32 c; - while (e_dlist_empty(&s->output)) { + while (g_queue_is_empty (&s->output)) { /* get next token */ tok = (guchar *)s->next_token(s->next_data); if (tok == NULL) { @@ -724,7 +727,7 @@ searcher_next_token(struct _searcher *s) output_subpending (s); push_subpending (s, offstart, offend); /*output_match(s, offstart, offend);*/ - } else if (e_dlist_length(&s->input) > 8) { + } else if (g_queue_get_length (&s->input) > 8) { /* we're continuing to match and merge, but we have a lot of stuff waiting, so flush it out now since this is a safe point to do it */ output_subpending (s); @@ -749,7 +752,7 @@ searcher_next_token(struct _searcher *s) if (s->current) free_token(s->current); - s->current = token = (struct _token *)e_dlist_remhead (&s->output); + s->current = token = g_queue_pop_head (&s->output); return token ? g_strdup (token->tok) : NULL; } @@ -763,7 +766,7 @@ searcher_peek_token(struct _searcher *s) tok = searcher_next_token(s); if (tok) { /* need to clear this so we dont free it while its still active */ - e_dlist_addhead (&s->output, (EDListNode *)s->current); + g_queue_push_head (&s->output, s->current); s->current = NULL; } @@ -773,7 +776,7 @@ searcher_peek_token(struct _searcher *s) static gint searcher_pending (struct _searcher *s) { - return !(e_dlist_empty(&s->input) && e_dlist_empty(&s->output)); + return !(g_queue_is_empty (&s->input) && g_queue_is_empty (&s->output)); } /* ********************************************************************** */ diff --git a/mail/em-config.c b/mail/em-config.c index dcdf9b10ef..4b1e835627 100644 --- a/mail/em-config.c +++ b/mail/em-config.c @@ -30,7 +30,6 @@ #include <gtk/gtk.h> #include "em-config.h" -#include "libedataserver/e-msgport.h" #include "em-utils.h" #include "em-composer-utils.h" diff --git a/mail/em-event.c b/mail/em-event.c index de8f468fa9..4434e0a447 100644 --- a/mail/em-event.c +++ b/mail/em-event.c @@ -31,7 +31,6 @@ #include "em-event.h" #include "composer/e-msg-composer.h" -#include "libedataserver/e-msgport.h" #include <camel/camel-store.h> #include <camel/camel-folder.h> diff --git a/mail/em-format-hook.h b/mail/em-format-hook.h index e0560f4994..c03a826731 100644 --- a/mail/em-format-hook.h +++ b/mail/em-format-hook.h @@ -24,11 +24,8 @@ #ifndef __EM_FORMAT_HOOK_H__ #define __EM_FORMAT_HOOK_H__ -#include <glib-object.h> -#include "libedataserver/e-msgport.h" -#include "e-util/e-plugin.h" - -#include "em-format/em-format.h" +#include <e-util/e-plugin.h> +#include <em-format/em-format.h> G_BEGIN_DECLS diff --git a/mail/em-format-html-display.c b/mail/em-format-html-display.c index 620f56e85a..46241186aa 100644 --- a/mail/em-format-html-display.c +++ b/mail/em-format-html-display.c @@ -62,7 +62,6 @@ #include <e-util/e-util.h> #include <e-util/e-util-private.h> -#include <libedataserver/e-msgport.h> #include "e-util/e-datetime-format.h" #include <e-util/e-dialog-utils.h> #include <e-util/e-icon-factory.h> diff --git a/mail/em-format-html.c b/mail/em-format-html.c index 80fa6b6567..53d10e8f12 100644 --- a/mail/em-format-html.c +++ b/mail/em-format-html.c @@ -72,8 +72,6 @@ #include <camel/camel-data-cache.h> #include <camel/camel-file-utils.h> -#include <libedataserver/e-msgport.h> - #include "mail-config.h" #include "mail-mt.h" @@ -105,7 +103,7 @@ struct _EMFormatHTMLPrivate { /* Table that re-maps text parts into a mutlipart/mixed, EMFormatHTMLCache * */ GHashTable *text_inline_parts; - EDList pending_jobs; + GQueue pending_jobs; GMutex *lock; GdkColor colors[EM_FORMAT_HTML_NUM_COLOR_TYPES]; @@ -168,14 +166,17 @@ efh_format_desc (struct _format_msg *m) static void efh_format_exec (struct _format_msg *m) { + EMFormat *format; struct _EMFormatHTMLJob *job; - struct _EMFormatPURITree *puri_level; + GNode *puri_level; gint cancelled = FALSE; CamelURL *base; if (m->format->html == NULL) return; + format = EM_FORMAT (m->format); + camel_stream_printf ( (CamelStream *)m->estream, "<!doctype html public \"-//W3C//DTD HTML 4.0 TRANSITIONAL//EN\">\n<html>\n" @@ -190,28 +191,40 @@ efh_format_exec (struct _format_msg *m) /* <insert top-header stuff here> */ - if (((EMFormat *)m->format)->mode == EM_FORMAT_SOURCE) { - em_format_format_source((EMFormat *)m->format, (CamelStream *)m->estream, (CamelMimePart *)m->message); + if (format->mode == EM_FORMAT_SOURCE) { + em_format_format_source ( + format, (CamelStream *) m->estream, + (CamelMimePart *) m->message); } else { const EMFormatHandler *handle; + const gchar *mime_type; + + mime_type = "x-evolution/message/prefix"; + handle = em_format_find_handler (format, mime_type); + + if (handle != NULL) + handle->handler ( + format, (CamelStream *) m->estream, + (CamelMimePart *) m->message, handle); - handle = em_format_find_handler((EMFormat *)m->format, "x-evolution/message/prefix"); - if (handle) - handle->handler((EMFormat *)m->format, (CamelStream *)m->estream, (CamelMimePart *)m->message, handle); - handle = em_format_find_handler((EMFormat *)m->format, "x-evolution/message/rfc822"); - if (handle) - handle->handler((EMFormat *)m->format, (CamelStream *)m->estream, (CamelMimePart *)m->message, handle); + mime_type = "x-evolution/message/rfc822"; + handle = em_format_find_handler (format, mime_type); + + if (handle != NULL) + handle->handler ( + format, (CamelStream *) m->estream, + (CamelMimePart *) m->message, handle); } camel_stream_flush((CamelStream *)m->estream); - puri_level = ((EMFormat *)m->format)->pending_uri_level; - base = ((EMFormat *)m->format)->base; + puri_level = format->pending_uri_level; + base = format->base; do { /* now dispatch any added tasks ... */ g_mutex_lock(m->format->priv->lock); - while ((job = (struct _EMFormatHTMLJob *)e_dlist_remhead(&m->format->priv->pending_jobs))) { + while ((job = g_queue_pop_head (&m->format->priv->pending_jobs))) { g_mutex_unlock(m->format->priv->lock); /* This is an implicit check to see if the gtkhtml has been destroyed */ @@ -223,11 +236,11 @@ efh_format_exec (struct _format_msg *m) cancelled = camel_operation_cancel_check(NULL); /* call jobs even if cancelled, so they can clean up resources */ - ((EMFormat *)m->format)->pending_uri_level = job->puri_level; + format->pending_uri_level = job->puri_level; if (job->base) - ((EMFormat *)m->format)->base = job->base; - job->callback(job, cancelled); - ((EMFormat *)m->format)->base = base; + format->base = job->base; + job->callback (job, cancelled); + format->base = base; /* clean up the job */ camel_object_unref(job->stream); @@ -249,12 +262,11 @@ efh_format_exec (struct _format_msg *m) m->estream = NULL; } - /* e_dlist_empty is atomic and doesn't need locking */ - } while (!e_dlist_empty(&m->format->priv->pending_jobs)); + } while (!g_queue_is_empty (&m->format->priv->pending_jobs)); d(printf("out of jobs, done\n")); - ((EMFormat *)m->format)->pending_uri_level = puri_level; + format->pending_uri_level = puri_level; } static void @@ -312,7 +324,7 @@ efh_format_timeout(struct _format_msg *m) return TRUE; } - g_return_val_if_fail (e_dlist_empty(&p->pending_jobs), FALSE); + g_return_val_if_fail (g_queue_is_empty (&p->pending_jobs), FALSE); d(printf(" ready to go, firing off format thread\n")); @@ -879,8 +891,8 @@ efh_init (EMFormatHTML *efh, efh->priv = EM_FORMAT_HTML_GET_PRIVATE (efh); - e_dlist_init(&efh->pending_object_list); - e_dlist_init(&efh->priv->pending_jobs); + g_queue_init (&efh->pending_object_list); + g_queue_init (&efh->priv->pending_jobs); efh->priv->lock = g_mutex_new(); efh->priv->format_id = -1; efh->priv->text_inline_parts = g_hash_table_new_full ( @@ -1173,57 +1185,84 @@ em_format_html_add_pobject(EMFormatHTML *efh, gsize size, const gchar *classid, pobj->func = func; pobj->part = part; - e_dlist_addtail(&efh->pending_object_list, (EDListNode *)pobj); + g_queue_push_tail (&efh->pending_object_list, pobj); return pobj; } EMFormatHTMLPObject * -em_format_html_find_pobject(EMFormatHTML *emf, const gchar *classid) +em_format_html_find_pobject (EMFormatHTML *emf, + const gchar *classid) { - EMFormatHTMLPObject *pw; + GList *link; + + g_return_val_if_fail (EM_IS_FORMAT_HTML (emf), NULL); + g_return_val_if_fail (classid != NULL, NULL); + + link = g_queue_peek_head_link (&emf->pending_object_list); - pw = (EMFormatHTMLPObject *)emf->pending_object_list.head; - while (pw->next) { - if (!strcmp(pw->classid, classid)) + while (link != NULL) { + EMFormatHTMLPObject *pw = link->data; + + if (!strcmp (pw->classid, classid)) return pw; - pw = pw->next; + + link = g_list_next (link); } return NULL; } EMFormatHTMLPObject * -em_format_html_find_pobject_func(EMFormatHTML *emf, CamelMimePart *part, EMFormatHTMLPObjectFunc func) +em_format_html_find_pobject_func (EMFormatHTML *emf, + CamelMimePart *part, + EMFormatHTMLPObjectFunc func) { - EMFormatHTMLPObject *pw; + GList *link; + + g_return_val_if_fail (EM_IS_FORMAT_HTML (emf), NULL); + + link = g_queue_peek_head_link (&emf->pending_object_list); + + while (link != NULL) { + EMFormatHTMLPObject *pw = link->data; - pw = (EMFormatHTMLPObject *)emf->pending_object_list.head; - while (pw->next) { if (pw->func == func && pw->part == part) return pw; - pw = pw->next; + + link = g_list_next (link); } return NULL; } void -em_format_html_remove_pobject(EMFormatHTML *emf, EMFormatHTMLPObject *pobject) +em_format_html_remove_pobject (EMFormatHTML *emf, + EMFormatHTMLPObject *pobject) { - e_dlist_remove((EDListNode *)pobject); - if (pobject->free) - pobject->free(pobject); - g_free(pobject->classid); - g_free(pobject); + g_return_if_fail (EM_IS_FORMAT_HTML (emf)); + g_return_if_fail (pobject != NULL); + + g_queue_remove (&emf->pending_object_list, pobject); + + if (pobject->free != NULL) + pobject->free (pobject); + + g_free (pobject->classid); + g_free (pobject); } void -em_format_html_clear_pobject(EMFormatHTML *emf) +em_format_html_clear_pobject (EMFormatHTML *emf) { - d(printf("clearing pending objects\n")); - while (!e_dlist_empty(&emf->pending_object_list)) - em_format_html_remove_pobject(emf, (EMFormatHTMLPObject *)emf->pending_object_list.head); + g_return_if_fail (EM_IS_FORMAT_HTML (emf)); + + while (!g_queue_is_empty (&emf->pending_object_list)) { + EMFormatHTMLPObject *pobj; + + pobj = g_queue_pop_head (&emf->pending_object_list); + em_format_html_remove_pobject (emf, pobj); + } } struct _EMFormatHTMLJob * @@ -1245,7 +1284,7 @@ void em_format_html_job_queue(EMFormatHTML *emfh, struct _EMFormatHTMLJob *job) { g_mutex_lock(emfh->priv->lock); - e_dlist_addtail(&emfh->priv->pending_jobs, (EDListNode *)job); + g_queue_push_tail (&emfh->priv->pending_jobs, job); g_mutex_unlock(emfh->priv->lock); } @@ -1432,9 +1471,9 @@ efh_object_requested(GtkHTML *html, GtkHTMLEmbedded *eb, EMFormatHTML *efh) pobject = em_format_html_find_pobject(efh, eb->classid); if (pobject) { /* This stops recursion of the part */ - e_dlist_remove((EDListNode *)pobject); + g_queue_remove (&efh->pending_object_list, pobject); res = pobject->func(efh, eb, pobject); - e_dlist_addhead(&efh->pending_object_list, (EDListNode *)pobject); + g_queue_push_head (&efh->pending_object_list, pobject); } else { d(printf("HTML Includes reference to unknown object '%s'\n", eb->classid)); } @@ -1891,34 +1930,37 @@ emfh_write_related(EMFormat *emf, CamelStream *stream, EMFormatPURI *puri) static void emfh_multipart_related_check(struct _EMFormatHTMLJob *job, gint cancelled) { - struct _EMFormatPURITree *ptree; - EMFormatPURI *puri, *purin; + EMFormat *format; + GList *link; gchar *oldpartid; if (cancelled) return; + format = EM_FORMAT (job->format); + d(printf(" running multipart/related check task\n")); - oldpartid = g_strdup(((EMFormat *)job->format)->part_id->str); + oldpartid = g_strdup (format->part_id->str); + + link = g_queue_peek_head_link (job->puri_level->data); + + while (link->next != NULL) { + EMFormatPURI *puri = link->data; - ptree = job->puri_level; - puri = (EMFormatPURI *)ptree->uri_list.head; - purin = puri->next; - while (purin) { if (puri->use_count == 0) { d(printf("part '%s' '%s' used '%d'\n", puri->uri?puri->uri:"", puri->cid, puri->use_count)); if (puri->func == emfh_write_related) { - g_string_printf(((EMFormat *)job->format)->part_id, "%s", puri->part_id); - em_format_part((EMFormat *)job->format, (CamelStream *)job->stream, puri->part); + g_string_printf (format->part_id, "%s", puri->part_id); + em_format_part (format, (CamelStream *)job->stream, puri->part); } /* else it was probably added by a previous format this loop */ } - puri = purin; - purin = purin->next; + + link = g_list_next (link); } - g_string_printf(((EMFormat *)job->format)->part_id, "%s", oldpartid); - g_free(oldpartid); + g_string_printf (format->part_id, "%s", oldpartid); + g_free (oldpartid); } /* RFC 2387 */ @@ -2407,7 +2449,6 @@ static void efh_format_headers(EMFormatHTML *efh, CamelStream *stream, CamelMedium *part) { EMFormat *emf = (EMFormat *) efh; - EMFormatHeader *h; const gchar *charset; CamelContentType *ct; struct _camel_header_raw *header; @@ -2499,7 +2540,6 @@ efh_format_headers(EMFormatHTML *efh, CamelStream *stream, CamelMedium *part) camel_stream_printf (stream, "<tr><td><table border=0 cellpadding=\"0\">\n"); /* dump selected headers */ - h = (EMFormatHeader *)emf->header_list.head; if (emf->mode == EM_FORMAT_ALLHEADERS) { header = ((CamelMimePart *)part)->headers; while (header) { @@ -2507,8 +2547,13 @@ efh_format_headers(EMFormatHTML *efh, CamelStream *stream, CamelMedium *part) header = header->next; } } else { + GList *link; gint mailer_shown = FALSE; - while (h->next) { + + link = g_queue_peek_head_link (&emf->header_list); + + while (link != NULL) { + EMFormatHeader *h = link->data; gint mailer, face; header = ((CamelMimePart *)part)->headers; @@ -2565,7 +2610,8 @@ efh_format_headers(EMFormatHTML *efh, CamelStream *stream, CamelMedium *part) header = header->next; } - h = h->next; + + link = g_list_next (link); } } diff --git a/mail/em-format-html.h b/mail/em-format-html.h index 4f9c0b209b..a76ae9cfb7 100644 --- a/mail/em-format-html.h +++ b/mail/em-format-html.h @@ -92,8 +92,6 @@ typedef struct _EMFormatHTMLJob EMFormatHTMLJob; /** * struct _EMFormatHTMLJob - A formatting job. * - * @next: Double linked list header. - * @prev: Double linked list header. * @format: Set by allocation function. * @stream: Free for use by caller. * @puri_level: Set by allocation function. @@ -113,15 +111,12 @@ typedef struct _EMFormatHTMLJob EMFormatHTMLJob; * may be used to allocate these. **/ struct _EMFormatHTMLJob { - EMFormatHTMLJob *next; - EMFormatHTMLJob *prev; - EMFormatHTML *format; CamelStream *stream; /* We need to track the state of the visibility tree at the point this uri was generated */ - struct _EMFormatPURITree *puri_level; + GNode *puri_level; CamelURL *base; void (*callback)(EMFormatHTMLJob *job, gint cancelled); @@ -129,7 +124,7 @@ struct _EMFormatHTMLJob { gchar *uri; CamelMedium *msg; EMFormatPURI *puri; - struct _EMFormatPURITree *puri_level; + GNode *puri_level; gpointer data; } u; }; @@ -142,8 +137,6 @@ typedef gboolean (*EMFormatHTMLPObjectFunc)(EMFormatHTML *md, GtkHTMLEmbedded *e /** * struct _EMFormatHTMLPObject - Pending object. * - * @next: Double linked list header. - * @prev: Double linked list header. * @free: Invoked when the object is no longer needed. * @format: The parent formatter. * @classid: The assigned class id as passed to add_pobject(). @@ -158,9 +151,6 @@ typedef gboolean (*EMFormatHTMLPObjectFunc)(EMFormatHTML *md, GtkHTMLEmbedded *e * em_format_html_add_pobject() may be used to allocate these. **/ struct _EMFormatHTMLPObject { - EMFormatHTMLPObject *next; - EMFormatHTMLPObject *prev; - void (*free)(EMFormatHTMLPObject *); EMFormatHTML *format; @@ -211,7 +201,7 @@ struct _EMFormatHTML { GtkHTML *html; - EDList pending_object_list; + GQueue pending_object_list; GSList *headers; diff --git a/mail/em-subscribe-editor.c b/mail/em-subscribe-editor.c index e9c933de50..b6d7404795 100644 --- a/mail/em-subscribe-editor.c +++ b/mail/em-subscribe-editor.c @@ -33,7 +33,6 @@ #include "camel/camel-exception.h" #include "camel/camel-store.h" #include "camel/camel-session.h" -#include "libedataserver/e-msgport.h" #include "e-util/e-account-utils.h" #include "e-util/e-util-private.h" @@ -49,7 +48,7 @@ typedef struct _EMSubscribeEditor EMSubscribeEditor; struct _EMSubscribeEditor { - EDList stores; + GQueue stores; gint busy; guint busy_id; @@ -65,9 +64,6 @@ struct _EMSubscribeEditor { typedef struct _EMSubscribe EMSubscribe; struct _EMSubscribe { - struct _EMSubscribe *next; - struct _EMSubscribe *prev; - gint ref_count; gint cancel; gint seq; /* upped every time we refresh */ @@ -88,11 +84,11 @@ struct _EMSubscribe { /* pending LISTs, EMSubscribeNode's */ gint pending_id; - EDList pending; + GQueue pending; /* queue of pending UN/SUBSCRIBEs, EMsg's */ gint subscribe_id; - EDList subscribe; + GQueue subscribe; /* working variables at runtime */ gint selected_count; @@ -102,16 +98,12 @@ struct _EMSubscribe { typedef struct _EMSubscribeNode EMSubscribeNode; struct _EMSubscribeNode { - struct _EMSubscribeNode *next; - struct _EMSubscribeNode *prev; - CamelFolderInfo *info; GtkTreePath *path; }; typedef struct _MailMsgListNode MailMsgListNode; struct _MailMsgListNode { - EDListNode node; MailMsg *msg; }; @@ -215,7 +207,7 @@ sub_folder_done (struct _zsubscribe_msg *m) } /* queue any further ones, or if out, update the ui */ - msgListNode = (MailMsgListNode *) e_dlist_remhead(&m->sub->subscribe); + msgListNode = g_queue_pop_head (&m->sub->subscribe); if (msgListNode) { next = (struct _zsubscribe_msg *) msgListNode->msg; /* Free the memory of the MailMsgListNode which won't be used anymore. */ @@ -267,7 +259,7 @@ sub_subscribe_folder (EMSubscribe *sub, EMSubscribeNode *node, gint state, const msgListNode = g_malloc0(sizeof(MailMsgListNode)); msgListNode->msg = (MailMsg *) m; d(printf("queueing subscribe folder '%s'\n", spath)); - e_dlist_addtail(&sub->subscribe, (EDListNode *)msgListNode); + g_queue_push_tail (&sub->subscribe, msgListNode); } return id; @@ -325,7 +317,7 @@ sub_fill_level(EMSubscribe *sub, CamelFolderInfo *info, GtkTreeIter *parent, gi } else { if (pending) - e_dlist_addtail(&sub->pending, (EDListNode *)node); + g_queue_push_tail (&sub->pending, node); } } else { d(printf("%s:%s: fi->flags & CAMEL_FOLDER_NOINFERIORS=%d\t node->path=[%p]\n", @@ -388,7 +380,7 @@ sub_folderinfo_done (struct _emse_folderinfo_msg *m) } /* check for more to do */ - node = (EMSubscribeNode *)e_dlist_remhead(&m->sub->pending); + node = g_queue_pop_head (&m->sub->pending); if (node) sub_queue_fill_level(m->sub, node); } @@ -548,10 +540,10 @@ sub_row_expanded(GtkTreeView *tree, GtkTreeIter *iter, GtkTreePath *path, EMSubs } } - e_dlist_addhead(&sub->pending, (EDListNode *)node); + g_queue_push_head (&sub->pending, node); if (sub->pending_id == -1 - && (node = (EMSubscribeNode *)e_dlist_remtail(&sub->pending))) + && (node = g_queue_pop_tail (&sub->pending)) != NULL) sub_queue_fill_level(sub, node); } @@ -570,7 +562,7 @@ sub_destroy(GtkWidget *w, EMSubscribe *sub) if (sub->subscribe_id != -1) mail_msg_cancel(sub->subscribe_id); - while ( (msgListNode = (MailMsgListNode *)e_dlist_remhead(&sub->subscribe))) { + while ((msgListNode = g_queue_pop_head (&sub->subscribe)) != NULL) { m = (struct _zsubscribe_msg *) msgListNode->msg; /* Free the memory of MailMsgListNode which won't be used anymore. */ g_free(msgListNode); @@ -590,9 +582,9 @@ subscribe_new(EMSubscribeEditor *se, const gchar *uri) sub->editor = se; sub->ref_count = 1; sub->pending_id = -1; - e_dlist_init(&sub->pending); + g_queue_init (&sub->pending); sub->subscribe_id = -1; - e_dlist_init(&sub->subscribe); + g_queue_init (&sub->subscribe); sub->store_id = -1; return sub; @@ -696,7 +688,7 @@ sub_editor_refresh(GtkWidget *w, EMSubscribeEditor *se) gtk_tree_store_clear((GtkTreeStore *)gtk_tree_view_get_model(sub->tree)); - e_dlist_init(&sub->pending); + g_queue_init (&sub->pending); if (sub->folders) g_hash_table_destroy(sub->folders); @@ -732,7 +724,7 @@ static void sub_editor_combobox_changed (GtkWidget *w, EMSubscribeEditor *se) { gint i, n; - struct _EMSubscribe *sub; + GList *link; d(printf("combobox changed\n")); @@ -757,8 +749,10 @@ sub_editor_combobox_changed (GtkWidget *w, EMSubscribeEditor *se) } se->current = NULL; - sub = (struct _EMSubscribe *)se->stores.head; - while (sub->next) { + link = g_queue_peek_head_link (&se->stores); + while (link != NULL) { + struct _EMSubscribe *sub = link->data; + if (i == n) { se->current = sub; if (sub->widget) { @@ -772,7 +766,8 @@ sub_editor_combobox_changed (GtkWidget *w, EMSubscribeEditor *se) gtk_widget_hide(sub->widget); } i++; - sub = sub->next; + + link = g_list_next (link); } } @@ -833,7 +828,7 @@ em_subscribe_editor_new(void) gchar *gladefile; se = g_malloc0(sizeof(*se)); - e_dlist_init(&se->stores); + g_queue_init (&se->stores); gladefile = g_build_filename (EVOLUTION_GLADEDIR, "mail-dialogs.glade", @@ -910,7 +905,9 @@ em_subscribe_editor_new(void) 0, account->name, 1, TRUE, -1); - e_dlist_addtail(&se->stores, (EDListNode *)subscribe_new(se, account->source->url)); + g_queue_push_tail ( + &se->stores, subscribe_new ( + se, account->source->url)); } else { d(printf("not adding account '%s'\n", account->name)); } diff --git a/mail/mail-folder-cache.c b/mail/mail-folder-cache.c index e7144df0f9..e9ffc5196e 100644 --- a/mail/mail-folder-cache.c +++ b/mail/mail-folder-cache.c @@ -45,7 +45,6 @@ #include <camel/camel-disco-store.h> #include <libedataserver/e-data-server-util.h> -#include <libedataserver/e-msgport.h> #include "e-util/e-util.h" #include "shell/e-shell.h" @@ -89,9 +88,6 @@ struct _folder_info { /* pending list of updates */ struct _folder_update { - struct _folder_update *next; - struct _folder_update *prev; - guint remove:1; /* removing from vfolders */ guint delete:1; /* deleting as well? */ guint add:1; /* add to vfolder */ @@ -114,7 +110,7 @@ struct _store_info { CamelStore *store; /* the store for these folders */ /* Outstanding folderinfo requests */ - EDList folderinfo_updates; + GQueue folderinfo_updates; }; static void folder_changed(CamelObject *o, gpointer event_data, gpointer user_data); @@ -128,7 +124,7 @@ static gboolean ping_cb (gpointer user_data); static GHashTable *stores = NULL; /* List of folder changes to be executed in gui thread */ -static EDList updates = E_DLIST_INITIALISER(updates); +static GQueue updates = G_QUEUE_INIT; static gint update_id = -1; /* hack for people who LIKE to have unsent count */ @@ -158,7 +154,7 @@ real_flush_updates (void) default_model = em_folder_tree_model_get_default (); G_LOCK (stores); - while ((up = (struct _folder_update *)e_dlist_remhead(&updates))) { + while ((up = g_queue_pop_head (&updates)) != NULL) { G_UNLOCK (stores); if (up->remove) { @@ -235,7 +231,7 @@ real_flush_updates (void) static void flush_updates (void) { - if (update_id == -1 && !e_dlist_empty(&updates)) + if (update_id == -1 && !g_queue_is_empty (&updates)) update_id = mail_async_event_emit ( mail_async_event, MAIL_ASYNC_GUI, (MailAsyncFunc) real_flush_updates, @@ -268,7 +264,7 @@ unset_folder_info(struct _folder_info *mfi, gint delete, gint unsub) camel_object_ref(up->store); up->uri = g_strdup(mfi->uri); - e_dlist_addtail(&updates, (EDListNode *)up); + g_queue_push_head (&updates, up); flush_updates(); } } @@ -355,7 +351,7 @@ update_1folder(struct _folder_info *mfi, gint new, CamelFolderInfo *info) up->store = mfi->store_info->store; up->uri = g_strdup(mfi->uri); camel_object_ref(up->store); - e_dlist_addtail(&updates, (EDListNode *)up); + g_queue_push_head (&updates, up); flush_updates(); } @@ -389,7 +385,7 @@ setup_folder(CamelFolderInfo *fi, struct _store_info *si) if ((fi->flags & CAMEL_FOLDER_NOSELECT) == 0) up->add = TRUE; - e_dlist_addtail(&updates, (EDListNode *)up); + g_queue_push_head (&updates, up); flush_updates(); } } @@ -669,7 +665,7 @@ rename_folders(struct _store_info *si, const gchar *oldbase, const gchar *newbas if ((fi->flags & CAMEL_FOLDER_NOSELECT) == 0) up->add = TRUE; - e_dlist_addtail(&updates, (EDListNode *)up); + g_queue_push_tail (&updates, up); flush_updates(); #if 0 if (fi->sibling) @@ -755,9 +751,6 @@ store_folder_renamed(CamelObject *o, gpointer event_data, gpointer data) } struct _update_data { - struct _update_data *next; - struct _update_data *prev; - gint id; /* id for cancellation */ guint cancel:1; /* also tells us we're cancelled */ @@ -780,7 +773,6 @@ free_folder_info_hash(gchar *path, struct _folder_info *mfi, gpointer data) void mail_note_store_remove(CamelStore *store) { - struct _update_data *ud; struct _store_info *si; g_return_if_fail (CAMEL_IS_STORE(store)); @@ -792,6 +784,7 @@ mail_note_store_remove(CamelStore *store) G_LOCK (stores); si = g_hash_table_lookup(stores, store); if (si) { + GList *link; g_hash_table_remove(stores, store); camel_object_unhook_event(store, "folder_opened", store_folder_opened, NULL); @@ -802,12 +795,16 @@ mail_note_store_remove(CamelStore *store) camel_object_unhook_event(store, "folder_unsubscribed", store_folder_unsubscribed, NULL); g_hash_table_foreach(si->folders, (GHFunc)unset_folder_info_hash, NULL); - ud = (struct _update_data *)si->folderinfo_updates.head; - while (ud->next) { + link = g_queue_peek_head_link (&si->folderinfo_updates); + + while (link != NULL) { + struct _update_data *ud = link->data; + d(printf("Cancelling outstanding folderinfo update %d\n", ud->id)); mail_msg_cancel(ud->id); ud->cancel = 1; - ud = ud->next; + + link = g_list_next (link); } camel_object_unref(si->store); @@ -834,7 +831,7 @@ update_folders(CamelStore *store, CamelFolderInfo *fi, gpointer data) if (si && !ud->cancel) { /* the 'si' is still there, so we can remove ourselves from its list */ /* otherwise its not, and we're on our own and free anyway */ - e_dlist_remove((EDListNode *)ud); + g_queue_remove (&si->folderinfo_updates, ud); if (fi) create_folders(fi, si); @@ -979,7 +976,7 @@ mail_note_store(CamelStore *store, CamelOperation *op, si->store = store; camel_object_ref((CamelObject *)store); g_hash_table_insert(stores, store, si); - e_dlist_init(&si->folderinfo_updates); + g_queue_init (&si->folderinfo_updates); hook = TRUE; } @@ -1010,7 +1007,7 @@ mail_note_store(CamelStore *store, CamelOperation *op, ud->id = mail_get_folderinfo (store, op, update_folders, ud); } - e_dlist_addtail (&si->folderinfo_updates, (EDListNode *) ud); + g_queue_push_tail (&si->folderinfo_updates, ud); G_UNLOCK (stores); |