From 88b02e9cf481aee0762f7e7bc0b32032cdfeb899 Mon Sep 17 00:00:00 2001 From: Not Zed Date: Thu, 11 Mar 2004 03:05:43 +0000 Subject: pass the raw header in instead of name and value. (efh_format_headers): if 2004-03-11 Not Zed * em-format-html.c (efh_format_header): pass the raw header in instead of name and value. (efh_format_headers): if we have specific headers to show, iterate over all headers and print out all matching ones, so duplicate headers are properly displayed. Related to #55298. * em-folder-selector.c (em_folder_selector_construct): dont set this to be modal. otherwise you can't click on error popups. duh. 2004-03-08 Not Zed * em-folder-selection-button.c (em_folder_selection_button_clicked): don't let the user select virtual/vtrash folders or non-selectable folders. * mail-component.c (impl_createControls): disable selection of non-select rows. * em-folder-selector.c (em_folder_selector_create_new): exclude folders with noinferiors set. * em-folder-tree.c (folder_tree_new): add folder tree arg, hook onto the selection funciton for the tree selection. (emft_select_func): selection override function. allow certain things to be excluded. (em_folder_tree_set_excluded): api to set what is excluded from the selectability. (emft_tree_row_activated): call emft_select_func check to see if this row is excluded before emitting an activated signal. * em-folder-tree-model.c (em_folder_tree_model_set_folder_info): save folder info->flags in the tree store. * mail-folder-cache.c (create_folders): use tail recursion. (get_folders): tail recurse. * (*): Fixed for api changes in camel. svn path=/trunk/; revision=25020 --- mail/ChangeLog | 40 +++++++++++++++++++++++++++++ mail/em-folder-selection-button.c | 2 +- mail/em-folder-selector.c | 2 +- mail/em-folder-tree-model.c | 14 ++++++----- mail/em-folder-tree-model.h | 6 ++--- mail/em-folder-tree.c | 53 +++++++++++++++++++++++++++++++-------- mail/em-folder-tree.h | 11 ++++++-- mail/em-format-html.c | 36 +++++++++++++------------- mail/em-subscribe-editor.c | 2 +- mail/mail-component.c | 1 + mail/mail-folder-cache.c | 40 ++++++++++++++++------------- mail/mail-ops.c | 20 +++++++-------- 12 files changed, 156 insertions(+), 71 deletions(-) (limited to 'mail') diff --git a/mail/ChangeLog b/mail/ChangeLog index 5be2dcecc7..17e8519e47 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,3 +1,43 @@ +2004-03-11 Not Zed + + * em-format-html.c (efh_format_header): pass the raw header in + instead of name and value. + (efh_format_headers): if we have specific headers to show, iterate + over all headers and print out all matching ones, so duplicate + headers are properly displayed. Related to #55298. + + * em-folder-selector.c (em_folder_selector_construct): dont set + this to be modal. otherwise you can't click on error popups. duh. + +2004-03-08 Not Zed + + * em-folder-selection-button.c + (em_folder_selection_button_clicked): don't let the user select + virtual/vtrash folders or non-selectable folders. + + * mail-component.c (impl_createControls): disable selection of + non-select rows. + + * em-folder-selector.c (em_folder_selector_create_new): exclude + folders with noinferiors set. + + * em-folder-tree.c (folder_tree_new): add folder tree arg, hook + onto the selection funciton for the tree selection. + (emft_select_func): selection override function. allow certain + things to be excluded. + (em_folder_tree_set_excluded): api to set what is excluded from + the selectability. + (emft_tree_row_activated): call emft_select_func check to see if + this row is excluded before emitting an activated signal. + + * em-folder-tree-model.c (em_folder_tree_model_set_folder_info): + save folder info->flags in the tree store. + + * mail-folder-cache.c (create_folders): use tail recursion. + (get_folders): tail recurse. + + * (*): Fixed for api changes in camel. + 2004-03-10 Jeffrey Stedfast Fix for bug #55298. diff --git a/mail/em-folder-selection-button.c b/mail/em-folder-selection-button.c index c6dc309d6b..e898be02ba 100644 --- a/mail/em-folder-selection-button.c +++ b/mail/em-folder-selection-button.c @@ -220,7 +220,7 @@ em_folder_selection_button_clicked (GtkButton *button) model = mail_component_peek_tree_model (mail_component_peek ()); emft = (EMFolderTree *) em_folder_tree_new_with_model (model); em_folder_tree_set_multiselect (emft, priv->multiple_select); - + em_folder_tree_set_excluded(emft, EMFT_EXCLUDE_NOSELECT|EMFT_EXCLUDE_VIRTUAL|EMFT_EXCLUDE_VTRASH); dialog = em_folder_selector_new (emft, EM_FOLDER_SELECTOR_CAN_CREATE, priv->title, priv->caption); if (priv->multiple_select) em_folder_selector_set_selected_list ((EMFolderSelector *) dialog, priv->uris); diff --git a/mail/em-folder-selector.c b/mail/em-folder-selector.c index 3a587ddc72..4201fbd044 100644 --- a/mail/em-folder-selector.c +++ b/mail/em-folder-selector.c @@ -223,7 +223,6 @@ em_folder_selector_construct (EMFolderSelector *emfs, EMFolderTree *emft, guint3 GtkWidget *label; gtk_window_set_default_size (GTK_WINDOW (emfs), 350, 300); - gtk_window_set_modal (GTK_WINDOW (emfs), TRUE); gtk_window_set_title (GTK_WINDOW (emfs), title); gtk_container_set_border_width (GTK_CONTAINER (emfs), 6); @@ -298,6 +297,7 @@ em_folder_selector_create_new (EMFolderTree *emft, guint32 flags, const char *ti emfs = g_object_new (em_folder_selector_get_type (), NULL); em_folder_selector_construct (emfs, emft, flags, title, text); + em_folder_tree_set_excluded(emft, EMFT_EXCLUDE_NOINFERIORS); hbox = gtk_hbox_new (FALSE, 0); w = gtk_label_new_with_mnemonic (_("Folder _name:")); diff --git a/mail/em-folder-tree-model.c b/mail/em-folder-tree-model.c index a095a88da6..62b526496a 100644 --- a/mail/em-folder-tree-model.c +++ b/mail/em-folder-tree-model.c @@ -59,6 +59,7 @@ static GType col_types[] = { G_TYPE_STRING, /* path */ G_TYPE_STRING, /* uri */ G_TYPE_UINT, /* unread count */ + G_TYPE_UINT, /* flags */ G_TYPE_BOOLEAN, /* is a store node */ G_TYPE_BOOLEAN, /* has not-yet-loaded subfolders */ }; @@ -433,13 +434,13 @@ em_folder_tree_model_set_folder_info (EMFolderTreeModel *model, GtkTreeIter *ite path_row = gtk_tree_row_reference_copy (uri_row); gtk_tree_path_free (path); - g_hash_table_insert (model->uri_hash, g_strdup (fi->url), uri_row); + g_hash_table_insert (model->uri_hash, g_strdup (fi->uri), uri_row); g_hash_table_insert (si->path_hash, g_strdup (fi->path), path_row); /* HACK: if we have the folder, and its the outbox folder, we need the total count, not unread */ /* This is duplicated in mail-folder-cache too, should perhaps be functionised */ - unread = fi->unread_message_count == -1 ? 0 : fi->unread_message_count; - if (mail_note_get_folder_from_uri(fi->url, &folder) && folder) { + unread = fi->unread == -1 ? 0 : fi->unread; + if (mail_note_get_folder_from_uri(fi->uri, &folder) && folder) { if (folder == mail_component_get_folder(NULL, MAIL_COMPONENT_FOLDER_OUTBOX)) unread = camel_folder_get_message_count(folder); camel_object_unref(folder); @@ -449,8 +450,9 @@ em_folder_tree_model_set_folder_info (EMFolderTreeModel *model, GtkTreeIter *ite COL_STRING_DISPLAY_NAME, fi->name, COL_POINTER_CAMEL_STORE, si->store, COL_STRING_FOLDER_PATH, fi->path, - COL_STRING_URI, fi->url, + COL_STRING_URI, fi->uri, COL_UINT_UNREAD, unread, + COL_UINT_FLAGS, fi->flags, COL_BOOL_IS_STORE, FALSE, COL_BOOL_LOAD_SUBDIRS, load, -1); @@ -461,7 +463,7 @@ em_folder_tree_model_set_folder_info (EMFolderTreeModel *model, GtkTreeIter *ite do { gtk_tree_store_append ((GtkTreeStore *) model, &sub, iter); em_folder_tree_model_set_folder_info (model, &sub, si, fi); - fi = fi->sibling; + fi = fi->next; } while (fi); } else if (load) { /* create a placeholder node for our subfolders... */ @@ -537,7 +539,7 @@ folder_subscribed (CamelStore *store, CamelFolderInfo *fi, EMFolderTreeModel *mo em_folder_tree_model_set_folder_info (model, &iter, si, fi); - g_signal_emit (model, signals[FOLDER_ADDED], 0, fi->path, fi->url); + g_signal_emit (model, signals[FOLDER_ADDED], 0, fi->path, fi->uri); done: diff --git a/mail/em-folder-tree-model.h b/mail/em-folder-tree-model.h index df48d1738a..103dc57052 100644 --- a/mail/em-folder-tree-model.h +++ b/mail/em-folder-tree-model.h @@ -51,10 +51,10 @@ enum { COL_STRING_DISPLAY_NAME, /* string that appears in the tree */ COL_POINTER_CAMEL_STORE, /* CamelStore object */ COL_STRING_FOLDER_PATH, /* if node is a folder, the full path of the folder */ - COL_STRING_URI, /* the uri to get the store or - * folder object */ + COL_STRING_URI, /* the uri to get the store or folder object */ COL_UINT_UNREAD, /* unread count */ - + COL_UINT_FLAGS, /* FolderInfo.flags */ + COL_BOOL_IS_STORE, /* toplevel store node? */ COL_BOOL_LOAD_SUBDIRS, /* %TRUE only if the store/folder * has subfolders which have not yet diff --git a/mail/em-folder-tree.c b/mail/em-folder-tree.c index 730e86252d..e78491ff6d 100644 --- a/mail/em-folder-tree.c +++ b/mail/em-folder-tree.c @@ -71,6 +71,8 @@ struct _EMFolderTreePrivate { char *selected_uri; char *selected_path; + guint32 excluded; + gboolean do_multiselect; /* when doing a multiselect, folders that we didn't find */ GList *lost_folders; @@ -303,6 +305,29 @@ render_display_name (GtkTreeViewColumn *column, GtkCellRenderer *renderer, g_free (display); } +static gboolean +emft_select_func(GtkTreeSelection *selection, GtkTreeModel *model, GtkTreePath *path, gboolean selected, gpointer data) +{ + EMFolderTree *emft = data; + gboolean is_store; + guint32 flags; + GtkTreeIter iter; + + /* NB: This will be called with selection==NULL from tree_row_activated */ + + if (emft->priv->excluded == 0) + return TRUE; + + if (!gtk_tree_model_get_iter(model, &iter, path)) + return TRUE; + + gtk_tree_model_get(model, &iter, COL_UINT_FLAGS, &flags, COL_BOOL_IS_STORE, &is_store, -1); + if (is_store) + flags |= CAMEL_FOLDER_NOSELECT; + + return (flags & emft->priv->excluded) == 0; +} + static void em_folder_tree_init (EMFolderTree *emft) { @@ -361,7 +386,7 @@ em_folder_tree_destroy (GtkObject *obj) } static GtkTreeView * -folder_tree_new (EMFolderTreeModel *model) +folder_tree_new (EMFolderTree *emft, EMFolderTreeModel *model) { GtkTreeSelection *selection; GtkTreeViewColumn *column; @@ -384,7 +409,7 @@ folder_tree_new (EMFolderTreeModel *model) selection = gtk_tree_view_get_selection ((GtkTreeView *) tree); gtk_tree_selection_set_mode (selection, GTK_SELECTION_SINGLE); - + gtk_tree_selection_set_select_function(selection, emft_select_func, emft, NULL); gtk_tree_view_set_headers_visible ((GtkTreeView *) tree, FALSE); return (GtkTreeView *) tree; @@ -403,7 +428,7 @@ em_folder_tree_construct (EMFolderTree *emft, EMFolderTreeModel *model) gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolled), GTK_SHADOW_IN); priv->model = model; - priv->treeview = folder_tree_new (model); + priv->treeview = folder_tree_new (emft, model); gtk_widget_show ((GtkWidget *) priv->treeview); g_signal_connect (priv->treeview, "row-expanded", G_CALLBACK (emft_tree_row_expanded), emft); @@ -1280,6 +1305,11 @@ em_folder_tree_set_multiselect (EMFolderTree *tree, gboolean mode) gtk_tree_selection_set_mode (sel, mode ? GTK_SELECTION_MULTIPLE : GTK_SELECTION_SINGLE); } +void em_folder_tree_set_excluded(EMFolderTree *emft, guint32 flags) +{ + emft->priv->excluded = flags; +} + static void get_selected_uris_iterate (GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gpointer data) { @@ -1447,7 +1477,7 @@ emft_get_folder_info__got (struct _mail_msg *mm) * want to fill our tree with... *sigh* */ if (m->top && m->fi && !strcmp (m->fi->full_name, m->top)) { if (!(fi = m->fi->child)) - fi = m->fi->sibling; + fi = m->fi->next; } else fi = m->fi; @@ -1458,7 +1488,7 @@ emft_get_folder_info__got (struct _mail_msg *mm) do { em_folder_tree_model_set_folder_info (priv->model, &iter, si, fi); - if ((fi = fi->sibling) != NULL) + if ((fi = fi->next) != NULL) gtk_tree_store_append (model, &iter, &root); } while (fi != NULL); } @@ -1572,13 +1602,16 @@ emft_tree_row_activated (GtkTreeView *treeview, GtkTreePath *tree_path, GtkTreeV GtkTreeModel *model = (GtkTreeModel *) priv->model; GtkTreeIter iter; char *path, *uri; - + + if (!emft_select_func(NULL, model, tree_path, FALSE, emft)) + return; + if (!gtk_tree_model_get_iter (model, &iter, tree_path)) return; - + gtk_tree_model_get (model, &iter, COL_STRING_FOLDER_PATH, &path, COL_STRING_URI, &uri, -1); - + g_free (priv->selected_uri); priv->selected_uri = g_strdup (uri); @@ -1696,7 +1729,7 @@ emft_copy_folders__copy (struct _mail_msg *mm) else if (m->delete) deleting = g_list_prepend (deleting, info); - info = info->sibling; + info = info->next; } } @@ -2112,7 +2145,7 @@ emft_popup_delete_rec (CamelStore *store, CamelFolderInfo *fi, CamelException *e if (camel_exception_is_set (ex)) return; - fi = fi->sibling; + fi = fi->next; } } diff --git a/mail/em-folder-tree.h b/mail/em-folder-tree.h index 32f9b5518a..915e73c02e 100644 --- a/mail/em-folder-tree.h +++ b/mail/em-folder-tree.h @@ -44,9 +44,16 @@ extern "C" { typedef struct _EMFolderTree EMFolderTree; typedef struct _EMFolderTreeClass EMFolderTreeClass; +/* not sure this api is the best, but its the easiest to implement and will cover what we need */ +#define EMFT_EXCLUDE_NOSELECT CAMEL_FOLDER_NOSELECT +#define EMFT_EXCLUDE_NOINFERIORS CAMEL_FOLDER_NOINFERIORS +#define EMFT_EXCLUDE_VIRTUAL CAMEL_FOLDER_VIRTUAL +#define EMFT_EXCLUDE_SYSTEM CAMEL_FOLDER_SYSTEM +#define EMFT_EXCLUDE_VTRASH CAMEL_FOLDER_VTRASH + struct _EMFolderTree { GtkVBox parent_object; - + struct _EMFolderTreePrivate *priv; }; @@ -58,7 +65,6 @@ struct _EMFolderTreeClass { void (* folder_selected) (EMFolderTree *emft, const char *path, const char *uri); }; - GType em_folder_tree_get_type (void); GtkWidget *em_folder_tree_new (void); @@ -67,6 +73,7 @@ GtkWidget *em_folder_tree_new_with_model (EMFolderTreeModel *model); void em_folder_tree_enable_drag_and_drop (EMFolderTree *emft); void em_folder_tree_set_multiselect (EMFolderTree *emft, gboolean mode); +void em_folder_tree_set_excluded(EMFolderTree *emft, guint32 flags); void em_folder_tree_set_selected_list (EMFolderTree *emft, GList *list); GList *em_folder_tree_get_selected_uris (EMFolderTree *emft); diff --git a/mail/em-format-html.c b/mail/em-format-html.c index 046d250de4..10ed59260f 100644 --- a/mail/em-format-html.c +++ b/mail/em-format-html.c @@ -1430,16 +1430,16 @@ efh_format_address (GString *out, struct _camel_header_address *a) } static void -efh_format_header(EMFormat *emf, CamelStream *stream, CamelMedium *part, const char *namein, const char *txt, guint32 flags, const char *charset) +efh_format_header(EMFormat *emf, CamelStream *stream, CamelMedium *part, struct _camel_header_raw *header, guint32 flags, const char *charset) { CamelMimeMessage *msg = (CamelMimeMessage *) part; EMFormatHTML *efh = (EMFormatHTML *) emf; char *name, *value = NULL, *p; - const char *label; + const char *label, *txt; int addrspec = 0, i; - name = alloca(strlen(namein)+1); - strcpy(name, namein); + name = alloca(strlen(header->name)+1); + strcpy(name, header->name); camel_strdown(name); for (i = 0; addrspec_hdrs[i]; i++) { @@ -1453,10 +1453,7 @@ efh_format_header(EMFormat *emf, CamelStream *stream, CamelMedium *part, const c struct _camel_header_address *addrs; GString *html; - if (!txt && !(txt = camel_medium_get_header (part, name))) - return; - - if (!(addrs = camel_header_address_decode (txt, emf->charset ? emf->charset : emf->default_charset))) + if (!(addrs = camel_header_address_decode (header->value, emf->charset ? emf->charset : emf->default_charset))) return; /* canonicalise the header name... first letter is @@ -1495,11 +1492,8 @@ efh_format_header(EMFormat *emf, CamelStream *stream, CamelMedium *part, const c time_t msg_date; struct tm local; - if (!txt && !(txt = camel_medium_get_header (part, name))) - return; - /* Show the local timezone equivalent in brackets if the sender is remote */ - msg_date = camel_header_decode_date (txt, &msg_offset); + msg_date = camel_header_decode_date (header->value, &msg_offset); e_localtime_with_offset (msg_date, &local, &local_tz); /* Convert message offset to minutes (e.g. -0400 --> -240) */ @@ -1519,7 +1513,7 @@ efh_format_header(EMFormat *emf, CamelStream *stream, CamelMedium *part, const c e_utf8_strftime (buf, sizeof (buf), _(" (%R %Z)"), &local); } - html = camel_text_to_html (txt, efh->text_html_flags, 0); + html = camel_text_to_html (header->value, efh->text_html_flags, 0); txt = value = g_strdup_printf ("%s %s", html, buf); g_free (html); flags |= EM_FORMAT_HTML_HEADER_HTML; @@ -1532,8 +1526,8 @@ efh_format_header(EMFormat *emf, CamelStream *stream, CamelMedium *part, const c flags |= EM_FORMAT_HEADER_BOLD; } else { - txt = value = camel_header_decode_string (txt, charset); - label = namein; + txt = value = camel_header_decode_string (header->value, charset); + label = header->name; } efh_format_text_header (efh, stream, label, txt, flags); @@ -1548,6 +1542,7 @@ efh_format_headers(EMFormatHTML *efh, CamelStream *stream, CamelMedium *part) EMFormatHeader *h; const char *charset; CamelContentType *ct; + struct _camel_header_raw *header; ct = camel_mime_part_get_content_type((CamelMimePart *)part); charset = camel_content_type_param (ct, "charset"); @@ -1562,16 +1557,19 @@ efh_format_headers(EMFormatHTML *efh, CamelStream *stream, CamelMedium *part) /* dump selected headers */ h = (EMFormatHeader *)emf->header_list.head; if (h->next == NULL || emf->mode == EM_FORMAT_ALLHEADERS) { - struct _camel_header_raw *header; - header = ((CamelMimePart *)part)->headers; while (header) { - efh_format_header(emf, stream, part, header->name, header->value, EM_FORMAT_HTML_HEADER_NOCOLUMNS, charset); + efh_format_header(emf, stream, part, header, EM_FORMAT_HTML_HEADER_NOCOLUMNS, charset); header = header->next; } } else { while (h->next) { - efh_format_header(emf, stream, part, h->name, NULL, h->flags, charset); + header = ((CamelMimePart *)part)->headers; + while (header) { + if (!g_ascii_strcasecmp(header->name, h->name)) + efh_format_header(emf, stream, part, header, h->flags, charset); + header = header->next; + } h = h->next; } } diff --git a/mail/em-subscribe-editor.c b/mail/em-subscribe-editor.c index dc7105b52b..3107fa7317 100644 --- a/mail/em-subscribe-editor.c +++ b/mail/em-subscribe-editor.c @@ -319,7 +319,7 @@ sub_fill_level(EMSubscribe *sub, CamelFolderInfo *info, GtkTreeIter *parent, in } g_hash_table_insert(sub->folders, fi->full_name, node); } - fi = fi->sibling; + fi = fi->next; } } diff --git a/mail/mail-component.c b/mail/mail-component.c index 79d493fb9c..78baa620cf 100644 --- a/mail/mail-component.c +++ b/mail/mail-component.c @@ -440,6 +440,7 @@ impl_createControls (PortableServer_Servant servant, view_widget = em_folder_browser_new (); tree_widget = (GtkWidget *) em_folder_tree_new_with_model (priv->model); + em_folder_tree_set_excluded((EMFolderTree *)tree_widget, EMFT_EXCLUDE_NOSELECT); em_folder_tree_enable_drag_and_drop ((EMFolderTree *) tree_widget); em_format_set_session ((EMFormat *) ((EMFolderView *) view_widget)->preview, session); diff --git a/mail/mail-folder-cache.c b/mail/mail-folder-cache.c index edd6dc1dc3..a17fecc99e 100644 --- a/mail/mail-folder-cache.c +++ b/mail/mail-folder-cache.c @@ -343,12 +343,12 @@ update_1folder(struct _folder_info *mfi, int new, CamelFolderInfo *info) } else { d(printf(" unread count\n")); if (info) - unread = info->unread_message_count; + unread = info->unread; else unread = camel_folder_get_unread_message_count (folder); } } else if (info) - unread = info->unread_message_count; + unread = info->unread; d(printf("folder updated: unread %d: '%s'\n", unread, mfi->full_name)); @@ -380,7 +380,7 @@ setup_folder(CamelFolderInfo *fi, struct _store_info *si) mfi = g_malloc0(sizeof(*mfi)); mfi->path = g_strdup(fi->path); mfi->full_name = g_strdup(fi->full_name); - mfi->uri = g_strdup(fi->url); + mfi->uri = g_strdup(fi->uri); mfi->store_info = si; mfi->flags = fi->flags; @@ -390,8 +390,8 @@ setup_folder(CamelFolderInfo *fi, struct _store_info *si) up = g_malloc0(sizeof(*up)); up->path = g_strdup(mfi->path); up->name = g_strdup(fi->name); - up->uri = g_strdup(fi->url); - up->unread = (fi->unread_message_count==-1)?0:fi->unread_message_count; + up->uri = g_strdup(fi->uri); + up->unread = (fi->unread==-1)?0:fi->unread; up->store = si->store; camel_object_ref(up->store); @@ -408,12 +408,14 @@ create_folders(CamelFolderInfo *fi, struct _store_info *si) { d(printf("Setup new folder: %s\n %s\n", fi->url, fi->full_name)); - setup_folder(fi, si); + while (fi) { + setup_folder(fi, si); - if (fi->child) - create_folders(fi->child, si); - if (fi->sibling) - create_folders(fi->sibling, si); + if (fi->child) + create_folders(fi->child, si); + + fi = fi->next; + } } static void @@ -595,7 +597,7 @@ rename_folders(struct _store_info *si, const char *oldbase, const char *newbase, g_free(mfi->full_name); mfi->path = g_strdup(fi->path); mfi->full_name = g_strdup(fi->full_name); - mfi->uri = g_strdup(fi->url); + mfi->uri = g_strdup(fi->uri); mfi->flags = fi->flags; g_hash_table_insert(si->folders, mfi->full_name, mfi); @@ -606,7 +608,7 @@ rename_folders(struct _store_info *si, const char *oldbase, const char *newbase, mfi = g_malloc0(sizeof(*mfi)); mfi->path = g_strdup(fi->path); mfi->full_name = g_strdup(fi->full_name); - mfi->uri = g_strdup(fi->url); + mfi->uri = g_strdup(fi->uri); mfi->store_info = si; mfi->flags = fi->flags; @@ -619,7 +621,7 @@ rename_folders(struct _store_info *si, const char *oldbase, const char *newbase, up->path = g_strdup(mfi->path); up->name = g_strdup(fi->name); up->uri = g_strdup(mfi->uri); - up->unread = fi->unread_message_count==-1?0:fi->unread_message_count; + up->unread = fi->unread==-1?0:fi->unread; up->store = si->store; camel_object_ref(up->store); @@ -639,12 +641,14 @@ rename_folders(struct _store_info *si, const char *oldbase, const char *newbase, static void get_folders(CamelFolderInfo *fi, GPtrArray *folders) { - g_ptr_array_add(folders, fi); + while (fi) { + g_ptr_array_add(folders, fi); - if (fi->child) - get_folders(fi->child, folders); - if (fi->sibling) - get_folders(fi->sibling, folders); + if (fi->child) + get_folders(fi->child, folders); + + fi = fi->next; + } } static int diff --git a/mail/mail-ops.c b/mail/mail-ops.c index d72423b3e9..112b59f8ca 100644 --- a/mail/mail-ops.c +++ b/mail/mail-ops.c @@ -1053,14 +1053,14 @@ add_special_info(CamelStore *store, CamelFolderInfo *info, char *name, char *ful g_return_val_if_fail (info != NULL, NULL); parent = NULL; - for (fi = info; fi; fi = fi->sibling) { + for (fi = info; fi; fi = fi->next) { if (!strcmp (fi->name, name)) break; parent = fi; } /* create our vTrash/vJunk URL */ - url = camel_url_new (info->url, NULL); + url = camel_url_new (info->uri, NULL); path = g_strdup_printf ("/%s", name); if (url->fragment) camel_url_set_fragment (url, path); @@ -1075,7 +1075,7 @@ add_special_info(CamelStore *store, CamelFolderInfo *info, char *name, char *ful vinfo = fi; g_free (vinfo->full_name); g_free (vinfo->name); - g_free (vinfo->url); + g_free (vinfo->uri); } else { /* There wasn't a Trash/Junk folder so create a new folder entry */ vinfo = g_new0 (CamelFolderInfo, 1); @@ -1083,14 +1083,14 @@ add_special_info(CamelStore *store, CamelFolderInfo *info, char *name, char *ful g_assert(parent != NULL); /* link it into the right spot */ - vinfo->sibling = parent->sibling; - parent->sibling = vinfo; + vinfo->next = parent->next; + parent->next = vinfo; } /* Fill in the new fields */ vinfo->full_name = g_strdup (full_name); vinfo->name = g_strdup(vinfo->full_name); - vinfo->url = g_strdup_printf ("%s:%s", url_base, uri); + vinfo->uri = g_strdup_printf ("%s:%s", url_base, uri); vinfo->path = g_strdup_printf("/%s", vinfo->name); g_free (uri); @@ -1100,7 +1100,7 @@ add_special_info(CamelStore *store, CamelFolderInfo *info, char *name, char *ful static void add_unmatched_info(CamelFolderInfo *fi) { - for (; fi; fi = fi->sibling) { + for (; fi; fi = fi->next) { if (!strcmp(fi->full_name, CAMEL_UNMATCHED_NAME)) { g_free(fi->name); fi->name = g_strdup(_("Unmatched")); @@ -1122,13 +1122,13 @@ get_folderinfo_get (struct _mail_msg *mm) m->info = camel_store_get_folder_info (m->store, NULL, flags, &mm->ex); if (m->info) { - if (m->info->url && (m->store->flags & CAMEL_STORE_VTRASH)) + if (m->info->uri && (m->store->flags & CAMEL_STORE_VTRASH)) add_special_info(m->store, m->info, CAMEL_VTRASH_NAME, _("Trash"), "vtrash"); - if (m->info->url && (m->store->flags & CAMEL_STORE_VJUNK)) { + if (m->info->uri && (m->store->flags & CAMEL_STORE_VJUNK)) { CamelFolderInfo *info; info = add_special_info(m->store, m->info, CAMEL_VJUNK_NAME, _("Junk"), "vjunk"); - info->unread_message_count = -1; + info->unread = -1; } if (CAMEL_IS_VEE_STORE(m->store)) -- cgit v1.2.3