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/ChangeLog | 11 +++++++++++ addressbook/addressbook.error.xml | 5 +++++ addressbook/gui/widgets/e-addressbook-view.c | 25 +++++++++++++++++++++---- 3 files changed, 37 insertions(+), 4 deletions(-) diff --git a/addressbook/ChangeLog b/addressbook/ChangeLog index 83a5b49cd8..e1e101633e 100644 --- a/addressbook/ChangeLog +++ b/addressbook/ChangeLog @@ -1,3 +1,14 @@ +2006-08-07 Sushma Rai + + * gui/widgets/e-addressbook-view.c (eab_view_delete_selection): Added a + callback function to handle the contact deletion error. + (delete_contacts_cb): Added new, a callback function. + + * addressbook.error.xml: Added a error code contact-delete-error-perm + and corresponding error string. Fixes #260403 + + Original patch was submitted by "Vandana Shenoy .B" + 2006-07-25 Johnny Jacob * gui/widgets/e-addressbook-view.c: (search_activated), diff --git a/addressbook/addressbook.error.xml b/addressbook/addressbook.error.xml index e5052416af..446e51c05b 100644 --- a/addressbook/addressbook.error.xml +++ b/addressbook/addressbook.error.xml @@ -108,4 +108,9 @@ <_secondary>Currently you can access only GroupWise System Address Book from Evolution. Please use some other GroupWise mail client once, to get your GroupWise Frequent Contacts and Groupwise Personal Contacts folders. + + <_primary>Failed to delete contact + <_secondary>Permission Denied. + + 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 v1.2.3