summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNiels De Graef <nielsdegraef@gmail.com>2017-12-24 01:50:14 +0100
committerNiels De Graef <nielsdegraef@gmail.com>2017-12-24 01:50:14 +0100
commit5efeaea38664b9c3e99ae26baa3c00a04b3eb2dc (patch)
tree0d5178236c3ad5dbeb258685792f143f53787430
parent035b76b2a9594fa6759d9e06625e78a4bdbb1f10 (diff)
downloadgnome-contacts-5efeaea38664b9c3e99ae26baa3c00a04b3eb2dc.tar.gz
ContactStore: only store 1 calling account.
Telepathy is on it's way out, and really, the end-result of this code still does exactly the same thing.
-rw-r--r--src/contacts-contact-sheet.vala4
-rw-r--r--src/contacts-store.vala18
-rw-r--r--src/contacts-utils.vala8
3 files changed, 6 insertions, 24 deletions
diff --git a/src/contacts-contact-sheet.vala b/src/contacts-contact-sheet.vala
index e0243f2..6b96794 100644
--- a/src/contacts-contact-sheet.vala
+++ b/src/contacts-contact-sheet.vala
@@ -152,10 +152,10 @@ public class Contacts.ContactSheet : Grid {
if (phone_details != null) {
var phones = Contact.sort_fields<PhoneFieldDetails>(phone_details.phone_numbers);
foreach (var phone in phones) {
- if (c.store != null && c.store.can_call) {
+ if (c.store != null && c.store.caller_account != null) {
var button = add_row_with_button (ref i, TypeSet.phone.format_type (phone), phone.value);
button.clicked.connect (() => {
- Utils.start_call (phone.value, c.store.calling_accounts);
+ Utils.start_call (phone.value, c.store.caller_account);
});
} else {
add_row_with_label (ref i, TypeSet.phone.format_type (phone), phone.value);
diff --git a/src/contacts-store.vala b/src/contacts-store.vala
index f841f2f..c92f61a 100644
--- a/src/contacts-store.vala
+++ b/src/contacts-store.vala
@@ -34,15 +34,9 @@ public class Contacts.Store : GLib.Object {
public BackendStore backend_store { get; private set; }
Gee.ArrayList<Contact> contacts;
- public Gee.HashMap<string, Account> calling_accounts;
-
public Gee.HashMultiMap<string, string> dont_suggest_link;
- public bool can_call {
- get {
- return this.calling_accounts.size > 0 ? true : false;
- }
- }
+ public Account? caller_account { get; private set; default = null; }
public bool is_quiescent {
get { return this.aggregator.is_quiescent; }
@@ -319,7 +313,6 @@ public class Contacts.Store : GLib.Object {
// TODO: listen for changes in Account#URISchemes
private async void check_call_capabilities () {
- this.calling_accounts = new Gee.HashMap<string, Account> ();
var account_manager = AccountManager.dup ();
try {
@@ -347,13 +340,8 @@ public class Contacts.Store : GLib.Object {
}
if (account.is_prepared (addressing)) {
- var k = account.get_object_path ();
- if (account.is_enabled () &&
- account.associated_with_uri_scheme ("tel")) {
- this.calling_accounts.set (k, account);
- } else {
- this.calling_accounts.unset (k);
- }
+ if (account.is_enabled () && account.associated_with_uri_scheme ("tel"))
+ this.caller_account = account;
}
}
}
diff --git a/src/contacts-utils.vala b/src/contacts-utils.vala
index c629778..a589a16 100644
--- a/src/contacts-utils.vala
+++ b/src/contacts-utils.vala
@@ -168,13 +168,7 @@ namespace Contacts.Utils {
request.ensure_channel_async.begin ("org.freedesktop.Telepathy.Client.Empathy.Chat", null);
}
- public void start_call (string contact_id, Gee.HashMap<string, TelepathyGLib.Account> accounts) {
- // TODO: prompt for which account to use
- var account = accounts.values.to_array ()[0];
- Utils.start_call_with_account (contact_id, account);
- }
-
- public void start_call_with_account (string contact_id, TelepathyGLib.Account account) {
+ public void start_call (string contact_id, TelepathyGLib.Account account) {
var request_dict = new HashTable<weak string,GLib.Value?>(str_hash, str_equal);
request_dict.insert (TelepathyGLib.PROP_CHANNEL_CHANNEL_TYPE,