From babd1ee042e82a72aeac582ca93bfdbe7e3a6f2e Mon Sep 17 00:00:00 2001 From: Stephan Erb Date: Mon, 11 Jun 2007 08:37:46 +0000 Subject: [PATCH] Enable ellipsization in roster and chatwindow. Fixes #2079, #2739 Reorder occupantlist in groupchat to match roster. Fixes #2102 --- data/glade/message_window.glade | 2 +- src/config.py | 9 ++++++++- src/groupchat_control.py | 18 +++++++++++------- src/roster_window.py | 4 ++++ 4 files changed, 24 insertions(+), 9 deletions(-) diff --git a/data/glade/message_window.glade b/data/glade/message_window.glade index ad23fad7b..77d9028b1 100644 --- a/data/glade/message_window.glade +++ b/data/glade/message_window.glade @@ -591,7 +591,7 @@ Status message 0.5 0 0 - PANGO_ELLIPSIZE_NONE + PANGO_ELLIPSIZE_END -1 False 0 diff --git a/src/config.py b/src/config.py index 294885e92..9acba1a85 100644 --- a/src/config.py +++ b/src/config.py @@ -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() diff --git a/src/groupchat_control.py b/src/groupchat_control.py index fc4c55ced..d698706f4 100644 --- a/src/groupchat_control.py +++ b/src/groupchat_control.py @@ -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): diff --git a/src/roster_window.py b/src/roster_window.py index 283513e98..374fb425e 100644 --- a/src/roster_window.py +++ b/src/roster_window.py @@ -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)