[gnome-contacts] Handle exceptions when preparing accounts and checking caps
- From: Raul Gutierrez Segales <raulgs src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-contacts] Handle exceptions when preparing accounts and checking caps
- Date: Sat, 3 Sep 2011 09:46:46 +0000 (UTC)
commit 6ab8d195d1b9c26af05f10739ef8449af8bf982a
Author: Raul Gutierrez Segales <rgs collabora co uk>
Date: Sat Sep 3 10:42:19 2011 +0100
Handle exceptions when preparing accounts and checking caps
src/contacts-store.vala | 35 +++++++++++++++++++++++------------
1 files changed, 23 insertions(+), 12 deletions(-)
---
diff --git a/src/contacts-store.vala b/src/contacts-store.vala
index 13a2e16..0b0eca4 100644
--- a/src/contacts-store.vala
+++ b/src/contacts-store.vala
@@ -151,13 +151,18 @@ public class Contacts.Store : GLib.Object {
private async void check_call_capabilities () {
this.calling_accounts = new Gee.HashMap<string, Account> ();
var account_manager = AccountManager.dup ();
- yield account_manager.prepare_async (null);
- account_manager.account_enabled.connect (this.check_account_caps);
- account_manager.account_disabled.connect (this.check_account_caps);
+ try {
+ yield account_manager.prepare_async (null);
- foreach (var account in account_manager.get_valid_accounts ()) {
- yield this.check_account_caps (account);
+ account_manager.account_enabled.connect (this.check_account_caps);
+ account_manager.account_disabled.connect (this.check_account_caps);
+
+ foreach (var account in account_manager.get_valid_accounts ()) {
+ yield this.check_account_caps (account);
+ }
+ } catch (GLib.Error e) {
+ warning ("Unable to check accounts caps %s", e.message);
}
}
@@ -165,15 +170,21 @@ public class Contacts.Store : GLib.Object {
GLib.Quark addressing = Account.get_feature_quark_addressing ();
if (!account.is_prepared (addressing)) {
GLib.Quark[] features = { addressing };
- yield account.prepare_async (features);
+ try {
+ yield account.prepare_async (features);
+ } catch (GLib.Error e) {
+ warning ("Unable to prepare account %s", e.message);
+ }
}
- 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_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);
+ }
}
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]