Commit 85e8d88f authored by Philip Withnall's avatar Philip Withnall
Browse files

eds: Add an Edsf.Persona.in_google_personal_group property

This is set whenever the persona is in the “My Contacts” group in Google
Contacts, which is normally exposed by EDS as being in the “Personal”
category. This system group can’t be reliably detected normally as “Personal”
is translated by EDS. This caused problems for gnome-contacts, hence the
new API.

The new API requires EDS 3.5.3 at runtime, and will always be false
otherwise.

Helps: https://bugzilla.gnome.org/show_bug.cgi?id=676383
parent 134c64b5
...@@ -8,9 +8,11 @@ Bugs fixed: ...@@ -8,9 +8,11 @@ Bugs fixed:
• Bug 673918 — Port to newer libgee • Bug 673918 — Port to newer libgee
• Bug 629537 — Support anti-linking • Bug 629537 — Support anti-linking
• Bug 679618 — Crash when unsetting all groups • Bug 679618 — Crash when unsetting all groups
• Bug 678696 — Add API for EDS Google system groups
API changes: API changes:
• Add AntiLinkable interface and implement it on Kf.Persona and Edsf.Persona • Add AntiLinkable interface and implement it on Kf.Persona and Edsf.Persona
• Add Edsf.Persona.in_google_personal_group
Overview of changes from libfolks 0.7.1 to libfolks 0.7.2 Overview of changes from libfolks 0.7.1 to libfolks 0.7.2
========================================================= =========================================================
...@@ -29,7 +31,6 @@ Bugs fixed: ...@@ -29,7 +31,6 @@ Bugs fixed:
API changes: API changes:
• Add profiling api • Add profiling api
Overview of changes from libfolks 0.7.0 to libfolks 0.7.1 Overview of changes from libfolks 0.7.0 to libfolks 0.7.1
========================================================= =========================================================
......
...@@ -699,6 +699,20 @@ public class Edsf.Persona : Folks.Persona, ...@@ -699,6 +699,20 @@ public class Edsf.Persona : Folks.Persona,
yield ((Edsf.PersonaStore) this.store)._set_anti_links (this, anti_links); yield ((Edsf.PersonaStore) this.store)._set_anti_links (this, anti_links);
} }
private bool _in_google_personal_group;
/**
* Whether this contact is in the “My Contacts” section of the user’s address
* book, rather than the “Other” section.
*
* @since UNRELEASED
*/
[CCode (notify = false)]
public bool in_google_personal_group
{
get { return this._in_google_personal_group; }
}
/** /**
* Build a IID. * Build a IID.
* *
...@@ -1504,8 +1518,34 @@ public class Edsf.Persona : Folks.Persona, ...@@ -1504,8 +1518,34 @@ public class Edsf.Persona : Folks.Persona,
} }
} }
var old_is_favourite = this._is_favourite; /* Check our new set of system groups if this is a Google address book. */
var store = (Edsf.PersonaStore) this.store; var store = (Edsf.PersonaStore) this.store;
var in_google_personal_group = false;
if (store._is_google_contacts_address_book ())
{
var vcard = (E.VCard) this.contact;
unowned E.VCardAttribute? attr =
vcard.get_attribute ("X-GOOGLE-SYSTEM-GROUP-IDS");
if (attr != null)
{
unowned GLib.List<string> vals = attr.get_values ();
/* If we're in the GDATA_CONTACTS_GROUP_CONTACTS group, then
* we're in the user's "My Contacts" address book, as opposed
* to their "Other" address book. */
foreach (var system_group_id in vals)
{
if (system_group_id == "Contacts")
{
in_google_personal_group = true;
break;
}
}
}
}
var old_is_favourite = this._is_favourite;
/* Make the changes to this._groups and emit signals. */ /* Make the changes to this._groups and emit signals. */
foreach (var category_name in removed_categories) foreach (var category_name in removed_categories)
...@@ -1545,6 +1585,11 @@ public class Edsf.Persona : Folks.Persona, ...@@ -1545,6 +1585,11 @@ public class Edsf.Persona : Folks.Persona,
{ {
this.notify_property ("is-favourite"); this.notify_property ("is-favourite");
} }
if (in_google_personal_group != this._in_google_personal_group)
{
this._in_google_personal_group = in_google_personal_group;
this.notify_property ("in-google-personal-group");
}
this.thaw_notify (); this.thaw_notify ();
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment