From 2b7464339fdfb4fea0e829a09820254f31bfce5b Mon Sep 17 00:00:00 2001 From: Sushma Rai Date: Mon, 9 May 2005 09:23:14 +0000 Subject: Forming contact deletion confirmation message based on contact(s) or contact list(s) being deleted. Fixes #222599 svn path=/trunk/; revision=29317 --- addressbook/ChangeLog | 11 ++++++++++ addressbook/gui/contact-editor/eab-editor.c | 30 +++++++++++++++++++--------- addressbook/gui/widgets/e-addressbook-view.c | 20 +++++++++++++++++-- 3 files changed, 50 insertions(+), 11 deletions(-) diff --git a/addressbook/ChangeLog b/addressbook/ChangeLog index b9c57f192b..71828bc8a8 100644 --- a/addressbook/ChangeLog +++ b/addressbook/ChangeLog @@ -1,3 +1,14 @@ +2005-05-09 Sushma Rai + + * gui/widgets/e-addressbook-view.c (eab_view_delete_selection): Checking + if single or multiple contacts/contact lists are being deleted. Also + finding the name, if the single contact/contact list is being deleted. + + * gui/contact-editor/eab-editor.c (eab_editor_confirm_delete): Forming + the display messages based on the contact/contact list and number of + contacts/contact lists being deleted. + Fixes #222599 + 2005-05-06 Chenthill Palanisamy Fixes #301459 diff --git a/addressbook/gui/contact-editor/eab-editor.c b/addressbook/gui/contact-editor/eab-editor.c index 8f03352af0..65b985c153 100644 --- a/addressbook/gui/contact-editor/eab-editor.c +++ b/addressbook/gui/contact-editor/eab-editor.c @@ -311,23 +311,35 @@ eab_editor_get_all_editors (void) } gboolean -eab_editor_confirm_delete (GtkWindow *parent) +eab_editor_confirm_delete (GtkWindow *parent, gboolean plural, gboolean is_list, char *name) { GtkWidget *dialog; gint result; + char *msg; + + if (is_list) { + /* contact list(s) */ + if (!plural) + msg = g_strdup_printf (_("Are you sure you want\nto delete contact list (%s) ?"), + name); + else + msg = g_strdup (_("Are you sure you want\nto delete these contact lists?")); + } + else { + /* contact(s) */ + if (!plural) + msg = g_strdup_printf (_("Are you sure you want\nto delete contact (%s) ?"), + name); + else + msg = g_strdup (_("Are you sure you want\nto delete these contacts?")); + } dialog = gtk_message_dialog_new (parent, 0, GTK_MESSAGE_QUESTION, GTK_BUTTONS_NONE, -#if notyet - /* XXX we really need to handle the plural case here.. */ - (plural - ? _("Are you sure you want\n" - "to delete these contacts?")) -#endif - _("Are you sure you want\n" - "to delete this contact?")); + msg); + g_free (msg); gtk_dialog_add_buttons (GTK_DIALOG (dialog), GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, diff --git a/addressbook/gui/widgets/e-addressbook-view.c b/addressbook/gui/widgets/e-addressbook-view.c index d98c328cc6..dd36b03ee2 100644 --- a/addressbook/gui/widgets/e-addressbook-view.c +++ b/addressbook/gui/widgets/e-addressbook-view.c @@ -1854,11 +1854,27 @@ void eab_view_delete_selection(EABView *view) { GList *list, *l; + gboolean plural = FALSE, is_list = FALSE; + EContact *contact; + char *name = NULL; + + list = get_selected_contacts (view); + contact = list->data; + + if (g_list_next(list)) + plural = TRUE; + else + name = e_contact_get (contact, E_CONTACT_FILE_AS); + + if (e_contact_get (contact, E_CONTACT_IS_LIST)) + is_list = TRUE; - if (!eab_editor_confirm_delete(GTK_WINDOW(gtk_widget_get_toplevel(view->widget)))) + if (!eab_editor_confirm_delete(GTK_WINDOW(gtk_widget_get_toplevel(view->widget)), + plural, is_list, name)) { + g_free (name); return; + } - list = get_selected_contacts(view); if (e_book_check_static_capability (view->book, "bulk-remove")) { GList *ids = NULL; -- cgit v1.2.3