Commit e9afe36f authored by nkour's avatar nkour

clean code and update to using GTK/PyGTK 2.8; see #2248

parent abcb9a35
......@@ -72,8 +72,7 @@ class AdvancedConfigurationWindow(object):
renderer_text, text = 1)
col.set_cell_data_func(renderer_text, self.cb_value_column_data)
if gtk.gtk_version >= (2, 8, 0) and gtk.pygtk_version >= (2, 8, 0):
col.set_resizable(True) # there is a bug in 2.6.x series
col.props.resizable = True
col.set_max_width(250)
renderer_text = gtk.CellRendererText()
......
'''atom_window.py - a window to display atom entries from pubsub. For now greatly simplified,
supports only simple feeds like the one from pubsub.com. '''
## atom_window.py - a window to display atom entries from pubsub.
##
## For now greatly simplified, supports only simple feeds like the
## one from pubsub.com.
##
## Copyright (C) 2006-2007 Yann Le Boulanger <asterix@lagaule.org>
## Copyright (C) 2007 Nikos Kouremenos <kourem@gmail.com>
## Copyright (C) 2006-2007 Liori (I think) put ur self here please
##
## This program is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published
## by the Free Software Foundation; version 2 only.
##
## This program is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
## GNU General Public License for more details.
##
import gtk
import gtk.gdk
import gobject
import gtkgui_helpers
from common import helpers
......@@ -11,7 +28,7 @@ class AtomWindow:
window = None
entries = []
@classmethod # python2.4 decorator
@classmethod
def newAtomEntry(cls, entry):
''' Queue new entry, open window if there's no one opened. '''
cls.entries.append(entry)
......@@ -52,22 +69,22 @@ class AtomWindow:
if newentry.feed_link is not None:
self.feed_title_label.set_markup(
u'<span foreground="blue" underline="single">%s</span>' % \
gtkgui_helpers.escape_for_pango_markup(newentry.feed_title))
gobject.markup_escape_text(newentry.feed_title))
else:
self.feed_title_label.set_markup(
gtkgui_helpers.escape_for_pango_markup(newentry.feed_title))
gobject.markup_escape_text(newentry.feed_title))
self.feed_tagline_label.set_markup(
u'<small>%s</small>' % \
gtkgui_helpers.escape_for_pango_markup(newentry.feed_tagline))
gobject.markup_escape_text(newentry.feed_tagline))
if newentry.uri is not None:
self.entry_title_label.set_markup(
u'<span foreground="blue" underline="single">%s</span>' % \
gtkgui_helpers.escape_for_pango_markup(newentry.title))
gobject.markup_escape_text(newentry.title))
else:
self.entry_title_label.set_markup(
gtkgui_helpers.escape_for_pango_markup(newentry.title))
gobject.markup_escape_text(newentry.title))
self.last_modified_label.set_text(newentry.updated)
......@@ -97,7 +114,7 @@ class AtomWindow:
self.displayNextEntry()
def on_entry_title_button_press_event(self, widget, event):
# TODO: make it using special gtk2.10 widget
#FIXME: make it using special gtk2.10 widget
if event.button == 1: # left click
uri = self.entry.uri
if uri is not None:
......@@ -105,7 +122,7 @@ class AtomWindow:
return True
def on_feed_title_button_press_event(self, widget, event):
# TODO: make it using special gtk2.10 widget
#FIXME: make it using special gtk2.10 widget
if event.button == 1: # left click
uri = self.entry.feed_uri
if uri is not None:
......
......@@ -133,6 +133,3 @@ class CellRendererImage(gtk.GenericCellRenderer):
(cell_area.height - calc_height - \
self.get_property('ypad'))
return x_offset, y_offset, calc_width, calc_height
if gtk.pygtk_version < (2, 8, 0):
gobject.type_register(CellRendererImage)
## chat_control.py
##
## Copyright (C) 2006 Yann Le Boulanger <asterix@lagaule.org>
## Copyright (C) 2006 Nikos Kouremenos <kourem@gmail.com>
## Copyright (C) 2006-2007 Nikos Kouremenos <kourem@gmail.com>
## Copyright (C) 2006 Travis Shirk <travis@pobox.com>
## Copyright (C) 2006 Dimitur Kirov <dkirov@gmail.com>
##
......@@ -1033,7 +1033,7 @@ class ChatControl(ChatControlBase):
if self.TYPE_ID == message_control.TYPE_PM:
name = _('%(nickname)s from group chat %(room_name)s') %\
{'nickname': name, 'room_name': self.room_name}
name = gtkgui_helpers.escape_for_pango_markup(name)
name = gobject.markup_escape_text(name)
# We know our contacts nick, but if another contact has the same nick
# in another account we need to also display the account.
......@@ -1048,14 +1048,14 @@ class ChatControl(ChatControlBase):
contact_ = gajim.contacts.get_first_contact_from_jid(account, jid)
if contact_.get_shown_name() == self.contact.get_shown_name():
acct_info = ' (%s)' % \
gtkgui_helpers.escape_for_pango_markup(self.account)
gobject.markup_escape_text(self.account)
break
status = contact.status
if status is not None:
banner_name_label.set_ellipsize(pango.ELLIPSIZE_END)
status = helpers.reduce_chars_newlines(status, max_lines = 2)
status_escaped = gtkgui_helpers.escape_for_pango_markup(status)
status_escaped = gobject.markup_escape_text(status)
font_attrs, font_attrs_small = self.get_font_attrs()
st = gajim.config.get('displayed_chat_state_notifications')
......@@ -1330,7 +1330,7 @@ class ChatControl(ChatControlBase):
name = self.contact.get_shown_name()
if self.resource:
name += '/' + self.resource
label_str = gtkgui_helpers.escape_for_pango_markup(name)
label_str = gobject.markup_escape_text(name)
if num_unread: # if unread, text in the label becomes bold
label_str = '<b>' + unread + label_str + '</b>'
return (label_str, color)
......
......@@ -3,7 +3,7 @@
##
## Copyright (C) 2003-2006 Yann Le Boulanger <asterix@lagaule.org>
## Copyright (C) 2003-2004 Vincent Hanquez <tab@snarc.org>
## Copyright (C) 2005-2006 Nikos Kouremenos <kourem@gmail.com>
## Copyright (C) 2005-2007 Nikos Kouremenos <kourem@gmail.com>
## Copyright (C) 2005 Dimitur Kirov <dkirov@gmail.com>
## Copyright (C) 2005-2006 Travis Shirk <travis@pobox.com>
## Copyright (C) 2005 Norman Rasmussen <norman@rasmussen.co.za>
......@@ -768,8 +768,7 @@ class AboutDialog:
dlg.set_authors(authors)
if gtk.pygtk_version >= (2, 8, 0) and gtk.gtk_version >= (2, 8, 0):
dlg.props.wrap_license = True
dlg.props.wrap_license = True
pixbuf = gtk.gdk.pixbuf_new_from_file(os.path.join(
gajim.DATA_DIR, 'pixmaps', 'gajim_about.png'))
......@@ -1855,7 +1854,7 @@ class PrivacyListWindow:
self.privacy_lists_title_label.set_label(
_('Privacy List <b><i>%s</i></b>') % \
gtkgui_helpers.escape_for_pango_markup(self.privacy_list_name))
gobject.markup_escape_text(self.privacy_list_name))
if len(gajim.connections) > 1:
title = _('Privacy List for %s') % self.account
......
......@@ -2,7 +2,7 @@
## config.py
##
## Copyright (C) 2005-2006 Yann Le Boulanger <asterix@lagaule.org>
## Copyright (C) 2005-2006 Nikos Kouremenos <kourem@gmail.com>
## Copyright (C) 2005-2007 Nikos Kouremenos <kourem@gmail.com>
## Copyright (C) 2005-2006 Stéphan Kochen <stephan@kochen.nl>
##
## This program is free software; you can redistribute it and/or modify
......@@ -41,6 +41,7 @@ import inspect
import weakref
import gobject
import gtk
import gobject
import pango
import dialogs
......@@ -497,10 +498,7 @@ _('Without a connection, you can not browse available services'))
title_text = _('Service Discovery using account %s') % self.account
self.window.set_title(title_text)
self._set_window_banner_text(_('Service Discovery'))
if gtk.gtk_version >= (2, 8, 0) and gtk.pygtk_version >= (2, 8, 0):
self.banner_icon.clear()
else:
self.banner_icon.set_from_file(None)
self.banner_icon.clear()
self.banner_icon.hide() # Just clearing it doesn't work
def _set_window_banner_text(self, text, text_after = None):
......@@ -1730,7 +1728,7 @@ class DiscussionGroupsBrowser(AgentBrowser):
dunno = True
subscribed = False
name = gtkgui_helpers.escape_for_pango_markup(name)
name = gobject.markup_escape_text(name)
name = '<b>%s</b>' % name
model.append((jid, node, name, dunno, subscribed))
......
## filetransfers_window.py
##
## Copyright (C) 2003-2006 Yann Le Boulanger <asterix@lagaule.org>
## Copyright (C) 2005-2006 Nikos Kouremenos <kourem@gmail.com>
## Copyright (C) 2005-2007 Nikos Kouremenos <kourem@gmail.com>
## Copyright (C) 2005
## Dimitur Kirov <dkirov@gmail.com>
## Travis Shirk <travis@pobox.com>
......@@ -575,7 +575,7 @@ _('Connection with peer cannot be established.'))
(file_path, file_name) = os.path.split(file_props['file-name'])
else:
file_name = file_props['name']
text_props = gtkgui_helpers.escape_for_pango_markup(file_name) + '\n'
text_props = gobject.markup_escape_text(file_name) + '\n'
text_props += contact.get_shown_name()
self.model.set(iter, 1, text_labels, 2, text_props, C_SID,
file_props['type'] + file_props['sid'])
......
......@@ -122,12 +122,12 @@ except RuntimeError, msg:
print >> sys.stderr, _('Gajim needs X server to run. Quiting...')
sys.exit()
pritext = ''
if gtk.pygtk_version < (2, 6, 0):
pritext = _('Gajim needs PyGTK 2.6 or above')
sectext = _('Gajim needs PyGTK 2.6 or above to run. Quiting...')
elif gtk.gtk_version < (2, 6, 0):
pritext = _('Gajim needs GTK 2.6 or above')
sectext = _('Gajim needs GTK 2.6 or above to run. Quiting...')
if gtk.pygtk_version < (2, 8, 0):
pritext = _('Gajim needs PyGTK 2.8 or above')
sectext = _('Gajim needs PyGTK 2.8 or above to run. Quiting...')
elif gtk.gtk_version < (2, 8, 0):
pritext = _('Gajim needs GTK 2.8 or above')
sectext = _('Gajim needs GTK 2.8 or above to run. Quiting...')
try:
import gtk.glade # check if user has libglade (in pygtk and in gtk)
......@@ -340,10 +340,9 @@ class GlibIdleQueue(idlequeue.IdleQueue):
''' this method is called at the end of class constructor.
Creates a dict, which maps file/pipe/sock descriptor to glib event id'''
self.events = {}
if gtk.pygtk_version >= (2, 8, 0):
# time() is already called in glib, we just get the last value
# overrides IdleQueue.current_time()
self.current_time = lambda: gobject.get_current_time()
# time() is already called in glib, we just get the last value
# overrides IdleQueue.current_time()
self.current_time = lambda: gobject.get_current_time()
def add_idle(self, fd, flags):
''' this method is called when we plug a new idle object.
......@@ -2107,9 +2106,9 @@ class Interface:
else:
gajim.log.setLevel(None)
# pygtk2.8 on win, breaks io_add_watch. We use good old select.select()
if os.name == 'nt' and (gtk.pygtk_version > (2, 8, 0) or
gtk.gtk_version > (2, 8, 0)):
# pygtk2.8+ on win, breaks io_add_watch.
# We use good old select.select()
if os.name == 'nt':
gajim.idlequeue = idlequeue.SelectIdleQueue()
else:
# in a nongui implementation, just call:
......
......@@ -4,11 +4,11 @@
## Vincent Hanquez <tab@snarc.org>
## Copyright (C) 2005 Yann Le Boulanger <asterix@lagaule.org>
## Vincent Hanquez <tab@snarc.org>
## Nikos Kouremenos <kourem@gmail.com>
## Dimitur Kirov <dkirov@gmail.com>
## Travis Shirk <travis@pobox.com>
## Norman Rasmussen <norman@rasmussen.co.za>
## Copyright (C) 2006 Travis Shirk <travis@pobox.com>
## Copyright (C) 2005-2007 Nikos Kouremenos <kourem@gmail.com>
##
## This program is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published
......@@ -460,7 +460,7 @@ class GroupchatControl(ChatControlBase):
text = '<span %s>%s</span>' % (font_attrs, self.room_jid)
if self.subject:
subject = helpers.reduce_chars_newlines(self.subject, max_lines = 2)
subject = gtkgui_helpers.escape_for_pango_markup(subject)
subject = gobject.markup_escape_text(subject)
text += '\n<span %s>%s</span>' % (font_attrs_small, subject)
# tooltip must always hold ALL the subject
......@@ -778,7 +778,7 @@ class GroupchatControl(ChatControlBase):
else:
image = state_images[gc_contact.show]
name = gtkgui_helpers.escape_for_pango_markup(gc_contact.name)
name = gobject.markup_escape_text(gc_contact.name)
status = gc_contact.status
# add status msg, if not empty, under contact name in the treeview
if status and gajim.config.get('show_status_msgs_in_roster'):
......@@ -790,7 +790,7 @@ class GroupchatControl(ChatControlBase):
selected, focus)
colorstring = "#%04x%04x%04x" % (color.red, color.green, color.blue)
name += '\n' '<span size="small" style="italic" foreground="%s">%s</span>'\
% (colorstring, gtkgui_helpers.escape_for_pango_markup(status))
% (colorstring, gobject.markup_escape_text(status))
model[iter][C_IMG] = image
model[iter][C_TEXT] = name
......
......@@ -172,19 +172,6 @@ def get_default_font():
return None
def escape_for_pango_markup(string):
# escapes < > & ' "
# for pango markup not to break
if string is None:
return
if gtk.pygtk_version >= (2, 8, 0) and gtk.gtk_version >= (2, 8, 0):
escaped_str = gobject.markup_escape_text(string)
else:
escaped_str = xml.sax.saxutils.escape(string, {"'": '&apos;',
'"': '&quot;'})
return escaped_str
def autodetect_browser_mailer():
# recognize the environment and set appropriate browser/mailer
if user_runs_gnome():
......@@ -354,8 +341,7 @@ def parse_server_xml(path_to_file):
def set_unset_urgency_hint(window, unread_messages_no):
'''sets/unsets urgency hint in window argument
depending if we have unread messages or not'''
if gtk.gtk_version >= (2, 8, 0) and gtk.pygtk_version >= (2, 8, 0) and \
gajim.config.get('use_urgency_hint'):
if gajim.config.get('use_urgency_hint'):
if unread_messages_no > 0:
window.props.urgency_hint = True
else:
......
#!/usr/bin/env python
## history_manager.py
##
## Copyright (C) 2006 Nikos Kouremenos <kourem@gmail.com>
## Copyright (C) 2006-2007 Nikos Kouremenos <kourem@gmail.com>
##
## This program is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published
......@@ -21,6 +21,7 @@ import sys
import os
import signal
import gtk
import gobject
import time
import locale
......@@ -337,7 +338,7 @@ class HistoryManager:
if color:
message_ += ' foreground="%s"' % color
message_ += '>%s</span>' % \
gtkgui_helpers.escape_for_pango_markup(message)
gobject.markup_escape_text(message)
self.logs_liststore.append((log_line_id, jid_id, time_, message_,
subject, nickname))
......@@ -399,8 +400,7 @@ class HistoryManager:
dlg = xml.get_widget('filechooserdialog')
dlg.set_title(_('Exporting History Logs...'))
dlg.set_current_folder(gajim.HOME_DIR)
if gtk.pygtk_version > (2, 8, 0):
dlg.props.do_overwrite_confirmation = True
dlg.props.do_overwrite_confirmation = True
response = dlg.run()
if response == gtk.RESPONSE_OK: # user want us to export ;)
......
This diff is collapsed.
......@@ -62,9 +62,6 @@ class MessageTextView(gtk.TextView):
start, end = buffer.get_bounds()
buffer.delete(start, end)
if gobject.pygtk_version < (2, 8, 0):
gobject.type_register(MessageTextView)
# We register depending on keysym and modifier some bindings
# but we also pass those as param so we can construct fake Event
......
## notify.py
##
## Copyright (C) 2005-2006 Yann Le Boulanger <asterix@lagaule.org>
## Copyright (C) 2005-2006 Nikos Kouremenos <kourem@gmail.com>
## Copyright (C) 2005-2007 Nikos Kouremenos <kourem@gmail.com>
## Copyright (C) 2005-2006 Andrew Sayman <lorien420@myrealbox.com>
##
## Notification daemon connection via D-Bus code:
......@@ -20,6 +20,7 @@
import os
import time
import dialogs
import gobject
import gtkgui_helpers
from common import gajim
......@@ -280,8 +281,8 @@ def popup(event_type, jid, account, msg_type = '', path_to_image = None,
'''Notifies a user of an event. It first tries to a valid implementation of
the Desktop Notification Specification. If that fails, then we fall back to
the older style PopupNotificationWindow method.'''
text = gtkgui_helpers.escape_for_pango_markup(text)
title = gtkgui_helpers.escape_for_pango_markup(title)
text = gobject.markup_escape_text(text)
title = gobject.markup_escape_text(title)
if gajim.config.get('use_notif_daemon') and dbus_support.supported:
try:
......
......@@ -2,7 +2,7 @@
## roster_window.py
##
## Copyright (C) 2003-2006 Yann Le Boulanger <asterix@lagaule.org>
## Copyright (C) 2005-2006 Nikos Kouremenos <kourem@gmail.com>
## Copyright (C) 2005-2007 Nikos Kouremenos <kourem@gmail.com>
## Copyright (C) 2005-2006 Dimitur Kirov <dkirov@gmail.com>
##
## This program is free software; you can redistribute it and/or modify
......@@ -182,7 +182,7 @@ class RosterWindow:
our_jid = gajim.get_jid_from_account(account)
model.append(None, [self.jabber_state_images['16'][show],
gtkgui_helpers.escape_for_pango_markup(account),
gobject.markup_escape_text(account),
'account', our_jid, account, tls_pixbuf])
def draw_account(self, account):
......@@ -350,7 +350,7 @@ class RosterWindow:
IterAcct = self.get_account_iter(account)
iterG = model.append(IterAcct, [
self.jabber_state_images['16']['closed'],
gtkgui_helpers.escape_for_pango_markup(group), 'group',
gobject.markup_escape_text(group), 'group',
group, account, None])
self.draw_group(group, account)
if model.iter_n_children(IterAcct) == 1: # We added the first one
......@@ -396,7 +396,7 @@ class RosterWindow:
accounts = accounts, groups = [group])
text += ' (%s/%s)' % (repr(nbr_on), repr(nbr_total))
model = self.tree.get_model()
model.set_value(iter, 1 , gtkgui_helpers.escape_for_pango_markup(text))
model.set_value(iter, 1 , gobject.markup_escape_text(text))
def add_to_not_in_the_roster(self, account, jid, nick = ''):
''' add jid to group "not in the roster", he MUST not be in roster yet,
......@@ -558,7 +558,7 @@ class RosterWindow:
contact_instances)
if not contact:
return
name = gtkgui_helpers.escape_for_pango_markup(contact.get_shown_name())
name = gobject.markup_escape_text(contact.get_shown_name())
nb_connected_contact = 0
for c in contact_instances:
......@@ -599,7 +599,7 @@ class RosterWindow:
colorstring = "#%04x%04x%04x" % (color.red, color.green, color.blue)
name += \
'\n<span size="small" style="italic" foreground="%s">%s</span>' \
% (colorstring, gtkgui_helpers.escape_for_pango_markup(status))
% (colorstring, gobject.markup_escape_text(status))
iter = iters[0] # choose the icon with the first iter
icon_name = helpers.get_icon_name_to_show(contact, account)
......
......@@ -225,9 +225,7 @@ class Systray:
sounds_mute_menuitem.set_active(not gajim.config.get('sounds_on'))
if os.name == 'nt':
# see http://bugzilla.gnome.org/show_bug.cgi?id=377349
#FIXME: until it is fixed, put under mouse coordinates
if os.name == 'nt':
if gtk.pygtk_version >= (2, 10, 0) and gtk.gtk_version >= (2, 10, 0):
if self.added_hide_menuitem is False:
self.systray_context_menu.prepend(gtk.SeparatorMenuItem())
......
## tooltips.py
##
## Copyright (C) 2005-2006 Dimitur Kirov <dkirov@gmail.com>
## Copyright (C) 2005-2006 Nikos Kouremenos <kourem@gmail.com>
## Copyright (C) 2005-2007 Nikos Kouremenos <kourem@gmail.com>
## Copyright (C) 2005-2006 Yann Le Boulanger <asterix@lagaule.org>
##
## This program is free software; you can redistribute it and/or modify
......@@ -178,8 +178,8 @@ class StatusTable:
status = unicode(status, encoding='utf-8')
# reduce to 100 chars, 1 line
status = helpers.reduce_chars_newlines(status, 100, 1)
str_status = gtkgui_helpers.escape_for_pango_markup(str_status)
status = gtkgui_helpers.escape_for_pango_markup(status)
str_status = gobject.markup_escape_text(str_status)
status = gobject.markup_escape_text(status)
str_status += ' - <i>' + status + '</i>'
return str_status
......@@ -233,7 +233,7 @@ class NotificationAreaTooltip(BaseTooltip, StatusTable):
if isinstance(message, str):
message = unicode(message, encoding = 'utf-8')
message = helpers.reduce_chars_newlines(message, 100, 1)
message = gtkgui_helpers.escape_for_pango_markup(message)
message = gobject.markup_escape_text(message)
if gajim.con_types.has_key(acct['name']) and \
gajim.con_types[acct['name']] in ('tls', 'ssl'):
show_lock = True
......@@ -241,11 +241,11 @@ class NotificationAreaTooltip(BaseTooltip, StatusTable):
show_lock = False
if message:
self.add_status_row(file_path, acct['show'],
gtkgui_helpers.escape_for_pango_markup(acct['name']) + \
gobject.markup_escape_text(acct['name']) + \
' - ' + message, show_lock=show_lock)
else:
self.add_status_row(file_path, acct['show'],
gtkgui_helpers.escape_for_pango_markup(acct['name'])
gobject.markup_escape_text(acct['name'])
, show_lock=show_lock)
def populate(self, data):
......@@ -259,7 +259,7 @@ class NotificationAreaTooltip(BaseTooltip, StatusTable):
self.table.set_property('column-spacing', 1)
text = helpers.get_notification_icon_tooltip_text()
text = gtkgui_helpers.escape_for_pango_markup(text)
text = gobject.markup_escape_text(text)
self.add_text_row(text)
self.hbox.add(self.table)
......@@ -288,7 +288,7 @@ class GCTooltip(BaseTooltip):
properties = []
nick_markup = '<b>' + \
gtkgui_helpers.escape_for_pango_markup(contact.get_shown_name()) \
gobject.markup_escape_text(contact.get_shown_name()) \
+ '</b>'
properties.append((nick_markup, None))
......@@ -298,7 +298,7 @@ class GCTooltip(BaseTooltip):
# escape markup entities
status = helpers.reduce_chars_newlines(status, 100, 5)
status = '<i>' +\
gtkgui_helpers.escape_for_pango_markup(status) + '</i>'
gobject.markup_escape_text(status) + '</i>'
properties.append((status, None))
else: # no status message, show SHOW instead
show = helpers.get_uf_show(contact.show)
......@@ -310,7 +310,7 @@ class GCTooltip(BaseTooltip):
if hasattr(contact, 'resource') and contact.resource.strip() != '':
properties.append((_('Resource: '),
gtkgui_helpers.escape_for_pango_markup(contact.resource) ))
gobject.markup_escape_text(contact.resource) ))
if contact.affiliation != 'none':
uf_affiliation = helpers.get_uf_affiliation(contact.affiliation)
affiliation_str = \
......@@ -411,7 +411,7 @@ class RosterTooltip(NotificationAreaTooltip):
properties = []
name_markup = u'<span weight="bold">' + \
gtkgui_helpers.escape_for_pango_markup(prim_contact.get_shown_name())\
gobject.markup_escape_text(prim_contact.get_shown_name())\
+ '</span>'
properties.append((name_markup, None))
......@@ -485,7 +485,7 @@ class RosterTooltip(NotificationAreaTooltip):
# (no more than 100 chars on line and no more than 5 lines)
status = helpers.reduce_chars_newlines(status, 100, 5)
# escape markup entities.
status = gtkgui_helpers.escape_for_pango_markup(status)
status = gobject.markup_escape_text(status)
properties.append(('<i>%s</i>' % status, None))
properties.append((show, None))
......@@ -494,13 +494,13 @@ class RosterTooltip(NotificationAreaTooltip):
# contact has only one ressource
if num_resources == 1 and contact.resource:
properties.append((_('Resource: '),
gtkgui_helpers.escape_for_pango_markup(contact.resource) +\
gobject.markup_escape_text(contact.resource) +\
' (' + unicode(contact.priority) + ')'))
if prim_contact.sub and prim_contact.sub != 'both':
# ('both' is the normal sub so we don't show it)
properties.append(( _('Subscription: '),
gtkgui_helpers.escape_for_pango_markup(helpers.get_uf_sub(prim_contact.sub))))
gobject.markup_escape_text(helpers.get_uf_sub(prim_contact.sub))))
if prim_contact.keyID:
keyID = None
......@@ -510,7 +510,7 @@ class RosterTooltip(NotificationAreaTooltip):
keyID = prim_contact.keyID[8:]
if keyID:
properties.append((_('OpenPGP: '),
gtkgui_helpers.escape_for_pango_markup(keyID)))
gobject.markup_escape_text(keyID)))
while properties:
property = properties.pop(0)
......@@ -561,7 +561,7 @@ class FileTransfersTooltip(BaseTooltip):
else:
file_name = file_props['name']
properties.append((_('Name: '),
gtkgui_helpers.escape_for_pango_markup(file_name)))
gobject.markup_escape_text(file_name)))
if file_props['type'] == 'r':
type = _('Download')
actor = _('Sender: ')
......@@ -577,7 +577,7 @@ class FileTransfersTooltip(BaseTooltip):
else:
name = receiver.split('/')[0]
properties.append((_('Type: '), type))
properties.append((actor, gtkgui_helpers.escape_for_pango_markup(name)))
properties.append((actor, gobject.markup_escape_text(name)))
transfered_len = 0
if file_props.has_key('received-len'):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment