aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook/gui/widgets/e-addressbook-model.c
diff options
context:
space:
mode:
Diffstat (limited to 'addressbook/gui/widgets/e-addressbook-model.c')
-rw-r--r--addressbook/gui/widgets/e-addressbook-model.c37
1 files changed, 33 insertions, 4 deletions
diff --git a/addressbook/gui/widgets/e-addressbook-model.c b/addressbook/gui/widgets/e-addressbook-model.c
index 6d84cca2e4..b26c68e755 100644
--- a/addressbook/gui/widgets/e-addressbook-model.c
+++ b/addressbook/gui/widgets/e-addressbook-model.c
@@ -233,8 +233,11 @@ modify_contact(EBookView *book_view,
continue;
g_object_unref (array->pdata[ii]);
- array->pdata[ii] = e_contact_duplicate (contact);
- g_signal_emit (model, signals[CONTACT_CHANGED], 0, ii);
+ contact = e_contact_duplicate (contact);
+ array->pdata[ii] = contact;
+
+ g_signal_emit (
+ model, signals[CONTACT_CHANGED], 0, contact);
break;
}
@@ -591,8 +594,8 @@ addressbook_model_class_init (EAddressbookModelClass *class)
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (EAddressbookModelClass, contact_changed),
NULL, NULL,
- g_cclosure_marshal_VOID__INT,
- G_TYPE_NONE, 1, G_TYPE_INT);
+ g_cclosure_marshal_VOID__OBJECT,
+ G_TYPE_NONE, 1, E_TYPE_CONTACT);
signals[MODEL_CHANGED] =
g_signal_new ("model_changed",
@@ -726,6 +729,32 @@ e_addressbook_model_contact_at (EAddressbookModel *model,
return model->priv->contacts->pdata[index];
}
+gint
+e_addressbook_model_find (EAddressbookModel *model,
+ EContact *contact)
+{
+ GPtrArray *array;
+ gint ii;
+
+ /* XXX This searches for a particular EContact instance,
+ * as opposed to an equivalent but possibly different
+ * EContact instance. Might have to revise this in
+ * the future. */
+
+ g_return_val_if_fail (E_IS_ADDRESSBOOK_MODEL (model), -1);
+ g_return_val_if_fail (E_IS_CONTACT (contact), -1);
+
+ array = model->priv->contacts;
+ for (ii = 0; ii < array->len; ii++) {
+ EContact *candidate = array->pdata[ii];
+
+ if (contact == candidate)
+ return ii;
+ }
+
+ return -1;
+}
+
EBook *
e_addressbook_model_get_book (EAddressbookModel *model)
{