From 203132df9b3d99d88cef1b8a6cb397d32d6ff55b Mon Sep 17 00:00:00 2001 From: Chris Toshok Date: Sat, 10 Apr 2004 17:23:16 +0000 Subject: add prototypes for eab_load_error_dialog and eab_search_result_dialog. 2004-04-10 Chris Toshok * gui/widgets/eab-gui-util.h: add prototypes for eab_load_error_dialog and eab_search_result_dialog. * gui/widgets/eab-gui-util.c (eab_load_error_dialog): the new addressbook_show_load_error_dialog. (eab_search_result_dialog): new function, the old contents of addressbook.c:search_result. * gui/component/addressbook.c (addressbook_show_load_error_dialog): move this function to eab-gui-utils.[ch] (search_result): split out the body of this into eab_search_result_dialog in eab-gui-utils.[ch]. (book_open_cb): call eab_load_error_dialog. * gui/component/addressbook.h: remove prototype for addressbook_show_load_error_dialog. svn path=/trunk/; revision=25409 --- addressbook/gui/widgets/eab-gui-util.c | 107 +++++++++++++++++++++++++++++++++ addressbook/gui/widgets/eab-gui-util.h | 5 ++ 2 files changed, 112 insertions(+) (limited to 'addressbook/gui/widgets') diff --git a/addressbook/gui/widgets/eab-gui-util.c b/addressbook/gui/widgets/eab-gui-util.c index 3ad9ae7a9f..14f446644f 100644 --- a/addressbook/gui/widgets/eab-gui-util.c +++ b/addressbook/gui/widgets/eab-gui-util.c @@ -73,6 +73,113 @@ eab_error_dialog (const gchar *msg, EBookStatus status) g_free (error_msg); } +void +eab_load_error_dialog (GtkWidget *parent, ESource *source, EBookStatus status) +{ + char *label_string; + GtkWidget *warning_dialog; + GtkWidget *href = NULL; + gchar *uri; + + g_return_if_fail (source != NULL); + + uri = e_source_get_uri (source); + + if (!strncmp (uri, "file:", 5)) { + label_string = + _("We were unable to open this addressbook. Please check that the " + "path exists and that you have permission to access it."); + } + else if (!strncmp (uri, "ldap:", 5)) { + /* special case for ldap: contact folders so we can tell the user about openldap */ +#if HAVE_LDAP + label_string = + _("We were unable to open this addressbook. This either " + "means you have entered an incorrect URI, or the LDAP server " + "is unreachable."); +#else + label_string = + _("This version of Evolution does not have LDAP support " + "compiled in to it. If you want to use LDAP in Evolution " + "you must compile the program from the CVS sources after " + "retrieving OpenLDAP from the link below."); + href = gnome_href_new ("http://www.openldap.org/", "OpenLDAP at http://www.openldap.org/"); +#endif + } else { + /* other network folders */ + label_string = + _("We were unable to open this addressbook. This either " + "means you have entered an incorrect URI, or the server " + "is unreachable."); + } + + warning_dialog = gtk_message_dialog_new (parent ? GTK_WINDOW (parent) : NULL, + 0, + GTK_MESSAGE_WARNING, + GTK_BUTTONS_CLOSE, + label_string, + NULL); + + g_signal_connect (warning_dialog, + "response", + G_CALLBACK (gtk_widget_destroy), + warning_dialog); + + gtk_window_set_title (GTK_WINDOW (warning_dialog), _("Unable to open addressbook")); + + if (href) + gtk_box_pack_start (GTK_BOX (GTK_DIALOG (warning_dialog)->vbox), + href, FALSE, FALSE, 0); + + gtk_widget_show_all (warning_dialog); + + g_free (uri); +} + +void +eab_search_result_dialog (GtkWidget *parent, + EBookViewStatus status) +{ + char *str = NULL; + + switch (status) { + case E_BOOK_VIEW_STATUS_OK: + return; + case E_BOOK_VIEW_STATUS_SIZE_LIMIT_EXCEEDED: + str = _("More cards matched this query than either the server is \n" + "configured to return or Evolution is configured to display.\n" + "Please make your search more specific or raise the result limit in\n" + "the directory server preferences for this addressbook."); + break; + case E_BOOK_VIEW_STATUS_TIME_LIMIT_EXCEEDED: + str = _("The time to execute this query exceeded the server limit or the limit\n" + "you have configured for this addressbook. Please make your search\n" + "more specific or raise the time limit in the directory server\n" + "preferences for this addressbook."); + break; + case E_BOOK_VIEW_ERROR_INVALID_QUERY: + str = _("The backend for this addressbook was unable to parse this query."); + break; + case E_BOOK_VIEW_ERROR_QUERY_REFUSED: + str = _("The backend for this addressbook refused to perform this query."); + break; + case E_BOOK_VIEW_ERROR_OTHER_ERROR: + str = _("This query did not complete successfully."); + break; + } + + if (str) { + GtkWidget *dialog; + dialog = gtk_message_dialog_new (parent ? GTK_WINDOW (parent) : NULL, + 0, + GTK_MESSAGE_WARNING, + GTK_BUTTONS_OK, + str); + g_signal_connect (dialog, "response", G_CALLBACK(gtk_widget_destroy), NULL); + gtk_widget_show (dialog); + } +} + gint eab_prompt_save_dialog (GtkWindow *parent) { diff --git a/addressbook/gui/widgets/eab-gui-util.h b/addressbook/gui/widgets/eab-gui-util.h index 5f96bc740c..e986fd925a 100644 --- a/addressbook/gui/widgets/eab-gui-util.h +++ b/addressbook/gui/widgets/eab-gui-util.h @@ -29,6 +29,11 @@ G_BEGIN_DECLS void eab_error_dialog (const gchar *msg, EBookStatus status); +void eab_load_error_dialog (GtkWidget *parent, + ESource *source, + EBookStatus status); +void eab_search_result_dialog (GtkWidget *parent, + EBookViewStatus status); gint eab_prompt_save_dialog (GtkWindow *parent); EContactEditor *eab_show_contact_editor (EBook *book, -- cgit v1.2.3