aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--mail/ChangeLog20
-rw-r--r--mail/component-factory.c66
-rw-r--r--mail/mail-folder-cache.c5
3 files changed, 47 insertions, 44 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog
index 0066b90955..ca252f840b 100644
--- a/mail/ChangeLog
+++ b/mail/ChangeLog
@@ -1,3 +1,23 @@
+2002-03-14 Dan Winship <danw@ximian.com>
+
+ * component-factory.c (folder_types): Remove "mailstorage", since
+ it's not needed any more.
+ (storage_activate): Gone, although some of it is moved to
+ storage_connect.
+ (create_view): Remove mailstorage code.
+ (add_storage): Connect to the storage's open_folder signal.
+ Instead of creating a "mailstorage" folder, call
+ evolution_storage_has_subfolders to let the shell know we haven't
+ finished filling it in yet.
+ (storage_connect): Handler for the storage's asyncOpenFolder
+ signal. Call mail_note_store() to try to connect.
+ (storage_connected): Callback for above. If the connection attempt
+ failed, call evolution_storage_has_subfolders again to make the
+ shell re-close the storage.
+
+ * mail-folder-cache.c (update_folders): Remove a piece of
+ mailstorage legacy code from here.
+
2002-03-14 Radek Doulik <rodo@ximian.com>
* mail-config.c (get_new_signature_filename): create new signature
diff --git a/mail/component-factory.c b/mail/component-factory.c
index 4f5c886e3d..1e2a652ca4 100644
--- a/mail/component-factory.c
+++ b/mail/component-factory.c
@@ -37,7 +37,7 @@
#include "evolution-shell-component.h"
#include "evolution-shell-component-dnd.h"
#include "folder-browser.h"
-#include "mail.h" /* YUCK FIXME */
+#include "mail.h"
#include "mail-config.h"
#include "mail-tools.h"
#include "mail-ops.h"
@@ -98,7 +98,6 @@ static char *exported_dnd_types[] = {
static const EvolutionShellComponentFolderType folder_types[] = {
{ "mail", "evolution-inbox.png", N_("Mail"), N_("Folder containing mail"), TRUE, accepted_dnd_types, exported_dnd_types },
- { "mailstorage", "evolution-inbox.png", "Mailstorage", N_("Mail storage folder (internal)"), FALSE, NULL, NULL },
{ "vtrash", "evolution-trash.png", N_("Virtual Trash"), N_("Virtual Trash folder"), FALSE, accepted_dnd_types, exported_dnd_types },
{ NULL, NULL, NULL, NULL, FALSE, NULL, NULL }
};
@@ -110,35 +109,6 @@ static const char *schema_types[] = {
/* EvolutionShellComponent methods and signals. */
-static void
-storage_activate (BonoboControl *control, gboolean activate,
- const char *physical_uri)
-{
- CamelService *store;
- EvolutionStorage *storage;
- CamelException ex;
-
- if (!activate)
- return;
-
- camel_exception_init (&ex);
- store = camel_session_get_service (session, physical_uri,
- CAMEL_PROVIDER_STORE, &ex);
- if (!store) {
- e_notice (NULL, GNOME_MESSAGE_BOX_ERROR,
- _("Cannot connect to store: %s"),
- camel_exception_get_description (&ex));
- camel_exception_clear (&ex);
- return;
- }
- camel_exception_clear (&ex);
-
- storage = g_hash_table_lookup (storages_hash, store);
- if (storage && !gtk_object_get_data (GTK_OBJECT (storage), "connected"))
- mail_note_store (CAMEL_STORE(store), storage, CORBA_OBJECT_NIL, NULL, NULL);
- camel_object_unref (CAMEL_OBJECT (store));
-}
-
static BonoboControl *
create_noselect_control (void)
{
@@ -175,14 +145,6 @@ create_view (EvolutionShellComponent *shell_component,
control = folder_browser_factory_new_control (physical_uri,
corba_shell);
camel_url_free (url);
- } else if (!g_strcasecmp (folder_type, "mailstorage")) {
- char *uri_dup = g_strdup (physical_uri);
-
- control = create_noselect_control ();
- gtk_object_set_data_full (GTK_OBJECT (control), "physical_uri",
- uri_dup, g_free);
- gtk_signal_connect (GTK_OBJECT (control), "activate",
- storage_activate, uri_dup);
} else if (!g_strcasecmp (folder_type, "vtrash")) {
if (!g_strncasecmp (physical_uri, "file:", 5))
control = folder_browser_factory_new_control ("vtrash:file:/", corba_shell);
@@ -1203,6 +1165,27 @@ storage_xfer_folder (EvolutionStorage *storage,
}
static void
+storage_connected (CamelStore *store, CamelFolderInfo *info, void *storage)
+{
+ if (!info) {
+ /* Let it know the connection failed by calling
+ * has_subfolders again.
+ */
+ evolution_storage_has_subfolders (storage, "/",
+ _("Connecting..."));
+ }
+}
+
+static void
+storage_connect (EvolutionStorage *storage,
+ const char *path,
+ CamelStore *store)
+{
+ mail_note_store (CAMEL_STORE(store), storage, CORBA_OBJECT_NIL,
+ storage_connected, storage);
+}
+
+static void
add_storage (const char *name, const char *uri, CamelService *store,
GNOME_Evolution_Shell corba_shell, CamelException *ex)
{
@@ -1210,7 +1193,7 @@ add_storage (const char *name, const char *uri, CamelService *store,
EvolutionStorageResult res;
storage = evolution_storage_new (name);
- evolution_storage_new_folder (storage, "/", name, "mailstorage", uri, "", 0);
+ gtk_signal_connect (GTK_OBJECT (storage), "open_folder", storage_connect, store);
gtk_signal_connect (GTK_OBJECT (storage), "create_folder", storage_create_folder, store);
gtk_signal_connect (GTK_OBJECT (storage), "remove_folder", storage_remove_folder, store);
gtk_signal_connect ((GtkObject *)storage, "xfer_folder", storage_xfer_folder, store);
@@ -1219,11 +1202,14 @@ add_storage (const char *name, const char *uri, CamelService *store,
switch (res) {
case EVOLUTION_STORAGE_OK:
+ evolution_storage_has_subfolders (storage, "/",
+ _("Connecting..."));
mail_hash_storage (store, storage);
mail_note_store((CamelStore *)store, storage, CORBA_OBJECT_NIL, NULL, NULL);
/* falllll */
case EVOLUTION_STORAGE_ERROR_ALREADYREGISTERED:
case EVOLUTION_STORAGE_ERROR_EXISTS:
+ bonobo_object_unref (BONOBO_OBJECT (storage));
return;
default:
camel_exception_set (ex, CAMEL_EXCEPTION_SYSTEM,
diff --git a/mail/mail-folder-cache.c b/mail/mail-folder-cache.c
index c7bd808369..a9479f3d36 100644
--- a/mail/mail-folder-cache.c
+++ b/mail/mail-folder-cache.c
@@ -711,11 +711,8 @@ update_folders(CamelStore *store, CamelFolderInfo *fi, void *data)
/* otherwise its not, and we're on our own and free anyway */
e_dlist_remove((EDListNode *)ud);
- if (fi) {
- if (si->storage)
- gtk_object_set_data (GTK_OBJECT (si->storage), "connected", GINT_TO_POINTER (TRUE));
+ if (fi)
create_folders(fi, si);
- }
}
UNLOCK(info_lock);