diff options
author | Marco Barisione <marco.barisione@collabora.co.uk> | 2013-08-02 13:33:04 +0100 |
---|---|---|
committer | Marco Barisione <marco.barisione@collabora.co.uk> | 2013-08-20 11:44:24 +0100 |
commit | 4874591ca5fd0981a2fa471dffb8975001c807aa (patch) | |
tree | df4bdb777fe13d05e7ef206de40421cad60da63d /tp-account-widgets | |
parent | 0aab6f2536812fad6ca357d199b48b261d0041b6 (diff) | |
download | telepathy-account-widgets-4874591ca5fd0981a2fa471dffb8975001c807aa.tar.gz |
user-info: prepare the connection's ContactInfo interface
Diffstat (limited to 'tp-account-widgets')
-rw-r--r-- | tp-account-widgets/tpaw-user-info.c | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/tp-account-widgets/tpaw-user-info.c b/tp-account-widgets/tpaw-user-info.c index 69d0ef03..7fac7d3d 100644 --- a/tp-account-widgets/tpaw-user-info.c +++ b/tp-account-widgets/tpaw-user-info.c @@ -57,6 +57,8 @@ enum #define DATA_FIELD "contact-info-field" #define DATA_IS_CONTACT_INFO "is-contact-info" +static void reload_contact_info (TpawUserInfo *self); + static void contact_info_changed_cb (GtkEntry *entry, TpawUserInfo *self) @@ -360,6 +362,21 @@ request_contact_info_cb (GObject *object, } static void +connection_contact_info_prepared_cb (GObject *object, + GAsyncResult *res, + gpointer user_data) +{ + TpawUserInfo *self = user_data; + + if (!tp_proxy_prepare_finish (object, res, NULL)) + return; + + reload_contact_info (self); + + g_object_unref (self); +} + +static void reload_contact_info (TpawUserInfo *self) { TpConnection *connection; @@ -381,7 +398,17 @@ reload_contact_info (TpawUserInfo *self) connection = tp_account_get_connection (self->priv->account); if (connection != NULL) - contact = tp_connection_get_self_contact (connection); + { + contact = tp_connection_get_self_contact (connection); + + if (!tp_proxy_is_prepared (connection, + TP_CONNECTION_FEATURE_CONTACT_INFO)) + { + GQuark features[] = { TP_CONNECTION_FEATURE_CONTACT_INFO, 0 }; + tp_proxy_prepare_async (connection, features, + connection_contact_info_prepared_cb, g_object_ref (self)); + } + } /* Display infobar if we don't have a self contact (probably offline) */ if (contact == NULL) |