summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonny Lamb <jonnylamb@gnome.org>2010-12-15 10:17:07 +0000
committerJonny Lamb <jonnylamb@gnome.org>2010-12-15 10:17:07 +0000
commit63c9b8383796bdbc0918f7f376cb7ab3960538aa (patch)
treef7b70590b90af15bd9fd650eb1e4ccc632dfd7f2
parent2d19c5b79c562f421224a7733e08a42c3328bf0f (diff)
contact-view: display presence messages where available
Signed-off-by: Jonny Lamb <jonnylamb@gnome.org>
-rw-r--r--liszt/contact-view.c78
1 files changed, 44 insertions, 34 deletions
diff --git a/liszt/contact-view.c b/liszt/contact-view.c
index b7daf7fc3..70e704f19 100644
--- a/liszt/contact-view.c
+++ b/liszt/contact-view.c
@@ -48,6 +48,39 @@ lol_contact_view_init (LolContactView *self)
LolContactViewPrivate);
}
+static TpContact *
+get_contact_and_account (LolContactView *self,
+ TpAccount **account)
+{
+ LolContactViewPrivate *priv = self->priv;
+ GList *personas, *l;
+ FolksPersona *persona = NULL;
+ FolksPersonaStore *store;
+ TpContact *contact;
+
+ personas = folks_individual_get_personas (priv->individual);
+
+ for (l = personas; l != NULL; l = l->next)
+ {
+ if (!TPF_IS_PERSONA (l->data))
+ continue;
+
+ persona = l->data;
+ break;
+ }
+
+ if (persona == NULL)
+ return NULL;
+
+ store = folks_persona_get_store (persona);
+ contact = tpf_persona_get_contact (TPF_PERSONA (persona));
+
+ if (account != NULL)
+ *account = tpf_persona_store_get_account (TPF_PERSONA_STORE (store));
+
+ return contact;
+}
+
static void
lol_contact_view_set_markup (LolContactView *self,
const gchar *text,
@@ -56,11 +89,21 @@ lol_contact_view_set_markup (LolContactView *self,
LolContactViewPrivate *priv = self->priv;
gchar *markup;
TpConnectionPresenceType tmp;
+ TpContact *contact;
+ const gchar *status = NULL;
tmp = empathy_folks_presence_type_to_tp (presence);
+ contact = get_contact_and_account (self, NULL);
+
+ if (contact != NULL)
+ status = tp_contact_get_presence_message (contact);
+
+ if (EMP_STR_EMPTY (status))
+ status = empathy_presence_get_default_message (tmp);
+
markup = g_strdup_printf ("%s\n<span size=\"x-small\">%s</span>",
- text, empathy_presence_get_default_message (tmp));
+ text, status);
clutter_text_set_markup (CLUTTER_TEXT (priv->name_text), markup);
g_free (markup);
}
@@ -141,39 +184,6 @@ lol_contact_view_set_presence (LolContactView *self,
g_free (tmp);
}
-static TpContact *
-get_contact_and_account (LolContactView *self,
- TpAccount **account)
-{
- LolContactViewPrivate *priv = self->priv;
- GList *personas, *l;
- FolksPersona *persona = NULL;
- FolksPersonaStore *store;
- TpContact *contact;
-
- personas = folks_individual_get_personas (priv->individual);
-
- for (l = personas; l != NULL; l = l->next)
- {
- if (!TPF_IS_PERSONA (l->data))
- continue;
-
- persona = l->data;
- break;
- }
-
- if (persona == NULL)
- return NULL;
-
- store = folks_persona_get_store (persona);
- contact = tpf_persona_get_contact (TPF_PERSONA (persona));
-
- if (account != NULL)
- *account = tpf_persona_store_get_account (TPF_PERSONA_STORE (store));
-
- return contact;
-}
-
static void
lol_contact_view_update_capabilities (LolContactView *self)
{