diff options
author | Jeffrey Stedfast <fejj@novell.com> | 2004-05-25 22:57:04 +0800 |
---|---|---|
committer | Jeffrey Stedfast <fejj@src.gnome.org> | 2004-05-25 22:57:04 +0800 |
commit | 479e75883911fc03b2b7d09d69f48faf0f3812eb (patch) | |
tree | e0fd0f15f7abaf56031e6be4262a2cc3aea74ba7 /addressbook/gui/component | |
parent | f87fe83e1df3a2370b9b2dcef90eb8869f4b0eff (diff) | |
download | gsoc2013-evolution-479e75883911fc03b2b7d09d69f48faf0f3812eb.tar.gz gsoc2013-evolution-479e75883911fc03b2b7d09d69f48faf0f3812eb.tar.zst gsoc2013-evolution-479e75883911fc03b2b7d09d69f48faf0f3812eb.zip |
Generate the addressbook-errors.xml.h file and install the xml file and
2004-05-25 Jeffrey Stedfast <fejj@novell.com>
* Makefile.am: Generate the addressbook-errors.xml.h file and
install the xml file and all that jazz.
* addressbook-errors.xml: New error xml file.
* gui/widgets/e-addressbook-view.c (backend_died): Use
e_error_run().
* gui/widgets/eab-gui-util.c (eab_error_dialog): Use
e_error_run().
(eab_load_error_dialog): Same.
(eab_search_result_dialog): Same.
(eab_prompt_save_dialog): Same.
(save_it): Same.
* gui/contact-editor/e-contact-editor.c (categories_clicked): Use
e_error_run().
(e_contact_editor_is_valid): Same.
(save_contact): Same.
* gui/component/addressbook-view.c (delete_addressbook_cb): Use
e_error_run().
* gui/component/addressbook-config.c (addressbook_ldap_init): Use
e_error_run().
(addressbook_ldap_auth): Same.
(addressbook_root_dse_query): Same.
(do_ldap_root_dse_query): Same.
(do_schema_query): Same.
svn path=/trunk/; revision=26077
Diffstat (limited to 'addressbook/gui/component')
-rw-r--r-- | addressbook/gui/component/addressbook-config.c | 71 | ||||
-rw-r--r-- | addressbook/gui/component/addressbook-view.c | 15 |
2 files changed, 21 insertions, 65 deletions
diff --git a/addressbook/gui/component/addressbook-config.c b/addressbook/gui/component/addressbook-config.c index e9e3c123f4..47ca15ebc5 100644 --- a/addressbook/gui/component/addressbook-config.c +++ b/addressbook/gui/component/addressbook-config.c @@ -29,6 +29,8 @@ #include "addressbook-component.h" #include "addressbook-config.h" +#include "widgets/misc/e-error.h" + #include "evolution-config-control.h" #include <gal/e-table/e-table-memory-store.h> @@ -473,17 +475,8 @@ addressbook_ldap_init (GtkWidget *window, ESource *source) if (!source_to_uri_parts (source, &host, NULL, NULL, &port)) return NULL; - ldap = ldap_init (host, port); - if (!ldap) { - GtkWidget *dialog; - dialog = gtk_message_dialog_new (GTK_WINDOW(window), - GTK_DIALOG_MODAL, - GTK_MESSAGE_ERROR, - GTK_BUTTONS_OK, - _("Failed to connect to LDAP server")); - g_signal_connect (dialog, "response", G_CALLBACK(gtk_widget_destroy), NULL); - gtk_widget_show (dialog); - } + if (!(ldap = ldap_init (host, port))) + e_error_run ((GtkWindow *) window, "addressbook:ldap-init", NULL); /* XXX do TLS if it's configured in */ @@ -498,23 +491,15 @@ addressbook_ldap_auth (GtkWidget *window, LDAP *ldap) /* XXX use auth info from source */ ldap_error = ldap_simple_bind_s (ldap, NULL, NULL); - if (LDAP_SUCCESS != ldap_error) { - GtkWidget *dialog; - dialog = gtk_message_dialog_new (GTK_WINDOW (window), - GTK_DIALOG_MODAL, - GTK_MESSAGE_ERROR, - GTK_BUTTONS_OK, - _("Failed to authenticate with LDAP server")); - g_signal_connect (dialog, "response", G_CALLBACK(gtk_widget_destroy), NULL); - gtk_widget_show (dialog); - } - + if (LDAP_SUCCESS != ldap_error) + e_error_run ((GtkWindow *) window, "addressbook:ldap-auth", NULL); + return ldap_error; } static int addressbook_root_dse_query (AddressbookSourceDialog *dialog, GtkWindow *window, LDAP *ldap, -char **attrs, LDAPMessage **resp) + char **attrs, LDAPMessage **resp) { int ldap_error; struct timeval timeout; @@ -526,17 +511,9 @@ char **attrs, LDAPMessage **resp) LDAP_ROOT_DSE, LDAP_SCOPE_BASE, "(objectclass=*)", attrs, 0, NULL, NULL, &timeout, LDAP_NO_LIMIT, resp); - if (LDAP_SUCCESS != ldap_error) { - GtkWidget *dialog; - dialog = gtk_message_dialog_new (window, - GTK_DIALOG_MODAL, - GTK_MESSAGE_ERROR, - GTK_BUTTONS_OK, - _("Could not perform query on Root DSE")); - g_signal_connect (dialog, "response", G_CALLBACK(gtk_widget_destroy), NULL); - gtk_widget_show (dialog); - } - + if (LDAP_SUCCESS != ldap_error) + e_error_run ((GtkWindow *) window, "addressbook:ldap-search-base", NULL); + return ldap_error; } @@ -832,14 +809,7 @@ do_ldap_root_dse_query (AddressbookSourceDialog *sdialog, GtkWidget *dialog, ETa values = ldap_get_values (ldap, resp, "namingContexts"); if (!values || values[0] == NULL) { - GtkWidget *error_dialog; - error_dialog = gtk_message_dialog_new (GTK_WINDOW (dialog), - GTK_DIALOG_MODAL, - GTK_MESSAGE_ERROR, - GTK_BUTTONS_OK, - _("The server responded with no supported search bases")); - g_signal_connect (error_dialog, "response", G_CALLBACK(gtk_widget_destroy), NULL); - gtk_widget_show (error_dialog); + e_error_run ((GtkWindow *) dialog, "addressbook:ldap-search-base", NULL); goto fail; } @@ -1241,9 +1211,7 @@ do_schema_query (AddressbookSourceDialog *sdialog) values = ldap_get_values (ldap, resp, "subschemaSubentry"); if (!values || values[0] == NULL) { - GtkWidget *dialog; - dialog = gnome_ok_dialog_parented (_("This server does not support LDAPv3 schema information"), GTK_WINDOW (sdialog->window)); - gtk_window_set_modal (GTK_WINDOW (dialog), TRUE); + e_error_run ((GtkWindow *) sdialog->window, "addressbook:ldap-v3-schema", NULL); goto fail; } @@ -1262,21 +1230,16 @@ do_schema_query (AddressbookSourceDialog *sdialog) "(objectClass=subschema)", attrs, 0, NULL, NULL, &timeout, LDAP_NO_LIMIT, &resp); if (LDAP_SUCCESS != ldap_error) { - GtkWidget *dialog; - dialog = gnome_error_dialog_parented (_("Error retrieving schema information"), GTK_WINDOW (sdialog->window)); - gtk_window_set_modal (GTK_WINDOW (dialog), TRUE); + e_error_run ((GtkWindow *) sdialog->window, "addressbook:ldap-get-schema", NULL); goto fail; } - values = ldap_get_values (ldap, resp, "objectClasses"); - if (!values) { - GtkWidget *dialog; - dialog = gnome_error_dialog_parented (_("Server did not respond with valid schema information"), GTK_WINDOW (sdialog->window)); - gtk_window_set_modal (GTK_WINDOW (dialog), TRUE); + if (!(values = ldap_get_values (ldap, resp, "objectClasses"))) { + e_error_run ((GtkWindow *) sdialog->window, "addressbook:ldap-invalid-schema", NULL); goto fail; } - for (i = 0; values[i]; i ++) { + for (i = 0; values[i]; i ++) { int j; int code; const char *err; diff --git a/addressbook/gui/component/addressbook-view.c b/addressbook/gui/component/addressbook-view.c index 3b8c86cfef..ce0003cc03 100644 --- a/addressbook/gui/component/addressbook-view.c +++ b/addressbook/gui/component/addressbook-view.c @@ -38,6 +38,7 @@ #include <bonobo/bonobo-exception.h> #include <gal/util/e-util.h> +#include "widgets/misc/e-error.h" #include "widgets/misc/e-task-bar.h" #include "widgets/misc/e-info-label.h" #include "widgets/misc/e-source-selector.h" @@ -696,17 +697,9 @@ delete_addressbook_cb (GtkWidget *widget, AddressbookView *view) e_source_list_sync (priv->source_list, NULL); } else { - GtkWidget *error_dialog; - - error_dialog = gtk_message_dialog_new (GTK_WINDOW (gtk_widget_get_toplevel (widget)), - GTK_DIALOG_MODAL, - GTK_MESSAGE_ERROR, - GTK_BUTTONS_CLOSE, - "Error removing address book: %s", - error->message); - gtk_dialog_run (GTK_DIALOG (error_dialog)); - gtk_widget_destroy (error_dialog); - + e_error_run (GTK_WINDOW (gtk_widget_get_toplevel (widget)), + "addressbook:remove-addressbook", + error->message, NULL); g_error_free (error); } |