diff options
-rw-r--r-- | addressbook/ChangeLog | 11 | ||||
-rw-r--r-- | addressbook/gui/widgets/eab-gui-util.c | 68 |
2 files changed, 54 insertions, 25 deletions
diff --git a/addressbook/ChangeLog b/addressbook/ChangeLog index 6b9389ef33..3f0a7de6c3 100644 --- a/addressbook/ChangeLog +++ b/addressbook/ChangeLog @@ -1,3 +1,14 @@ +2004-04-23 Chris Toshok <toshok@ximian.com> + + * gui/widgets/eab-gui-util.c (added_cb): this signal takes an + EContact* too. + (modified_cb): same. + (deleted_cb): same. + (eab_error_dialog): pad the table of status messages out with the + new status codes, and don't specify gui text for messages that + aren't generated by the backends. This fixes the "U" error + messages people were seeing. + 2004-04-22 Hans Petter Jansson <hpj@ximian.com> * gui/contact-editor/contact-editor.glade: Correct the dialog's title. diff --git a/addressbook/gui/widgets/eab-gui-util.c b/addressbook/gui/widgets/eab-gui-util.c index 5415aa1700..eef9988ce3 100644 --- a/addressbook/gui/widgets/eab-gui-util.c +++ b/addressbook/gui/widgets/eab-gui-util.c @@ -43,34 +43,46 @@ void eab_error_dialog (const gchar *msg, EBookStatus status) { + /* the NULL's in this table correspond to the status codes + that should *never* be generated by a backend */ static char *status_to_string[] = { - N_("Success"), - N_("Unknown error"), - N_("Repository offline"), - N_("Permission denied"), - N_("Contact not found"), - N_("Contact ID already exists"), - N_("Protocol not supported"), - N_("Cancelled"), - N_("Authentication Failed"), - N_("Authentication Required"), - N_("TLS not Available"), - N_("Address Book does not exist"), - N_("Other error") + /* E_BOOK_ERROR_OK */ N_("Success"), + /* E_BOOK_ERROR_INVALID_ARG */ NULL, + /* E_BOOK_ERROR_BUSY */ N_("Backend busy"), + /* E_BOOK_ERROR_REPOSITORY_OFFLINE */ N_("Repository offline"), + /* E_BOOK_ERROR_NO_SUCH_BOOK */ N_("Address Book does not exist"), + /* E_BOOK_ERROR_NO_SELF_CONTACT */ N_("No Self Contact defined"), + /* E_BOOK_ERROR_URI_NOT_LOADED */ NULL, + /* E_BOOK_ERROR_URI_ALREADY_LOADED */ NULL, + /* E_BOOK_ERROR_PERMISSION_DENIED */ N_("Permission denied"), + /* E_BOOK_ERROR_CONTACT_NOT_FOUND */ N_("Contact not found"), + /* E_BOOK_ERROR_CONTACT_ID_ALREADY_EXISTS */ N_("Contact ID already exists"), + /* E_BOOK_ERROR_PROTOCOL_NOT_SUPPORTED */ N_("Protocol not supported"), + /* E_BOOK_ERROR_CANCELLED */ N_("Cancelled"), + /* E_BOOK_ERROR_COULD_NOT_CANCEL */ N_("Could not cancel"), + /* E_BOOK_ERROR_AUTHENTICATION_FAILED */ N_("Authentication Failed"), + /* E_BOOK_ERROR_AUTHENTICATION_REQUIRED */ N_("Authentication Required"), + /* E_BOOK_ERROR_TLS_NOT_AVAILABLE */ N_("TLS not Available"), + /* E_BOOK_ERROR_CORBA_EXCEPTION */ NULL, + /* E_BOOK_ERROR_NO_SUCH_SOURCE */ N_("No such source"), + /* E_BOOK_ERROR_OTHER_ERROR */ N_("Other error") }; char *error_msg; + char *status_str = status_to_string [status]; GtkWidget *dialog; - error_msg = g_strdup_printf ("%s: %s", msg, _(status_to_string [status])); + if (status_str) { + error_msg = g_strdup_printf ("%s: %s", msg, _(status_str)); - dialog = gtk_message_dialog_new (NULL, 0, GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, - error_msg); + dialog = gtk_message_dialog_new (NULL, 0, GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, + error_msg); - g_signal_connect (dialog, "response", G_CALLBACK (gtk_widget_destroy), NULL); + g_signal_connect (dialog, "response", G_CALLBACK (gtk_widget_destroy), NULL); - gtk_widget_show (dialog); + gtk_widget_show (dialog); - g_free (error_msg); + g_free (error_msg); + } } void @@ -207,18 +219,22 @@ eab_prompt_save_dialog (GtkWindow *parent) } static void -added_cb (EBook* book, EBookStatus status, const char *id, - gboolean is_list) +added_cb (EBook* book, EBookStatus status, EContact *contact, + gpointer data) { + gboolean is_list = GPOINTER_TO_INT (data); + if (status != E_BOOK_ERROR_OK) { eab_error_dialog (is_list ? _("Error adding list") : _("Error adding contact"), status); } } static void -modified_cb (EBook* book, EBookStatus status, - gboolean is_list) +modified_cb (EBook* book, EBookStatus status, EContact *contact, + gpointer data) { + gboolean is_list = GPOINTER_TO_INT (data); + if (status != E_BOOK_ERROR_OK) { eab_error_dialog (is_list ? _("Error modifying list") : _("Error modifying contact"), status); @@ -226,9 +242,11 @@ modified_cb (EBook* book, EBookStatus status, } static void -deleted_cb (EBook* book, EBookStatus status, - gboolean is_list) +deleted_cb (EBook* book, EBookStatus status, EContact *contact, + gpointer data) { + gboolean is_list = GPOINTER_TO_INT (data); + if (status != E_BOOK_ERROR_OK) { eab_error_dialog (is_list ? _("Error removing list") : _("Error removing contact"), status); |