aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook/gui/contact-editor
diff options
context:
space:
mode:
Diffstat (limited to 'addressbook/gui/contact-editor')
-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
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;