GObject -> GLib

This commit is contained in:
Yann Leboulanger 2013-07-29 21:41:01 +02:00
parent 134f87ced5
commit d1a6467d82
4 changed files with 29 additions and 29 deletions

View File

@ -23,7 +23,7 @@
from gi.repository import Gtk from gi.repository import Gtk
from gi.repository import GObject from gi.repository import GLib
import gtkgui_helpers import gtkgui_helpers
from common import helpers from common import helpers
@ -85,23 +85,23 @@ class AtomWindow:
if newentry.feed_link is not None: if newentry.feed_link is not None:
self.feed_title_label.set_markup( self.feed_title_label.set_markup(
'<span foreground="blue" underline="single">%s</span>' % \ '<span foreground="blue" underline="single">%s</span>' % \
GObject.markup_escape_text(newentry.feed_title)) GLib.markup_escape_text(newentry.feed_title))
else: else:
self.feed_title_label.set_markup( self.feed_title_label.set_markup(GLib.markup_escape_text(
GObject.markup_escape_text(newentry.feed_title)) newentry.feed_title))
self.feed_tagline_label.set_markup( self.feed_tagline_label.set_markup(
'<small>%s</small>' % \ '<small>%s</small>' % GLib.markup_escape_text(
GObject.markup_escape_text(newentry.feed_tagline)) newentry.feed_tagline))
if newentry.title: if newentry.title:
if newentry.uri is not None: if newentry.uri is not None:
self.entry_title_label.set_markup( self.entry_title_label.set_markup(
'<span foreground="blue" underline="single">%s</span>' % \ '<span foreground="blue" underline="single">%s</span>' % \
GObject.markup_escape_text(newentry.title)) GLib.markup_escape_text(newentry.title))
else: else:
self.entry_title_label.set_markup( self.entry_title_label.set_markup(GLib.markup_escape_text(
GObject.markup_escape_text(newentry.title)) newentry.title))
else: else:
self.entry_title_label.set_markup('') self.entry_title_label.set_markup('')

View File

@ -215,7 +215,7 @@ LOCATION_DATA = {
'timestamp': _('timestamp'), 'timestamp': _('timestamp'),
'uri': _('uri')} 'uri': _('uri')}
from gi.repository import GObject from gi.repository import GLib
from gi.repository import Gtk from gi.repository import Gtk
from gi.repository import GdkPixbuf from gi.repository import GdkPixbuf
@ -299,10 +299,10 @@ class UserMoodPEP(AbstractPEP):
assert not self._retracted assert not self._retracted
untranslated_mood = self._pep_specific_data['mood'] untranslated_mood = self._pep_specific_data['mood']
mood = self._translate_mood(untranslated_mood) mood = self._translate_mood(untranslated_mood)
markuptext = '<b>%s</b>' % GObject.markup_escape_text(mood) markuptext = '<b>%s</b>' % GLib.markup_escape_text(mood)
if 'text' in self._pep_specific_data: if 'text' in self._pep_specific_data:
text = self._pep_specific_data['text'] text = self._pep_specific_data['text']
markuptext += ' (%s)' % GObject.markup_escape_text(text) markuptext += ' (%s)' % GLib.markup_escape_text(text)
return markuptext return markuptext
def _translate_mood(self, mood): def _translate_mood(self, mood):
@ -339,13 +339,13 @@ class UserTunePEP(AbstractPEP):
tune = self._pep_specific_data tune = self._pep_specific_data
artist = tune.get('artist', _('Unknown Artist')) artist = tune.get('artist', _('Unknown Artist'))
artist = GObject.markup_escape_text(artist) artist = GLib.markup_escape_text(artist)
title = tune.get('title', _('Unknown Title')) title = tune.get('title', _('Unknown Title'))
title = GObject.markup_escape_text(title) title = GLib.markup_escape_text(title)
source = tune.get('source', _('Unknown Source')) source = tune.get('source', _('Unknown Source'))
source = GObject.markup_escape_text(source) source = GLib.markup_escape_text(source)
tune_string = _('<b>"%(title)s"</b> by <i>%(artist)s</i>\n' tune_string = _('<b>"%(title)s"</b> by <i>%(artist)s</i>\n'
'from <i>%(source)s</i>') % {'title': title, 'from <i>%(source)s</i>') % {'title': title,
@ -392,12 +392,12 @@ class UserActivityPEP(AbstractPEP):
subactivity = ACTIVITIES[activity][subactivity] subactivity = ACTIVITIES[activity][subactivity]
activity = ACTIVITIES[activity]['category'] activity = ACTIVITIES[activity]['category']
markuptext = '<b>' + GObject.markup_escape_text(activity) markuptext = '<b>' + GLib.markup_escape_text(activity)
if subactivity: if subactivity:
markuptext += ': ' + GObject.markup_escape_text(subactivity) markuptext += ': ' + GLib.markup_escape_text(subactivity)
markuptext += '</b>' markuptext += '</b>'
if text: if text:
markuptext += ' (%s)' % GObject.markup_escape_text(text) markuptext += ' (%s)' % GLib.markup_escape_text(text)
return markuptext return markuptext
@ -463,7 +463,7 @@ class UserLocationPEP(AbstractPEP):
for entry in location.keys(): for entry in location.keys():
text = location[entry] text = location[entry]
text = GObject.markup_escape_text(text) text = GLib.markup_escape_text(text)
# Translate standart location tag # Translate standart location tag
tag = LOCATION_DATA.get(entry, entry) tag = LOCATION_DATA.get(entry, entry)
location_string += '\n<b>%(tag)s</b>: %(text)s' % \ location_string += '\n<b>%(tag)s</b>: %(text)s' % \
@ -473,4 +473,4 @@ class UserLocationPEP(AbstractPEP):
SUPPORTED_PERSONAL_USER_EVENTS = [UserMoodPEP, UserTunePEP, UserActivityPEP, SUPPORTED_PERSONAL_USER_EVENTS = [UserMoodPEP, UserTunePEP, UserActivityPEP,
UserNicknamePEP, UserLocationPEP] UserNicknamePEP, UserLocationPEP]

View File

@ -51,7 +51,7 @@ import sys
import signal import signal
from gi.repository import Gtk from gi.repository import Gtk
from gi.repository import Gdk from gi.repository import Gdk
from gi.repository import GObject from gi.repository import GLib
import time import time
import locale import locale
@ -417,10 +417,9 @@ class HistoryManager:
message_ = '<span' message_ = '<span'
if color: if color:
message_ += ' foreground="%s"' % color message_ += ' foreground="%s"' % color
message_ += '>%s</span>' % \ message_ += '>%s</span>' % GLib.markup_escape_text(message)
GObject.markup_escape_text(message) self.logs_liststore.append((str(log_line_id), str(jid_id),
self.logs_liststore.append((str(log_line_id), str(jid_id), time_, time_, message_, subject, nickname))
message_, subject, nickname))
def _fill_search_results_listview(self, text): def _fill_search_results_listview(self, text):
""" """

View File

@ -31,6 +31,7 @@ import os
import time import time
from dialogs import PopupNotificationWindow from dialogs import PopupNotificationWindow
from gi.repository import GObject from gi.repository import GObject
from gi.repository import GLib
import gtkgui_helpers import gtkgui_helpers
from gi.repository import Gtk from gi.repository import Gtk
@ -89,7 +90,7 @@ text=None, timeout=-1):
if gajim.config.get('use_notif_daemon') and dbus_support.supported: if gajim.config.get('use_notif_daemon') and dbus_support.supported:
try: try:
DesktopNotification(event_type, jid, account, msg_type, DesktopNotification(event_type, jid, account, msg_type,
path_to_image, title, GObject.markup_escape_text(text), timeout) path_to_image, title, GLib.markup_escape_text(text), timeout)
return # sucessfully did D-Bus Notification procedure! return # sucessfully did D-Bus Notification procedure!
except dbus.DBusException as e: except dbus.DBusException as e:
# Connection to D-Bus failed # Connection to D-Bus failed
@ -103,10 +104,10 @@ text=None, timeout=-1):
if not text and event_type == 'new_message': if not text and event_type == 'new_message':
# empty text for new_message means do_preview = False # empty text for new_message means do_preview = False
# -> default value for text # -> default value for text
_text = GObject.markup_escape_text( _text = GLib.markup_escape_text(gajim.get_name_from_jid(account,
gajim.get_name_from_jid(account, jid)) jid))
else: else:
_text = GObject.markup_escape_text(text) _text = GLib.markup_escape_text(text)
if not title: if not title:
_title = '' _title = ''