aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Vrátil <dvratil@redhat.com>2011-06-03 17:51:38 +0800
committerMilan Crha <mcrha@redhat.com>2011-06-03 17:51:38 +0800
commitb2b6ba119f5e782bc55b4b39290a23edf19b9a4d (patch)
tree3a7b661cf29afe5a26fb10c4d8cd84aec1570f22
parent00b88396f479d7d9c2f9714421a0b152f157bbc0 (diff)
downloadgsoc2013-evolution-b2b6ba119f5e782bc55b4b39290a23edf19b9a4d.tar.gz
gsoc2013-evolution-b2b6ba119f5e782bc55b4b39290a23edf19b9a4d.tar.zst
gsoc2013-evolution-b2b6ba119f5e782bc55b4b39290a23edf19b9a4d.zip
Bug #332907 - Contact editor duplication alert misleading
-rw-r--r--addressbook/gui/contact-editor/contact-editor.ui7
-rw-r--r--addressbook/gui/contact-editor/e-contact-editor.c21
-rw-r--r--addressbook/gui/contact-editor/e-contact-editor.h3
-rw-r--r--addressbook/gui/merging/eab-contact-commit-duplicate-detected.ui4
4 files changed, 32 insertions, 3 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;
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 @@
<property name="visible">True</property>
<property name="can_default">True</property>
<property name="can_focus">True</property>
- <property name="label">gtk-add</property>
+ <property name="label">gtk-save</property>
<property name="use_stock">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
</object>
@@ -70,7 +70,7 @@
<child>
<object class="GtkLabel" id="label1">
<property name="visible">True</property>
- <property name="label" translatable="yes">The name or email of this contact already exists in this folder. Would you like to add it anyway?</property>
+ <property name="label" translatable="yes">The name or email of this contact already exists in this folder. Would you like to save the changes anyway?</property>
<property name="use_underline">False</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>