diff options
author | Matthew Barnes <mbarnes@src.gnome.org> | 2008-09-18 10:32:04 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@src.gnome.org> | 2008-09-18 10:32:04 +0800 |
commit | 8d21ab98d99ca43ee7873adba8172b699d8a007f (patch) | |
tree | d6a85918167907daf7c4dcf87b8b7feee89f12af /addressbook/gui/widgets/e-addressbook-model.c | |
parent | bb7cb1d677117a938ae18d9cae7acc7a56678b6f (diff) | |
download | gsoc2013-evolution-8d21ab98d99ca43ee7873adba8172b699d8a007f.tar gsoc2013-evolution-8d21ab98d99ca43ee7873adba8172b699d8a007f.tar.gz gsoc2013-evolution-8d21ab98d99ca43ee7873adba8172b699d8a007f.tar.bz2 gsoc2013-evolution-8d21ab98d99ca43ee7873adba8172b699d8a007f.tar.lz gsoc2013-evolution-8d21ab98d99ca43ee7873adba8172b699d8a007f.tar.xz gsoc2013-evolution-8d21ab98d99ca43ee7873adba8172b699d8a007f.tar.zst gsoc2013-evolution-8d21ab98d99ca43ee7873adba8172b699d8a007f.zip |
Progress update:
- Get context menus working in the contact preview pane.
- Kill EABPopup.
- Yet more code refactoring.
- Add a handy utility function: e_shell_window_show_popup_menu()
Takes a widget path in the shell window's UI definition.
svn path=/branches/kill-bonobo/; revision=36366
Diffstat (limited to 'addressbook/gui/widgets/e-addressbook-model.c')
-rw-r--r-- | addressbook/gui/widgets/e-addressbook-model.c | 37 |
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) { |