Skip to content
Snippets Groups Projects
Commit 8afb7974 authored by Yann Leboulanger's avatar Yann Leboulanger
Browse files

we must decode ALL string from GTK to prevent TB when there are contacts with non-ascii chars

parent c62bf15c
No related branches found
No related tags found
No related merge requests found
...@@ -2396,7 +2396,7 @@ _('If "%s" accepts this request you will know his or her status.') %jid) ...@@ -2396,7 +2396,7 @@ _('If "%s" accepts this request you will know his or her status.') %jid)
path = model.get_path(iter) path = model.get_path(iter)
data = '' data = ''
if len(path) == 3: if len(path) == 3:
data = model[iter][C_JID] data = model[iter][C_JID].decode('utf-8')
selection.set(selection.target, 8, data) selection.set(selection.target, 8, data)
def drag_data_received_data(self, treeview, context, x, y, selection, info, def drag_data_received_data(self, treeview, context, x, y, selection, info,
...@@ -2404,7 +2404,7 @@ _('If "%s" accepts this request you will know his or her status.') %jid) ...@@ -2404,7 +2404,7 @@ _('If "%s" accepts this request you will know his or her status.') %jid)
model = treeview.get_model() model = treeview.get_model()
if not selection.data: if not selection.data:
return return
data = selection.data.decode('utf-8') data = selection.data
drop_info = treeview.get_dest_row_at_pos(x, y) drop_info = treeview.get_dest_row_at_pos(x, y)
if not drop_info: if not drop_info:
return return
...@@ -2490,7 +2490,8 @@ _('If "%s" accepts this request you will know his or her status.') %jid) ...@@ -2490,7 +2490,8 @@ _('If "%s" accepts this request you will know his or her status.') %jid)
def on_roster_treeview_style_set(self, treeview, style): def on_roster_treeview_style_set(self, treeview, style):
'''When style (theme) changes, redraw all contacts''' '''When style (theme) changes, redraw all contacts'''
for contact in self.iter_contact_rows(): for contact in self.iter_contact_rows():
self.draw_contact(contact[C_JID], contact[C_ACCOUNT]) self.draw_contact(contact[C_JID].decode('utf-8'),
contact[C_ACCOUNT].decode('utf-8'))
def _on_treeview_selection_changed(self, selection): def _on_treeview_selection_changed(self, selection):
model, selected_iter = selection.get_selected() model, selected_iter = selection.get_selected()
...@@ -2502,11 +2503,13 @@ _('If "%s" accepts this request you will know his or her status.') %jid) ...@@ -2502,11 +2503,13 @@ _('If "%s" accepts this request you will know his or her status.') %jid)
self._last_selected_contact = None self._last_selected_contact = None
return return
contact = model[selected_iter] contact = model[selected_iter]
self._last_selected_contact = (contact[C_JID], contact[C_ACCOUNT]) self._last_selected_contact = (contact[C_JID].decode('utf-8'),
contact[C_ACCOUNT].decode('utf-8'))
# FIXME: we first set last selected contact and then test if contact?? # FIXME: we first set last selected contact and then test if contact??
if contact[C_TYPE] != 'contact': if contact[C_TYPE] != 'contact':
return return
self.draw_contact(contact[C_JID], contact[C_ACCOUNT], selected = True) self.draw_contact(contact[C_JID].decode('utf-8'),
contact[C_ACCOUNT].decode('utf-8'), selected = True)
def __init__(self): def __init__(self):
self.xml = gtk.glade.XML(GTKGUI_GLADE, 'roster_window', APP) self.xml = gtk.glade.XML(GTKGUI_GLADE, 'roster_window', APP)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment