[gnome-documents] search: distinguish better sources from the same provider
- From: Cosimo Cecchi <cosimoc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-documents] search: distinguish better sources from the same provider
- Date: Sun, 2 Apr 2017 00:46:08 +0000 (UTC)
commit 67a1efd9286ecc71cacfdb87444d20334f396d41
Author: Cosimo Cecchi <cosimoc gnome org>
Date: Sat Apr 1 17:42:21 2017 -0700
search: distinguish better sources from the same provider
When there's two online sources from the same provider, add the
presentation identity string to distinguish them.
https://bugzilla.gnome.org/show_bug.cgi?id=769088
src/search.js | 17 +++++++++++++++++
1 files changed, 17 insertions(+), 0 deletions(-)
---
diff --git a/src/search.js b/src/search.js
index 1096204..c60ff4e 100644
--- a/src/search.js
+++ b/src/search.js
@@ -473,6 +473,7 @@ const SourceManager = new Lang.Class({
_refreshGoaAccounts: function() {
let newItems = {};
+ let newSources = [];
let accounts = Application.goaClient.get_accounts();
accounts.forEach(Lang.bind(this,
@@ -484,9 +485,25 @@ const SourceManager = new Lang.Class({
return;
let source = new Source({ object: object });
+
+ newSources.push(source);
newItems[source.id] = source;
}));
+ // Ensure an unique name for GOA accounts from the same provider
+ newSources.forEach(function(source) {
+ if (newSources.some(function(s) {
+ return s.name == source.name;
+ })) {
+ let account = source.object.get_account();
+ // Translators: the first %s is an online account provider name,
+ // e.g. "Google". The second %s is the identity used to log in,
+ // e.g. "foo gmail com".
+ source.name = _("%s (%s)").format(account.provider_name,
+ account.presentation_identity);
+ }
+ });
+
this.processNewItems(newItems);
},
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]