From c2ee0afbc85ce3ddf38ec07497c0cdae4f42a7fc Mon Sep 17 00:00:00 2001 From: Jonathon Jongsma Date: Mon, 30 Nov 2009 11:34:43 -0600 Subject: Rename EError to EAlert to match general use better The EError mechanism is used both for error dialogs as well as basic alerts or user prompts, so we should give it a more general name which matches this use. This patch also cleans up a few includes of e-alert.h (formerly e-error.h) that were not actually being used. https://bugzilla.gnome.org/show_bug.cgi?id=602963 --- addressbook/gui/contact-editor/e-contact-editor.c | 10 +- .../gui/contact-editor/e-contact-quick-add.c | 4 +- .../contact-list-editor/e-contact-list-editor.c | 4 +- .../gui/contact-list-editor/e-contact-list-model.c | 4 +- addressbook/gui/widgets/e-addressbook-view.c | 8 +- addressbook/gui/widgets/eab-gui-util.c | 10 +- addressbook/util/addressbook.c | 4 +- calendar/gui/alarm-notify/alarm-queue.c | 1 - calendar/gui/dialogs/cancel-comp.c | 4 +- calendar/gui/dialogs/comp-editor.c | 6 +- calendar/gui/dialogs/delete-comp.c | 4 +- calendar/gui/dialogs/save-comp.c | 10 +- calendar/gui/dialogs/send-comp.c | 6 +- calendar/gui/e-calendar-view.c | 4 +- calendar/gui/gnome-cal.c | 12 +- calendar/importers/icalendar-importer.c | 4 +- composer/e-composer-actions.c | 16 +- composer/e-composer-autosave.c | 4 +- composer/e-msg-composer.c | 16 +- e-util/Makefile.am | 4 +- e-util/e-alert.c | 698 +++++++++++++++++++++ e-util/e-alert.h | 66 ++ e-util/e-error.c | 698 --------------------- e-util/e-error.h | 66 -- e-util/e-non-intrusive-error-dialog.h | 1 - e-util/e-util.c | 1 + filter/e-filter-datespec.c | 10 +- filter/e-filter-element.c | 6 +- filter/e-filter-element.h | 6 +- filter/e-filter-file.c | 14 +- filter/e-filter-input.c | 10 +- filter/e-filter-part.c | 4 +- filter/e-filter-part.h | 7 +- filter/e-filter-rule.c | 22 +- filter/e-filter-rule.h | 4 +- filter/e-rule-context.c | 12 +- filter/e-rule-editor.c | 22 +- mail/e-mail-reader-utils.c | 4 +- mail/em-account-editor.c | 6 +- mail/em-composer-utils.c | 12 +- mail/em-filter-folder-element.c | 12 +- mail/em-filter-rule.c | 8 +- mail/em-folder-tree.c | 8 +- mail/em-folder-utils.c | 16 +- mail/em-utils.c | 16 +- mail/em-vfolder-rule.c | 18 +- mail/importers/elm-importer.c | 1 - mail/importers/pine-importer.c | 1 - mail/mail-autofilter.c | 5 +- mail/mail-mt.c | 6 +- mail/mail-session.c | 6 +- mail/mail-vfolder.c | 16 +- modules/addressbook/addressbook-config.c | 10 +- modules/addressbook/e-book-shell-view-actions.c | 10 +- modules/calendar/e-cal-shell-sidebar.c | 6 +- modules/calendar/e-cal-shell-view-actions.c | 3 +- modules/calendar/e-cal-shell-view-private.h | 1 - modules/calendar/e-memo-shell-sidebar.c | 6 +- modules/calendar/e-memo-shell-view-actions.c | 3 +- modules/calendar/e-memo-shell-view-private.h | 1 - modules/calendar/e-task-shell-sidebar.c | 6 +- modules/calendar/e-task-shell-view-actions.c | 3 +- modules/calendar/e-task-shell-view-private.h | 1 - modules/mail/e-mail-attachment-handler.c | 4 +- modules/mail/e-mail-junk-hook.c | 4 +- modules/mail/e-mail-shell-backend.c | 4 +- modules/mail/e-mail-shell-migrate.c | 4 +- modules/mail/e-mail-shell-view.c | 1 + modules/mail/em-account-prefs.c | 6 +- modules/mail/em-composer-prefs.c | 1 - modules/mail/em-network-prefs.c | 1 - plugins/attachment-reminder/attachment-reminder.c | 4 +- plugins/backup-restore/backup-restore.c | 16 +- plugins/default-mailer/default-mailer.c | 1 - plugins/email-custom-header/email-custom-header.c | 1 - plugins/external-editor/external-editor.c | 6 +- plugins/face/face.c | 8 +- plugins/groupwise-features/camel-gw-listener.c | 6 +- plugins/groupwise-features/junk-settings.c | 1 - plugins/groupwise-features/mail-retract.c | 4 +- plugins/groupwise-features/process-meeting.c | 8 +- plugins/groupwise-features/proxy-login.c | 8 +- plugins/groupwise-features/proxy.c | 10 +- plugins/groupwise-features/share-folder.c | 6 +- plugins/hula-account-setup/camel-hula-listener.c | 1 - plugins/itip-formatter/itip-formatter.c | 8 +- .../mailing-list-actions/mailing-list-actions.c | 14 +- plugins/mark-all-read/mark-all-read.c | 1 - plugins/save-calendar/csv-format.c | 2 - plugins/save-calendar/ical-format.c | 1 - plugins/save-calendar/rdf-format.c | 2 - plugins/save-calendar/save-calendar.c | 4 +- plugins/startup-wizard/startup-wizard.c | 4 +- plugins/templates/templates.c | 1 - plugins/tnef-attachments/tnef-plugin.c | 1 - shell/e-shell-content.c | 20 +- shell/e-shell-migrate.c | 10 +- shell/e-shell-window-actions.c | 4 +- shell/main.c | 1 - widgets/misc/e-import-assistant.c | 1 - widgets/misc/e-signature-editor.c | 10 +- 101 files changed, 1071 insertions(+), 1085 deletions(-) create mode 100644 e-util/e-alert.c create mode 100644 e-util/e-alert.h delete mode 100644 e-util/e-error.c delete mode 100644 e-util/e-error.h diff --git a/addressbook/gui/contact-editor/e-contact-editor.c b/addressbook/gui/contact-editor/e-contact-editor.c index 2973730788..501af7d97e 100644 --- a/addressbook/gui/contact-editor/e-contact-editor.c +++ b/addressbook/gui/contact-editor/e-contact-editor.c @@ -43,7 +43,7 @@ #include "addressbook/printing/e-contact-print.h" #include "addressbook/gui/widgets/eab-gui-util.h" #include "e-util/e-util.h" -#include "e-util/e-error.h" +#include "e-util/e-alert.h" #include "misc/e-dateedit.h" #include "misc/e-image-chooser.h" #include "misc/e-url-entry.h" @@ -2345,7 +2345,7 @@ extract_simple_field (EContactEditor *editor, GtkWidget *widget, gint field_id) if ((height > 96 || width > 96)) { prompt_response = - e_error_run_dialog_for_args + e_alert_run_dialog_for_args (GTK_WINDOW (editor->app), "addressbook:prompt-resize", NULL); @@ -2773,7 +2773,7 @@ categories_clicked (GtkWidget *button, EContactEditor *editor) g_free (categories); return; }else if (!(dialog = GTK_DIALOG (e_categories_dialog_new (categories)))) { - e_error_run_dialog_for_args (GTK_WINDOW (editor->app), + e_alert_run_dialog_for_args (GTK_WINDOW (editor->app), "addressbook:edit-categories", NULL); g_free (categories); @@ -3061,7 +3061,7 @@ save_contact (EContactEditor *ce, gboolean should_close) return; if (ce->target_editable && !e_book_is_writable (ce->source_book)) { - if (e_error_run_dialog_for_args (GTK_WINDOW (ce->app), + if (e_alert_run_dialog_for_args (GTK_WINDOW (ce->app), "addressbook:prompt-move", NULL) == GTK_RESPONSE_NO) return; @@ -3209,7 +3209,7 @@ e_contact_editor_is_valid (EABEditor *editor) if (validation_error) { g_string_append (errmsg, "."); - e_error_run_dialog_for_args (GTK_WINDOW (ce->app), + e_alert_run_dialog_for_args (GTK_WINDOW (ce->app), "addressbook:generic-error", _("Invalid contact."), errmsg->str, NULL); diff --git a/addressbook/gui/contact-editor/e-contact-quick-add.c b/addressbook/gui/contact-editor/e-contact-quick-add.c index ced2f2ec12..bc750d15ef 100644 --- a/addressbook/gui/contact-editor/e-contact-quick-add.c +++ b/addressbook/gui/contact-editor/e-contact-quick-add.c @@ -33,7 +33,7 @@ #include "e-contact-editor.h" #include "e-contact-quick-add.h" #include "eab-contact-merging.h" -#include "e-util/e-error.h" +#include "e-util/e-alert.h" typedef struct _QuickAdd QuickAdd; struct _QuickAdd { @@ -129,7 +129,7 @@ merge_cb (EBook *book, EBookStatus status, gpointer closure) if (e_book_is_writable (book)) eab_merging_book_add_contact (book, qa->contact, NULL, NULL); else - e_error_run_dialog_for_args (e_shell_get_active_window (NULL), + e_alert_run_dialog_for_args (e_shell_get_active_window (NULL), "addressbook:error-read-only", e_source_peek_name (e_book_get_source (book)), NULL); diff --git a/addressbook/gui/contact-list-editor/e-contact-list-editor.c b/addressbook/gui/contact-list-editor/e-contact-list-editor.c index dff1b3da83..7eb07007da 100644 --- a/addressbook/gui/contact-list-editor/e-contact-list-editor.c +++ b/addressbook/gui/contact-list-editor/e-contact-list-editor.c @@ -24,7 +24,7 @@ #include "e-contact-list-editor.h" #include -#include +#include #include "shell/e-shell.h" #include @@ -262,7 +262,7 @@ contact_list_editor_contact_exists (EContactListModel *model, if (!e_contact_list_model_has_email (model, email)) return FALSE; - return (e_error_run_dialog_for_args (e_shell_get_active_window (NULL), + return (e_alert_run_dialog_for_args (e_shell_get_active_window (NULL), tag, email, NULL) != GTK_RESPONSE_YES); } diff --git a/addressbook/gui/contact-list-editor/e-contact-list-model.c b/addressbook/gui/contact-list-editor/e-contact-list-model.c index 87fd8e8fec..5359d8d607 100644 --- a/addressbook/gui/contact-list-editor/e-contact-list-model.c +++ b/addressbook/gui/contact-list-editor/e-contact-list-model.c @@ -23,7 +23,7 @@ #include #include "e-contact-list-model.h" -#include "e-util/e-error.h" +#include "e-util/e-alert.h" #include "shell/e-shell.h" static gpointer parent_class; @@ -153,7 +153,7 @@ e_contact_list_model_add_email (EContactListModel *model, g_return_if_fail (email != NULL); if (e_contact_list_model_has_email (model, email)) - if (e_error_run_dialog_for_args (e_shell_get_active_window + if (e_alert_run_dialog_for_args (e_shell_get_active_window (NULL), tag, email, NULL) != GTK_RESPONSE_YES) return; diff --git a/addressbook/gui/widgets/e-addressbook-view.c b/addressbook/gui/widgets/e-addressbook-view.c index 3e10722c00..cb64e36272 100644 --- a/addressbook/gui/widgets/e-addressbook-view.c +++ b/addressbook/gui/widgets/e-addressbook-view.c @@ -52,7 +52,7 @@ #include "e-addressbook-table-adapter.h" #include "eab-contact-merging.h" -#include "e-util/e-error.h" +#include "e-util/e-alert.h" #include "e-util/e-util-private.h" #include @@ -894,7 +894,7 @@ backend_died (EAddressbookView *view) model = e_addressbook_view_get_model (view); book = e_addressbook_model_get_book (model); - e_error_run_dialog_for_args ( + e_alert_run_dialog_for_args ( GTK_WINDOW (shell_window), "addressbook:backend-died", e_book_get_uri (book), NULL); @@ -1013,7 +1013,7 @@ delete_contacts_cb (EBook *book, EBookStatus status, gpointer closure) case E_BOOK_ERROR_CANCELLED : break; case E_BOOK_ERROR_PERMISSION_DENIED : - e_error_run_dialog_for_args (e_shell_get_active_window (NULL), + e_alert_run_dialog_for_args (e_shell_get_active_window (NULL), "addressbook:contact-delete-error-perm", NULL); break; @@ -1217,7 +1217,7 @@ e_addressbook_view_view (EAddressbookView *view) if (length > 5) { GtkWidget *dialog; - /* XXX Use e_error_new(). */ + /* XXX Use e_alert_new(). */ /* XXX Provide a parent window. */ dialog = gtk_message_dialog_new ( NULL, 0, GTK_MESSAGE_QUESTION, GTK_BUTTONS_NONE, diff --git a/addressbook/gui/widgets/eab-gui-util.c b/addressbook/gui/widgets/eab-gui-util.c index e80e65575f..efc97e682e 100644 --- a/addressbook/gui/widgets/eab-gui-util.c +++ b/addressbook/gui/widgets/eab-gui-util.c @@ -35,7 +35,7 @@ #include "eab-gui-util.h" #include "util/eab-book-util.h" #include -#include "e-util/e-error.h" +#include "e-util/e-alert.h" #include "e-util/e-html-utils.h" #include "shell/e-shell.h" #include "misc/e-image-chooser.h" @@ -86,7 +86,7 @@ eab_error_dialog (const gchar *msg, EBookStatus status) status_str = status_to_string [status]; if (status_str) - e_error_run_dialog_for_args (e_shell_get_active_window (NULL), + e_alert_run_dialog_for_args (e_shell_get_active_window (NULL), "addressbook:generic-error", msg, _(status_str), NULL); } @@ -147,7 +147,7 @@ eab_load_error_dialog (GtkWidget *parent, ESource *source, EBookStatus status) } } - dialog = e_error_new_dialog_for_args ((GtkWindow *) parent, "addressbook:load-error", label_string, NULL); + dialog = e_alert_new_dialog_for_args ((GtkWindow *) parent, "addressbook:load-error", label_string, NULL); g_signal_connect (dialog, "response", G_CALLBACK (gtk_widget_destroy), NULL); gtk_widget_show (dialog); @@ -189,13 +189,13 @@ eab_search_result_dialog (GtkWidget *parent, g_return_if_reached (); } - e_error_run_dialog_for_args ((GtkWindow *) parent, "addressbook:search-error", str, NULL); + e_alert_run_dialog_for_args ((GtkWindow *) parent, "addressbook:search-error", str, NULL); } gint eab_prompt_save_dialog (GtkWindow *parent) { - return e_error_run_dialog_for_args (parent, "addressbook:prompt-save", NULL); + return e_alert_run_dialog_for_args (parent, "addressbook:prompt-save", NULL); } static gchar * diff --git a/addressbook/util/addressbook.c b/addressbook/util/addressbook.c index 6e70e5f3f3..7fe470a4f3 100644 --- a/addressbook/util/addressbook.c +++ b/addressbook/util/addressbook.c @@ -30,7 +30,7 @@ #include #include -#include "e-util/e-error.h" +#include "e-util/e-alert.h" #include "shell/e-shell.h" #include "addressbook.h" @@ -108,7 +108,7 @@ load_source_auth_cb (EBook *book, EBookStatus status, gpointer closure) goto done; } } else if (status == E_BOOK_ERROR_INVALID_SERVER_VERSION) { - e_error_run_dialog_for_args (e_shell_get_active_window (NULL), + e_alert_run_dialog_for_args (e_shell_get_active_window (NULL), "addressbook:server-version", NULL); status = E_BOOK_ERROR_OK; diff --git a/calendar/gui/alarm-notify/alarm-queue.c b/calendar/gui/alarm-notify/alarm-queue.c index 25010a649d..f7160451bb 100644 --- a/calendar/gui/alarm-notify/alarm-queue.c +++ b/calendar/gui/alarm-notify/alarm-queue.c @@ -48,7 +48,6 @@ #include "alarm-notify.h" #include "config-data.h" #include "util.h" -#include "e-util/e-error.h" #define d(x) diff --git a/calendar/gui/dialogs/cancel-comp.c b/calendar/gui/dialogs/cancel-comp.c index 69331f03a1..81ac2b6f82 100644 --- a/calendar/gui/dialogs/cancel-comp.c +++ b/calendar/gui/dialogs/cancel-comp.c @@ -28,7 +28,7 @@ #include #include -#include "e-util/e-error.h" +#include "e-util/e-alert.h" #include "cancel-comp.h" @@ -105,7 +105,7 @@ cancel_component_dialog (GtkWindow *parent, ECal *client, ECalComponent *comp, g return FALSE; } - if (e_error_run_dialog_for_args (parent, id, NULL) == GTK_RESPONSE_YES) + if (e_alert_run_dialog_for_args (parent, id, NULL) == GTK_RESPONSE_YES) return TRUE; else return FALSE; diff --git a/calendar/gui/dialogs/comp-editor.c b/calendar/gui/dialogs/comp-editor.c index 85f2304d8a..07d68806a5 100644 --- a/calendar/gui/dialogs/comp-editor.c +++ b/calendar/gui/dialogs/comp-editor.c @@ -65,7 +65,7 @@ #include "widgets/misc/e-attachment-view.h" #include "widgets/misc/e-attachment-paned.h" -#include "e-util/e-error.h" +#include "e-util/e-alert.h" #define COMP_EDITOR_GET_PRIVATE(obj) \ (G_TYPE_INSTANCE_GET_PRIVATE \ @@ -833,7 +833,7 @@ action_save_cb (GtkAction *action, } if (!e_cal_is_read_only (priv->client, &read_only, NULL) || read_only) { - e_error_run_dialog_for_args ((GtkWindow *) gtk_widget_get_toplevel (GTK_WIDGET (editor)), "calendar:prompt-read-only-cal-editor", e_source_peek_name (e_cal_get_source (priv->client)), NULL); + e_alert_run_dialog_for_args ((GtkWindow *) gtk_widget_get_toplevel (GTK_WIDGET (editor)), "calendar:prompt-read-only-cal-editor", e_source_peek_name (e_cal_get_source (priv->client)), NULL); return; } @@ -1833,7 +1833,7 @@ prompt_and_save_changes (CompEditor *editor, gboolean send) switch (save_component_dialog (GTK_WINDOW(editor), priv->comp)) { case GTK_RESPONSE_YES: /* Save */ if (!e_cal_is_read_only (priv->client, &read_only, NULL) || read_only) { - e_error_run_dialog_for_args ((GtkWindow *) gtk_widget_get_toplevel (GTK_WIDGET (editor)), "calendar:prompt-read-only-cal-editor", e_source_peek_name (e_cal_get_source (priv->client)), NULL); + e_alert_run_dialog_for_args ((GtkWindow *) gtk_widget_get_toplevel (GTK_WIDGET (editor)), "calendar:prompt-read-only-cal-editor", e_source_peek_name (e_cal_get_source (priv->client)), NULL); /* don't discard changes when selected readonly calendar */ return FALSE; } diff --git a/calendar/gui/dialogs/delete-comp.c b/calendar/gui/dialogs/delete-comp.c index c205f3bd8d..d5f5929e6a 100644 --- a/calendar/gui/dialogs/delete-comp.c +++ b/calendar/gui/dialogs/delete-comp.c @@ -27,7 +27,7 @@ #endif #include -#include "e-util/e-error.h" +#include "e-util/e-alert.h" #include "../calendar-config.h" #include "delete-comp.h" @@ -159,7 +159,7 @@ delete_component_dialog (ECalComponent *comp, arg0 = g_strdup_printf ("%d", n_comps); } - response = e_error_run_dialog_for_args ((GtkWindow *) gtk_widget_get_toplevel (widget), id, arg0, NULL); + response = e_alert_run_dialog_for_args ((GtkWindow *) gtk_widget_get_toplevel (widget), id, arg0, NULL); g_free (arg0); return response == GTK_RESPONSE_YES; diff --git a/calendar/gui/dialogs/save-comp.c b/calendar/gui/dialogs/save-comp.c index 91f55a0ca7..dc698b4596 100644 --- a/calendar/gui/dialogs/save-comp.c +++ b/calendar/gui/dialogs/save-comp.c @@ -25,7 +25,7 @@ #include #endif -#include "e-util/e-error.h" +#include "e-util/e-alert.h" #include "save-comp.h" #include "comp-editor.h" @@ -50,13 +50,13 @@ save_component_dialog (GtkWindow *parent, ECalComponent *comp) case E_CAL_COMPONENT_EVENT: flags = comp_editor_get_flags (COMP_EDITOR(parent)); if (flags & COMP_EDITOR_MEETING) - return e_error_run_dialog_for_args (parent, "calendar:prompt-save-meeting", NULL); + return e_alert_run_dialog_for_args (parent, "calendar:prompt-save-meeting", NULL); else - return e_error_run_dialog_for_args (parent, "calendar:prompt-save-appointment", NULL); + return e_alert_run_dialog_for_args (parent, "calendar:prompt-save-appointment", NULL); case E_CAL_COMPONENT_TODO: - return e_error_run_dialog_for_args (parent, "calendar:prompt-save-task", NULL); + return e_alert_run_dialog_for_args (parent, "calendar:prompt-save-task", NULL); case E_CAL_COMPONENT_JOURNAL: - return e_error_run_dialog_for_args (parent, "calendar:prompt-save-memo", NULL); + return e_alert_run_dialog_for_args (parent, "calendar:prompt-save-memo", NULL); default: return GTK_RESPONSE_NO; } diff --git a/calendar/gui/dialogs/send-comp.c b/calendar/gui/dialogs/send-comp.c index 13f016982e..1d663478c8 100644 --- a/calendar/gui/dialogs/send-comp.c +++ b/calendar/gui/dialogs/send-comp.c @@ -27,7 +27,7 @@ #endif #include -#include "e-util/e-error.h" +#include "e-util/e-alert.h" #include "send-comp.h" @@ -154,7 +154,7 @@ send_component_dialog (GtkWindow *parent, ECal *client, ECalComponent *comp, gbo strip_alarms = NULL; } - dialog = e_error_new_dialog_for_args (parent, id, NULL); + dialog = e_alert_new_dialog_for_args (parent, id, NULL); if (strip_alarms) sa_checkbox = add_checkbox (GTK_BOX (GTK_DIALOG (dialog)->vbox), _("Send my alarms with this event")); @@ -199,7 +199,7 @@ send_component_prompt_subject (GtkWindow *parent, ECal *client, ECalComponent *c return FALSE; } - if (e_error_run_dialog_for_args (parent, id, NULL) == GTK_RESPONSE_YES) + if (e_alert_run_dialog_for_args (parent, id, NULL) == GTK_RESPONSE_YES) return TRUE; else return FALSE; diff --git a/calendar/gui/e-calendar-view.c b/calendar/gui/e-calendar-view.c index 885cd66a90..840c5526c6 100644 --- a/calendar/gui/e-calendar-view.c +++ b/calendar/gui/e-calendar-view.c @@ -32,7 +32,7 @@ #include #include #include -#include +#include #include #include #include @@ -1202,7 +1202,7 @@ e_calendar_view_new_appointment_for (ECalendarView *cal_view, if (e_cal_is_read_only (default_client, &readonly, NULL) && readonly) { GtkWidget *widget; - widget = e_error_new_dialog_for_args (parent, "calendar:prompt-read-only-cal", e_source_peek_name (e_cal_get_source (default_client)), NULL); + widget = e_alert_new_dialog_for_args (parent, "calendar:prompt-read-only-cal", e_source_peek_name (e_cal_get_source (default_client)), NULL); g_signal_connect ((GtkDialog *)widget, "response", G_CALLBACK (gtk_widget_destroy), widget); diff --git a/calendar/gui/gnome-cal.c b/calendar/gui/gnome-cal.c index 1d6629aa61..22791b31c3 100644 --- a/calendar/gui/gnome-cal.c +++ b/calendar/gui/gnome-cal.c @@ -46,7 +46,7 @@ #include #include "e-util/e-binding.h" #include "e-util/e-util.h" -#include "e-util/e-error.h" +#include "e-util/e-alert.h" #include "e-util/e-util-private.h" #include "shell/e-shell.h" #include "dialogs/delete-error.h" @@ -1900,7 +1900,7 @@ client_cal_opened_cb (ECal *ecal, ECalendarStatus status, GnomeCalendar *gcal) return; } - w = e_error_new_dialog_for_args (parent, "calendar:server-version", NULL); + w = e_alert_new_dialog_for_args (parent, "calendar:server-version", NULL); /*e_calendar_utils_show_error_silent (w); KILL-BONOBO */ g_hash_table_insert (non_intrusive_error_table, id, g_object_ref(w)); g_signal_connect(w, "destroy", G_CALLBACK(non_intrusive_error_remove), id); @@ -1922,7 +1922,7 @@ client_cal_opened_cb (ECal *ecal, ECalendarStatus status, GnomeCalendar *gcal) return; } - w = e_error_new_dialog_for_args (parent, "calendar:unable-to-load-the-calendar", e_cal_get_error_message (status), NULL); + w = e_alert_new_dialog_for_args (parent, "calendar:unable-to-load-the-calendar", e_cal_get_error_message (status), NULL); /*e_calendar_utils_show_error_silent (w); KILL-BONOBO */ g_hash_table_insert (non_intrusive_error_table, id, g_object_ref(w)); g_signal_connect(w, "destroy", G_CALLBACK(non_intrusive_error_remove), id); @@ -1987,7 +1987,7 @@ default_client_cal_opened_cb (ECal *ecal, ECalendarStatus status, GnomeCalendar e_cal_open_async (ecal, FALSE); return; case E_CALENDAR_STATUS_INVALID_SERVER_VERSION: - e_error_run_dialog_for_args (GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (gcal))), "calendar:server-version", NULL); + e_alert_run_dialog_for_args (GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (gcal))), "calendar:server-version", NULL); default: /* Make sure the source doesn't disappear on us */ g_object_ref (source); @@ -2067,7 +2067,7 @@ backend_error_cb (ECal *client, const gchar *message, gpointer data) return; } - dialog = (GtkDialog *)e_error_new(parent, "calendar:error-on-loading-the-calendar", uristr, message, NULL); + dialog = (GtkDialog *)e_alert_new(parent, "calendar:error-on-loading-the-calendar", uristr, message, NULL); /* e_calendar_utils_show_error_silent(GTK_WIDGET (dialog)); KILL-BONOBO */ g_hash_table_insert (non_intrusive_error_table, id, g_object_ref(dialog)); @@ -2114,7 +2114,7 @@ backend_died_cb (ECal *ecal, gpointer data) return; } - w = e_error_new_dialog_for_args (parent, "calendar:backend_died", NULL); + w = e_alert_new_dialog_for_args (parent, "calendar:backend_died", NULL); /* e_calendar_utils_show_error_silent (w); KILL-BONOBO */ g_hash_table_insert (non_intrusive_error_table, (gpointer) id, g_object_ref(w)); g_signal_connect((GtkObject *)w, "destroy", G_CALLBACK(non_intrusive_error_remove), (gpointer) id); diff --git a/calendar/importers/icalendar-importer.c b/calendar/importers/icalendar-importer.c index 6a09c36e03..b7b2b515ad 100644 --- a/calendar/importers/icalendar-importer.c +++ b/calendar/importers/icalendar-importer.c @@ -284,13 +284,13 @@ ivcal_import_items(gpointer d) case E_CAL_SOURCE_TYPE_EVENT: prepare_events (ici->icalcomp, NULL); if (!update_objects (ici->client, ici->icalcomp)) { - /* FIXME: e_error ... */; + /* FIXME: e_alert ... */; } break; case E_CAL_SOURCE_TYPE_TODO: prepare_tasks (ici->icalcomp, NULL); if (!update_objects (ici->client, ici->icalcomp)) { - /* FIXME: e_error ... */; + /* FIXME: e_alert ... */; } break; default: diff --git a/composer/e-composer-actions.c b/composer/e-composer-actions.c index f7ea281f78..31c069a088 100644 --- a/composer/e-composer-actions.c +++ b/composer/e-composer-actions.c @@ -21,7 +21,7 @@ #include #include -#include +#include static void action_attach_cb (GtkAction *action, @@ -78,7 +78,7 @@ action_close_cb (GtkAction *action, if (subject == NULL || *subject == '\0') subject = _("Untitled Message"); - response = e_error_run_dialog_for_args ( + response = e_alert_run_dialog_for_args ( GTK_WINDOW (composer), "mail-composer:exit-unsaved", subject, NULL); @@ -162,16 +162,16 @@ action_save_cb (GtkAction *action, if (g_file_test (filename, G_FILE_TEST_IS_REGULAR)) { gint response; - response = e_error_run_dialog_for_args ( + response = e_alert_run_dialog_for_args ( GTK_WINDOW (composer), - E_ERROR_ASK_FILE_EXISTS_OVERWRITE, + E_ALERT_ASK_FILE_EXISTS_OVERWRITE, filename, NULL); if (response != GTK_RESPONSE_OK) return; } else { - e_error_run_dialog_for_args ( + e_alert_run_dialog_for_args ( GTK_WINDOW (composer), - E_ERROR_NO_SAVE_FILE, filename, + E_ALERT_NO_SAVE_FILE, filename, g_strerror (errno_saved), NULL); return; } @@ -179,9 +179,9 @@ action_save_cb (GtkAction *action, close (fd); if (!gtkhtml_editor_save (editor, filename, TRUE, &error)) { - e_error_run_dialog_for_args ( + e_alert_run_dialog_for_args ( GTK_WINDOW (composer), - E_ERROR_NO_SAVE_FILE, + E_ALERT_NO_SAVE_FILE, filename, error->message, NULL); g_error_free (error); return; diff --git a/composer/e-composer-autosave.c b/composer/e-composer-autosave.c index 5a9c95705b..638ca9b019 100644 --- a/composer/e-composer-autosave.c +++ b/composer/e-composer-autosave.c @@ -22,7 +22,7 @@ #include #include -#include +#include #include #include #include @@ -123,7 +123,7 @@ composer_autosave_finish_cb (EMsgComposer *composer, e_composer_autosave_snapshot_finish (composer, result, &error); if (error != NULL) { - e_error_run_dialog_for_args ( + e_alert_run_dialog_for_args ( GTK_WINDOW (composer), "mail-composer:no-autosave", "", error->message, NULL); diff --git a/composer/e-msg-composer.c b/composer/e-msg-composer.c index 77a7014c47..07bec1ac13 100644 --- a/composer/e-msg-composer.c +++ b/composer/e-msg-composer.c @@ -47,7 +47,7 @@ #include #include "e-util/e-dialog-utils.h" -#include "e-util/e-error.h" +#include "e-util/e-alert.h" #include "e-util/e-mktemp.h" #include "e-util/e-plugin-ui.h" #include "e-util/e-util-private.h" @@ -174,7 +174,7 @@ emcu_prompt_user (GtkWindow *parent, const gchar *promptkey, const gchar *tag, c va_list ap; gint button; GConfClient *gconf = gconf_client_get_default (); - EError *error = NULL; + EAlert *alert = NULL; if (promptkey && !gconf_client_get_bool(gconf, promptkey, NULL)) { @@ -183,11 +183,11 @@ emcu_prompt_user (GtkWindow *parent, const gchar *promptkey, const gchar *tag, c } va_start(ap, arg0); - error = e_error_newv(tag, arg0, ap); + alert = e_alert_newv(tag, arg0, ap); va_end(ap); - mbox = e_error_new_dialog (parent, error); - e_error_free (error); + mbox = e_alert_new_dialog (parent, alert); + e_alert_free (alert); if (promptkey) { check = gtk_check_button_new_with_mnemonic (_("_Do not show this message again.")); @@ -1085,7 +1085,7 @@ skip_content: camel_object_unref (new); if (ex.id != CAMEL_EXCEPTION_USER_CANCEL) { - e_error_run_dialog_for_args ((GtkWindow *)composer, "mail-composer:no-build-message", + e_alert_run_dialog_for_args ((GtkWindow *)composer, "mail-composer:no-build-message", camel_exception_get_description (&ex), NULL); } @@ -1377,7 +1377,7 @@ autosave_load_draft_cb (EMsgComposer *composer, g_unlink (filename); else { - e_error_run_dialog_for_args ( + e_alert_run_dialog_for_args ( GTK_WINDOW (composer), "mail-composer:no-autosave", (filename != NULL) ? filename : "", @@ -4020,7 +4020,7 @@ e_msg_composer_check_autosave (GtkWindow *parent) } /* Ask if the user wants to recover the orphaned files. */ - response = e_error_run_dialog_for_args ( + response = e_alert_run_dialog_for_args ( parent, "mail-composer:recover-autosave", NULL); /* Based on the user's response, recover or delete them. */ diff --git a/e-util/Makefile.am b/e-util/Makefile.am index c0b12d63c1..51fa43428e 100644 --- a/e-util/Makefile.am +++ b/e-util/Makefile.am @@ -22,7 +22,7 @@ eutilinclude_HEADERS = \ e-datetime-format.h \ e-dialog-utils.h \ e-dialog-widgets.h \ - e-error.h \ + e-alert.h \ e-event.h \ e-file-utils.h \ e-folder-map.h \ @@ -95,7 +95,7 @@ libeutil_la_SOURCES = \ e-datetime-format.c \ e-dialog-utils.c \ e-dialog-widgets.c \ - e-error.c \ + e-alert.c \ e-event.c \ e-file-utils.c \ e-folder-map.c \ diff --git a/e-util/e-alert.c b/e-util/e-alert.c new file mode 100644 index 0000000000..cc7488744e --- /dev/null +++ b/e-util/e-alert.c @@ -0,0 +1,698 @@ +/* + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) version 3. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with the program; if not, see + * + * + * Authors: + * Michael Zucchi + * + * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) + * + */ + +#include + +#include +#include + +#include +#include + +#include +#include + +#include + +#include "e-util.h" +#include "e-util-private.h" +#include "e-alert.h" + +#define d(x) + +struct _EAlert +{ + gchar *tag; + GPtrArray *args; +}; + +void +e_alert_free (EAlert *alert) +{ + if (alert == NULL) + return; + g_free (alert->tag); + /* arg strings will be freed automatically since we set a free func when + * creating the ptr array */ + g_ptr_array_free (alert->args, TRUE); +} + +struct _e_alert_button { + struct _e_alert_button *next; + const gchar *stock; + const gchar *label; + gint response; +}; + +struct _e_alert { + guint32 flags; + const gchar *id; + gint type; + gint default_response; + const gchar *title; + const gchar *primary; + const gchar *secondary; + const gchar *help_uri; + gboolean scroll; + struct _e_alert_button *buttons; +}; + +struct _e_alert_table { + const gchar *domain; + const gchar *translation_domain; + GHashTable *alerts; +}; + +static GHashTable *alert_table; + +/* ********************************************************************** */ + +static struct _e_alert_button default_ok_button = { + NULL, "gtk-ok", NULL, GTK_RESPONSE_OK +}; + +static struct _e_alert default_alerts[] = { + { GTK_DIALOG_MODAL, "error", 3, GTK_RESPONSE_OK, N_("Evolution Error"), "{0}", "{1}", NULL, FALSE, &default_ok_button }, + { GTK_DIALOG_MODAL, "error-primary", 3, GTK_RESPONSE_OK, N_("Evolution Error"), "{0}", NULL, NULL, FALSE, &default_ok_button }, + { GTK_DIALOG_MODAL, "warning", 1, GTK_RESPONSE_OK, N_("Evolution Warning"), "{0}", "{1}", NULL, FALSE, &default_ok_button }, + { GTK_DIALOG_MODAL, "warning-primary", 1, GTK_RESPONSE_OK, N_("Evolution Warning"), "{0}", NULL, NULL, FALSE, &default_ok_button }, +}; + +/* ********************************************************************** */ + +static struct { + const gchar *name; + gint id; +} response_map[] = { + { "GTK_RESPONSE_REJECT", GTK_RESPONSE_REJECT }, + { "GTK_RESPONSE_ACCEPT", GTK_RESPONSE_ACCEPT }, + { "GTK_RESPONSE_OK", GTK_RESPONSE_OK }, + { "GTK_RESPONSE_CANCEL", GTK_RESPONSE_CANCEL }, + { "GTK_RESPONSE_CLOSE", GTK_RESPONSE_CLOSE }, + { "GTK_RESPONSE_YES", GTK_RESPONSE_YES }, + { "GTK_RESPONSE_NO", GTK_RESPONSE_NO }, + { "GTK_RESPONSE_APPLY", GTK_RESPONSE_APPLY }, + { "GTK_RESPONSE_HELP", GTK_RESPONSE_HELP }, +}; + +static gint +map_response(const gchar *name) +{ + gint i; + + for (i = 0; i < G_N_ELEMENTS (response_map); i++) + if (!strcmp(name, response_map[i].name)) + return response_map[i].id; + + return 0; +} + +static struct { + const gchar *name; + const gchar *icon; +} type_map[] = { + { "info", GTK_STOCK_DIALOG_INFO }, + { "warning", GTK_STOCK_DIALOG_WARNING }, + { "question", GTK_STOCK_DIALOG_QUESTION }, + { "error", GTK_STOCK_DIALOG_ERROR }, +}; + +static gint +map_type(const gchar *name) +{ + gint i; + + if (name) { + for (i = 0; i < G_N_ELEMENTS (type_map); i++) + if (!strcmp(name, type_map[i].name)) + return i; + } + + return 3; +} + +/* + XML format: + + + Window Title? + Primary error text.? + Secondary error text.? + ? +