+
+ if (priv->event_id >= 0) {
+ gboolean new_account = g_strcmp0 (priv->local_id, local_id);
+
+ if (g_strcmp0 (priv->remote_id, remote_id) ||
+ new_account ||
+ !priv->contact) {
+ clean_contact (self, TRUE);
+ start_aggregator (self);
+ }
+ else if (priv->contact) {
+ show_contact (self);
+ }
+
+ if (new_account) {
+ if (g_strcmp0 (priv->local_id, "ring/tel/ring") == 0) {
+ icon_name = "general_sms";
+ }
+ else {
+ McAccount *account;
+ OssoABookAccountManager *am = osso_abook_account_manager_get_default ();
+ if (!osso_abook_waitable_is_ready (OSSO_ABOOK_WAITABLE (am), NULL)) {
+ osso_abook_account_manager_call_when_ready (am,
+ am_ready,
+ self,
+ NULL);
+ }
+ else {
+ account = osso_abook_account_manager_lookup_by_name (NULL,
+ priv->local_id);
+ if (account) {
+ McProfile *profile = mc_profile_lookup (mc_account_compat_get_profile (account));
+ icon_name = mc_profile_get_icon_name (profile);
+ }
+ }
+ }
+
+ if (icon_name) {
+ gtk_image_set_from_icon_name (GTK_IMAGE (priv->icon),
+ icon_name,
+ HILDON_ICON_SIZE_XSMALL);
+ gtk_widget_show (priv->icon);
+ }
+ else
+ gtk_widget_hide (priv->icon);
+ }
+ }
+ else {
+ gchar *text;
+ gint n_sms_events = 0, n_sms_convs = 0;
+ gint n_chat_events = 0, n_chat_convs = 0;
+ const gchar *fmt = "%d <span size=\"small\">(%d)</span>";
+
+ query_read_events (priv->eventlogger,
+ "RTCOM_EL_SERVICE_SMS",
+ &n_sms_events, &n_sms_convs);
+ query_read_events (priv->eventlogger,
+ "RTCOM_EL_SERVICE_CHAT",
+ &n_chat_events, &n_chat_convs);
+
+ text = g_strdup_printf (fmt, n_sms_convs, n_sms_events);
+ gtk_label_set_markup (GTK_LABEL (priv->sms_total), text);
+ g_free (text);
+
+ text = g_strdup_printf (fmt, n_chat_convs, n_chat_events);
+ gtk_label_set_markup (GTK_LABEL (priv->chat_total), text);
+ g_free (text);
+
+ gtk_label_set_text (GTK_LABEL (priv->sender),
+ dgettext ("rtcom-messaging-ui",
+ "messaging_ap_conversations"));
+
+ clean_contact (self, TRUE);
+ gtk_widget_hide (priv->icon);
+ }
+
+ g_free (local_id);
+ g_free (remote_id);