diff options
-rw-r--r-- | addressbook/ChangeLog | 12 | ||||
-rw-r--r-- | addressbook/addressbook-errors.xml | 4 | ||||
-rw-r--r-- | addressbook/gui/widgets/eab-gui-util.c | 27 |
3 files changed, 40 insertions, 3 deletions
diff --git a/addressbook/ChangeLog b/addressbook/ChangeLog index 71828bc8a8..bde060a742 100644 --- a/addressbook/ChangeLog +++ b/addressbook/ChangeLog @@ -1,5 +1,17 @@ 2005-05-09 Sushma Rai <rsushma@novell.com> + * gui/widgets/eab-gui-util.c (eab_contact_save)(eab_contact_list_save): + Finding if multiple contacts or a single contact has been selected for + saving, and storing it in SaveAsInfo structure. + (save_it): Depending on selected contacts, forming a part of error + message. + + * addressbook-errors.xml: Changed the save-error message, to read + string contact/contacts. + Fixes #261969. + +2005-05-09 Sushma Rai <rsushma@novell.com> + * 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. diff --git a/addressbook/addressbook-errors.xml b/addressbook/addressbook-errors.xml index 0d6b331b28..fbcc3a0d78 100644 --- a/addressbook/addressbook-errors.xml +++ b/addressbook/addressbook-errors.xml @@ -75,8 +75,8 @@ </error> <error id="save-error" type="error"> - <primary>Unable to save contact(s).</primary> - <secondary>Error saving contacts to {0}: {1}</secondary> + <primary>Unable to save {0}.</primary> + <secondary>Error saving {0} to {1}: {2}</secondary> </error> <error id="backend-died" type="error"> diff --git a/addressbook/gui/widgets/eab-gui-util.c b/addressbook/gui/widgets/eab-gui-util.c index a6c4517cb1..5fd8feb0d7 100644 --- a/addressbook/gui/widgets/eab-gui-util.c +++ b/addressbook/gui/widgets/eab-gui-util.c @@ -323,6 +323,7 @@ file_exists(GtkWindow *window, const char *filename) typedef struct { GtkWidget *filesel; char *vcard; + gboolean has_multiple_contacts; } SaveAsInfo; static void @@ -351,7 +352,23 @@ save_it(GtkWidget *widget, SaveAsInfo *info) return; } } else if (error != 0) { - e_error_run (GTK_WINDOW (info->filesel), "addressbook:save-error", filename, g_strerror (errno)); + char *err_str_ext; + if (info->has_multiple_contacts) { + /* more than one, finding the total number of contacts might + * hit performance while saving large number of contacts + */ + err_str_ext = ngettext ("contact", "contacts", 2); + } + else { + err_str_ext = ngettext ("contact", "contacts", 1); + } + + /* translators: Arguments, err_str_ext (item to be saved: "contact"/"contacts"), + * destination file name, and error code will fill the placeholders + * {0}, {1} and {2}, respectively in the error message formed + */ + e_error_run (GTK_WINDOW (info->filesel), "addressbook:save-error", + err_str_ext, filename, g_strerror (errno)); return; } @@ -479,6 +496,8 @@ eab_contact_save (char *title, EContact *contact, GtkWindow *parent_window) name = e_contact_get (contact, E_CONTACT_FILE_AS); file = make_safe_filename (name); + info->has_multiple_contacts = FALSE; + #ifdef USE_GTKFILECHOOSER filesel = gtk_file_chooser_dialog_new (title, parent_window, @@ -543,6 +562,12 @@ eab_contact_list_save (char *title, GList *list, GtkWindow *parent_window) filesel = gtk_file_selection_new(title); #endif + /* Check if the list has more than one contact */ + if (g_list_next (list)) + info->has_multiple_contacts = TRUE; + else + info->has_multiple_contacts = FALSE; + /* This is a filename. Translators take note. */ if (list && list->data && list->next == NULL) { char *name; |