diff options
author | Chris Toshok <toshok@ximian.com> | 2004-04-11 01:23:16 +0800 |
---|---|---|
committer | Chris Toshok <toshok@src.gnome.org> | 2004-04-11 01:23:16 +0800 |
commit | 203132df9b3d99d88cef1b8a6cb397d32d6ff55b (patch) | |
tree | ce627ba788332909dbd7e828d3c3b1f17ea1d8a9 | |
parent | f556de209eb4261f46fb32ab89098693193b0f46 (diff) | |
download | gsoc2013-evolution-203132df9b3d99d88cef1b8a6cb397d32d6ff55b.tar.gz 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
-rw-r--r-- | addressbook/ChangeLog | 20 | ||||
-rw-r--r-- | addressbook/gui/component/addressbook.c | 104 | ||||
-rw-r--r-- | addressbook/gui/component/addressbook.h | 1 | ||||
-rw-r--r-- | addressbook/gui/widgets/eab-gui-util.c | 107 | ||||
-rw-r--r-- | addressbook/gui/widgets/eab-gui-util.h | 5 |
5 files changed, 134 insertions, 103 deletions
diff --git a/addressbook/ChangeLog b/addressbook/ChangeLog index b3390ffbe7..f3f3ef7e6a 100644 --- a/addressbook/ChangeLog +++ b/addressbook/ChangeLog @@ -1,5 +1,25 @@ 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. + +2004-04-10 Chris Toshok <toshok@ximian.com> + * util/e-destination.h: remove the e_destination_get_book api, since the function doesn't exist. diff --git a/addressbook/gui/component/addressbook.c b/addressbook/gui/component/addressbook.c index 6de2d8d921..9e5f3795bc 100644 --- a/addressbook/gui/component/addressbook.c +++ b/addressbook/gui/component/addressbook.c @@ -268,44 +268,7 @@ set_status_message (EABView *eav, const char *message, AddressbookView *view) static void search_result (EABView *eav, EBookViewStatus status, AddressbookView *view) { - 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 (NULL, - 0, - GTK_MESSAGE_WARNING, - GTK_BUTTONS_OK, - str); - g_signal_connect (dialog, "response", G_CALLBACK(gtk_widget_destroy), NULL); - gtk_widget_show (dialog); - } + eab_search_result_dialog (NULL /* XXX */, status); } static void @@ -583,69 +546,6 @@ addressbook_view_unref (AddressbookView *view) } } -void -addressbook_show_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); -} - typedef struct { EABView *view; ESource *source; @@ -672,7 +572,7 @@ book_open_cb (EBook *book, EBookStatus status, gpointer closure) NULL); } else { - addressbook_show_load_error_dialog (NULL /* XXX */, source, status); + eab_load_error_dialog (NULL /* XXX */, source, status); } diff --git a/addressbook/gui/component/addressbook.h b/addressbook/gui/component/addressbook.h index 875752e0c3..6eb4210951 100644 --- a/addressbook/gui/component/addressbook.h +++ b/addressbook/gui/component/addressbook.h @@ -15,7 +15,6 @@ void addressbook_load_uri (EBook *book, const char *uri, EBook guint addressbook_load_source (EBook *book, ESource *source, EBookCallback cb, gpointer closure); void addressbook_load_source_cancel (guint id); void addressbook_load_default_book (EBookCallback open_response, gpointer closure); -void addressbook_show_load_error_dialog (GtkWidget *parent, ESource *source, EBookStatus status); BonoboControl *addressbook_new_control (void); 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, |