From 0ac37a3b6c4abbb022055880fadb3e01aef7c2eb Mon Sep 17 00:00:00 2001 From: Yann Leboulanger Date: Fri, 29 Dec 2006 18:39:33 +0000 Subject: [PATCH] add an ACE option to show or not number of online / total contacts. fixes #2811 --- src/common/config.py | 1 + src/roster_window.py | 15 +++++++++------ 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/common/config.py b/src/common/config.py index ae6fb285c..8512916d8 100644 --- a/src/common/config.py +++ b/src/common/config.py @@ -222,6 +222,7 @@ class Config: 'confirm_metacontacts': [ opt_str, '', _('Should we show the confirm metacontacts creation dialog or not? Empty string means we never show the dialog.')], 'enable_negative_priority': [ opt_bool, False, _('If True, you will be able to set a negative priority to your account in account modification window. BE CAREFULL, when you are logged in with a negative priority, you will NOT receive any message from your server.')], 'use_gnomekeyring': [opt_bool, True, _('If True, Gajim will use Gnome Keyring (if available) to store account passwords.')], + 'show_contacts_number': [opt_bool, True, _('If True, Gajim will show number of online and total contacts in account and group rows.')], } __options_per_key = { diff --git a/src/roster_window.py b/src/roster_window.py index 0f4084b5b..945e77352 100644 --- a/src/roster_window.py +++ b/src/roster_window.py @@ -228,8 +228,9 @@ class RosterWindow: if not self.tree.row_expanded(path) and model.iter_has_child(iter): # account row not expanded account_name = '[%s]' % account_name - if gajim.account_is_connected(account) or (self.regroup and \ - gajim.get_number_of_connected_accounts()): + if (gajim.account_is_connected(account) or (self.regroup and \ + gajim.get_number_of_connected_accounts())) and gajim.config.get( + 'show_contacts_number'): nbr_on, nbr_total = gajim.contacts.get_nb_online_total_contacts( accounts = accounts) account_name += ' (%s/%s)' % (repr(nbr_on),repr(nbr_total)) @@ -389,11 +390,13 @@ class RosterWindow: accounts = [] else: accounts = [account] - nbr_on, nbr_total = gajim.contacts.get_nb_online_total_contacts( - accounts = accounts, groups = [group]) + text = group + if gajim.config.get('show_contacts_number'): + nbr_on, nbr_total = gajim.contacts.get_nb_online_total_contacts( + accounts = accounts, groups = [group]) + text += ' (%s/%s)' % (repr(nbr_on), repr(nbr_total)) model = self.tree.get_model() - model.set_value(iter, 1 , gtkgui_helpers.escape_for_pango_markup( - '%s (%s/%s)' % (group, repr(nbr_on), repr(nbr_total)))) + model.set_value(iter, 1 , gtkgui_helpers.escape_for_pango_markup(text)) def add_to_not_in_the_roster(self, account, jid, nick = ''): ''' add jid to group "not in the roster", he MUST not be in roster yet,