aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Winship <danw@src.gnome.org>2000-10-03 03:08:44 +0800
committerDan Winship <danw@src.gnome.org>2000-10-03 03:08:44 +0800
commite459a0465f0a0d6cabb2ae55366060a7d38da13f (patch)
tree6977ff537a362757bd4bc37e2ec694fbfa2277c8
parente9dc30dbf0c018bbc845f253bfe0b26baddbeaf2 (diff)
downloadgsoc2013-evolution-e459a0465f0a0d6cabb2ae55366060a7d38da13f.tar
gsoc2013-evolution-e459a0465f0a0d6cabb2ae55366060a7d38da13f.tar.gz
gsoc2013-evolution-e459a0465f0a0d6cabb2ae55366060a7d38da13f.tar.bz2
gsoc2013-evolution-e459a0465f0a0d6cabb2ae55366060a7d38da13f.tar.lz
gsoc2013-evolution-e459a0465f0a0d6cabb2ae55366060a7d38da13f.tar.xz
gsoc2013-evolution-e459a0465f0a0d6cabb2ae55366060a7d38da13f.tar.zst
gsoc2013-evolution-e459a0465f0a0d6cabb2ae55366060a7d38da13f.zip
Update for CamelFolderInfo changes.
* mail-ops.c (mail_do_scan_subfolders, etc): Update for CamelFolderInfo changes. * message-list.c (message_list_destroy): Don't save_tree_state if there's no folder associated with the MessageList. * folder-browser.c (folder_browser_set_uri): Only call mail_do_load_folder if the URI is not "". svn path=/trunk/; revision=5664
-rw-r--r--mail/ChangeLog11
-rw-r--r--mail/folder-browser.c3
-rw-r--r--mail/mail-ops.c83
-rw-r--r--mail/message-list.c3
4 files changed, 52 insertions, 48 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog
index 18ac1810b2..4a0edf188e 100644
--- a/mail/ChangeLog
+++ b/mail/ChangeLog
@@ -1,3 +1,14 @@
+2000-10-02 Dan Winship <danw@helixcode.com>
+
+ * mail-ops.c (mail_do_scan_subfolders, etc): Update for
+ CamelFolderInfo changes.
+
+ * message-list.c (message_list_destroy): Don't save_tree_state if
+ there's no folder associated with the MessageList.
+
+ * folder-browser.c (folder_browser_set_uri): Only call
+ mail_do_load_folder if the URI is not "".
+
2000-10-02 Iain Holmes <iain@helixcode.com>
* mail-display.[ch]: Add a cache for the pixbufs, hashed on CID,
diff --git a/mail/folder-browser.c b/mail/folder-browser.c
index 2e461ed3ea..6530929b42 100644
--- a/mail/folder-browser.c
+++ b/mail/folder-browser.c
@@ -115,7 +115,8 @@ folder_browser_class_init (GtkObjectClass *object_class)
gboolean folder_browser_set_uri (FolderBrowser *folder_browser, const char *uri)
{
- mail_do_load_folder (folder_browser, uri);
+ if (*uri)
+ mail_do_load_folder (folder_browser, uri);
return TRUE;
}
diff --git a/mail/mail-ops.c b/mail/mail-ops.c
index 3bb789b5f8..d8a45412ff 100644
--- a/mail/mail-ops.c
+++ b/mail/mail-ops.c
@@ -1165,7 +1165,6 @@ mail_do_flag_all_messages (CamelFolder *source, gboolean invert,
typedef struct scan_subfolders_input_s
{
gchar *source_uri;
- gboolean add_INBOX;
EvolutionStorage *storage;
}
scan_subfolders_input_t;
@@ -1173,6 +1172,7 @@ scan_subfolders_input_t;
typedef struct scan_subfolders_folderinfo_s
{
char *path;
+ char *name;
char *uri;
}
scan_subfolders_folderinfo_t;
@@ -1208,50 +1208,41 @@ setup_scan_subfolders (gpointer in_data, gpointer op_data,
}
static void
+add_folders (GPtrArray *folders, const char *prefix, CamelFolderInfo *fi)
+{
+ scan_subfolders_folderinfo_t *info;
+
+ info = g_new (scan_subfolders_folderinfo_t, 1);
+ info->path = g_strdup_printf ("%s/%s", prefix, fi->name);
+ info->name = g_strdup (fi->name);
+ info->uri = g_strdup (fi->url);
+ g_ptr_array_add (folders, info);
+ if (fi->child)
+ add_folders (folders, info->path, fi->child);
+ if (fi->sibling)
+ add_folders (folders, prefix, fi->sibling);
+}
+
+static void
do_scan_subfolders (gpointer in_data, gpointer op_data, CamelException *ex)
{
scan_subfolders_input_t *input = (scan_subfolders_input_t *) in_data;
scan_subfolders_op_t *data = (scan_subfolders_op_t *) op_data;
- scan_subfolders_folderinfo_t *info;
- GPtrArray *lsub;
- CamelFolderInfo *fi;
- CamelFolder *folder;
- int i;
- char *splice;
-
- if (input->source_uri[strlen (input->source_uri) - 1] == '/')
- splice = "";
- else
- splice = "/";
-
- folder = mail_tool_get_root_of_store (input->source_uri, ex);
- if (camel_exception_is_set (ex))
+ CamelStore *store;
+ CamelFolderInfo *tree;
+
+ store = camel_session_get_store (session, input->source_uri, ex);
+ if (!store)
return;
-
- mail_tool_camel_lock_up ();
-
- lsub = camel_folder_get_subfolder_info (folder);
-
- mail_tool_camel_lock_down ();
-
- for (i = 0; i < lsub->len; i++) {
- fi = lsub->pdata[i];
- mail_op_set_message (_("Found subfolder \"%s\""), fi->full_name);
- info = g_new (scan_subfolders_folderinfo_t, 1);
- info->path = g_strdup_printf ("/%s", fi->full_name);
- info->uri = g_strdup_printf ("%s%s%s", input->source_uri, splice,
- fi->full_name);
- g_ptr_array_add (data->new_folders, info);
- }
-
- camel_folder_free_subfolder_info (folder, lsub);
-
+
+ tree = camel_store_get_folder_info (store, NULL, TRUE, TRUE, ex);
+ add_folders (data->new_folders, "", tree);
+ camel_store_free_folder_info (store, tree);
+
/* FIXME: We intentionally lose a reference to the store here
* for the benefit of the IMAP provider. Undo this when the
* namespace situation is fixed.
*/
- camel_object_ref (CAMEL_OBJECT (folder->parent_store));
- camel_object_unref (CAMEL_OBJECT (folder));
}
static void
@@ -1260,23 +1251,23 @@ cleanup_scan_subfolders (gpointer in_data, gpointer op_data,
{
scan_subfolders_input_t *input = (scan_subfolders_input_t *) in_data;
scan_subfolders_op_t *data = (scan_subfolders_op_t *) op_data;
+ scan_subfolders_folderinfo_t *info;
int i;
-
+
for (i = 0; i < data->new_folders->len; i++) {
- scan_subfolders_folderinfo_t *info;
-
info = data->new_folders->pdata[i];
- evolution_storage_new_folder (input->storage,
- info->path,
- g_basename (info->path),
- "mail",
- info->uri, _("(No description)"));
- g_free (info->path);
+ evolution_storage_new_folder (input->storage, info->path,
+ info->name, "mail",
+ info->uri ? info->uri : "",
+ _("(No description)"));
+
g_free (info->uri);
+ g_free (info->name);
+ g_free (info->path);
g_free (info);
}
-
g_ptr_array_free (data->new_folders, TRUE);
+
gtk_object_unref (GTK_OBJECT (input->storage));
g_free (input->source_uri);
}
diff --git a/mail/message-list.c b/mail/message-list.c
index bceaee60aa..87846302ec 100644
--- a/mail/message-list.c
+++ b/mail/message-list.c
@@ -1103,7 +1103,8 @@ message_list_destroy (GtkObject *object)
MessageList *message_list = MESSAGE_LIST (object);
int i;
- save_tree_state(message_list);
+ if (message_list->folder)
+ save_tree_state(message_list);
gtk_object_unref (GTK_OBJECT (message_list->table_model));
gtk_object_unref (GTK_OBJECT (message_list->header_model));