From fa8b494f312cbcfa6306d5a6628757befc348346 Mon Sep 17 00:00:00 2001 From: Sushma Rai Date: Mon, 7 Aug 2006 08:24:35 +0000 Subject: Added a callback to handle contact deletion error and corresponding error strings. Fixes #260403. svn path=/trunk/; revision=32483 --- addressbook/gui/widgets/e-addressbook-view.c | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) (limited to 'addressbook/gui/widgets') diff --git a/addressbook/gui/widgets/e-addressbook-view.c b/addressbook/gui/widgets/e-addressbook-view.c index 66df83b9eb..5023d2a3c5 100644 --- a/addressbook/gui/widgets/e-addressbook-view.c +++ b/addressbook/gui/widgets/e-addressbook-view.c @@ -1891,6 +1891,25 @@ eab_view_print_preview(EABView *view) #endif } +/* callback function to handle removal of contacts for + * which a user doesnt have write permission + */ +static void delete_contacts_cb (EBook *book, EBookStatus status, gpointer closure) +{ + switch(status) { + case E_BOOK_ERROR_OK : + case E_BOOK_ERROR_CANCELLED : + break; + case E_BOOK_ERROR_PERMISSION_DENIED : + e_error_run (NULL, "addressbook:contact-delete-error-perm", NULL); + break; + default : + /* Unknown error */ + e_error_run (NULL, "addressbook:generic-error", _("Failed to delete contact"), _("Other error"), NULL); + break; + } +} + void eab_view_delete_selection(EABView *view, gboolean is_delete) { @@ -1929,10 +1948,9 @@ eab_view_delete_selection(EABView *view, gboolean is_delete) } /* Remove the cards all at once. */ - /* XXX no callback specified... ugh */ e_book_async_remove_contacts (view->book, ids, - NULL, + delete_contacts_cb, NULL); g_list_free (ids); @@ -1941,10 +1959,9 @@ eab_view_delete_selection(EABView *view, gboolean is_delete) for (l=list;l;l=g_list_next(l)) { contact = l->data; /* Remove the card. */ - /* XXX no callback specified... ugh */ e_book_async_remove_contact (view->book, contact, - NULL, + delete_contacts_cb, NULL); } } -- cgit