diff options
Diffstat (limited to 'mail')
-rw-r--r-- | mail/ChangeLog | 18 | ||||
-rw-r--r-- | mail/em-folder-utils.c | 9 | ||||
-rw-r--r-- | mail/em-folder-view.c | 6 | ||||
-rw-r--r-- | mail/em-utils.c | 38 | ||||
-rw-r--r-- | mail/em-utils.h | 4 | ||||
-rw-r--r-- | mail/mail-autofilter.c | 3 | ||||
-rw-r--r-- | mail/mail-component.c | 2 | ||||
-rw-r--r-- | mail/mail-mt.c | 3 | ||||
-rw-r--r-- | mail/mail-session.c | 7 | ||||
-rw-r--r-- | mail/mail-vfolder.c | 7 |
10 files changed, 78 insertions, 19 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog index 89f075fe98..3315c1b57c 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,3 +1,21 @@ +2008-01-10 Srinivasa Ragavan <sragavan@novell.com> + + ** Most of the errors are now non-intrusive + + * em-folder-utils.c: (emfu_copy_folder_selected), + (emfu_delete_response), (em_folder_utils_delete_folder): + * em-folder-view.c: (emfv_delete_msg_response): + * em-utils.c: (em_utils_edit_filters), + (em_utils_save_part_to_file), (em_utils_temp_save_part), + (error_response), (em_utils_show_error_silent), + (em_utils_show_info_silent): + * em-utils.h: + * mail-autofilter.c: (mail_filter_delete_uri): + * mail-component.c: (mail_component_show_logger): + * mail-mt.c: (mail_msg_free): + * mail-session.c: (do_user_message): + * mail-vfolder.c: (mail_vfolder_delete_uri), (vfolder_edit_rule): + 2008-01-10 Sankar P <psankar@novell.com> * em-format-html.c: (efh_format_headers): diff --git a/mail/em-folder-utils.c b/mail/em-folder-utils.c index e32efee827..e66213f9d6 100644 --- a/mail/em-folder-utils.c +++ b/mail/em-folder-utils.c @@ -290,8 +290,9 @@ emfu_copy_folder_selected (const char *uri, void *data) } if (cfd->delete && fromstore == mail_component_peek_local_store (NULL) && emfu_is_special_local_folder (cfd->fi->full_name)) { - e_error_run(NULL, + GtkWidget *w = e_error_new (NULL, "mail:no-rename-special-folder", cfd->fi->full_name, NULL); + em_utils_show_error_silent (w); goto fail; } @@ -438,8 +439,9 @@ emfu_delete_response (GtkWidget *dialog, int response, gpointer data) camel_exception_init (&ex); emfu_delete_folders (store, full_name, &ex); if (camel_exception_is_set (&ex)) { - e_error_run(NULL, + GtkWidget *w = e_error_new(NULL, "mail:no-delete-folder", full_name, ex.desc, NULL); + em_utils_show_error_silent (w); camel_exception_clear (&ex); } } @@ -457,7 +459,8 @@ em_folder_utils_delete_folder (CamelFolder *folder) local = mail_component_peek_local_store (NULL); if (folder->parent_store == local && emfu_is_special_local_folder (folder->full_name)) { - e_error_run(NULL, "mail:no-delete-special-folder", folder->full_name, NULL); + dialog = e_error_new (NULL, "mail:no-delete-special-folder", folder->full_name, NULL); + em_utils_show_error_silent (dialog); return; } diff --git a/mail/em-folder-view.c b/mail/em-folder-view.c index 914f335063..97b7359402 100644 --- a/mail/em-folder-view.c +++ b/mail/em-folder-view.c @@ -1091,8 +1091,10 @@ emfv_delete_msg_response (GtkWidget *dialog, int response, gpointer data) _("Mail Deletion Failed"), _("You do not have sufficient permissions to delete this mail.")); gtk_html_stream_close(hstream, GTK_HTML_STREAM_OK); - } else - e_error_run (NULL, "mail:no-delete-permission", "", ""); + } else { + GtkWidget *w = e_error_new (NULL, "mail:no-delete-permission", "", ""); + em_utils_show_error_silent (w); + } count = -1; break; diff --git a/mail/em-utils.c b/mail/em-utils.c index 552f7cc609..1e41708afa 100644 --- a/mail/em-utils.c +++ b/mail/em-utils.c @@ -79,6 +79,7 @@ #include "em-format-quote.h" #include "em-account-editor.h" #include "e-attachment.h" +#include "e-activity-handler.h" static void emu_save_part_done (CamelMimePart *part, char *name, int done, void *data); @@ -299,7 +300,8 @@ em_utils_edit_filters (GtkWidget *parent) g_free (system); if (((RuleContext *) fc)->error) { - e_error_run((GtkWindow *)parent, "mail:filter-load-error", ((RuleContext *)fc)->error, NULL); + GtkWidget *w = e_error_new((GtkWindow *)parent, "mail:filter-load-error", ((RuleContext *)fc)->error, NULL); + em_utils_show_error_silent (w); return; } @@ -564,8 +566,9 @@ em_utils_save_part_to_file(GtkWidget *parent, const char *filename, CamelMimePar dirname = g_path_get_dirname(filename); if (g_mkdir_with_parents(dirname, 0777) == -1) { - e_error_run((GtkWindow *)parent, "mail:no-create-path", filename, g_strerror(errno), NULL); + GtkWidget *w = e_error_new((GtkWindow *)parent, "mail:no-create-path", filename, g_strerror(errno), NULL); g_free(dirname); + em_utils_show_error_silent (w); return FALSE; } g_free(dirname); @@ -578,7 +581,8 @@ em_utils_save_part_to_file(GtkWidget *parent, const char *filename, CamelMimePar } if (g_stat(filename, &st) != -1 && !S_ISREG(st.st_mode)) { - e_error_run((GtkWindow *)parent, "mail:no-write-path-notfile", filename, NULL); + GtkWidget *w = e_error_new((GtkWindow *)parent, "mail:no-write-path-notfile", filename, NULL); + em_utils_show_error_silent (w); return FALSE; } @@ -1275,10 +1279,12 @@ em_utils_temp_save_part(GtkWidget *parent, CamelMimePart *part, gboolean mode) const char *filename; char *tmpdir, *path, *utf8_mfilename = NULL, *mfilename = NULL; int done; + GtkWidget *w; tmpdir = e_mkdtemp("evolution-tmp-XXXXXX"); if (tmpdir == NULL) { - e_error_run((GtkWindow *)parent, "mail:no-create-tmp-path", g_strerror(errno), NULL); + w = e_error_new((GtkWindow *)parent, "mail:no-create-tmp-path", g_strerror(errno), NULL); + em_utils_show_error_silent (w); return NULL; } @@ -2214,3 +2220,27 @@ em_utils_clear_get_password_canceled_accounts_flag (void) g_object_unref (iter); } } + + +static void error_response(GtkObject *o, int button, void *data) +{ + gtk_widget_destroy((GtkWidget *)o); +} + +void +em_utils_show_error_silent (GtkWidget *widget) +{ + EActivityHandler *handler = mail_component_peek_activity_handler (mail_component_peek ()); + if(!g_object_get_data ((GObject *) widget, "response-handled")) + g_signal_connect(widget, "response", G_CALLBACK(error_response), NULL); + e_activity_handler_make_error (handler, "mail", E_LOG_ERROR, widget); +} + +void +em_utils_show_info_silent (GtkWidget *widget) +{ + EActivityHandler *handler = mail_component_peek_activity_handler (mail_component_peek ()); + if(!g_object_get_data ((GObject *) widget, "response-handled")) + g_signal_connect(widget, "response", G_CALLBACK(error_response), NULL); + e_activity_handler_make_error (handler, "mail", E_LOG_WARNINGS, widget); +} diff --git a/mail/em-utils.h b/mail/em-utils.h index 7e627c414c..587e2c18b7 100644 --- a/mail/em-utils.h +++ b/mail/em-utils.h @@ -102,6 +102,10 @@ char *em_utils_folder_name_from_uri (const char *uri); char *em_uri_from_camel (const char *curi); char *em_uri_to_camel (const char *euri); +/* Run errors silently on the status bar */ +void em_utils_show_error_silent (struct _GtkWidget *widget); +void em_utils_show_info_silent (struct _GtkWidget *widget); + /* is this address in the addressbook? caches results */ gboolean em_utils_in_addressbook(struct _CamelInternetAddress *addr); struct _CamelMimePart *em_utils_contact_photo (struct _CamelInternetAddress *addr, gboolean local); diff --git a/mail/mail-autofilter.c b/mail/mail-autofilter.c index 675dbcc9bc..9fa59622da 100644 --- a/mail/mail-autofilter.c +++ b/mail/mail-autofilter.c @@ -436,9 +436,8 @@ mail_filter_delete_uri(CamelStore *store, const char *uri) } dialog = e_error_new(NULL, "mail:filter-updated", s->str, euri, NULL); - g_signal_connect_swapped (dialog, "response", G_CALLBACK (gtk_widget_destroy), dialog); g_string_free(s, TRUE); - gtk_widget_show(dialog); + em_utils_show_info_silent (dialog); d(printf("Folder delete/rename '%s' changed filters, resaving\n", euri)); if (rule_context_save ((RuleContext *) fc, user) == -1) diff --git a/mail/mail-component.c b/mail/mail-component.c index 036ad0a667..f1aec270cf 100644 --- a/mail/mail-component.c +++ b/mail/mail-component.c @@ -1624,7 +1624,7 @@ mail_component_show_logger (gpointer top) window = gtk_window_new (GTK_WINDOW_TOPLEVEL); gtk_window_set_transient_for ((GtkWindow *) window, (GtkWindow *) gtk_widget_get_toplevel ((GtkWidget *) top)); gtk_container_set_border_width ((GtkContainer *) window, 6); - + gtk_window_set_default_size ((GtkWindow *)window, 500, 400); gtk_window_set_title ((GtkWindow *) window, _("Debug Logs")); vbox = gtk_vbox_new (FALSE, 6); hbox = gtk_hbox_new (FALSE, 6); diff --git a/mail/mail-mt.c b/mail/mail-mt.c index 77ae1bfa54..141abad095 100644 --- a/mail/mail-mt.c +++ b/mail/mail-mt.c @@ -260,8 +260,7 @@ mail_msg_unref (gpointer msg) activity_id = mail_msg->priv->activity_id; error = mail_msg->priv->error; if (error && !activity_id) { - e_activity_handler_make_error (mail_component_peek_activity_handler (mail_component_peek ()), "mail", - g_object_get_data ((GObject *) error, "primary"), error); + e_activity_handler_make_error (mail_component_peek_activity_handler (mail_component_peek ()), "mail", E_LOG_ERROR, error); printf("Making error\n"); } diff --git a/mail/mail-session.c b/mail/mail-session.c index 6dd7d5a8cd..010b758146 100644 --- a/mail/mail-session.c +++ b/mail/mail-session.c @@ -47,6 +47,7 @@ #include "em-filter-context.h" #include "em-filter-rule.h" +#include "em-utils.h" #include "mail-component.h" #include "mail-config.h" #include "mail-mt.h" @@ -331,7 +332,8 @@ user_message_exec (struct _user_message_msg *m) "mail:session-message-error"; break; default: - g_assert_not_reached (); + error_type = NULL; + g_return_if_reached (); } user_message_dialog = e_error_new (NULL, error_type, m->prompt, NULL); @@ -345,10 +347,11 @@ user_message_exec (struct _user_message_msg *m) gint response = gtk_dialog_run (user_message_dialog); user_message_response (user_message_dialog, response, m); } else { + g_object_set_data ((GObject *) user_message_dialog, "response-handled", GINT_TO_POINTER(TRUE)); g_signal_connect ( user_message_dialog, "response", G_CALLBACK (user_message_response), m); - gtk_widget_show (user_message_dialog); + em_utils_show_error_silent (user_message_dialog); } } diff --git a/mail/mail-vfolder.c b/mail/mail-vfolder.c index 6a959a2280..c240826b68 100644 --- a/mail/mail-vfolder.c +++ b/mail/mail-vfolder.c @@ -586,8 +586,7 @@ mail_vfolder_delete_uri(CamelStore *store, const char *curi) char *user; dialog = e_error_new(NULL, "mail:vfolder-updated", changed->str, uri, NULL); - g_signal_connect_swapped (dialog, "response", G_CALLBACK (gtk_widget_destroy), dialog); - gtk_widget_show (dialog); + em_utils_show_info_silent (dialog); user = g_strdup_printf ("%s/mail/vfolders.xml", mail_component_peek_base_directory (mail_component_peek ())); @@ -1061,8 +1060,10 @@ vfolder_edit_rule(const char *uri) g_signal_connect(gd, "response", G_CALLBACK(edit_rule_response), NULL); gtk_widget_show((GtkWidget *)gd); } else { + GtkWidget *w; /* TODO: we should probably just create it ... */ - e_error_run(NULL, "mail:vfolder-notexist", uri, NULL); + w = e_error_new(NULL, "mail:vfolder-notexist", uri, NULL); + em_utils_show_error_silent (w); } if (url) |