[evolution-data-server] [GOA/UOA] Remove duplicate ESource-s referencing the same GOA/UOA account
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-data-server] [GOA/UOA] Remove duplicate ESource-s referencing the same GOA/UOA account
- Date: Thu, 20 Aug 2015 16:01:59 +0000 (UTC)
commit b97be37db50de248a15525e8ed62333f567d38dc
Author: Milan Crha <mcrha redhat com>
Date: Thu Aug 20 18:00:02 2015 +0200
[GOA/UOA] Remove duplicate ESource-s referencing the same GOA/UOA account
If it ever happens that multiple ESource-s reference the same GOA or UOA
account, remove the duplicate, thus the user interface is not filled
multiple times with the same information.
libedataserver/e-source.c | 9 ++++++++-
.../module-gnome-online-accounts.c | 7 +++++++
.../module-ubuntu-online-accounts.c | 7 +++++++
3 files changed, 22 insertions(+), 1 deletions(-)
---
diff --git a/libedataserver/e-source.c b/libedataserver/e-source.c
index 6263cfe..4c5c5df 100644
--- a/libedataserver/e-source.c
+++ b/libedataserver/e-source.c
@@ -3570,9 +3570,16 @@ gint
e_source_compare_by_display_name (ESource *source1,
ESource *source2)
{
- return g_strcmp0 (
+ gint res;
+
+ res = g_strcmp0 (
source1->priv->collate_key,
source2->priv->collate_key);
+
+ if (res == 0)
+ res = g_strcmp0 (source1->priv->uid, source2->priv->uid);
+
+ return res;
}
/**
diff --git a/modules/gnome-online-accounts/module-gnome-online-accounts.c
b/modules/gnome-online-accounts/module-gnome-online-accounts.c
index 2f9be5e..929c0e4 100644
--- a/modules/gnome-online-accounts/module-gnome-online-accounts.c
+++ b/modules/gnome-online-accounts/module-gnome-online-accounts.c
@@ -1007,6 +1007,13 @@ gnome_online_accounts_populate_accounts_table (EGnomeOnlineAccounts *extension,
if (account_id == NULL)
continue;
+ if (g_hash_table_lookup (extension->goa_to_eds, account_id)) {
+ /* There are more ESource-s referencing the same GOA account;
+ delete the later. */
+ g_queue_push_tail (&trash, source);
+ continue;
+ }
+
/* Verify the GOA account still exists. */
match = g_list_find_custom (
goa_objects, account_id,
diff --git a/modules/ubuntu-online-accounts/module-ubuntu-online-accounts.c
b/modules/ubuntu-online-accounts/module-ubuntu-online-accounts.c
index 65a3f00..ba3882e 100644
--- a/modules/ubuntu-online-accounts/module-ubuntu-online-accounts.c
+++ b/modules/ubuntu-online-accounts/module-ubuntu-online-accounts.c
@@ -787,6 +787,13 @@ ubuntu_online_accounts_populate_accounts_table (EUbuntuOnlineAccounts *extension
if (ag_account_id == 0)
continue;
+ if (g_hash_table_lookup (extension->uoa_to_eds, GUINT_TO_POINTER (ag_account_id))) {
+ /* There are more ESource-s referencing the same UOA account;
+ delete the later. */
+ g_queue_push_tail (&trash, source);
+ continue;
+ }
+
/* Verify the UOA account still exists. */
match = g_list_find (
ag_account_ids,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]