use ellipse if pygtk26, gtk26 or else ... trick for status message in tc

This commit is contained in:
Nikos Kouremenos 2005-07-21 23:19:33 +00:00
parent ad638f9bb9
commit 44f5dccb1e
3 changed files with 39 additions and 7 deletions

View File

@ -15301,7 +15301,7 @@ the Jabber network.</property>
<signal name="activate" handler="on_history_button_clicked" last_modification_time="Thu, 30 Jun 2005 10:23:04 GMT"/> <signal name="activate" handler="on_history_button_clicked" last_modification_time="Thu, 30 Jun 2005 10:23:04 GMT"/>
<child internal-child="image"> <child internal-child="image">
<widget class="GtkImage" id="image731"> <widget class="GtkImage" id="image940">
<property name="visible">True</property> <property name="visible">True</property>
<property name="stock">gtk-justify-fill</property> <property name="stock">gtk-justify-fill</property>
<property name="icon_size">1</property> <property name="icon_size">1</property>
@ -15342,6 +15342,33 @@ the Jabber network.</property>
<signal name="activate" handler="on_compact_view_menuitem_activate" last_modification_time="Thu, 30 Jun 2005 13:07:17 GMT"/> <signal name="activate" handler="on_compact_view_menuitem_activate" last_modification_time="Thu, 30 Jun 2005 13:07:17 GMT"/>
</widget> </widget>
</child> </child>
<child>
<widget class="GtkSeparatorMenuItem" id="separator10">
<property name="visible">True</property>
</widget>
</child>
<child>
<widget class="GtkImageMenuItem" id="add_to_roster_menuitem">
<property name="visible">True</property>
<property name="label" translatable="yes">_Add to Roster</property>
<property name="use_underline">True</property>
<signal name="activate" handler="on_add_to_roster_menuitem_activate" last_modification_time="Thu, 21 Jul 2005 22:46:10 GMT"/>
<child internal-child="image">
<widget class="GtkImage" id="image941">
<property name="visible">True</property>
<property name="stock">gtk-add</property>
<property name="icon_size">1</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
</child>
</widget>
</child>
</widget> </widget>
<widget class="GtkMenu" id="roster_contact_context_menu"> <widget class="GtkMenu" id="roster_contact_context_menu">

View File

@ -39,4 +39,5 @@ def get_contact_name_from_jid(account, jid):
def escape_for_pango_markup(string): def escape_for_pango_markup(string):
# escapes chars for pango markup not to break # escapes chars for pango markup not to break
return cgi.escape(string) if string is not None:
return cgi.escape(string)

View File

@ -121,15 +121,20 @@ class TabbedChatWindow(chat.Chat):
houses the status icon, name, jid, and avatar''' houses the status icon, name, jid, and avatar'''
# this is the text for the big brown bar # this is the text for the big brown bar
# some chars need to be escaped.. # some chars need to be escaped..
jid = contact.jid
banner_name_label = self.xmls[jid].get_widget('banner_name_label')
name = gtkgui_helpers.escape_for_pango_markup(contact.name) name = gtkgui_helpers.escape_for_pango_markup(contact.name)
status = contact.status status = contact.status
if len(status) > 25: #FIXME: do me with pango ellipseEND when gtk24 is OLD #FIXME: when gtk2.4 is OOOOLD do it via glade2.10+
status = status[:21] + '...' if gtk.pygtk_version >= (2, 6, 0) and gtk.gtk_version >= (2, 6, 0):
banner_name_label.set_ellipsize(pango.ELLIPSIZE_END)
#FIXME: do me with pango ellipseEND when gtk24 is OLD
elif status is not None and len(status) > 50:
status = status[:47] + '...'
status = gtkgui_helpers.escape_for_pango_markup(status) status = gtkgui_helpers.escape_for_pango_markup(status)
jid = contact.jid
#FIXME: uncomment me when we support sending messages to specific resource #FIXME: uncomment me when we support sending messages to specific resource
# composing full jid # composing full jid
#fulljid = jid #fulljid = jid
@ -149,7 +154,6 @@ class TabbedChatWindow(chat.Chat):
label_text += '\n%s' % status label_text += '\n%s' % status
# setup the label that holds name and jid # setup the label that holds name and jid
banner_name_label = self.xmls[jid].get_widget('banner_name_label')
banner_name_label.set_markup(label_text) banner_name_label.set_markup(label_text)
self.paint_banner(jid) self.paint_banner(jid)