From 0355aa7fd3bd46c356af6f58a59235cb6ae48df2 Mon Sep 17 00:00:00 2001
From: Yann Leboulanger <asterix@lagaule.org>
Date: Tue, 13 Mar 2012 14:32:09 +0100
Subject: [PATCH] [leon] show account name in tooltip rather than in roster in
 merged mode. Fixes #7118

---
 src/roster_window.py | 23 -----------------------
 src/tooltips.py      |  5 +++++
 2 files changed, 5 insertions(+), 23 deletions(-)

diff --git a/src/roster_window.py b/src/roster_window.py
index b238460182..dd0111db3a 100644
--- a/src/roster_window.py
+++ b/src/roster_window.py
@@ -1163,29 +1163,6 @@ class RosterWindow:
             name += i18n.paragraph_direction_mark(unicode(name))
             name += u' (%d)' % nb_connected_contact
 
-        # show (account_name) if there are 2 contact with same jid
-        # in merged mode
-        if self.regroup:
-            add_acct = False
-            # look through all contacts of all accounts
-            for account_ in gajim.connections:
-                # useless to add account name
-                if account_ == account:
-                    continue
-                for jid_ in gajim.contacts.get_jid_list(account_):
-                    contact_ = gajim.contacts.get_first_contact_from_jid(
-                            account_, jid_)
-                    if contact_.get_shown_name() == contact.get_shown_name() \
-                    and (jid_, account_) != (jid, account):
-                        add_acct = True
-                        break
-                if add_acct:
-                    # No need to continue in other account
-                    # if we already found one
-                    break
-            if add_acct:
-                name += ' (' + account + ')'
-
         # add status msg, if not empty, under contact name in
         # the treeview
         if contact.status and gajim.config.get('show_status_msgs_in_roster'):
diff --git a/src/tooltips.py b/src/tooltips.py
index ba55b36881..db5064ad30 100644
--- a/src/tooltips.py
+++ b/src/tooltips.py
@@ -498,6 +498,11 @@ class RosterTooltip(NotificationAreaTooltip):
         name_markup = u'<span weight="bold">' + \
                 gobject.markup_escape_text(prim_contact.get_shown_name())\
                 + '</span>'
+        if gajim.config.get('mergeaccounts'):
+          name_markup += u" <span foreground='#888A85'>(" + \
+                gobject.markup_escape_text(prim_contact.account.name) \
+                + ')</span>'
+
         if self.account and helpers.jid_is_blocked(self.account,
         prim_contact.jid):
             name_markup += _(' [blocked]')
-- 
GitLab