summaryrefslogtreecommitdiff
path: root/telepathy-glib/account.c
diff options
context:
space:
mode:
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2013-01-07 17:29:45 +0100
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2013-01-09 14:04:58 +0100
commit18dd2cc616621f796bf1d1987e55b51eedca00b8 (patch)
tree08be253a7ed81c8827bff3bbd54ade8a5f963035 /telepathy-glib/account.c
parent15b8eea5133e683ac14c79734dfbea6747af6e5f (diff)
downloadtelepathy-glib-18dd2cc616621f796bf1d1987e55b51eedca00b8.tar.gz
TpAccount: implement change notification on uri-schemes property
Diffstat (limited to 'telepathy-glib/account.c')
-rw-r--r--telepathy-glib/account.c42
1 files changed, 42 insertions, 0 deletions
diff --git a/telepathy-glib/account.c b/telepathy-glib/account.c
index c49699c48..3b4d44f4b 100644
--- a/telepathy-glib/account.c
+++ b/telepathy-glib/account.c
@@ -1020,6 +1020,42 @@ _tp_account_got_all_cb (TpProxy *proxy,
}
static void
+addressing_props_changed (TpAccount *self,
+ GHashTable *changed_properties)
+{
+ const gchar * const * v;
+
+ if (self->priv->uri_schemes == NULL)
+ /* We did not fetch the initial value yet, ignoring */
+ return;
+
+ v = tp_asv_get_strv (changed_properties, "URISchemes");
+ if (v == NULL)
+ return;
+
+ g_strfreev (self->priv->uri_schemes);
+ self->priv->uri_schemes = g_strdupv ((GStrv) v);
+
+ g_object_notify (G_OBJECT (self), "uri-schemes");
+}
+
+static void
+dbus_properties_changed_cb (TpProxy *proxy,
+ const gchar *interface_name,
+ GHashTable *changed_properties,
+ const gchar **invalidated_properties,
+ gpointer user_data,
+ GObject *weak_object)
+{
+ TpAccount *self = TP_ACCOUNT (weak_object);
+
+ if (!tp_strdiff (interface_name, TP_IFACE_ACCOUNT_INTERFACE_ADDRESSING))
+ {
+ addressing_props_changed (self, changed_properties);
+ }
+}
+
+static void
_tp_account_constructed (GObject *object)
{
TpAccount *self = TP_ACCOUNT (object);
@@ -1059,6 +1095,9 @@ _tp_account_constructed (GObject *object)
tp_cli_account_connect_to_account_property_changed (self,
_tp_account_properties_changed, NULL, NULL, object, NULL);
+ tp_cli_dbus_properties_connect_to_properties_changed (self,
+ dbus_properties_changed_cb, NULL, NULL, object, NULL);
+
tp_cli_dbus_properties_call_get_all (self, -1, TP_IFACE_ACCOUNT,
_tp_account_got_all_cb, NULL, NULL, G_OBJECT (self));
}
@@ -2047,6 +2086,9 @@ tp_account_class_init (TpAccountClass *klass)
* protocol (for instance, "xmpp" for XMPP, or "sip" or "sips" for SIP),
* since it should be assumed to be useful for those schemes in any case.
*
+ * The notify::uri-schemes signal cannot be relied on if the Account Manager
+ * is Mission Control version 5.14.0 or older.
+ *
* Since: UNRELEASED
*/
g_object_class_install_property (object_class, PROP_URI_SCHEMES,