diff options
Diffstat (limited to 'mail')
-rw-r--r-- | mail/e-mail-reader-utils.c | 2 | ||||
-rw-r--r-- | mail/em-account-editor.c | 4 | ||||
-rw-r--r-- | mail/em-composer-utils.c | 10 | ||||
-rw-r--r-- | mail/em-filter-folder-element.c | 9 | ||||
-rw-r--r-- | mail/em-filter-rule.c | 8 | ||||
-rw-r--r-- | mail/em-folder-tree.c | 6 | ||||
-rw-r--r-- | mail/em-folder-utils.c | 14 | ||||
-rw-r--r-- | mail/em-utils.c | 10 | ||||
-rw-r--r-- | mail/em-vfolder-rule.c | 15 | ||||
-rw-r--r-- | mail/mail-autofilter.c | 2 | ||||
-rw-r--r-- | mail/mail-mt.c | 4 | ||||
-rw-r--r-- | mail/mail-session.c | 4 | ||||
-rw-r--r-- | mail/mail-vfolder.c | 12 |
13 files changed, 56 insertions, 44 deletions
diff --git a/mail/e-mail-reader-utils.c b/mail/e-mail-reader-utils.c index 2e634186aa..d4ab07f2f4 100644 --- a/mail/e-mail-reader-utils.c +++ b/mail/e-mail-reader-utils.c @@ -96,7 +96,7 @@ e_mail_reader_confirm_delete (EMailReader *reader) if (!prompt_delete_in_vfolder) return TRUE; - dialog = e_error_new ( + dialog = e_error_new_dialog_for_args ( window, "mail:ask-delete-vfolder-msg", folder->full_name, NULL); diff --git a/mail/em-account-editor.c b/mail/em-account-editor.c index ebd794bba2..d3c3b78514 100644 --- a/mail/em-account-editor.c +++ b/mail/em-account-editor.c @@ -594,7 +594,7 @@ emae_display_license (EMAccountEditor *emae, CamelProvider *prov) gtk_text_view_set_editable ((GtkTextView *)w, FALSE); response = gtk_dialog_run ((GtkDialog *)dialog); } else { - e_error_run (emae->editor ? (GtkWindow *)gtk_widget_get_toplevel (emae->editor) : e_shell_get_active_window (NULL), + e_error_run_dialog_for_args (emae->editor ? (GtkWindow *)gtk_widget_get_toplevel (emae->editor) : e_shell_get_active_window (NULL), "mail:no-load-license", prov->license_file, NULL); } @@ -1894,7 +1894,7 @@ static void emae_check_authtype (GtkWidget *w, EMAccountEditorService *service) uri = e_account_get_string (account, emae_service_info[service->type].account_uri_key); g_object_ref (emae); - service->check_dialog = e_error_new (emae->editor ? (GtkWindow *)gtk_widget_get_toplevel (emae->editor) : (GtkWindow *)gtk_widget_get_toplevel (w), + service->check_dialog = e_error_new_dialog_for_args (emae->editor ? (GtkWindow *)gtk_widget_get_toplevel (emae->editor) : (GtkWindow *)gtk_widget_get_toplevel (w), "mail:checking-service", NULL); g_signal_connect (service->check_dialog, "response", G_CALLBACK(emae_check_authtype_response), service); gtk_widget_show (service->check_dialog); diff --git a/mail/em-composer-utils.c b/mail/em-composer-utils.c index 44ad930405..62dbb4b27d 100644 --- a/mail/em-composer-utils.c +++ b/mail/em-composer-utils.c @@ -410,12 +410,12 @@ composer_get_message (EMsgComposer *composer, gboolean save_html_object_data) /* I'm sensing a lack of love, er, I mean recipients. */ if (num == 0 && num_post == 0) { - e_error_run((GtkWindow *)composer, "mail:send-no-recipients", NULL); + e_error_run_dialog_for_args ((GtkWindow *)composer, "mail:send-no-recipients", NULL); goto finished; } if (invalid_addrs) { - if (e_error_run ((GtkWindow *)composer, strstr (invalid_addrs->str, ", ") ? "mail:ask-send-invalid-recip-multi" : "mail:ask-send-invalid-recip-one", invalid_addrs->str, NULL) == GTK_RESPONSE_CANCEL) { + if (e_error_run_dialog_for_args ((GtkWindow *)composer, strstr (invalid_addrs->str, ", ") ? "mail:ask-send-invalid-recip-multi" : "mail:ask-send-invalid-recip-one", invalid_addrs->str, NULL) == GTK_RESPONSE_CANCEL) { g_string_free (invalid_addrs, TRUE); goto finished; } @@ -521,7 +521,7 @@ em_utils_composer_send_cb (EMsgComposer *composer) table = e_msg_composer_get_header_table (composer); account = e_composer_header_table_get_account (table); if (!account || !account->enabled) { - e_error_run ( + e_error_run_dialog_for_args ( GTK_WINDOW (composer), "mail:send-no-account-enabled", NULL); return; @@ -680,7 +680,7 @@ em_utils_composer_save_draft_cb (EMsgComposer *composer) mail_msg_wait (id); if (!folder || !account->enabled) { - if (e_error_run((GtkWindow *)composer, "mail:ask-default-drafts", NULL) != GTK_RESPONSE_YES) { + if (e_error_run_dialog_for_args ((GtkWindow *)composer, "mail:ask-default-drafts", NULL) != GTK_RESPONSE_YES) { g_object_unref(composer); camel_object_unref(msg); if (sdi->emcs) @@ -1505,7 +1505,7 @@ em_utils_handle_receipt (CamelFolder *folder, const gchar *uid, CamelMimeMessage } if (account && (account->receipt_policy == E_ACCOUNT_RECEIPT_ALWAYS || account->receipt_policy == E_ACCOUNT_RECEIPT_ASK) - && e_error_run (e_shell_get_active_window (NULL), "mail:ask-receipt", addr, camel_mime_message_get_subject(msg), NULL) == GTK_RESPONSE_YES) + && e_error_run_dialog_for_args (e_shell_get_active_window (NULL), "mail:ask-receipt", addr, camel_mime_message_get_subject(msg), NULL) == GTK_RESPONSE_YES) em_utils_send_receipt(folder, msg); } diff --git a/mail/em-filter-folder-element.c b/mail/em-filter-folder-element.c index b705bbde25..7685c91274 100644 --- a/mail/em-filter-folder-element.c +++ b/mail/em-filter-folder-element.c @@ -40,7 +40,7 @@ #define d(x) -static gboolean validate(EFilterElement *fe, GtkWindow *error_parent); +static gboolean validate(EFilterElement *fe, EError **error); static gint folder_eq(EFilterElement *fe, EFilterElement *cm); static void xml_create(EFilterElement *fe, xmlNodePtr node); static xmlNodePtr xml_encode(EFilterElement *fe); @@ -139,14 +139,17 @@ em_filter_folder_element_set_value(EMFilterFolderElement *ff, const gchar *uri) } static gboolean -validate(EFilterElement *fe, GtkWindow *error_parent) +validate(EFilterElement *fe, EError **error) { EMFilterFolderElement *ff = (EMFilterFolderElement *)fe; + g_warn_if_fail (error == NULL || *error == NULL); + if (ff->uri && *ff->uri) { return TRUE; } else { - e_error_run (error_parent, "mail:no-folder", NULL); + if (error) + *error = e_error_new ("mail:no-folder", NULL); return FALSE; } diff --git a/mail/em-filter-rule.c b/mail/em-filter-rule.c index d655e804be..94fa734434 100644 --- a/mail/em-filter-rule.c +++ b/mail/em-filter-rule.c @@ -35,7 +35,7 @@ #define d(x) -static gint validate(EFilterRule *fr, GtkWindow *error_parent); +static gint validate(EFilterRule *fr, EError **error); static gint filter_eq(EFilterRule *fr, EFilterRule *cm); static xmlNodePtr xml_encode(EFilterRule *fr); static gint xml_decode(EFilterRule *fr, xmlNodePtr, ERuleContext *rc); @@ -172,18 +172,18 @@ em_filter_rule_build_action(EMFilterRule *fr, GString *out) } static gint -validate(EFilterRule *fr, GtkWindow *error_parent) +validate(EFilterRule *fr, EError **error) { EMFilterRule *ff =(EMFilterRule *)fr; GList *parts; gint valid; - valid = E_FILTER_RULE_CLASS(parent_class)->validate (fr, error_parent); + valid = E_FILTER_RULE_CLASS(parent_class)->validate (fr, error); /* validate rule actions */ parts = ff->actions; while (parts && valid) { - valid = e_filter_part_validate ((EFilterPart *)parts->data, error_parent); + valid = e_filter_part_validate ((EFilterPart *)parts->data, error); parts = parts->next; } diff --git a/mail/em-folder-tree.c b/mail/em-folder-tree.c index 2865e50840..9cc15c2bbb 100644 --- a/mail/em-folder-tree.c +++ b/mail/em-folder-tree.c @@ -439,7 +439,7 @@ folder_tree_cell_edited_cb (EMFolderTree *folder_tree, /* Check for invalid characters. */ if (strchr (new_name, '/') != NULL) { - e_error_run ( + e_error_run_dialog_for_args ( parent, "mail:no-rename-folder", old_name, new_name, _("Folder names cannot contain '/'"), NULL); @@ -458,7 +458,7 @@ folder_tree_cell_edited_cb (EMFolderTree *folder_tree, folder_info = camel_store_get_folder_info ( store, new_full_name, CAMEL_STORE_FOLDER_INFO_FAST, &ex); if (folder_info != NULL) { - e_error_run ( + e_error_run_dialog_for_args ( parent, "mail:no-rename-folder-exists", old_name, new_name, NULL); camel_store_free_folder_info (store, folder_info); @@ -468,7 +468,7 @@ folder_tree_cell_edited_cb (EMFolderTree *folder_tree, /* XXX This needs to be asynchronous. */ camel_store_rename_folder (store, old_full_name, new_full_name, &ex); if (camel_exception_is_set (&ex)) { - e_error_run ( + e_error_run_dialog_for_args ( parent, "mail:no-rename-folder", old_full_name, new_full_name, ex.desc, NULL); goto exit; diff --git a/mail/em-folder-utils.c b/mail/em-folder-utils.c index 8b1dab9388..14d09ee8fb 100644 --- a/mail/em-folder-utils.c +++ b/mail/em-folder-utils.c @@ -282,7 +282,7 @@ emfu_copy_folder_selected (const gchar *uri, gpointer data) local_store = e_mail_local_get_store (); if (!(fromstore = camel_session_get_store (session, cfd->fi->uri, &ex))) { - e_error_run (e_shell_get_active_window (NULL), + e_error_run_dialog_for_args (e_shell_get_active_window (NULL), cfd->delete?"mail:no-move-folder-notexist":"mail:no-copy-folder-notexist", cfd->fi->full_name, uri, ex.desc, NULL); goto fail; } @@ -290,7 +290,7 @@ emfu_copy_folder_selected (const gchar *uri, gpointer data) if (cfd->delete && fromstore == local_store && emfu_is_special_local_folder (cfd->fi->full_name)) { GtkWidget *w; - w = e_error_new ( + w = e_error_new_dialog_for_args ( e_shell_get_active_window (NULL), "mail:no-rename-special-folder", cfd->fi->full_name, NULL); em_utils_show_error_silent (w); @@ -298,7 +298,7 @@ emfu_copy_folder_selected (const gchar *uri, gpointer data) } if (!(tostore = camel_session_get_store (session, uri, &ex))) { - e_error_run (e_shell_get_active_window (NULL), + e_error_run_dialog_for_args (e_shell_get_active_window (NULL), cfd->delete?"mail:no-move-folder-to-notexist":"mail:no-copy-folder-to-notexist", cfd->fi->full_name, uri, ex.desc, NULL); goto fail; } @@ -405,7 +405,7 @@ emfu_delete_done (CamelFolder *folder, gboolean removed, CamelException *ex, gpo if (ex && camel_exception_is_set (ex)) { GtkWidget *w; - w = e_error_new ( + w = e_error_new_dialog_for_args ( e_shell_get_active_window (NULL), "mail:no-delete-folder", folder->full_name, camel_exception_get_description (ex), NULL); em_utils_show_error_silent (w); @@ -441,7 +441,7 @@ em_folder_utils_delete_folder (CamelFolder *folder) local_store = e_mail_local_get_store (); if (folder->parent_store == local_store && emfu_is_special_local_folder (folder->full_name)) { - dialog = e_error_new ( + dialog = e_error_new_dialog_for_args ( parent, "mail:no-delete-special-folder", folder->full_name, NULL); em_utils_show_error_silent (dialog); @@ -450,13 +450,13 @@ em_folder_utils_delete_folder (CamelFolder *folder) if (mail_folder_cache_get_folder_info_flags (folder, &flags) && (flags & CAMEL_FOLDER_SYSTEM)) { - e_error_run (parent,"mail:no-delete-special-folder", folder->name, NULL); + e_error_run_dialog_for_args (parent,"mail:no-delete-special-folder", folder->name, NULL); return; } camel_object_ref (folder); - dialog = e_error_new (parent, + dialog = e_error_new_dialog_for_args (parent, (folder->parent_store && CAMEL_IS_VEE_STORE(folder->parent_store))?"mail:ask-delete-vfolder":"mail:ask-delete-folder", folder->full_name, NULL); g_object_set_data_full ((GObject *) dialog, "folder", folder, camel_object_unref); diff --git a/mail/em-utils.c b/mail/em-utils.c index 245ab818e1..7714742a30 100644 --- a/mail/em-utils.c +++ b/mail/em-utils.c @@ -157,15 +157,19 @@ em_utils_prompt_user(GtkWindow *parent, const gchar *promptkey, const gchar *tag va_list ap; gint button; GConfClient *gconf = mail_config_get_gconf_client(); + EError *error = NULL; if (promptkey && !gconf_client_get_bool(gconf, promptkey, NULL)) return TRUE; va_start(ap, arg0); - mbox = e_error_newv(parent, tag, arg0, ap); + error = e_error_newv (tag, arg0, ap); va_end(ap); + mbox = e_error_new_dialog (parent, error); + e_error_free (error); + if (promptkey) { check = gtk_check_button_new_with_mnemonic (_("_Do not show this message again.")); gtk_container_set_border_width((GtkContainer *)check, 12); @@ -312,7 +316,7 @@ em_utils_edit_filters (GtkWidget *parent) g_free (system); if (((ERuleContext *) fc)->error) { - GtkWidget *w = e_error_new((GtkWindow *)parent, "mail:filter-load-error", ((ERuleContext *)fc)->error, NULL); + GtkWidget *w = e_error_new_dialog_for_args ((GtkWindow *)parent, "mail:filter-load-error", ((ERuleContext *)fc)->error, NULL); em_utils_show_error_silent (w); return; } @@ -940,7 +944,7 @@ em_utils_temp_save_part(GtkWidget *parent, CamelMimePart *part, gboolean mode) tmpdir = e_mkdtemp("evolution-tmp-XXXXXX"); if (tmpdir == NULL) { - w = e_error_new((GtkWindow *)parent, "mail:no-create-tmp-path", g_strerror(errno), NULL); + w = e_error_new_dialog_for_args ((GtkWindow *)parent, "mail:no-create-tmp-path", g_strerror(errno), NULL); em_utils_show_error_silent (w); return NULL; } diff --git a/mail/em-vfolder-rule.c b/mail/em-vfolder-rule.c index ea275795cc..c7cf0845b8 100644 --- a/mail/em-vfolder-rule.c +++ b/mail/em-vfolder-rule.c @@ -44,7 +44,7 @@ #define d(x) -static gint validate(EFilterRule *, GtkWindow *error_parent); +static gint validate(EFilterRule *, EError **error); static gint vfolder_eq(EFilterRule *fr, EFilterRule *cm); static xmlNodePtr xml_encode(EFilterRule *); static gint xml_decode(EFilterRule *, xmlNodePtr, ERuleContext *f); @@ -101,7 +101,7 @@ em_vfolder_rule_class_init(EMVFolderRuleClass *klass) object_class->finalize = em_vfolder_rule_finalise; /* override methods */ - fr_class->validate = validate; + fr_class->validate = validate; fr_class->eq = vfolder_eq; fr_class->xml_encode = xml_encode; fr_class->xml_decode = xml_decode; @@ -208,23 +208,26 @@ em_vfolder_rule_next_source(EMVFolderRule *vr, const gchar *last) } static gint -validate(EFilterRule *fr, GtkWindow *error_parent) +validate(EFilterRule *fr, EError **error) { g_return_val_if_fail(fr != NULL, 0); + g_warn_if_fail (error == NULL || *error == NULL); if (!fr->name || !*fr->name) { - e_error_run (error_parent, "mail:no-name-vfolder", NULL); + if (error) + *error = e_error_new ("mail:no-name-vfolder", NULL); return 0; } /* We have to have at least one source set in the "specific" case. Do not translate this string! */ if (((EMVFolderRule *)fr)->with == EM_VFOLDER_RULE_WITH_SPECIFIC && ((EMVFolderRule *)fr)->sources == NULL) { - e_error_run (error_parent, "mail:vfolder-no-source", NULL); + if (error) + *error = e_error_new ("mail:vfolder-no-source", NULL); return 0; } - return E_FILTER_RULE_CLASS(parent_class)->validate (fr, error_parent); + return E_FILTER_RULE_CLASS(parent_class)->validate (fr, error); } static gint diff --git a/mail/mail-autofilter.c b/mail/mail-autofilter.c index d64a4ae282..fe04b77782 100644 --- a/mail/mail-autofilter.c +++ b/mail/mail-autofilter.c @@ -431,7 +431,7 @@ mail_filter_delete_uri(CamelStore *store, const gchar *uri) l = l->next; } - dialog = e_error_new (e_shell_get_active_window (NULL), "mail:filter-updated", s->str, euri, NULL); + dialog = e_error_new_dialog_for_args (e_shell_get_active_window (NULL), "mail:filter-updated", s->str, euri, NULL); g_string_free(s, TRUE); em_utils_show_info_silent (dialog); diff --git a/mail/mail-mt.c b/mail/mail-mt.c index d1aea41ad6..8d939617b1 100644 --- a/mail/mail-mt.c +++ b/mail/mail-mt.c @@ -269,10 +269,10 @@ mail_msg_check_error (gpointer msg) if (m->info->desc && (what = m->info->desc (m))) { - gd = (GtkDialog *)e_error_new(parent, "mail:async-error", what, camel_exception_get_description(&m->ex), NULL); + gd = (GtkDialog *)e_error_new_dialog_for_args (parent, "mail:async-error", what, camel_exception_get_description(&m->ex), NULL); g_free(what); } else - gd = (GtkDialog *)e_error_new(parent, "mail:async-error-nodescribe", camel_exception_get_description(&m->ex), NULL); + gd = (GtkDialog *)e_error_new_dialog_for_args (parent, "mail:async-error-nodescribe", camel_exception_get_description(&m->ex), NULL); g_hash_table_insert(active_errors, m->info, gd); g_signal_connect(gd, "response", G_CALLBACK(error_response), m->info); diff --git a/mail/mail-session.c b/mail/mail-session.c index 14aec15866..ee035c7a6f 100644 --- a/mail/mail-session.c +++ b/mail/mail-session.c @@ -352,7 +352,7 @@ user_message_exec (struct _user_message_msg *m) g_return_if_reached (); } - user_message_dialog = e_error_new ( + user_message_dialog = e_error_new_dialog_for_args ( e_shell_get_active_window (NULL), error_type, m->prompt, NULL); g_object_set ( user_message_dialog, "allow_shrink", TRUE, @@ -362,7 +362,7 @@ user_message_exec (struct _user_message_msg *m) * emit a status bar message or present the dialog immediately, the * thought being if there's more than one button then something is * probably blocked until the user responds. */ - if (e_error_count_buttons (user_message_dialog) > 1) { + if (e_error_dialog_count_buttons (user_message_dialog) > 1) { if (m->ismain) { gint response; diff --git a/mail/mail-vfolder.c b/mail/mail-vfolder.c index 9fed82744f..4fabc848c0 100644 --- a/mail/mail-vfolder.c +++ b/mail/mail-vfolder.c @@ -600,7 +600,7 @@ done: const gchar *data_dir; gchar *user; - dialog = e_error_new (e_shell_get_active_window (NULL), "mail:vfolder-updated", changed->str, uri, NULL); + dialog = e_error_new_dialog_for_args (e_shell_get_active_window (NULL), "mail:vfolder-updated", changed->str, uri, NULL); em_utils_show_info_silent (dialog); data_dir = em_utils_get_data_dir (); @@ -1094,7 +1094,7 @@ vfolder_edit_rule(const gchar *uri) GtkWidget *w; /* TODO: we should probably just create it ... */ - w = e_error_new (e_shell_get_active_window (NULL), "mail:vfolder-notexist", uri, NULL); + w = e_error_new_dialog_for_args (e_shell_get_active_window (NULL), "mail:vfolder-notexist", uri, NULL); em_utils_show_error_silent (w); } @@ -1109,14 +1109,16 @@ new_rule_clicked(GtkWidget *w, gint button, gpointer data) const gchar *data_dir; gchar *user; EFilterRule *rule = g_object_get_data((GObject *)w, "rule"); + EError *error = NULL; - if (!e_filter_rule_validate (rule, GTK_WINDOW (w))) { - /* no need to popup a dialog because the validate code does that. */ + if (!e_filter_rule_validate (rule, &error)) { + e_error_run_dialog (GTK_WINDOW (w), error); + e_error_free (error); return; } if (e_rule_context_find_rule ((ERuleContext *)context, rule->name, rule->source)) { - e_error_run ((GtkWindow *)w, "mail:vfolder-notunique", rule->name, NULL); + e_error_run_dialog_for_args ((GtkWindow *)w, "mail:vfolder-notunique", rule->name, NULL); return; } |