Enable ellipsization in roster and chatwindow. Fixes #2079, #2739

Reorder occupantlist in groupchat to match roster. Fixes #2102
This commit is contained in:
Stephan Erb 2007-06-11 08:37:46 +00:00
parent 46a9657b46
commit babd1ee042
4 changed files with 24 additions and 9 deletions

View file

@ -591,7 +591,7 @@ Status message</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
<property name="ellipsize">PANGO_ELLIPSIZE_END</property>
<property name="width_chars">-1</property>
<property name="single_line_mode">False</property>
<property name="angle">0</property>

View file

@ -580,7 +580,14 @@ class PreferencesWindow:
def on_show_avatars_in_roster_checkbutton_toggled(self, widget):
self.on_checkbutton_toggled(widget, 'show_avatars_in_roster')
gajim.interface.roster.draw_roster()
# Redraw connected groupchats (in an ugly way)
for account in gajim.connections:
if gajim.connections[account].connected:
for gc_control in gajim.interface.msg_win_mgr.get_controls(
message_control.TYPE_GC) + \
gajim.interface.minimized_controls[account].values():
gc_control.draw_roster()
def on_emoticons_combobox_changed(self, widget):
active = widget.get_active()
model = widget.get_model()

View file

@ -288,14 +288,8 @@ class GroupchatControl(ChatControlBase):
# first one img, second one text, third is sec pixbuf
column = gtk.TreeViewColumn()
renderer_pixbuf = gtk.CellRendererPixbuf() # avatar image
column.pack_start(renderer_pixbuf, expand = False)
column.add_attribute(renderer_pixbuf, 'pixbuf', C_AVATAR)
column.set_cell_data_func(renderer_pixbuf, tree_cell_data_func,
self.list_treeview)
renderer_pixbuf.set_property('xalign', 1) # align pixbuf to the right
renderer_image = cell_renderer_image.CellRendererImage(0, 0) # status img
renderer_image.set_property('width', 26)
column.pack_start(renderer_image, expand = False)
column.add_attribute(renderer_image, 'image', C_IMG)
column.set_cell_data_func(renderer_image, tree_cell_data_func,
@ -304,9 +298,17 @@ class GroupchatControl(ChatControlBase):
renderer_text = gtk.CellRendererText() # nickname
column.pack_start(renderer_text, expand = True)
column.add_attribute(renderer_text, 'markup', C_TEXT)
renderer_text.set_property("ellipsize", pango.ELLIPSIZE_END)
column.set_cell_data_func(renderer_text, tree_cell_data_func,
self.list_treeview)
renderer_pixbuf = gtk.CellRendererPixbuf() # avatar image
column.pack_start(renderer_pixbuf, expand = False)
column.add_attribute(renderer_pixbuf, 'pixbuf', C_AVATAR)
column.set_cell_data_func(renderer_pixbuf, tree_cell_data_func,
self.list_treeview)
renderer_pixbuf.set_property('xalign', 1) # align pixbuf to the right
self.list_treeview.append_column(column)
# workaround to avoid gtk arrows to be shown
@ -801,6 +803,8 @@ class GroupchatControl(ChatControlBase):
self.add_contact_to_roster(nick, gc_contact.show, gc_contact.role,
gc_contact.affiliation, gc_contact.status,
gc_contact.jid)
# Recalculate column width for ellipsizin
self.list_treeview.columns_autosize()
def on_send_pm(self, widget = None, model = None, iter = None, nick = None,
msg = None):

View file

@ -16,6 +16,7 @@
##
import gtk
import pango
import gobject
import os
import time
@ -1188,6 +1189,8 @@ class RosterWindow:
for acct in gajim.connections:
self.add_account_to_roster(acct)
self.add_account_contacts(acct)
# Recalculate column width for ellipsizing
self.tree.columns_autosize()
def add_account_contacts(self, account):
'''adds contacts of group to roster treeview'''
@ -5045,6 +5048,7 @@ class RosterWindow:
col.set_cell_data_func(render_image, self.iconCellDataFunc, None)
render_text = gtk.CellRendererText() # contact or group or account name
render_text.set_property("ellipsize", pango.ELLIPSIZE_END)
col.pack_start(render_text, expand = True)
col.add_attribute(render_text, 'markup', C_NAME) # where we hold the name
col.set_cell_data_func(render_text, self.nameCellDataFunc, None)