From f5d1b8bc5a40700e81dc1162ba0206cd55daaa9e Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Mon, 25 Feb 2013 08:44:47 -0500 Subject: EAddressbookModel: Replace "registry" property with "client-cache". Registry can still be accessed through e_client_cache_ref_registry(), but we'll want to utilize the client cache as well. e_addressbook_model_new() now takes an EClientCache instead of an ESourceRegistry, and e_addressbook_model_get_registry() is replaced by e_addressbook_model_get_client_cache(). --- .../gui/widgets/e-addressbook-table-adapter.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) (limited to 'addressbook/gui/widgets/e-addressbook-table-adapter.c') diff --git a/addressbook/gui/widgets/e-addressbook-table-adapter.c b/addressbook/gui/widgets/e-addressbook-table-adapter.c index 12be6c821d..5bd188ccec 100644 --- a/addressbook/gui/widgets/e-addressbook-table-adapter.c +++ b/addressbook/gui/widgets/e-addressbook-table-adapter.c @@ -171,13 +171,11 @@ addressbook_set_value_at (ETableModel *etc, EAddressbookTableAdapterPrivate *priv = adapter->priv; if (e_addressbook_model_get_editable (priv->model)) { + EClientCache *client_cache; ESourceRegistry *registry; EBookClient *book_client; EContact *contact; - registry = e_addressbook_model_get_registry (priv->model); - book_client = e_addressbook_model_get_client (priv->model); - if (col >= COLS || row >= e_addressbook_model_contact_count (priv->model)) return; @@ -197,11 +195,19 @@ addressbook_set_value_at (ETableModel *etc, g_hash_table_remove (priv->emails, old_value); } + client_cache = + e_addressbook_model_get_client_cache (priv->model); + book_client = e_addressbook_model_get_client (priv->model); + + registry = e_client_cache_ref_registry (client_cache); + e_contact_set (contact, col, (gpointer) val); eab_merging_book_modify_contact ( registry, book_client, contact, contact_modified_cb, etc); + g_object_unref (registry); + g_object_unref (contact); /* XXX Do we need this? Shouldn't the commit_contact @@ -226,6 +232,7 @@ addressbook_append_row (ETableModel *etm, { EAddressbookTableAdapter *adapter = E_ADDRESSBOOK_TABLE_ADAPTER (etm); EAddressbookTableAdapterPrivate *priv = adapter->priv; + EClientCache *client_cache; ESourceRegistry *registry; EBookClient *book_client; EContact *contact; @@ -238,12 +245,17 @@ addressbook_append_row (ETableModel *etm, e_contact_set (contact, col, (gpointer) val); } - registry = e_addressbook_model_get_registry (priv->model); + client_cache = + e_addressbook_model_get_client_cache (priv->model); book_client = e_addressbook_model_get_client (priv->model); + registry = e_client_cache_ref_registry (client_cache); + eab_merging_book_add_contact ( registry, book_client, contact, NULL, NULL); + g_object_unref (registry); + g_object_unref (contact); } -- cgit v1.2.3