diff options
author | Dan Winship <danw@src.gnome.org> | 2001-10-09 02:14:59 +0800 |
---|---|---|
committer | Dan Winship <danw@src.gnome.org> | 2001-10-09 02:14:59 +0800 |
commit | e1581b778571f2b7d52cd2c034b88b7b5d0d9083 (patch) | |
tree | 5f126d32908175ec65df070110a72ea0deaf69bd | |
parent | 482567f1c783a6b479b05ff4dacc07b60727b4b9 (diff) | |
download | gsoc2013-evolution-e1581b778571f2b7d52cd2c034b88b7b5d0d9083.tar.gz gsoc2013-evolution-e1581b778571f2b7d52cd2c034b88b7b5d0d9083.tar.zst gsoc2013-evolution-e1581b778571f2b7d52cd2c034b88b7b5d0d9083.zip |
For mailstorage folders, connect to the control's "activate" signal, and
* component-factory.c (create_view): For mailstorage folders,
connect to the control's "activate" signal, and don't try to
connect to the store.
(storage_activate): Instead, do it here, so if the connection
fails, or the user cancels, or whatever else, he can try again
later.
svn path=/trunk/; revision=13503
-rw-r--r-- | mail/ChangeLog | 9 | ||||
-rw-r--r-- | mail/component-factory.c | 55 |
2 files changed, 47 insertions, 17 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog index 562b01c30a..03427d8d12 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,3 +1,12 @@ +2001-10-08 Dan Winship <danw@frotz.mysterion.org> + + * component-factory.c (create_view): For mailstorage folders, + connect to the control's "activate" signal, and don't try to + connect to the store. + (storage_activate): Instead, do it here, so if the connection + fails, or the user cancels, or whatever else, he can try again + later. + 2001-10-07 Dan Winship <danw@ximian.com> * mail-tools.c (mail_tool_do_movemail): Remove #ifndef diff --git a/mail/component-factory.c b/mail/component-factory.c index ab632031ea..f3f1d0d81c 100644 --- a/mail/component-factory.c +++ b/mail/component-factory.c @@ -106,6 +106,38 @@ 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) { @@ -143,24 +175,13 @@ create_view (EvolutionShellComponent *shell_component, corba_shell); camel_url_free (url); } else if (!g_strcasecmp (folder_type, "mailstorage")) { - CamelService *store; - EvolutionStorage *storage; - - store = camel_session_get_service (session, physical_uri, - CAMEL_PROVIDER_STORE, NULL); - if (!store) - return EVOLUTION_SHELL_COMPONENT_NOTFOUND; - storage = g_hash_table_lookup (storages_hash, store); - if (!storage) { - camel_object_unref (CAMEL_OBJECT (store)); - return EVOLUTION_SHELL_COMPONENT_NOTFOUND; - } - - if (!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)); - + 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); |