From: Xavier Claessens Date: Tue, 10 Apr 2012 14:54:21 +0000 (+0200) Subject: TpfPersonaStore: warn on error initialising tp logger X-Git-Tag: FOLKS_0_7_0~24 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=9d525bb0c3ae87b2156dfa52ee37736d42a6dd71;p=platform%2Fupstream%2Ffolks.git TpfPersonaStore: warn on error initialising tp logger https://bugzilla.gnome.org/show_bug.cgi?id=630822 --- diff --git a/backends/telepathy/lib/tpf-persona-store.vala b/backends/telepathy/lib/tpf-persona-store.vala index 8ae4711..ce1c6e0 100644 --- a/backends/telepathy/lib/tpf-persona-store.vala +++ b/backends/telepathy/lib/tpf-persona-store.vala @@ -462,25 +462,23 @@ public class Tpf.PersonaStore : Folks.PersonaStore } }); - /* We have to connect to the logger before dealing with the - * account status, because if the account's already connected we - * want to be able to query favourite information immediately. */ - try - { - this._logger = new Logger (this.id); - yield this._logger.prepare (); - this._logger.invalidated.connect ( - this._logger_invalidated_cb); - this._logger.favourite_contacts_changed.connect ( - this._favourite_contacts_changed_cb); - this._initialise_favourite_contacts.begin (); - } - catch (GLib.Error e) - { - warning ( - _("Couldn't connect to the telepathy-logger service.")); - this._logger = null; - } + this._logger = new Logger (this.id); + this._logger.invalidated.connect ( + this._logger_invalidated_cb); + this._logger.favourite_contacts_changed.connect ( + this._favourite_contacts_changed_cb); + this._initialise_favourite_contacts.begin ((o, r) => + { + try + { + this._initialise_favourite_contacts.end (r); + } + catch (GLib.Error e) + { + warning ("Failed to initialise favourite contacts: %s", + e.message); + } + }); this.account.notify["connection"].connect ( this._notify_connection_cb); @@ -532,22 +530,15 @@ public class Tpf.PersonaStore : Folks.PersonaStore this._logger = null; } - private async void _initialise_favourite_contacts () + private async void _initialise_favourite_contacts () throws GLib.Error { if (this._logger == null) return; - /* Get an initial set of favourite contacts */ - try - { - var contacts = yield this._logger.get_favourite_contacts (); - this._favourite_contacts_changed_cb (contacts, {}); - } - catch (GLib.Error e) - { - /* Translators: the parameter is an error message. */ - warning (_("Couldn't get list of favorite contacts: %s"), e.message); - } + yield this._logger.prepare (); + + var contacts = yield this._logger.get_favourite_contacts (); + this._favourite_contacts_changed_cb (contacts, {}); } private Persona? _lookup_persona_by_id (string id)