add an ACE option to show or not number of online / total contacts. fixes #2811

This commit is contained in:
Yann Leboulanger 2006-12-29 18:39:33 +00:00
parent 77d9f89eee
commit 0ac37a3b6c
2 changed files with 10 additions and 6 deletions

View File

@ -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.')], '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.')], '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.')], '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 = { __options_per_key = {

View File

@ -228,8 +228,9 @@ class RosterWindow:
if not self.tree.row_expanded(path) and model.iter_has_child(iter): if not self.tree.row_expanded(path) and model.iter_has_child(iter):
# account row not expanded # account row not expanded
account_name = '[%s]' % account_name account_name = '[%s]' % account_name
if gajim.account_is_connected(account) or (self.regroup and \ if (gajim.account_is_connected(account) or (self.regroup and \
gajim.get_number_of_connected_accounts()): gajim.get_number_of_connected_accounts())) and gajim.config.get(
'show_contacts_number'):
nbr_on, nbr_total = gajim.contacts.get_nb_online_total_contacts( nbr_on, nbr_total = gajim.contacts.get_nb_online_total_contacts(
accounts = accounts) accounts = accounts)
account_name += ' (%s/%s)' % (repr(nbr_on),repr(nbr_total)) account_name += ' (%s/%s)' % (repr(nbr_on),repr(nbr_total))
@ -389,11 +390,13 @@ class RosterWindow:
accounts = [] accounts = []
else: else:
accounts = [account] accounts = [account]
text = group
if gajim.config.get('show_contacts_number'):
nbr_on, nbr_total = gajim.contacts.get_nb_online_total_contacts( nbr_on, nbr_total = gajim.contacts.get_nb_online_total_contacts(
accounts = accounts, groups = [group]) accounts = accounts, groups = [group])
text += ' (%s/%s)' % (repr(nbr_on), repr(nbr_total))
model = self.tree.get_model() model = self.tree.get_model()
model.set_value(iter, 1 , gtkgui_helpers.escape_for_pango_markup( model.set_value(iter, 1 , gtkgui_helpers.escape_for_pango_markup(text))
'%s (%s/%s)' % (group, repr(nbr_on), repr(nbr_total))))
def add_to_not_in_the_roster(self, account, jid, nick = ''): 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, ''' add jid to group "not in the roster", he MUST not be in roster yet,