From 2dc0a29c7a168d7cf026561173443acaf9db8b9b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dan=20Vr=C3=A1til?= Date: Fri, 3 Jun 2011 11:51:38 +0200 Subject: Bug #332907 - Contact editor duplication alert misleading --- addressbook/gui/contact-editor/contact-editor.ui | 7 +++++++ addressbook/gui/contact-editor/e-contact-editor.c | 21 ++++++++++++++++++++- addressbook/gui/contact-editor/e-contact-editor.h | 3 +++ .../eab-contact-commit-duplicate-detected.ui | 4 ++-- 4 files changed, 32 insertions(+), 3 deletions(-) (limited to 'addressbook/gui') diff --git a/addressbook/gui/contact-editor/contact-editor.ui b/addressbook/gui/contact-editor/contact-editor.ui index b30e716a2f..2f133d4ccc 100644 --- a/addressbook/gui/contact-editor/contact-editor.ui +++ b/addressbook/gui/contact-editor/contact-editor.ui @@ -145,6 +145,7 @@ True True + fullname @@ -221,6 +222,7 @@ True True + nickname 3 @@ -260,6 +262,7 @@ True 0 model1 + file-as 1 @@ -315,6 +318,7 @@ True True + email-3 1 @@ -328,6 +332,7 @@ True True + email-1 1 @@ -339,6 +344,7 @@ True True + email-2 3 @@ -350,6 +356,7 @@ True True + email-4 3 diff --git a/addressbook/gui/contact-editor/e-contact-editor.c b/addressbook/gui/contact-editor/e-contact-editor.c index f545594039..1df7b62082 100644 --- a/addressbook/gui/contact-editor/e-contact-editor.c +++ b/addressbook/gui/contact-editor/e-contact-editor.c @@ -641,6 +641,8 @@ name_entry_changed (GtkWidget *widget, EContactEditor *editor) editor->name = e_contact_name_from_string (string); file_as_set_style (editor, style); + editor->check_merge = TRUE; + sensitize_ok (editor); if (string && !*string) gtk_window_set_title (GTK_WINDOW (editor->app), _("Contact Editor")); @@ -742,6 +744,19 @@ object_changed (GObject *object, EContactEditor *editor) return; } + if (!editor->check_merge && GTK_IS_WIDGET (object)) { + const gchar *widget_name; + + widget_name = gtk_widget_get_name (GTK_WIDGET (object)); + + if (widget_name && + ((g_str_equal (widget_name, "fullname")) || + (g_str_equal (widget_name, "nickname")) || + (g_str_equal (widget_name, "file-as")) || + (g_str_has_prefix (widget_name, "email-")))) + editor->check_merge = TRUE; + } + if (!editor->changed) { editor->changed = TRUE; sensitize_ok (editor); @@ -3441,10 +3456,13 @@ real_save_contact (EContactEditor *ce, gboolean should_close) eab_merging_book_add_contact ( ce->target_book, ce->contact, (EBookIdAsyncCallback) contact_added_cb, ecs); - else + else if (ce->check_merge) eab_merging_book_commit_contact ( ce->target_book, ce->contact, (EBookAsyncCallback) contact_modified_cb, ecs); + else + e_book_commit_contact_async (ce->target_book, ce->contact, + (EBookAsyncCallback) contact_modified_cb, ecs); } } @@ -3814,6 +3832,7 @@ e_contact_editor_init (EContactEditor *e_contact_editor) e_contact_editor->contact = NULL; e_contact_editor->changed = FALSE; + e_contact_editor->check_merge = FALSE; e_contact_editor->image_set = FALSE; e_contact_editor->image_changed = FALSE; e_contact_editor->in_async_call = FALSE; diff --git a/addressbook/gui/contact-editor/e-contact-editor.h b/addressbook/gui/contact-editor/e-contact-editor.h index 81b39d1e85..2f00a12f67 100644 --- a/addressbook/gui/contact-editor/e-contact-editor.h +++ b/addressbook/gui/contact-editor/e-contact-editor.h @@ -75,6 +75,9 @@ struct _EContactEditor /* Whether the contact has been changed since bringing up the contact editor */ guint changed : 1; + /* Wheter should check for contact to merge. Only when name or email are changed */ + guint check_merge : 1; + /* Whether the contact editor will accept modifications, save */ guint target_editable : 1; diff --git a/addressbook/gui/merging/eab-contact-commit-duplicate-detected.ui b/addressbook/gui/merging/eab-contact-commit-duplicate-detected.ui index aefd3de172..04ed728a56 100644 --- a/addressbook/gui/merging/eab-contact-commit-duplicate-detected.ui +++ b/addressbook/gui/merging/eab-contact-commit-duplicate-detected.ui @@ -34,7 +34,7 @@ True True True - gtk-add + gtk-save True GTK_RELIEF_NORMAL @@ -70,7 +70,7 @@ True - The name or email of this contact already exists in this folder. Would you like to add it anyway? + The name or email of this contact already exists in this folder. Would you like to save the changes anyway? False False GTK_JUSTIFY_LEFT -- cgit v1.2.3