+
+static gboolean
+contact_list_store_iface_setup (gpointer user_data)
+{
+ EmpathyContactListStore *store = user_data;
+ EmpathyContactListStorePriv *priv = GET_PRIV (store);
+ GList *contacts, *l;
+
+ /* Signal connection. */
+ g_signal_connect (priv->list,
+ "members-changed",
+ G_CALLBACK (contact_list_store_members_changed_cb),
+ store);
+ g_signal_connect (priv->list,
+ "groups-changed",
+ G_CALLBACK (contact_list_store_groups_changed_cb),
+ store);
+
+ /* Add contacts already created. */
+ contacts = empathy_contact_list_get_members (priv->list);
+ for (l = contacts; l; l = l->next) {
+ contact_list_store_members_changed_cb (priv->list, l->data,
+ NULL, 0, NULL,
+ TRUE,
+ store);
+
+ g_object_unref (l->data);
+ }
+ g_list_free (contacts);
+
+ return FALSE;
+}
+
+
+static void
+contact_list_store_set_contact_list (EmpathyContactListStore *store,
+ EmpathyContactList *list_iface)
+{
+ EmpathyContactListStorePriv *priv = GET_PRIV (store);
+
+ priv->list = g_object_ref (list_iface);
+
+ /* Let a chance to have all properties set before populating */
+ g_idle_add (contact_list_store_iface_setup,
+ store);
+}
+