aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook/gui/widgets/eab-gui-util.c
diff options
context:
space:
mode:
authorChris Toshok <toshok@ximian.com>2004-04-11 01:23:16 +0800
committerChris Toshok <toshok@src.gnome.org>2004-04-11 01:23:16 +0800
commit203132df9b3d99d88cef1b8a6cb397d32d6ff55b (patch)
treece627ba788332909dbd7e828d3c3b1f17ea1d8a9 /addressbook/gui/widgets/eab-gui-util.c
parentf556de209eb4261f46fb32ab89098693193b0f46 (diff)
downloadgsoc2013-evolution-203132df9b3d99d88cef1b8a6cb397d32d6ff55b.tar
gsoc2013-evolution-203132df9b3d99d88cef1b8a6cb397d32d6ff55b.tar.gz
gsoc2013-evolution-203132df9b3d99d88cef1b8a6cb397d32d6ff55b.tar.bz2
gsoc2013-evolution-203132df9b3d99d88cef1b8a6cb397d32d6ff55b.tar.lz
gsoc2013-evolution-203132df9b3d99d88cef1b8a6cb397d32d6ff55b.tar.xz
gsoc2013-evolution-203132df9b3d99d88cef1b8a6cb397d32d6ff55b.tar.zst
gsoc2013-evolution-203132df9b3d99d88cef1b8a6cb397d32d6ff55b.zip
add prototypes for eab_load_error_dialog and eab_search_result_dialog.
2004-04-10 Chris Toshok <toshok@ximian.com> * 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
Diffstat (limited to 'addressbook/gui/widgets/eab-gui-util.c')
-rw-r--r--addressbook/gui/widgets/eab-gui-util.c107
1 files changed, 107 insertions, 0 deletions
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)
{