Do not redefine built-in 'iter'. Follow recommendation and use 'titer' instead.
This commit is contained in:
parent
bbb07caa0a
commit
708e48a2a7
|
@ -165,9 +165,9 @@ class RosterWindow:
|
||||||
return []
|
return []
|
||||||
|
|
||||||
if jid == gajim.get_jid_from_account(account):
|
if jid == gajim.get_jid_from_account(account):
|
||||||
iter = self._get_self_contact_iter(jid, account, model)
|
contact_iter = self._get_self_contact_iter(jid, account, model)
|
||||||
if iter:
|
if contact_iter:
|
||||||
return [iter]
|
return [contact_iter]
|
||||||
else:
|
else:
|
||||||
return []
|
return []
|
||||||
|
|
||||||
|
@ -214,14 +214,14 @@ class RosterWindow:
|
||||||
return found
|
return found
|
||||||
|
|
||||||
|
|
||||||
def _iter_is_separator(self, model, iter):
|
def _iter_is_separator(self, model, titer):
|
||||||
''' Return True if the given iter is a separator.
|
''' Return True if the given iter is a separator.
|
||||||
|
|
||||||
Keyword arguments:
|
Keyword arguments:
|
||||||
model -- the data model
|
model -- the data model
|
||||||
iter -- the gtk.TreeIter to test
|
iter -- the gtk.TreeIter to test
|
||||||
'''
|
'''
|
||||||
if model[iter][0] == 'SEPARATOR':
|
if model[titer][0] == 'SEPARATOR':
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
@ -417,8 +417,8 @@ class RosterWindow:
|
||||||
# Only remove from specified groups
|
# Only remove from specified groups
|
||||||
all_iters = iters[:]
|
all_iters = iters[:]
|
||||||
group_iters = [self._get_group_iter(group, account) for group in groups]
|
group_iters = [self._get_group_iter(group, account) for group in groups]
|
||||||
iters = [iter for iter in all_iters
|
iters = [titer for titer in all_iters
|
||||||
if self.model.iter_parent(iter) in group_iters]
|
if self.model.iter_parent(titer) in group_iters]
|
||||||
|
|
||||||
iter_children = self.model.iter_children(iters[0])
|
iter_children = self.model.iter_children(iters[0])
|
||||||
|
|
||||||
|
@ -1062,13 +1062,13 @@ class RosterWindow:
|
||||||
iters = self._get_contact_iter(jid, account, contact)
|
iters = self._get_contact_iter(jid, account, contact)
|
||||||
if iters and self.modelfilter.iter_has_child(iters[0]):
|
if iters and self.modelfilter.iter_has_child(iters[0]):
|
||||||
# We are big brother contact and visible in the roster
|
# We are big brother contact and visible in the roster
|
||||||
iter = iters[0]
|
titer = iters[0]
|
||||||
path = self.modelfilter.get_path(iter)
|
path = self.modelfilter.get_path(titer)
|
||||||
|
|
||||||
if not self.tree.row_expanded(path) and \
|
if not self.tree.row_expanded(path) and \
|
||||||
icon_name not in ('event', 'muc_active', 'muc_inactive'):
|
icon_name not in ('event', 'muc_active', 'muc_inactive'):
|
||||||
|
|
||||||
iterC = self.modelfilter.iter_children(iter)
|
iterC = self.modelfilter.iter_children(titer)
|
||||||
if icon_name in ('error', 'offline'):
|
if icon_name in ('error', 'offline'):
|
||||||
# get the icon from the first child as they are sorted by show
|
# get the icon from the first child as they are sorted by show
|
||||||
jidC = self.modelfilter[iterC][C_JID].decode('utf-8')
|
jidC = self.modelfilter[iterC][C_JID].decode('utf-8')
|
||||||
|
@ -1229,8 +1229,8 @@ class RosterWindow:
|
||||||
### Roster and Modelfilter handling
|
### Roster and Modelfilter handling
|
||||||
##############################################################################
|
##############################################################################
|
||||||
|
|
||||||
def _search_roster_func(self, model, column, key, iter):
|
def _search_roster_func(self, model, column, key, titer):
|
||||||
if model[iter][C_NAME].decode('utf-8').lower().startswith(
|
if model[titer][C_NAME].decode('utf-8').lower().startswith(
|
||||||
gobject.markup_escape_text(key.lower())):
|
gobject.markup_escape_text(key.lower())):
|
||||||
return False
|
return False
|
||||||
return True
|
return True
|
||||||
|
@ -1261,21 +1261,21 @@ class RosterWindow:
|
||||||
return False
|
return False
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def _visible_func(self, model, iter):
|
def _visible_func(self, model, titer):
|
||||||
'''Determine whether iter should be visible in the treeview'''
|
'''Determine whether iter should be visible in the treeview'''
|
||||||
type_ = model[iter][C_TYPE]
|
type_ = model[titer][C_TYPE]
|
||||||
if not type_:
|
if not type_:
|
||||||
return False
|
return False
|
||||||
if type_ == 'account':
|
if type_ == 'account':
|
||||||
# Always show account
|
# Always show account
|
||||||
return True
|
return True
|
||||||
|
|
||||||
account = model[iter][C_ACCOUNT]
|
account = model[titer][C_ACCOUNT]
|
||||||
if not account:
|
if not account:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
account = account.decode('utf-8')
|
account = account.decode('utf-8')
|
||||||
jid = model[iter][C_JID]
|
jid = model[titer][C_JID]
|
||||||
if not jid:
|
if not jid:
|
||||||
return False
|
return False
|
||||||
jid = jid.decode('utf-8')
|
jid = jid.decode('utf-8')
|
||||||
|
@ -2286,16 +2286,16 @@ class RosterWindow:
|
||||||
self.tooltip.hide_tooltip()
|
self.tooltip.hide_tooltip()
|
||||||
if props:
|
if props:
|
||||||
[row, col, x, y] = props
|
[row, col, x, y] = props
|
||||||
iter = None
|
titer = None
|
||||||
try:
|
try:
|
||||||
iter = model.get_iter(row)
|
titer = model.get_iter(row)
|
||||||
except:
|
except:
|
||||||
self.tooltip.hide_tooltip()
|
self.tooltip.hide_tooltip()
|
||||||
return
|
return
|
||||||
if model[iter][C_TYPE] in ('contact', 'self_contact'):
|
if model[titer][C_TYPE] in ('contact', 'self_contact'):
|
||||||
# we're on a contact entry in the roster
|
# we're on a contact entry in the roster
|
||||||
account = model[iter][C_ACCOUNT].decode('utf-8')
|
account = model[titer][C_ACCOUNT].decode('utf-8')
|
||||||
jid = model[iter][C_JID].decode('utf-8')
|
jid = model[titer][C_JID].decode('utf-8')
|
||||||
if self.tooltip.timeout == 0 or self.tooltip.id != props[0]:
|
if self.tooltip.timeout == 0 or self.tooltip.id != props[0]:
|
||||||
self.tooltip.id = row
|
self.tooltip.id = row
|
||||||
contacts = gajim.contacts.get_contacts(account, jid)
|
contacts = gajim.contacts.get_contacts(account, jid)
|
||||||
|
@ -2309,18 +2309,18 @@ class RosterWindow:
|
||||||
self.tooltip.account = account
|
self.tooltip.account = account
|
||||||
self.tooltip.timeout = gobject.timeout_add(500,
|
self.tooltip.timeout = gobject.timeout_add(500,
|
||||||
self.show_tooltip, connected_contacts)
|
self.show_tooltip, connected_contacts)
|
||||||
elif model[iter][C_TYPE] == 'groupchat':
|
elif model[titer][C_TYPE] == 'groupchat':
|
||||||
account = model[iter][C_ACCOUNT].decode('utf-8')
|
account = model[titer][C_ACCOUNT].decode('utf-8')
|
||||||
jid = model[iter][C_JID].decode('utf-8')
|
jid = model[titer][C_JID].decode('utf-8')
|
||||||
if self.tooltip.timeout == 0 or self.tooltip.id != props[0]:
|
if self.tooltip.timeout == 0 or self.tooltip.id != props[0]:
|
||||||
self.tooltip.id = row
|
self.tooltip.id = row
|
||||||
contact = gajim.contacts.get_contacts(account, jid)
|
contact = gajim.contacts.get_contacts(account, jid)
|
||||||
self.tooltip.account = account
|
self.tooltip.account = account
|
||||||
self.tooltip.timeout = gobject.timeout_add(500,
|
self.tooltip.timeout = gobject.timeout_add(500,
|
||||||
self.show_tooltip, contact)
|
self.show_tooltip, contact)
|
||||||
elif model[iter][C_TYPE] == 'account':
|
elif model[titer][C_TYPE] == 'account':
|
||||||
# we're on an account entry in the roster
|
# we're on an account entry in the roster
|
||||||
account = model[iter][C_ACCOUNT].decode('utf-8')
|
account = model[titer][C_ACCOUNT].decode('utf-8')
|
||||||
if account == 'all':
|
if account == 'all':
|
||||||
if self.tooltip.timeout == 0 or self.tooltip.id != props[0]:
|
if self.tooltip.timeout == 0 or self.tooltip.id != props[0]:
|
||||||
self.tooltip.id = row
|
self.tooltip.id = row
|
||||||
|
@ -2438,14 +2438,14 @@ class RosterWindow:
|
||||||
dialogs.ConfirmationDialog(pritext, sectext,
|
dialogs.ConfirmationDialog(pritext, sectext,
|
||||||
on_response_ok = (remove, list_))
|
on_response_ok = (remove, list_))
|
||||||
|
|
||||||
def on_block(self, widget, iter, group_list):
|
def on_block(self, widget, titer, group_list):
|
||||||
''' When clicked on the 'block' button in context menu. '''
|
''' When clicked on the 'block' button in context menu. '''
|
||||||
model = self.modelfilter
|
model = self.modelfilter
|
||||||
accounts = []
|
accounts = []
|
||||||
msg = self.get_status_message('offline')
|
msg = self.get_status_message('offline')
|
||||||
if group_list is None:
|
if group_list is None:
|
||||||
jid = model[iter][C_JID].decode('utf-8')
|
jid = model[titer][C_JID].decode('utf-8')
|
||||||
account = model[iter][C_ACCOUNT].decode('utf-8')
|
account = model[titer][C_ACCOUNT].decode('utf-8')
|
||||||
accounts.append(account)
|
accounts.append(account)
|
||||||
self.send_status(account, 'offline', msg, to = jid)
|
self.send_status(account, 'offline', msg, to = jid)
|
||||||
new_rule = {'order': u'1', 'type': u'jid', 'action': u'deny',
|
new_rule = {'order': u'1', 'type': u'jid', 'action': u'deny',
|
||||||
|
@ -2455,7 +2455,7 @@ class RosterWindow:
|
||||||
gajim.connections[account].blocked_contacts.append(jid)
|
gajim.connections[account].blocked_contacts.append(jid)
|
||||||
self.draw_contact(jid, account)
|
self.draw_contact(jid, account)
|
||||||
else:
|
else:
|
||||||
if iter is None:
|
if titer is None:
|
||||||
for (contact, account) in group_list:
|
for (contact, account) in group_list:
|
||||||
if account not in accounts:
|
if account not in accounts:
|
||||||
if not gajim.connections[account].privacy_rules_supported:
|
if not gajim.connections[account].privacy_rules_supported:
|
||||||
|
@ -2470,7 +2470,7 @@ class RosterWindow:
|
||||||
gajim.connections[account].blocked_contacts.append(contact.jid)
|
gajim.connections[account].blocked_contacts.append(contact.jid)
|
||||||
self.draw_contact(contact.jid, account)
|
self.draw_contact(contact.jid, account)
|
||||||
else:
|
else:
|
||||||
group = model[iter][C_JID].decode('utf-8')
|
group = model[titer][C_JID].decode('utf-8')
|
||||||
for (contact, account) in group_list:
|
for (contact, account) in group_list:
|
||||||
if account not in accounts:
|
if account not in accounts:
|
||||||
if not gajim.connections[account].privacy_rules_supported:
|
if not gajim.connections[account].privacy_rules_supported:
|
||||||
|
@ -2492,13 +2492,13 @@ class RosterWindow:
|
||||||
gajim.connections[account].set_default_list('block')
|
gajim.connections[account].set_default_list('block')
|
||||||
gajim.connections[account].get_privacy_list('block')
|
gajim.connections[account].get_privacy_list('block')
|
||||||
|
|
||||||
def on_unblock(self, widget, iter, group_list):
|
def on_unblock(self, widget, titer, group_list):
|
||||||
''' When clicked on the 'unblock' button in context menu. '''
|
''' When clicked on the 'unblock' button in context menu. '''
|
||||||
model = self.modelfilter
|
model = self.modelfilter
|
||||||
accounts = []
|
accounts = []
|
||||||
if group_list is None:
|
if group_list is None:
|
||||||
jid = model[iter][C_JID].decode('utf-8')
|
jid = model[titer][C_JID].decode('utf-8')
|
||||||
jid_account = model[iter][C_ACCOUNT].decode('utf-8')
|
jid_account = model[titer][C_ACCOUNT].decode('utf-8')
|
||||||
accounts.append(jid_account)
|
accounts.append(jid_account)
|
||||||
gajim.connections[jid_account].new_blocked_list = []
|
gajim.connections[jid_account].new_blocked_list = []
|
||||||
for rule in gajim.connections[jid_account].blocked_list:
|
for rule in gajim.connections[jid_account].blocked_list:
|
||||||
|
@ -2510,7 +2510,7 @@ class RosterWindow:
|
||||||
gajim.connections[jid_account].blocked_contacts.remove(jid)
|
gajim.connections[jid_account].blocked_contacts.remove(jid)
|
||||||
self.draw_contact(jid, jid_account)
|
self.draw_contact(jid, jid_account)
|
||||||
else:
|
else:
|
||||||
if iter is None:
|
if titer is None:
|
||||||
for (contact, account) in group_list:
|
for (contact, account) in group_list:
|
||||||
if account not in accounts:
|
if account not in accounts:
|
||||||
if gajim.connections[account].privacy_rules_supported:
|
if gajim.connections[account].privacy_rules_supported:
|
||||||
|
@ -2531,7 +2531,7 @@ class RosterWindow:
|
||||||
or rule['value'] not in gajim.connections[account].to_unblock:
|
or rule['value'] not in gajim.connections[account].to_unblock:
|
||||||
gajim.connections[account].new_blocked_list.append(rule)
|
gajim.connections[account].new_blocked_list.append(rule)
|
||||||
else:
|
else:
|
||||||
group = model[iter][C_JID].decode('utf-8')
|
group = model[titer][C_JID].decode('utf-8')
|
||||||
for (contact, account) in group_list:
|
for (contact, account) in group_list:
|
||||||
if account not in accounts:
|
if account not in accounts:
|
||||||
if gajim.connections[account].privacy_rules_supported:
|
if gajim.connections[account].privacy_rules_supported:
|
||||||
|
@ -2584,16 +2584,16 @@ class RosterWindow:
|
||||||
self.send_status(account, show,
|
self.send_status(account, show,
|
||||||
gajim.connections[account].status, to=contact.jid)
|
gajim.connections[account].status, to=contact.jid)
|
||||||
|
|
||||||
def on_rename(self, widget, iter, path):
|
def on_rename(self, widget, titer, path):
|
||||||
# this function is called either by F2 or by Rename menuitem
|
# this function is called either by F2 or by Rename menuitem
|
||||||
if gajim.interface.instances.has_key('rename'):
|
if gajim.interface.instances.has_key('rename'):
|
||||||
gajim.interface.instances['rename'].dialog.present()
|
gajim.interface.instances['rename'].dialog.present()
|
||||||
return
|
return
|
||||||
model = self.modelfilter
|
model = self.modelfilter
|
||||||
|
|
||||||
row_type = model[iter][C_TYPE]
|
row_type = model[titer][C_TYPE]
|
||||||
jid = model[iter][C_JID].decode('utf-8')
|
jid = model[titer][C_JID].decode('utf-8')
|
||||||
account = model[iter][C_ACCOUNT].decode('utf-8')
|
account = model[titer][C_ACCOUNT].decode('utf-8')
|
||||||
# account is offline, don't allow to rename
|
# account is offline, don't allow to rename
|
||||||
if gajim.connections[account].connected < 2:
|
if gajim.connections[account].connected < 2:
|
||||||
return
|
return
|
||||||
|
@ -2606,7 +2606,7 @@ class RosterWindow:
|
||||||
elif row_type == 'group':
|
elif row_type == 'group':
|
||||||
if jid in helpers.special_groups + (_('General'),):
|
if jid in helpers.special_groups + (_('General'),):
|
||||||
return
|
return
|
||||||
old_text = model[iter][C_JID].decode('utf-8')
|
old_text = model[titer][C_JID].decode('utf-8')
|
||||||
title = _('Rename Group')
|
title = _('Rename Group')
|
||||||
message = _('Enter a new name for group %s') % old_text
|
message = _('Enter a new name for group %s') % old_text
|
||||||
|
|
||||||
|
@ -2914,8 +2914,8 @@ class RosterWindow:
|
||||||
path = list_of_paths[0]
|
path = list_of_paths[0]
|
||||||
type_ = model[path][C_TYPE]
|
type_ = model[path][C_TYPE]
|
||||||
if type_ in ('contact', 'group', 'agent'):
|
if type_ in ('contact', 'group', 'agent'):
|
||||||
iter = model.get_iter(path)
|
titer = model.get_iter(path)
|
||||||
self.on_rename(widget, iter, path)
|
self.on_rename(widget, titer, path)
|
||||||
|
|
||||||
elif event.keyval == gtk.keysyms.Delete:
|
elif event.keyval == gtk.keysyms.Delete:
|
||||||
treeselection = self.tree.get_selection()
|
treeselection = self.tree.get_selection()
|
||||||
|
@ -3020,16 +3020,16 @@ class RosterWindow:
|
||||||
if gajim.single_click and not event.state & gtk.gdk.SHIFT_MASK and \
|
if gajim.single_click and not event.state & gtk.gdk.SHIFT_MASK and \
|
||||||
not event.state & gtk.gdk.CONTROL_MASK:
|
not event.state & gtk.gdk.CONTROL_MASK:
|
||||||
# Don't handle dubble click if we press icon of a metacontact
|
# Don't handle dubble click if we press icon of a metacontact
|
||||||
iter = model.get_iter(path)
|
titer = model.get_iter(path)
|
||||||
if x > x_min and x < x_min + 27 and type_ == 'contact' and \
|
if x > x_min and x < x_min + 27 and type_ == 'contact' and \
|
||||||
model.iter_has_child(iter):
|
model.iter_has_child(titer):
|
||||||
# FIXME: Expand all meta contacts or only the current one?
|
# FIXME: Expand all meta contacts or only the current one?
|
||||||
#account = model[path][C_ACCOUNT].decode('utf-8')
|
#account = model[path][C_ACCOUNT].decode('utf-8')
|
||||||
#jid = model[path][C_JID].decode('utf-8')
|
#jid = model[path][C_JID].decode('utf-8')
|
||||||
# first cell in 1st column (the arrow SINGLE clicked)
|
# first cell in 1st column (the arrow SINGLE clicked)
|
||||||
#iters = self._get_contact_iter(jid, account)
|
#iters = self._get_contact_iter(jid, account)
|
||||||
#for iter in iters:
|
#for titer in iters:
|
||||||
# path = model.get_path(iter)
|
# path = model.get_path(titer)
|
||||||
if (self.tree.row_expanded(path)):
|
if (self.tree.row_expanded(path)):
|
||||||
self.tree.collapse_row(path)
|
self.tree.collapse_row(path)
|
||||||
else:
|
else:
|
||||||
|
@ -3053,8 +3053,8 @@ class RosterWindow:
|
||||||
#jid = model[path][C_JID].decode('utf-8')
|
#jid = model[path][C_JID].decode('utf-8')
|
||||||
# first cell in 1st column (the arrow SINGLE clicked)
|
# first cell in 1st column (the arrow SINGLE clicked)
|
||||||
#iters = self._get_contact_iter(jid, account)
|
#iters = self._get_contact_iter(jid, account)
|
||||||
#for iter in iters:
|
#for titer in iters:
|
||||||
# path = model.get_path(iter)
|
# path = model.get_path(titer)
|
||||||
if (self.tree.row_expanded(path)):
|
if (self.tree.row_expanded(path)):
|
||||||
self.tree.collapse_row(path)
|
self.tree.collapse_row(path)
|
||||||
else:
|
else:
|
||||||
|
@ -3359,7 +3359,7 @@ class RosterWindow:
|
||||||
jid = model[path][C_JID].decode('utf-8')
|
jid = model[path][C_JID].decode('utf-8')
|
||||||
resource = None
|
resource = None
|
||||||
contact = None
|
contact = None
|
||||||
iter = model.get_iter(path)
|
titer = model.get_iter(path)
|
||||||
if type_ in ('group', 'account'):
|
if type_ in ('group', 'account'):
|
||||||
if self.tree.row_expanded(path):
|
if self.tree.row_expanded(path):
|
||||||
self.tree.collapse_row(path)
|
self.tree.collapse_row(path)
|
||||||
|
@ -3377,8 +3377,8 @@ class RosterWindow:
|
||||||
if first_ev:
|
if first_ev:
|
||||||
resource = c.resource
|
resource = c.resource
|
||||||
break
|
break
|
||||||
if not first_ev and model.iter_has_child(iter):
|
if not first_ev and model.iter_has_child(titer):
|
||||||
child_iter = model.iter_children(iter)
|
child_iter = model.iter_children(titer)
|
||||||
while not first_ev and child_iter:
|
while not first_ev and child_iter:
|
||||||
child_jid = model[child_iter][C_JID].decode('utf-8')
|
child_jid = model[child_iter][C_JID].decode('utf-8')
|
||||||
first_ev = gajim.events.get_first_event(account, child_jid)
|
first_ev = gajim.events.get_first_event(account, child_jid)
|
||||||
|
@ -3410,23 +3410,23 @@ class RosterWindow:
|
||||||
if not gajim.single_click:
|
if not gajim.single_click:
|
||||||
self.on_row_activated(widget, path)
|
self.on_row_activated(widget, path)
|
||||||
|
|
||||||
def on_roster_treeview_row_expanded(self, widget, iter, path):
|
def on_roster_treeview_row_expanded(self, widget, titer, path):
|
||||||
'''When a row is expanded change the icon of the arrow'''
|
'''When a row is expanded change the icon of the arrow'''
|
||||||
self._toggeling_row = True
|
self._toggeling_row = True
|
||||||
model = widget.get_model()
|
model = widget.get_model()
|
||||||
child_model = model.get_model()
|
child_model = model.get_model()
|
||||||
child_iter = model.convert_iter_to_child_iter(iter)
|
child_iter = model.convert_iter_to_child_iter(titer)
|
||||||
|
|
||||||
if self.regroup: # merged accounts
|
if self.regroup: # merged accounts
|
||||||
accounts = gajim.connections.keys()
|
accounts = gajim.connections.keys()
|
||||||
else:
|
else:
|
||||||
accounts = [model[iter][C_ACCOUNT].decode('utf-8')]
|
accounts = [model[titer][C_ACCOUNT].decode('utf-8')]
|
||||||
|
|
||||||
type_ = model[iter][C_TYPE]
|
type_ = model[titer][C_TYPE]
|
||||||
if type_ == 'group':
|
if type_ == 'group':
|
||||||
child_model[child_iter][C_IMG] = gajim.interface.jabber_state_images[
|
child_model[child_iter][C_IMG] = gajim.interface.jabber_state_images[
|
||||||
'16']['opened']
|
'16']['opened']
|
||||||
group = model[iter][C_JID].decode('utf-8')
|
group = model[titer][C_JID].decode('utf-8')
|
||||||
for account in accounts:
|
for account in accounts:
|
||||||
if group in gajim.groups[account]: # This account has this group
|
if group in gajim.groups[account]: # This account has this group
|
||||||
gajim.groups[account][group]['expand'] = True
|
gajim.groups[account][group]['expand'] = True
|
||||||
|
@ -3440,35 +3440,35 @@ class RosterWindow:
|
||||||
# When we expand, groups are collapsed. Restore expand state
|
# When we expand, groups are collapsed. Restore expand state
|
||||||
for group in gajim.groups[account]:
|
for group in gajim.groups[account]:
|
||||||
if gajim.groups[account][group]['expand']:
|
if gajim.groups[account][group]['expand']:
|
||||||
iter = self._get_group_iter(group, account)
|
titer = self._get_group_iter(group, account)
|
||||||
if iter:
|
if titer:
|
||||||
path = model.get_path(iter)
|
path = model.get_path(titer)
|
||||||
self.tree.expand_row(path, False)
|
self.tree.expand_row(path, False)
|
||||||
elif type_ == 'contact':
|
elif type_ == 'contact':
|
||||||
# Metacontact got toggled, update icon
|
# Metacontact got toggled, update icon
|
||||||
jid = model[iter][C_JID].decode('utf-8')
|
jid = model[titer][C_JID].decode('utf-8')
|
||||||
account = model[iter][C_ACCOUNT].decode('utf-8')
|
account = model[titer][C_ACCOUNT].decode('utf-8')
|
||||||
self.draw_contact(jid, account)
|
self.draw_contact(jid, account)
|
||||||
|
|
||||||
self._toggeling_row = False
|
self._toggeling_row = False
|
||||||
|
|
||||||
def on_roster_treeview_row_collapsed(self, widget, iter, path):
|
def on_roster_treeview_row_collapsed(self, widget, titer, path):
|
||||||
'''When a row is collapsed change the icon of the arrow'''
|
'''When a row is collapsed change the icon of the arrow'''
|
||||||
self._toggeling_row = True
|
self._toggeling_row = True
|
||||||
model = widget.get_model()
|
model = widget.get_model()
|
||||||
child_model = model.get_model()
|
child_model = model.get_model()
|
||||||
child_iter = model.convert_iter_to_child_iter(iter)
|
child_iter = model.convert_iter_to_child_iter(titer)
|
||||||
|
|
||||||
if self.regroup: # merged accounts
|
if self.regroup: # merged accounts
|
||||||
accounts = gajim.connections.keys()
|
accounts = gajim.connections.keys()
|
||||||
else:
|
else:
|
||||||
accounts = [model[iter][C_ACCOUNT].decode('utf-8')]
|
accounts = [model[titer][C_ACCOUNT].decode('utf-8')]
|
||||||
|
|
||||||
type_ = model[iter][C_TYPE]
|
type_ = model[titer][C_TYPE]
|
||||||
if type_ == 'group':
|
if type_ == 'group':
|
||||||
child_model[child_iter][C_IMG] = gajim.interface.jabber_state_images[
|
child_model[child_iter][C_IMG] = gajim.interface.jabber_state_images[
|
||||||
'16']['closed']
|
'16']['closed']
|
||||||
group = model[iter][C_JID].decode('utf-8')
|
group = model[titer][C_JID].decode('utf-8')
|
||||||
for account in accounts:
|
for account in accounts:
|
||||||
if group in gajim.groups[account]: # This account has this group
|
if group in gajim.groups[account]: # This account has this group
|
||||||
gajim.groups[account][group]['expand'] = False
|
gajim.groups[account][group]['expand'] = False
|
||||||
|
@ -3481,13 +3481,13 @@ class RosterWindow:
|
||||||
self.draw_account(account)
|
self.draw_account(account)
|
||||||
elif type_ == 'contact':
|
elif type_ == 'contact':
|
||||||
# Metacontact got toggled, update icon
|
# Metacontact got toggled, update icon
|
||||||
jid = model[iter][C_JID].decode('utf-8')
|
jid = model[titer][C_JID].decode('utf-8')
|
||||||
account = model[iter][C_ACCOUNT].decode('utf-8')
|
account = model[titer][C_ACCOUNT].decode('utf-8')
|
||||||
self.draw_contact(jid, account)
|
self.draw_contact(jid, account)
|
||||||
|
|
||||||
self._toggeling_row = False
|
self._toggeling_row = False
|
||||||
|
|
||||||
def on_model_row_has_child_toggled(self, model, path, iter):
|
def on_model_row_has_child_toggled(self, model, path, titer):
|
||||||
'''Called when a row has gotten the first or lost its last child row.
|
'''Called when a row has gotten the first or lost its last child row.
|
||||||
|
|
||||||
Expand Parent if necessary.
|
Expand Parent if necessary.
|
||||||
|
@ -3496,24 +3496,24 @@ class RosterWindow:
|
||||||
# Signal is emitted when we write to our model
|
# Signal is emitted when we write to our model
|
||||||
return
|
return
|
||||||
|
|
||||||
type_ = model[iter][C_TYPE]
|
type_ = model[titer][C_TYPE]
|
||||||
account = model[iter][C_ACCOUNT]
|
account = model[titer][C_ACCOUNT]
|
||||||
if not account:
|
if not account:
|
||||||
return
|
return
|
||||||
|
|
||||||
account = account.decode('utf-8')
|
account = account.decode('utf-8')
|
||||||
|
|
||||||
if type_ == 'contact':
|
if type_ == 'contact':
|
||||||
child_iter = model.convert_iter_to_child_iter(iter)
|
child_iter = model.convert_iter_to_child_iter(titer)
|
||||||
if self.model.iter_has_child(child_iter):
|
if self.model.iter_has_child(child_iter):
|
||||||
# we are a bigbrother metacontact
|
# we are a bigbrother metacontact
|
||||||
# redraw us to show/hide expand icon
|
# redraw us to show/hide expand icon
|
||||||
if self.filtering:
|
if self.filtering:
|
||||||
# Prevent endless loops
|
# Prevent endless loops
|
||||||
jid = model[iter][C_JID].decode('utf-8')
|
jid = model[titer][C_JID].decode('utf-8')
|
||||||
gobject.idle_add(self.draw_contact, jid, account)
|
gobject.idle_add(self.draw_contact, jid, account)
|
||||||
elif type_ == 'group':
|
elif type_ == 'group':
|
||||||
group = model[iter][C_JID].decode('utf-8')
|
group = model[titer][C_JID].decode('utf-8')
|
||||||
self._adjust_group_expand_collapse_state(group, account)
|
self._adjust_group_expand_collapse_state(group, account)
|
||||||
elif type_ == 'account':
|
elif type_ == 'account':
|
||||||
if not self.filtering:
|
if not self.filtering:
|
||||||
|
@ -3954,13 +3954,13 @@ class RosterWindow:
|
||||||
self.draw_roster()
|
self.draw_roster()
|
||||||
# Update the status combobox
|
# Update the status combobox
|
||||||
model = self.status_combobox.get_model()
|
model = self.status_combobox.get_model()
|
||||||
iter = model.get_iter_root()
|
titer = model.get_iter_root()
|
||||||
while iter:
|
while titer:
|
||||||
if model[iter][2] != '':
|
if model[titer][2] != '':
|
||||||
# If it's not change status message iter
|
# If it's not change status message iter
|
||||||
# eg. if it has show parameter not ''
|
# eg. if it has show parameter not ''
|
||||||
model[iter][1] = gajim.interface.jabber_state_images['16'][model[iter][2]]
|
model[titer][1] = gajim.interface.jabber_state_images['16'][model[titer][2]]
|
||||||
iter = model.iter_next(iter)
|
titer = model.iter_next(titer)
|
||||||
# Update the systray
|
# Update the systray
|
||||||
if gajim.interface.systray_enabled:
|
if gajim.interface.systray_enabled:
|
||||||
gajim.interface.systray.set_img()
|
gajim.interface.systray.set_img()
|
||||||
|
@ -4019,10 +4019,10 @@ class RosterWindow:
|
||||||
|
|
||||||
gtkgui_helpers.set_unset_urgency_hint(self.window, nb_unread)
|
gtkgui_helpers.set_unset_urgency_hint(self.window, nb_unread)
|
||||||
|
|
||||||
def _change_style(self, model, path, iter, option):
|
def _change_style(self, model, path, titer, option):
|
||||||
if option is None or model[iter][C_TYPE] == option:
|
if option is None or model[titer][C_TYPE] == option:
|
||||||
# We changed style for this type of row
|
# We changed style for this type of row
|
||||||
model[iter][C_NAME] = model[iter][C_NAME]
|
model[titer][C_NAME] = model[titer][C_NAME]
|
||||||
|
|
||||||
def change_roster_style(self, option):
|
def change_roster_style(self, option):
|
||||||
model = self.modelfilter
|
model = self.modelfilter
|
||||||
|
@ -4066,10 +4066,10 @@ class RosterWindow:
|
||||||
fgcolor = self.tree.style.fg[style]
|
fgcolor = self.tree.style.fg[style]
|
||||||
renderer.set_property('foreground-gdk', fgcolor)
|
renderer.set_property('foreground-gdk', fgcolor)
|
||||||
|
|
||||||
def _iconCellDataFunc(self, column, renderer, model, iter, data = None):
|
def _iconCellDataFunc(self, column, renderer, model, titer, data = None):
|
||||||
'''When a row is added, set properties for icon renderer'''
|
'''When a row is added, set properties for icon renderer'''
|
||||||
theme = gajim.config.get('roster_theme')
|
theme = gajim.config.get('roster_theme')
|
||||||
type_ = model[iter][C_TYPE]
|
type_ = model[titer][C_TYPE]
|
||||||
if type_ == 'account':
|
if type_ == 'account':
|
||||||
color = gajim.config.get_per('themes', theme, 'accountbgcolor')
|
color = gajim.config.get_per('themes', theme, 'accountbgcolor')
|
||||||
if color:
|
if color:
|
||||||
|
@ -4085,11 +4085,11 @@ class RosterWindow:
|
||||||
self.set_renderer_color(renderer, gtk.STATE_PRELIGHT)
|
self.set_renderer_color(renderer, gtk.STATE_PRELIGHT)
|
||||||
renderer.set_property('xalign', 0.2)
|
renderer.set_property('xalign', 0.2)
|
||||||
elif type_: # prevent type_ = None, see http://trac.gajim.org/ticket/2534
|
elif type_: # prevent type_ = None, see http://trac.gajim.org/ticket/2534
|
||||||
if not model[iter][C_JID] or not model[iter][C_ACCOUNT]:
|
if not model[titer][C_JID] or not model[titer][C_ACCOUNT]:
|
||||||
# This can append when at the moment we add the row
|
# This can append when at the moment we add the row
|
||||||
return
|
return
|
||||||
jid = model[iter][C_JID].decode('utf-8')
|
jid = model[titer][C_JID].decode('utf-8')
|
||||||
account = model[iter][C_ACCOUNT].decode('utf-8')
|
account = model[titer][C_ACCOUNT].decode('utf-8')
|
||||||
if jid in gajim.newly_added[account]:
|
if jid in gajim.newly_added[account]:
|
||||||
renderer.set_property('cell-background', gajim.config.get(
|
renderer.set_property('cell-background', gajim.config.get(
|
||||||
'just_connected_bg_color'))
|
'just_connected_bg_color'))
|
||||||
|
@ -4102,17 +4102,17 @@ class RosterWindow:
|
||||||
renderer.set_property('cell-background', color)
|
renderer.set_property('cell-background', color)
|
||||||
else:
|
else:
|
||||||
renderer.set_property('cell-background', None)
|
renderer.set_property('cell-background', None)
|
||||||
parent_iter = model.iter_parent(iter)
|
parent_iter = model.iter_parent(titer)
|
||||||
if model[parent_iter][C_TYPE] == 'contact':
|
if model[parent_iter][C_TYPE] == 'contact':
|
||||||
renderer.set_property('xalign', 1)
|
renderer.set_property('xalign', 1)
|
||||||
else:
|
else:
|
||||||
renderer.set_property('xalign', 0.4)
|
renderer.set_property('xalign', 0.4)
|
||||||
renderer.set_property('width', 26)
|
renderer.set_property('width', 26)
|
||||||
|
|
||||||
def _nameCellDataFunc(self, column, renderer, model, iter, data = None):
|
def _nameCellDataFunc(self, column, renderer, model, titer, data = None):
|
||||||
'''When a row is added, set properties for name renderer'''
|
'''When a row is added, set properties for name renderer'''
|
||||||
theme = gajim.config.get('roster_theme')
|
theme = gajim.config.get('roster_theme')
|
||||||
type_ = model[iter][C_TYPE]
|
type_ = model[titer][C_TYPE]
|
||||||
if type_ == 'account':
|
if type_ == 'account':
|
||||||
color = gajim.config.get_per('themes', theme, 'accounttextcolor')
|
color = gajim.config.get_per('themes', theme, 'accounttextcolor')
|
||||||
if color:
|
if color:
|
||||||
|
@ -4143,11 +4143,11 @@ class RosterWindow:
|
||||||
gtkgui_helpers.get_theme_font_for_option(theme, 'groupfont'))
|
gtkgui_helpers.get_theme_font_for_option(theme, 'groupfont'))
|
||||||
renderer.set_property('xpad', 4)
|
renderer.set_property('xpad', 4)
|
||||||
elif type_: # prevent type_ = None, see http://trac.gajim.org/ticket/2534
|
elif type_: # prevent type_ = None, see http://trac.gajim.org/ticket/2534
|
||||||
if not model[iter][C_JID] or not model[iter][C_ACCOUNT]:
|
if not model[titer][C_JID] or not model[titer][C_ACCOUNT]:
|
||||||
# This can append when at the moment we add the row
|
# This can append when at the moment we add the row
|
||||||
return
|
return
|
||||||
jid = model[iter][C_JID].decode('utf-8')
|
jid = model[titer][C_JID].decode('utf-8')
|
||||||
account = model[iter][C_ACCOUNT].decode('utf-8')
|
account = model[titer][C_ACCOUNT].decode('utf-8')
|
||||||
color = gajim.config.get_per('themes', theme, 'contacttextcolor')
|
color = gajim.config.get_per('themes', theme, 'contacttextcolor')
|
||||||
if color:
|
if color:
|
||||||
renderer.set_property('foreground', color)
|
renderer.set_property('foreground', color)
|
||||||
|
@ -4167,33 +4167,33 @@ class RosterWindow:
|
||||||
renderer.set_property('cell-background', None)
|
renderer.set_property('cell-background', None)
|
||||||
renderer.set_property('font',
|
renderer.set_property('font',
|
||||||
gtkgui_helpers.get_theme_font_for_option(theme, 'contactfont'))
|
gtkgui_helpers.get_theme_font_for_option(theme, 'contactfont'))
|
||||||
parent_iter = model.iter_parent(iter)
|
parent_iter = model.iter_parent(titer)
|
||||||
if model[parent_iter][C_TYPE] == 'contact':
|
if model[parent_iter][C_TYPE] == 'contact':
|
||||||
renderer.set_property('xpad', 16)
|
renderer.set_property('xpad', 16)
|
||||||
else:
|
else:
|
||||||
renderer.set_property('xpad', 8)
|
renderer.set_property('xpad', 8)
|
||||||
|
|
||||||
def _fill_avatar_pixbuf_rederer(self, column, renderer, model, iter,
|
def _fill_avatar_pixbuf_rederer(self, column, renderer, model, titer,
|
||||||
data = None):
|
data = None):
|
||||||
'''When a row is added, set properties for avatar renderer'''
|
'''When a row is added, set properties for avatar renderer'''
|
||||||
theme = gajim.config.get('roster_theme')
|
theme = gajim.config.get('roster_theme')
|
||||||
type_ = model[iter][C_TYPE]
|
type_ = model[titer][C_TYPE]
|
||||||
if type_ in ('group', 'account'):
|
if type_ in ('group', 'account'):
|
||||||
renderer.set_property('visible', False)
|
renderer.set_property('visible', False)
|
||||||
return
|
return
|
||||||
|
|
||||||
# allocate space for the icon only if needed
|
# allocate space for the icon only if needed
|
||||||
if model[iter][C_AVATAR_PIXBUF] or \
|
if model[titer][C_AVATAR_PIXBUF] or \
|
||||||
gajim.config.get('avatar_position_in_roster') == 'left':
|
gajim.config.get('avatar_position_in_roster') == 'left':
|
||||||
renderer.set_property('visible', True)
|
renderer.set_property('visible', True)
|
||||||
else:
|
else:
|
||||||
renderer.set_property('visible', False)
|
renderer.set_property('visible', False)
|
||||||
if type_: # prevent type_ = None, see http://trac.gajim.org/ticket/2534
|
if type_: # prevent type_ = None, see http://trac.gajim.org/ticket/2534
|
||||||
if not model[iter][C_JID] or not model[iter][C_ACCOUNT]:
|
if not model[titer][C_JID] or not model[titer][C_ACCOUNT]:
|
||||||
# This can append at the moment we add the row
|
# This can append at the moment we add the row
|
||||||
return
|
return
|
||||||
jid = model[iter][C_JID].decode('utf-8')
|
jid = model[titer][C_JID].decode('utf-8')
|
||||||
account = model[iter][C_ACCOUNT].decode('utf-8')
|
account = model[titer][C_ACCOUNT].decode('utf-8')
|
||||||
if jid in gajim.newly_added[account]:
|
if jid in gajim.newly_added[account]:
|
||||||
renderer.set_property('cell-background', gajim.config.get(
|
renderer.set_property('cell-background', gajim.config.get(
|
||||||
'just_connected_bg_color'))
|
'just_connected_bg_color'))
|
||||||
|
@ -4212,13 +4212,13 @@ class RosterWindow:
|
||||||
else:
|
else:
|
||||||
renderer.set_property('xalign', 1) # align pixbuf to the right
|
renderer.set_property('xalign', 1) # align pixbuf to the right
|
||||||
|
|
||||||
def _fill_padlock_pixbuf_rederer(self, column, renderer, model, iter,
|
def _fill_padlock_pixbuf_rederer(self, column, renderer, model, titer,
|
||||||
data = None):
|
data = None):
|
||||||
'''When a row is added, set properties for padlock renderer'''
|
'''When a row is added, set properties for padlock renderer'''
|
||||||
theme = gajim.config.get('roster_theme')
|
theme = gajim.config.get('roster_theme')
|
||||||
type_ = model[iter][C_TYPE]
|
type_ = model[titer][C_TYPE]
|
||||||
# allocate space for the icon only if needed
|
# allocate space for the icon only if needed
|
||||||
if type_ == 'account' and model[iter][C_PADLOCK_PIXBUF]:
|
if type_ == 'account' and model[titer][C_PADLOCK_PIXBUF]:
|
||||||
renderer.set_property('visible', True)
|
renderer.set_property('visible', True)
|
||||||
color = gajim.config.get_per('themes', theme, 'accountbgcolor')
|
color = gajim.config.get_per('themes', theme, 'accountbgcolor')
|
||||||
if color:
|
if color:
|
||||||
|
@ -4684,10 +4684,10 @@ class RosterWindow:
|
||||||
|
|
||||||
return account_context_menu
|
return account_context_menu
|
||||||
|
|
||||||
def make_account_menu(self, event, iter):
|
def make_account_menu(self, event, titer):
|
||||||
'''Make account's popup menu'''
|
'''Make account's popup menu'''
|
||||||
model = self.modelfilter
|
model = self.modelfilter
|
||||||
account = model[iter][C_ACCOUNT].decode('utf-8')
|
account = model[titer][C_ACCOUNT].decode('utf-8')
|
||||||
|
|
||||||
if account != 'all': # not in merged mode
|
if account != 'all': # not in merged mode
|
||||||
menu = self.build_account_menu(account)
|
menu = self.build_account_menu(account)
|
||||||
|
@ -4716,17 +4716,17 @@ class RosterWindow:
|
||||||
menu.show_all()
|
menu.show_all()
|
||||||
menu.popup(None, None, None, event_button, event.time)
|
menu.popup(None, None, None, event_button, event.time)
|
||||||
|
|
||||||
def make_group_menu(self, event, iter):
|
def make_group_menu(self, event, titer):
|
||||||
'''Make group's popup menu'''
|
'''Make group's popup menu'''
|
||||||
model = self.modelfilter
|
model = self.modelfilter
|
||||||
path = model.get_path(iter)
|
path = model.get_path(titer)
|
||||||
group = model[iter][C_JID].decode('utf-8')
|
group = model[titer][C_JID].decode('utf-8')
|
||||||
account = model[iter][C_ACCOUNT].decode('utf-8')
|
account = model[titer][C_ACCOUNT].decode('utf-8')
|
||||||
|
|
||||||
list_ = [] # list of (jid, account) tuples
|
list_ = [] # list of (jid, account) tuples
|
||||||
list_online = [] # list of (jid, account) tuples
|
list_online = [] # list of (jid, account) tuples
|
||||||
|
|
||||||
group = model[iter][C_JID]
|
group = model[titer][C_JID]
|
||||||
for jid in gajim.contacts.get_jid_list(account):
|
for jid in gajim.contacts.get_jid_list(account):
|
||||||
contact = gajim.contacts.get_contact_with_highest_priority(account,
|
contact = gajim.contacts.get_contact_with_highest_priority(account,
|
||||||
jid)
|
jid)
|
||||||
|
@ -4818,7 +4818,7 @@ class RosterWindow:
|
||||||
img.set_from_file(path_to_kbd_input_img)
|
img.set_from_file(path_to_kbd_input_img)
|
||||||
rename_item.set_image(img)
|
rename_item.set_image(img)
|
||||||
menu.append(rename_item)
|
menu.append(rename_item)
|
||||||
rename_item.connect('activate', self.on_rename, iter, path)
|
rename_item.connect('activate', self.on_rename, titer, path)
|
||||||
|
|
||||||
# Block group
|
# Block group
|
||||||
is_blocked = False
|
is_blocked = False
|
||||||
|
@ -4834,13 +4834,13 @@ class RosterWindow:
|
||||||
unblock_menuitem = gtk.ImageMenuItem(_('_Unblock'))
|
unblock_menuitem = gtk.ImageMenuItem(_('_Unblock'))
|
||||||
icon = gtk.image_new_from_stock(gtk.STOCK_STOP, gtk.ICON_SIZE_MENU)
|
icon = gtk.image_new_from_stock(gtk.STOCK_STOP, gtk.ICON_SIZE_MENU)
|
||||||
unblock_menuitem.set_image(icon)
|
unblock_menuitem.set_image(icon)
|
||||||
unblock_menuitem.connect('activate', self.on_unblock, iter, list_)
|
unblock_menuitem.connect('activate', self.on_unblock, titer, list_)
|
||||||
menu.append(unblock_menuitem)
|
menu.append(unblock_menuitem)
|
||||||
else:
|
else:
|
||||||
block_menuitem = gtk.ImageMenuItem(_('_Block'))
|
block_menuitem = gtk.ImageMenuItem(_('_Block'))
|
||||||
icon = gtk.image_new_from_stock(gtk.STOCK_STOP, gtk.ICON_SIZE_MENU)
|
icon = gtk.image_new_from_stock(gtk.STOCK_STOP, gtk.ICON_SIZE_MENU)
|
||||||
block_menuitem.set_image(icon)
|
block_menuitem.set_image(icon)
|
||||||
block_menuitem.connect('activate', self.on_block, iter, list_)
|
block_menuitem.connect('activate', self.on_block, titer, list_)
|
||||||
menu.append(block_menuitem)
|
menu.append(block_menuitem)
|
||||||
if not gajim.connections[account].privacy_rules_supported:
|
if not gajim.connections[account].privacy_rules_supported:
|
||||||
block_menuitem.set_sensitive(False)
|
block_menuitem.set_sensitive(False)
|
||||||
|
@ -4870,12 +4870,12 @@ class RosterWindow:
|
||||||
menu.show_all()
|
menu.show_all()
|
||||||
menu.popup(None, None, None, event_button, event.time)
|
menu.popup(None, None, None, event_button, event.time)
|
||||||
|
|
||||||
def make_contact_menu(self, event, iter):
|
def make_contact_menu(self, event, titer):
|
||||||
'''Make contact\'s popup menu'''
|
'''Make contact\'s popup menu'''
|
||||||
model = self.modelfilter
|
model = self.modelfilter
|
||||||
jid = model[iter][C_JID].decode('utf-8')
|
jid = model[titer][C_JID].decode('utf-8')
|
||||||
tree_path = model.get_path(iter)
|
tree_path = model.get_path(titer)
|
||||||
account = model[iter][C_ACCOUNT].decode('utf-8')
|
account = model[titer][C_ACCOUNT].decode('utf-8')
|
||||||
our_jid = jid == gajim.get_jid_from_account(account)
|
our_jid = jid == gajim.get_jid_from_account(account)
|
||||||
contact = gajim.contacts.get_contact_with_highest_priority(account, jid)
|
contact = gajim.contacts.get_contact_with_highest_priority(account, jid)
|
||||||
if not contact:
|
if not contact:
|
||||||
|
@ -4939,7 +4939,7 @@ class RosterWindow:
|
||||||
else: # if we do no have resource we cannot do much
|
else: # if we do no have resource we cannot do much
|
||||||
send_file_menuitem.set_sensitive(False)
|
send_file_menuitem.set_sensitive(False)
|
||||||
|
|
||||||
rename_menuitem.connect('activate', self.on_rename, iter, tree_path)
|
rename_menuitem.connect('activate', self.on_rename, titer, tree_path)
|
||||||
if contact.show in ('offline', 'error'):
|
if contact.show in ('offline', 'error'):
|
||||||
information_menuitem.set_sensitive(False)
|
information_menuitem.set_sensitive(False)
|
||||||
send_file_menuitem.set_sensitive(False)
|
send_file_menuitem.set_sensitive(False)
|
||||||
|
@ -5111,7 +5111,7 @@ class RosterWindow:
|
||||||
send_single_message_menuitem.connect('activate',
|
send_single_message_menuitem.connect('activate',
|
||||||
self.on_send_single_message_menuitem_activate, account, contact)
|
self.on_send_single_message_menuitem_activate, account, contact)
|
||||||
|
|
||||||
rename_menuitem.connect('activate', self.on_rename, iter, tree_path)
|
rename_menuitem.connect('activate', self.on_rename, titer, tree_path)
|
||||||
remove_from_roster_menuitem.connect('activate', self.on_req_usub,
|
remove_from_roster_menuitem.connect('activate', self.on_req_usub,
|
||||||
[(contact, account)])
|
[(contact, account)])
|
||||||
information_menuitem.connect('activate', self.on_info, contact,
|
information_menuitem.connect('activate', self.on_info, contact,
|
||||||
|
@ -5179,11 +5179,11 @@ class RosterWindow:
|
||||||
privacy_rules_supported:
|
privacy_rules_supported:
|
||||||
if jid in gajim.connections[account].blocked_contacts:
|
if jid in gajim.connections[account].blocked_contacts:
|
||||||
block_menuitem.set_no_show_all(True)
|
block_menuitem.set_no_show_all(True)
|
||||||
unblock_menuitem.connect('activate', self.on_unblock, iter, None)
|
unblock_menuitem.connect('activate', self.on_unblock, titer, None)
|
||||||
block_menuitem.hide()
|
block_menuitem.hide()
|
||||||
else:
|
else:
|
||||||
unblock_menuitem.set_no_show_all(True)
|
unblock_menuitem.set_no_show_all(True)
|
||||||
block_menuitem.connect('activate', self.on_block, iter, None)
|
block_menuitem.connect('activate', self.on_block, titer, None)
|
||||||
unblock_menuitem.hide()
|
unblock_menuitem.hide()
|
||||||
else:
|
else:
|
||||||
unblock_menuitem.set_no_show_all(True)
|
unblock_menuitem.set_no_show_all(True)
|
||||||
|
@ -5205,9 +5205,9 @@ class RosterWindow:
|
||||||
list_ = [] # list of (jid, account) tuples
|
list_ = [] # list of (jid, account) tuples
|
||||||
one_account_offline = False
|
one_account_offline = False
|
||||||
is_blocked = True
|
is_blocked = True
|
||||||
for iter in iters:
|
for titer in iters:
|
||||||
jid = model[iter][C_JID].decode('utf-8')
|
jid = model[titer][C_JID].decode('utf-8')
|
||||||
account = model[iter][C_ACCOUNT].decode('utf-8')
|
account = model[titer][C_ACCOUNT].decode('utf-8')
|
||||||
if gajim.connections[account].connected < 2:
|
if gajim.connections[account].connected < 2:
|
||||||
one_account_offline = True
|
one_account_offline = True
|
||||||
contact = gajim.contacts.get_contact_with_highest_priority(account,
|
contact = gajim.contacts.get_contact_with_highest_priority(account,
|
||||||
|
@ -5296,12 +5296,12 @@ class RosterWindow:
|
||||||
menu.show_all()
|
menu.show_all()
|
||||||
menu.popup(None, None, None, event_button, event.time)
|
menu.popup(None, None, None, event_button, event.time)
|
||||||
|
|
||||||
def make_transport_menu(self, event, iter):
|
def make_transport_menu(self, event, titer):
|
||||||
'''Make transport\'s popup menu'''
|
'''Make transport\'s popup menu'''
|
||||||
model = self.modelfilter
|
model = self.modelfilter
|
||||||
jid = model[iter][C_JID].decode('utf-8')
|
jid = model[titer][C_JID].decode('utf-8')
|
||||||
path = model.get_path(iter)
|
path = model.get_path(titer)
|
||||||
account = model[iter][C_ACCOUNT].decode('utf-8')
|
account = model[titer][C_ACCOUNT].decode('utf-8')
|
||||||
contact = gajim.contacts.get_contact_with_highest_priority(account, jid)
|
contact = gajim.contacts.get_contact_with_highest_priority(account, jid)
|
||||||
menu = gtk.Menu()
|
menu = gtk.Menu()
|
||||||
|
|
||||||
|
@ -5386,7 +5386,7 @@ class RosterWindow:
|
||||||
img.set_from_file(path_to_kbd_input_img)
|
img.set_from_file(path_to_kbd_input_img)
|
||||||
item.set_image(img)
|
item.set_image(img)
|
||||||
manage_transport_submenu.append(item)
|
manage_transport_submenu.append(item)
|
||||||
item.connect('activate', self.on_rename, iter, path)
|
item.connect('activate', self.on_rename, titer, path)
|
||||||
if gajim.account_is_disconnected(account):
|
if gajim.account_is_disconnected(account):
|
||||||
item.set_sensitive(False)
|
item.set_sensitive(False)
|
||||||
|
|
||||||
|
@ -5396,10 +5396,10 @@ class RosterWindow:
|
||||||
# Block
|
# Block
|
||||||
if blocked:
|
if blocked:
|
||||||
item = gtk.ImageMenuItem(_('_Unblock'))
|
item = gtk.ImageMenuItem(_('_Unblock'))
|
||||||
item.connect('activate', self.on_unblock, iter, None)
|
item.connect('activate', self.on_unblock, titer, None)
|
||||||
else:
|
else:
|
||||||
item = gtk.ImageMenuItem(_('_Block'))
|
item = gtk.ImageMenuItem(_('_Block'))
|
||||||
item.connect('activate', self.on_block, iter, None)
|
item.connect('activate', self.on_block, titer, None)
|
||||||
|
|
||||||
icon = gtk.image_new_from_stock(gtk.STOCK_STOP, gtk.ICON_SIZE_MENU)
|
icon = gtk.image_new_from_stock(gtk.STOCK_STOP, gtk.ICON_SIZE_MENU)
|
||||||
item.set_image(icon)
|
item.set_image(icon)
|
||||||
|
@ -5434,12 +5434,12 @@ class RosterWindow:
|
||||||
menu.show_all()
|
menu.show_all()
|
||||||
menu.popup(None, None, None, event_button, event.time)
|
menu.popup(None, None, None, event_button, event.time)
|
||||||
|
|
||||||
def make_groupchat_menu(self, event, iter):
|
def make_groupchat_menu(self, event, titer):
|
||||||
model = self.modelfilter
|
model = self.modelfilter
|
||||||
|
|
||||||
path = model.get_path(iter)
|
path = model.get_path(titer)
|
||||||
jid = model[iter][C_JID].decode('utf-8')
|
jid = model[titer][C_JID].decode('utf-8')
|
||||||
account = model[iter][C_ACCOUNT].decode('utf-8')
|
account = model[titer][C_ACCOUNT].decode('utf-8')
|
||||||
contact = gajim.contacts.get_contact_with_highest_priority(account, jid)
|
contact = gajim.contacts.get_contact_with_highest_priority(account, jid)
|
||||||
menu = gtk.Menu()
|
menu = gtk.Menu()
|
||||||
|
|
||||||
|
@ -5666,8 +5666,8 @@ class RosterWindow:
|
||||||
# iters must be all of the same type
|
# iters must be all of the same type
|
||||||
model = self.modelfilter
|
model = self.modelfilter
|
||||||
type_ = model[iters[0]][C_TYPE]
|
type_ = model[iters[0]][C_TYPE]
|
||||||
for iter in iters[1:]:
|
for titer in iters[1:]:
|
||||||
if model[iter][C_TYPE] != type_:
|
if model[titer][C_TYPE] != type_:
|
||||||
return
|
return
|
||||||
if type_ == 'group' and len(iters) == 1:
|
if type_ == 'group' and len(iters) == 1:
|
||||||
self.make_group_menu(event, iters[0])
|
self.make_group_menu(event, iters[0])
|
||||||
|
|
Loading…
Reference in New Issue