aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--mail/ChangeLog10
-rw-r--r--mail/mail-config.c178
-rw-r--r--mail/mail-display.c6
-rw-r--r--mail/mail-ops.c26
4 files changed, 26 insertions, 194 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog
index fcb6893bed..8e31d99af4 100644
--- a/mail/ChangeLog
+++ b/mail/ChangeLog
@@ -1,3 +1,13 @@
+2002-05-10 Jeffrey Stedfast <fejj@ximian.com>
+
+ * mail-config.c (mail_config_add_account): Don't add any shortcuts
+ here.
+ (mail_config_remove_account): And don't remove them here. This
+ code has never worked properly.
+
+ * mail-ops.c (save_part_save): Use the exception enum names rather
+ than '1' since it makes the code clearer.
+
2002-05-10 Dan Winship <danw@ximian.com>
* mail-ops.c (transfer_messages_transfer): Simplify. Use
diff --git a/mail/mail-config.c b/mail/mail-config.c
index 3cb1dc9636..a65b8f00b4 100644
--- a/mail/mail-config.c
+++ b/mail/mail-config.c
@@ -2356,67 +2356,6 @@ mail_config_get_accounts (void)
}
static void
-add_shortcut_entry (const char *name, const char *uri, const char *type)
-{
- extern EvolutionShellClient *global_shell_client;
- CORBA_Environment ev;
- GNOME_Evolution_Shortcuts shortcuts_interface;
- GNOME_Evolution_Shortcuts_Group *the_group;
- GNOME_Evolution_Shortcuts_Shortcut *the_shortcut;
- int i;
-
- if (!global_shell_client)
- return;
-
- CORBA_exception_init (&ev);
-
- shortcuts_interface = evolution_shell_client_get_shortcuts_interface (global_shell_client);
- if (CORBA_Object_is_nil (shortcuts_interface, &ev)) {
- g_warning ("No ::Shortcut interface on the shell");
- CORBA_exception_free (&ev);
- return;
- }
-
- the_group = GNOME_Evolution_Shortcuts_getGroup (shortcuts_interface, 0, &ev);
- if (ev._major != CORBA_NO_EXCEPTION) {
- g_warning ("Exception getting first group: %s", ev._repo_id);
- CORBA_exception_free (&ev);
- return;
- }
-
- the_shortcut = NULL;
- for (i = 0; i < the_group->shortcuts._length; i++) {
- GNOME_Evolution_Shortcuts_Shortcut *iter;
-
- iter = the_group->shortcuts._buffer + i;
- if (!strcmp (iter->name, name)) {
- the_shortcut = iter;
- break;
- }
- }
-
- if (the_shortcut == NULL) {
- the_shortcut = GNOME_Evolution_Shortcuts_Shortcut__alloc ();
- the_shortcut->name = CORBA_string_dup (name);
- the_shortcut->uri = CORBA_string_dup (uri);
- the_shortcut->type = CORBA_string_dup (type);
-
- GNOME_Evolution_Shortcuts_add (shortcuts_interface,
- 0, -1, /* "end of list" */
- the_shortcut,
- &ev);
-
- CORBA_free (the_shortcut);
-
- if (ev._major != CORBA_NO_EXCEPTION)
- g_warning ("Exception creating shortcut \"%s\": %s", name, ev._repo_id);
- }
-
- CORBA_free (the_group);
- CORBA_exception_free (&ev);
-}
-
-static void
add_new_storage (const char *url, const char *name)
{
extern EvolutionShellClient *global_shell_client;
@@ -2426,126 +2365,10 @@ add_new_storage (const char *url, const char *name)
mail_load_storage_by_uri (corba_shell, url, name);
}
-static void
-new_source_created (MailConfigAccount *account)
-{
- CamelProvider *prov;
- CamelFolder *inbox;
- CamelException ex;
- char *name;
- char *url;
-
- /* no source, don't bother. */
- if (!account->source || !account->source->url)
- return;
-
- camel_exception_init (&ex);
- prov = camel_session_get_provider (session, account->source->url, &ex);
- if (camel_exception_is_set (&ex)) {
- g_warning ("Configured provider that doesn't exist?");
- camel_exception_clear (&ex);
- return;
- }
-
- /* not a storage, don't bother. */
- if (!(prov->flags & CAMEL_PROVIDER_IS_STORAGE) ||
- (prov->flags & CAMEL_PROVIDER_IS_EXTERNAL))
- return;
-
- inbox = mail_tool_get_inbox (account->source->url, &ex);
- if (camel_exception_is_set (&ex)) {
- e_notice (NULL, GNOME_MESSAGE_BOX_ERROR,
- _("Could not get inbox for new mail store:\n%s\n"
- "No shortcut will be created."),
- camel_exception_get_description (&ex));
- camel_exception_clear (&ex);
- return;
- }
-
- if (inbox) {
- /* Create the shortcut. FIXME: This only works if the
- * full name matches the path.
- */
- name = g_strdup_printf (U_("%s: Inbox"), account->name);
- url = g_strdup_printf ("evolution:/%s/%s", account->name,
- inbox->full_name);
- add_shortcut_entry (name, url, "mail");
- g_free (name);
- g_free (url);
-
- /* If we unref inbox here, it will disconnect from the
- * store, but then add_new_storage will reconnect. So
- * we'll keep holding the ref until after that.
- */
- }
-
- /* add the storage to the folder tree */
- add_new_storage (account->source->url, account->name);
-
- if (inbox)
- camel_object_unref (CAMEL_OBJECT (inbox));
-}
-
void
mail_config_add_account (MailConfigAccount *account)
{
config->accounts = g_slist_append (config->accounts, account);
-
- if (account->source && account->source->url)
- new_source_created (account);
-}
-
-static void
-remove_account_shortcuts (MailConfigAccount *account)
-{
- extern EvolutionShellClient *global_shell_client;
- CORBA_Environment ev;
- GNOME_Evolution_Shortcuts shortcuts_interface;
- GNOME_Evolution_Shortcuts_GroupList *groups;
- int i, j, len;;
-
- CORBA_exception_init (&ev);
-
- shortcuts_interface = evolution_shell_client_get_shortcuts_interface (global_shell_client);
- if (CORBA_Object_is_nil (shortcuts_interface, &ev)) {
- g_warning ("No ::Shortcut interface on the shell");
- CORBA_exception_free (&ev);
- return;
- }
-
- groups = GNOME_Evolution_Shortcuts__get_groups (shortcuts_interface, &ev);
- if (ev._major != CORBA_NO_EXCEPTION) {
- g_warning ("Exception getting the groups: %s", ev._repo_id);
- CORBA_exception_free (&ev);
- return;
- }
-
- len = strlen (account->name);
-
- for (i = 0; i < groups->_length; i++) {
- GNOME_Evolution_Shortcuts_Group *iter;
-
- iter = groups->_buffer + i;
-
- for (j = 0; j < iter->shortcuts._length; j++) {
- GNOME_Evolution_Shortcuts_Shortcut *sc;
-
- sc = iter->shortcuts._buffer + j;
-
- /* "evolution:/" = 11 */
- if (!strncmp (sc->uri + 11, account->name, len)) {
- GNOME_Evolution_Shortcuts_remove (shortcuts_interface, i, j, &ev);
-
- if (ev._major != CORBA_NO_EXCEPTION) {
- g_warning ("Exception removing shortcut \"%s\": %s", sc->name, ev._repo_id);
- break;
- }
- }
- }
- }
-
- CORBA_exception_free (&ev);
- CORBA_free (groups);
}
const GSList *
@@ -2565,7 +2388,6 @@ mail_config_remove_account (MailConfigAccount *account)
}
config->accounts = g_slist_remove (config->accounts, account);
- remove_account_shortcuts (account);
account_destroy (account);
return config->accounts;
diff --git a/mail/mail-display.c b/mail/mail-display.c
index a1c3e04ed7..267f28f078 100644
--- a/mail/mail-display.c
+++ b/mail/mail-display.c
@@ -97,7 +97,7 @@ static void
write_data_written(CamelMimePart *part, char *name, int done, void *data)
{
int *ret = data;
-
+
/* should we popup a dialogue to say its done too? */
*ret = done;
}
@@ -121,7 +121,7 @@ write_data_to_file (CamelMimePart *part, const char *name, gboolean unique)
NULL);
text = gtk_label_new (_("A file by that name already exists.\nOverwrite it?"));
gtk_box_pack_start (GTK_BOX (GNOME_DIALOG (dlg)->vbox), text, TRUE, TRUE, 4);
- gtk_window_set_policy(GTK_WINDOW(dlg), FALSE, TRUE, FALSE);
+ gtk_window_set_policy (GTK_WINDOW (dlg), FALSE, TRUE, FALSE);
gtk_widget_show (text);
if (gnome_dialog_run_and_close (GNOME_DIALOG (dlg)) != 0)
@@ -133,7 +133,7 @@ write_data_to_file (CamelMimePart *part, const char *name, gboolean unique)
/* should this have progress of what its doing? */
mail_msg_wait (mail_save_part (part, name, write_data_written, &ret));
-
+
return ret;
}
diff --git a/mail/mail-ops.c b/mail/mail-ops.c
index f86a013a7a..a864b87569 100644
--- a/mail/mail-ops.c
+++ b/mail/mail-ops.c
@@ -1994,15 +1994,16 @@ save_part_save (struct _mail_msg *mm)
struct _save_part_msg *m = (struct _save_part_msg *)mm;
CamelMimeFilterCharset *charsetfilter;
CamelContentType *content_type;
- CamelStreamFilter *filtered_stream;
+ CamelStream *filtered_stream;
CamelStream *stream_fs;
CamelDataWrapper *data;
const char *charset;
stream_fs = camel_stream_fs_new_with_name (m->path, O_WRONLY | O_CREAT | O_TRUNC, 0600);
if (stream_fs == NULL) {
- camel_exception_setv (&mm->ex, 1, _("Cannot create output file: %s:\n %s"), m->path,
- g_strerror (errno));
+ camel_exception_setv (&mm->ex, CAMEL_EXCEPTION_SYSTEM,
+ _("Cannot create output file: %s:\n %s"),
+ m->path, g_strerror (errno));
return;
}
@@ -2018,24 +2019,23 @@ save_part_save (struct _mail_msg *mm)
&& (charset = header_content_type_param (content_type, "charset"))
&& g_strcasecmp (charset, "utf-8") != 0) {
charsetfilter = camel_mime_filter_charset_new_convert ("utf-8", charset);
- filtered_stream = camel_stream_filter_new_with_stream (stream_fs);
+ filtered_stream = (CamelStream *) camel_stream_filter_new_with_stream (stream_fs);
+ camel_object_unref (CAMEL_OBJECT (stream_fs));
if (charsetfilter) {
- camel_stream_filter_add (filtered_stream, CAMEL_MIME_FILTER (charsetfilter));
+ camel_stream_filter_add (CAMEL_STREAM_FILTER (filtered_stream), CAMEL_MIME_FILTER (charsetfilter));
camel_object_unref (CAMEL_OBJECT (charsetfilter));
}
} else {
- /* no we can't use a CAMEL_BLAH() cast here, since its not true, HOWEVER
- we only treat it as a normal stream from here on, so it is OK */
- filtered_stream = (CamelStreamFilter *)stream_fs;
- camel_object_ref (CAMEL_OBJECT (stream_fs));
+ filtered_stream = stream_fs;
}
- if (camel_data_wrapper_write_to_stream (data, CAMEL_STREAM (filtered_stream)) == -1
- || camel_stream_flush (CAMEL_STREAM (filtered_stream)) == -1)
- camel_exception_setv (&mm->ex, 1, _("Could not write data: %s"), g_strerror (errno));
+ if (camel_data_wrapper_write_to_stream (data, filtered_stream) == -1
+ || camel_stream_flush (filtered_stream) == -1)
+ camel_exception_setv (&mm->ex, CAMEL_EXCEPTION_SYSTEM,
+ _("Could not write data: %s"),
+ g_strerror (errno));
camel_object_unref (CAMEL_OBJECT (filtered_stream));
- camel_object_unref (CAMEL_OBJECT (stream_fs));
}
static void