]> git.0d.be Git - empathy.git/commitdiff
Only show status in tooltip when it exists
authorWill Thompson <will.thompson@collabora.co.uk>
Sun, 7 Jun 2009 19:19:01 +0000 (20:19 +0100)
committerWill Thompson <will.thompson@collabora.co.uk>
Sun, 7 Jun 2009 19:19:01 +0000 (20:19 +0100)
empathy_contact_get_status () can return NULL: perhaps the protocol
doesn't support presence, or perhaps we're not subscribed to the
contact's presence.

src/empathy-chat-window.c

index bf02c3cc680cffaf5f45b1d643b346f5f72c96d0..bb168b6bbe090a29de119787f18c1d2522443764 100644 (file)
@@ -390,6 +390,7 @@ chat_window_update_chat_tab (EmpathyChat *chat)
        const gchar           *name;
        McAccount             *account;
        const gchar           *subject;
+       const gchar           *status;
        GtkWidget             *widget;
        GString               *tooltip;
        gchar                 *markup;
@@ -431,12 +432,19 @@ chat_window_update_chat_tab (EmpathyChat *chat)
        tooltip = g_string_new (NULL);
 
        if (remote_contact) {
-               markup = g_markup_printf_escaped ("<b>%s</b><small> (%s)</small>\n%s",
+               markup = g_markup_printf_escaped ("<b>%s</b><small> (%s)</small>",
                                                  empathy_contact_get_id (remote_contact),
-                                                 mc_account_get_display_name (account),
-                                                 empathy_contact_get_status (remote_contact));
+                                                 mc_account_get_display_name (account));
                g_string_append (tooltip, markup);
                g_free (markup);
+
+               status = empathy_contact_get_status (remote_contact);
+
+               if (status) {
+                       markup = g_markup_printf_escaped ("\n%s", status);
+                       g_string_append (tooltip, markup);
+                       g_free (markup);
+               }
        }
        else {
                markup = g_markup_printf_escaped ("<b>%s</b><small>  (%s)</small>", name,