diff options
author | Dan Vrátil <dvratil@redhat.com> | 2011-06-03 17:51:38 +0800 |
---|---|---|
committer | Rodrigo Moya <rodrigo@gnome-db.org> | 2011-06-30 00:42:25 +0800 |
commit | 2dc0a29c7a168d7cf026561173443acaf9db8b9b (patch) | |
tree | e966d3403cc77420dab3154db4cc11da6d271d1f /addressbook/gui/contact-editor | |
parent | fcc3aff7d6f099b6e343dc1165d6f9776be4c4c0 (diff) | |
download | gsoc2013-evolution-2dc0a29c7a168d7cf026561173443acaf9db8b9b.tar gsoc2013-evolution-2dc0a29c7a168d7cf026561173443acaf9db8b9b.tar.gz gsoc2013-evolution-2dc0a29c7a168d7cf026561173443acaf9db8b9b.tar.bz2 gsoc2013-evolution-2dc0a29c7a168d7cf026561173443acaf9db8b9b.tar.lz gsoc2013-evolution-2dc0a29c7a168d7cf026561173443acaf9db8b9b.tar.xz gsoc2013-evolution-2dc0a29c7a168d7cf026561173443acaf9db8b9b.tar.zst gsoc2013-evolution-2dc0a29c7a168d7cf026561173443acaf9db8b9b.zip |
Bug #332907 - Contact editor duplication alert misleading
Diffstat (limited to 'addressbook/gui/contact-editor')
-rw-r--r-- | addressbook/gui/contact-editor/contact-editor.ui | 7 | ||||
-rw-r--r-- | addressbook/gui/contact-editor/e-contact-editor.c | 21 | ||||
-rw-r--r-- | addressbook/gui/contact-editor/e-contact-editor.h | 3 |
3 files changed, 30 insertions, 1 deletions
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 @@ <object class="GtkEntry" id="entry-fullname"> <property name="visible">True</property> <property name="can_focus">True</property> + <property name="name">fullname</property> <accessibility> <relation type="labelled-by" target="button-fullname"/> </accessibility> @@ -221,6 +222,7 @@ <object class="GtkEntry" id="entry-nickname"> <property name="visible">True</property> <property name="can_focus">True</property> + <property name="name">nickname</property> </object> <packing> <property name="left_attach">3</property> @@ -260,6 +262,7 @@ <property name="has-entry">True</property> <property name="entry-text-column">0</property> <property name="model">model1</property> + <property name="name">file-as</property> </object> <packing> <property name="left_attach">1</property> @@ -315,6 +318,7 @@ <object class="GtkEntry" id="entry-email-3"> <property name="visible">True</property> <property name="can_focus">True</property> + <property name="name">email-3</property> </object> <packing> <property name="left_attach">1</property> @@ -328,6 +332,7 @@ <object class="GtkEntry" id="entry-email-1"> <property name="visible">True</property> <property name="can_focus">True</property> + <property name="name">email-1</property> </object> <packing> <property name="left_attach">1</property> @@ -339,6 +344,7 @@ <object class="GtkEntry" id="entry-email-2"> <property name="visible">True</property> <property name="can_focus">True</property> + <property name="name">email-2</property> </object> <packing> <property name="left_attach">3</property> @@ -350,6 +356,7 @@ <object class="GtkEntry" id="entry-email-4"> <property name="visible">True</property> <property name="can_focus">True</property> + <property name="name">email-4</property> </object> <packing> <property name="left_attach">3</property> 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; |