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
This commit is contained in:
parent
e5ed6c6667
commit
1cf1d966ba
5 changed files with 8 additions and 35 deletions
|
@ -36,7 +36,7 @@ AC_SUBST(GETTEXT_PACKAGE)
|
|||
pkg_modules="gtk+-3.0 >= 3.4.0
|
||||
glib-2.0 >= 2.31.10
|
||||
gnome-desktop-3.0
|
||||
folks >= 0.7.1
|
||||
folks >= 0.7.2
|
||||
folks-telepathy
|
||||
folks-eds
|
||||
libnotify
|
||||
|
|
|
@ -1199,13 +1199,17 @@ public class Contacts.Contact : GLib.Object {
|
|||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true only for personas which are in a Google address book, but which
|
||||
* are not in the user's "My Contacts" group in the address book.
|
||||
*/
|
||||
public static bool persona_is_google_other (Persona persona) {
|
||||
if (!persona_is_google (persona))
|
||||
return false;
|
||||
|
||||
var g = persona as GroupDetails;
|
||||
if (g != null && !g.groups.contains (eds_personal_google_group_name ()))
|
||||
return true;
|
||||
var p = persona as Edsf.Persona;
|
||||
if (p != null)
|
||||
return !p.in_google_personal_group;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -1287,10 +1291,6 @@ public class Contacts.Contact : GLib.Object {
|
|||
|
||||
public static async Persona? create_primary_persona_for_details (Folks.PersonaStore store, HashTable<string, Value?> details) throws GLib.Error {
|
||||
var p = yield store.add_persona_from_details (details);
|
||||
if (p != null && persona_is_google (p)) {
|
||||
var g = p as GroupDetails;
|
||||
yield g.change_group (eds_personal_google_group_name (), true);
|
||||
}
|
||||
return p;
|
||||
}
|
||||
|
||||
|
|
|
@ -71,30 +71,6 @@ gboolean contacts_has_goa_account (void)
|
|||
return has_goa_contacts;
|
||||
}
|
||||
|
||||
/* This is an enourmous hack to find google eds contacts that are
|
||||
in the "My Contacts" system group. */
|
||||
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;
|
||||
}
|
||||
|
||||
gboolean
|
||||
contacts_esource_uid_is_google (const char *uid)
|
||||
{
|
||||
|
|
|
@ -4,7 +4,6 @@ void contacts_ensure_eds_accounts (void);
|
|||
const char *contacts_lookup_esource_name_by_uid (const char *uid);
|
||||
const char *contacts_lookup_esource_name_by_uid_for_contact (const char *uid);
|
||||
gboolean contacts_esource_uid_is_google (const char *uid);
|
||||
char *eds_personal_google_group_name (void);
|
||||
gboolean contacts_has_goa_account (void);
|
||||
extern ESourceRegistry *eds_source_registry;
|
||||
extern gboolean contacts_avoid_goa_workaround;
|
||||
|
|
|
@ -33,8 +33,6 @@ namespace Contacts {
|
|||
public static unowned string? lookup_esource_name_by_uid_for_contact (string uid);
|
||||
[CCode (cname = "contacts_esource_uid_is_google")]
|
||||
public static bool esource_uid_is_google (string uid);
|
||||
[CCode (cname = "eds_personal_google_group_name")]
|
||||
public static unowned string? eds_personal_google_group_name ();
|
||||
[CCode (cname = "contacts_has_goa_account")]
|
||||
public static bool has_goa_account ();
|
||||
[CCode (cname = "eds_source_registry")]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue