After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 676383 - gnome-contacts does not show Google contacts
gnome-contacts does not show Google contacts
Status: RESOLVED FIXED
Product: gnome-contacts
Classification: Core
Component: general
3.4.x
Other Linux
: Normal major
: ---
Assigned To: GNOME Contacts maintainer(s)
GNOME Contacts maintainer(s)
: 679110 (view as bug list)
Depends on: 678696
Blocks:
 
 
Reported: 2012-05-19 18:32 UTC by Michael Monreal
Modified: 2012-09-05 08:52 UTC
See Also:
GNOME target: 3.6
GNOME version: ---


Attachments
screenshot (64.02 KB, image/png)
2012-05-31 18:06 UTC, Jean-François Fortin Tam
  Details
persona-stores output (13.77 KB, text/plain)
2012-06-14 03:54 UTC, Jean-François Fortin Tam
  Details
Use new folks API for Google Contacts system groups (4.85 KB, patch)
2012-06-24 10:58 UTC, Philip Withnall
needs-work Details | Review
Use new folks API for Google Contacts system groups (updated) (4.78 KB, patch)
2012-07-19 04:21 UTC, Philip Withnall
committed Details | Review

Description Michael Monreal 2012-05-19 18:32:49 UTC
I have my Google account set up using GOA and enabled for contacts. The address book was added, it shows up correctly in Evolution and is usable. However, even after switching the address book in gnome-contacts, it shows nothing.

It may be related: IM contacts do no longer show up in gnome-contacts as well (this used to work in 3.2.x - but maybe this is by design? they show up fine in the shell). The local address book is displayed correctly btw.

Using version 3.4.1
Comment 1 Michael Monreal 2012-05-19 18:38:06 UTC
Small update: I just noticed my Google contacts to *also* show up in the shell (when searching for a name), they just do not show up in the gnome-contacts UI.
Comment 2 Michael Monreal 2012-05-19 19:12:27 UTC
Another update: clicking the contact in shell does bring up gnome-contacts and shows the contact information, but the left side of the window (the contact list) stays empty
Comment 3 Jean-François Fortin Tam 2012-05-31 18:06:26 UTC
I can confirm this. In 3.4, google contacts are either not shown or only partially shown, I don't know why exactly. Currently, gnome-contacts only show 2 out of 162 contacts.
Comment 4 Jean-François Fortin Tam 2012-05-31 18:06:40 UTC
Created attachment 215357 [details]
screenshot
Comment 5 Marina Zhurakhinskaya 2012-06-12 03:35:22 UTC
Is it possible that your online status was "Unavailable" when you were testing this, as described in bug 677912 ?
Comment 6 Alexander Larsson 2012-06-12 09:28:59 UTC
Google contacts are split up in different types. If you look at the google web UI there is a subset called "My Contacts". These are the ones we're *supposed* to be showing by default in gnome-contacts. The rest (like autogenerated email contacts and google plus contacts) are relegated to the "other" status with other contacts like IM ones and facebook contacts that are availible when you search and when they are linked to your primary contacts.

Unfortunately the way to detect the "My Contacts" group is kinda hackish at the moment. For instance, it relies on the locale of eds and gnome-contacts to be the same. Also, there was a bug in this hack, but that was fixed in:

http://git.gnome.org/browse/gnome-contacts/commit/?id=0ce0d3f23698986a1ae21b91c6aea984e411d391

However that should be in the gnome-contacts 3.4.1 release.
Comment 7 Jean-François Fortin Tam 2012-06-12 11:51:34 UTC
Um, nope.
- I already have 3.4.1
- My status was online/available, it happens no matter what the status
- Even in the gmail interface there are 92 items in "My contacts" and gnome-contacts shows only a handful (currently 5 of them, which is an improvement over the 2 in my screenshot in attachment #215357 [details]). Go figure why the amount of contacts shown has now been raised by 3. In any case, Evolution shows them all, and I'd expect gnome-contacts to match that.
Comment 8 Alexander Larsson 2012-06-13 09:13:13 UTC
Can you have a look at the data in folks?

First of all, ensure that you actually have the data in folks by searching in gnome-contacts. You should be able to find all your google contacts if you start searching (they will appear under the "Other Contacts" header). If you don't get them there is something deeper going on. If you can find them under Other Contacts then something is going wrong with identifying which contacts are "My Contacts".

Run the folks-inspect app from folks, type "persona-stores" to list the stores, find the google one, mine looks like:

Persona store '1316155457.2693.0@fatty' with 334 personas:
  display-name          1316155457.2693.0@fatty
  id                    1316155457.2693.0@fatty
  is-writeable          FALSE
  trust-level           FOLKS_PERSONA_STORE_TRUST_FULL
  is-primary-store      TRUE
  is-user-set-default   TRUE
  type-id               eds
  can-add-personas      FOLKS_MAYBE_BOOL_TRUE
  can-alias-personas    FOLKS_MAYBE_BOOL_FALSE
  can-group-personas    FOLKS_MAYBE_BOOL_TRUE
  can-remove-personas   FOLKS_MAYBE_BOOL_TRUE
  is-prepared           TRUE
  always-writeable-properties  { 'gender', 'local-ids', 'avatar', 'postal-addresses', 'urls', 'phone-numbers', 'structured-name', 'im-addresses', 'is-favourite', 'birthday', 'notes', 'roles', 'email-addresses', 'web-service-addresses', 'groups', 'full-name' }
  is-quiescent          TRUE
  personas              Set of 334 personas
  source                0xf91360

(Watch out, there might be a similar one of your local addressbook)

Then you can list the personas in that store using the id, like:
persona-stores 1316155457.2693.0@fatty

The contacts in the "My Contacs" special google group gets translated by the e-d-s google backend to the "Personal" group, so any persona in there will have a line like:

      groups                { 'Personal' }
or
      groups                { 'Starred in Android', 'Family', 'Personal' }

Unfortunately the e-d-s daemon that does this puts in the translated name for "Personal", which complicates things. The way gnome-contacts figures out if the contacts is in this group is by comparing it like this:

char *
eds_personal_google_group_name (void)
{
  static char *name = NULL;
  char *domain;

  if (name == NULL) {
    domain = g_strdup_printf ("evolution-data-server-%d.%d",
			      EDS_MAJOR_VERSION,
			      EDS_MINOR_VERSION + ((EDS_MINOR_VERSION) % 2));

    /* Let's assume e-d-s is installed in the same prefix as gnome-contacts
       (which works for system and jhbuild setups) */
    bindtextdomain (domain, LOCALEDIR);

    name = dgettext (domain, "Personal");
    g_free (domain);
  }

  return name;
}

There are multiple things that can go wrong here:
1) e-d-s not in the same prefix as gnome-contacts
2) e-d-s server not same version as gnome-contacts was compiled against
3) e-d-s pofiles not availible
4) gnome-contacts not running in the same locale as evolution-addressbook-factory

Obviously this is kinda suboptimal and we should make it work in some smarter way, but you might be able to figure out where things go wrong for you.
Comment 9 Alexander Larsson 2012-06-13 09:15:44 UTC
Phillip: I CCed you to this bug. We really need a better solution for this in the e-d-s backend.
Comment 10 Jean-François Fortin Tam 2012-06-14 03:54:07 UTC
Created attachment 216369 [details]
persona-stores output

> First of all, ensure that you actually have the data in folks by searching in
> gnome-contacts. You should be able to find all your google contacts if you
> start searching (they will appear under the "Other Contacts" header).

Yes, that works.

> Run the folks-inspect app from folks, type "persona-stores" to list the stores

That output is quite messy, I'm not 100% sure what is what so I'm attaching it to the bug report so you can see the big picture. I suspect that "Persona store '1338354791.6875.0@krom' with 163 personas:" is the google addressbook.
Comment 11 Philip Withnall 2012-06-24 10:58:33 UTC
Created attachment 217108 [details] [review]
Use new folks API for Google Contacts system groups

Here’s a patch to fix the hack used by gnome-contacts. It depends on a new folks API from bug #678696 which will (pending review) be released in folks 0.7.2. It has a runtime dependency on EDS 3.5.3, since it depends on commit 1cfc48f58873ee448f2bb7853c9d3c0f0f48caab. I’ve bumped gnome-contacts’ dependencies on those two modules accordingly.

The patch also removes the code which automatically adds new contacts to the “My Contacts” group, since that was fixed in EDS itself in bug #663324.
Comment 12 Alexander Larsson 2012-06-29 12:11:12 UTC
Review of attachment 217108 [details] [review]:

::: src/contacts-contact.vala
@@ -1196,2 @@
   public static bool persona_is_google_other (Persona persona) {
-    if (!persona_is_google (persona))

This is not right.
persona_is_google() should return true for all google personas, but persona_is_google_other() should return true only for google personas that are *NOT* in the "My Contacts" group. In other words, "junk email contacts" as well as google plus people from the users circles.

Additionally persona_is_google_profile() should return true only for people that are from the google plus circles, which atm is also a gigantic hack based on not being in My Contacts and having a google profile link.
Comment 13 Philip Withnall 2012-07-19 04:21:26 UTC
Created attachment 219193 [details] [review]
Use new folks API for Google Contacts system groups (updated)

Whoops. This should be better.
Comment 14 Alexander Larsson 2012-07-23 18:20:39 UTC
Review of attachment 219193 [details] [review]:

Looks good to me. Please commit. Also, i'm not around a lot right now, any chance you could spin a release with this so it gets some testing?
Comment 15 Philip Withnall 2012-07-23 23:26:04 UTC
Comment on attachment 219193 [details] [review]
Use new folks API for Google Contacts system groups (updated)

I’ll try and roll a release in the next few days.

commit 1cf1d966bacd6456087f684493da72648cf3c68c
Author: Philip Withnall <philip@tecnocode.co.uk>
Date:   Sun Jun 24 11:46:36 2012 +0100

    eds: Use new folks API for Google address book system groups
    
    This removes the gigantic hack based on matching translatable strings across
    gettext domains, and instead uses a new API from libfolks 0.7.2.
    
    This requires EDS 3.5.2 at runtime (as it depends on a new vCard property
    being exported by the Google Contacts backend), so its dependency has been
    bumped as well. If the vCard property is not present, all Google contacts
    will be considered _not_ in the “My Contacts” address book.
    
    Closes: https://bugzilla.gnome.org/show_bug.cgi?id=676383

 configure.ac              |    2 +-
 src/contacts-contact.vala |   14 +++++++-------
 src/contacts-esd-setup.c  |   24 ------------------------
 src/contacts-esd-setup.h  |    1 -
 vapi/custom.vapi          |    2 --
 5 files changed, 8 insertions(+), 35 deletions(-)
Comment 16 André Klapper 2012-08-20 13:15:57 UTC
(In reply to comment #15)
> I’ll try and roll a release in the next few days.
> 
> Author: Philip Withnall <philip@tecnocode.co.uk>
>     eds: Use new folks API for Google address book system groups
>     This removes the gigantic hack based on matching translatable strings
> across
>     gettext domains, and instead uses a new API from libfolks 0.7.2.


As folks-0.7.3 was released three weeks ago:
Is the problem described in this report still an issue? 
What exactly is left to close this bug report?
Comment 17 Philip Withnall 2012-08-20 20:44:17 UTC
(In reply to comment #16)
> What exactly is left to close this bug report?

Nothing. My bad. Closed!
Comment 18 Alexander Larsson 2012-09-05 08:52:51 UTC
*** Bug 679110 has been marked as a duplicate of this bug. ***