summaryrefslogtreecommitdiff
path: root/libmcclient/mc-account-compat.c
diff options
context:
space:
mode:
authorAlberto Mardegan <alberto.mardegan@nokia.com>2009-08-11 16:13:27 +0300
committerAlberto Mardegan <alberto.mardegan@nokia.com>2009-08-11 16:13:27 +0300
commit4cff37f910b2aea3d59552c8b5110d23f8c008e4 (patch)
tree2a873451f738b38a6b70cf4717c38713c92cbbad /libmcclient/mc-account-compat.c
parentc8b780672dd20f8866d4fc9b293e31d0072ac764 (diff)
downloadtelepathy-mission-control-4cff37f910b2aea3d59552c8b5110d23f8c008e4.tar.gz
Setup property monitoring
This will update the local preoperties when MC daemon emits the CompatPropertyChanged signal.
Diffstat (limited to 'libmcclient/mc-account-compat.c')
-rw-r--r--libmcclient/mc-account-compat.c33
1 files changed, 30 insertions, 3 deletions
diff --git a/libmcclient/mc-account-compat.c b/libmcclient/mc-account-compat.c
index 81ed32f4..858a328c 100644
--- a/libmcclient/mc-account-compat.c
+++ b/libmcclient/mc-account-compat.c
@@ -37,11 +37,12 @@ struct _McAccountCompatProps {
};
static void create_props (TpProxy *proxy, GHashTable *props);
+static void setup_props_monitor (TpProxy *proxy, GQuark interface);
static McIfaceDescription iface_description = {
G_STRUCT_OFFSET (McAccountPrivate, compat_props),
create_props,
- NULL,
+ setup_props_monitor,
};
@@ -134,9 +135,13 @@ mc_account_compat_call_when_ready (McAccount *account,
iface_data.props_data_ptr = (gpointer)&account->priv->compat_props;
iface_data.create_props = create_props;
- _mc_iface_call_when_ready_int ((TpProxy *)account,
+ if (_mc_iface_call_when_ready_int ((TpProxy *)account,
(McIfaceWhenReadyCb)callback, user_data,
- &iface_data);
+ &iface_data))
+ {
+ setup_props_monitor ((TpProxy *)account,
+ MC_IFACE_QUARK_ACCOUNT_INTERFACE_COMPAT);
+ }
}
/**
@@ -188,6 +193,28 @@ mc_account_compat_get_secondary_vcard_fields (McAccount *account)
account->priv->compat_props->secondary_vcard_fields;
}
+static void
+on_compat_property_changed (TpProxy *proxy, GHashTable *properties,
+ gpointer user_data, GObject *weak_object)
+{
+ McAccount *account = MC_ACCOUNT (proxy);
+ McAccountPrivate *priv = account->priv;
+
+ /* if the GetAll method hasn't returned yet, we do nothing */
+ if (G_UNLIKELY (!priv->compat_props)) return;
+
+ _mc_iface_update_props (account_compat_properties, properties, account);
+}
+
+static void
+setup_props_monitor (TpProxy *proxy, GQuark interface)
+{
+ McAccount *account = MC_ACCOUNT (proxy);
+
+ mc_cli_account_interface_compat_connect_to_compat_property_changed
+ (account, on_compat_property_changed, NULL, NULL, NULL, NULL);
+}
+
/**
* mc_account_avatar_set:
* @account: the #McAccount.