Changeset 10009

Show
Ignore:
Timestamp:
07/23/08 18:27:06 (5 weeks ago)
Author:
js
Message:

Be compatible with pygtk 2.10.

I'm still for kicking compatibility for everything < 2.12.0 as with
2.12.0, there are a few new APIs that obsolete old, stupid APIs.

Location:
trunk/src
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • trunk/src/chat_control.py

    r9997 r10009  
    5555except: 
    5656        HAS_GTK_SPELL = False 
     57 
     58HAVE_MARKUP_TOOLTIPS = gtk.pygtk_version >= (2, 12, 0) 
    5759 
    5860# the next script, executed in the "po" directory, 
     
    10901092                self._tune_image = self.xml.get_widget('tune_image') 
    10911093 
     1094                if not HAVE_MARKUP_TOOLTIPS: 
     1095                        self._mood_tooltip = gtk.Tooltips() 
     1096                        self._activity_tooltip = gtk.Tooltips() 
     1097                        self._tune_tooltip = gtk.Tooltips() 
     1098 
    10921099                self.update_mood() 
    10931100                self.update_tune() 
     
    11981205        def update_mood(self): 
    11991206                if self.contact.mood.has_key('mood'): 
    1200                         mood = gobject.markup_escape_text( 
    1201                                 self.contact.mood['mood']) 
     1207                        mood = self.contact.mood['mood'] 
     1208                        if HAVE_MARKUP_TOOLTIPS: 
     1209                                mood = gobject.markup_escape_text(mood) 
    12021210                else: 
    12031211                        mood = None 
    12041212 
    12051213                if self.contact.mood.has_key('text'): 
    1206                         text = gobject.markup_escape_text( 
    1207                                 self.contact.mood['text']) 
     1214                        text = self.contact.mood['text'] 
     1215                        if HAVE_MARKUP_TOOLTIPS: 
     1216                                text = gobject.markup_escape_text(text) 
    12081217                else: 
    12091218                        text = '' 
     
    12211230                                        'unknown').get_pixbuf()) 
    12221231 
    1223                         self._mood_image.set_tooltip_markup('<b>%s</b>%s%s' % 
    1224                                 (mood, '\n' if text is not '' else '', text)) 
     1232                        if HAVE_MARKUP_TOOLTIPS: 
     1233                                self._mood_image.set_tooltip_markup( 
     1234                                        '<b>%s</b>%s%s' % (mood, 
     1235                                        '\n' if text is not '' else '', text)) 
     1236                        else: 
     1237                                self._mood_tooltip.set_tip( 
     1238                                        self._mood_image, '%s%s%s' % (mood, 
     1239                                        '\n' if text is not '' else '', text)) 
    12251240                        self._mood_image.show() 
    12261241                else: 
     
    12331248 
    12341249                if self.contact.tune.has_key('artist'): 
    1235                         artist = gobject.markup_escape_text( 
    1236                                 self.contact.tune['artist'].strip()) 
     1250                        artist = self.contact.tune['artist'].strip() 
     1251                        if HAVE_MARKUP_TOOLTIPS: 
     1252                                artist = gobject.markup_escape_text(artist) 
    12371253                if self.contact.tune.has_key('title'): 
    1238                         title = gobject.markup_escape_text( 
    1239                                 self.contact.tune['title'].strip()) 
     1254                        title = self.contact.tune['title'].strip() 
     1255                        if HAVE_MARKUP_TOOLTIPS: 
     1256                                title = gobject.markup_escape_text(title) 
    12401257                if self.contact.tune.has_key('source'): 
    1241                         title = gobject.markup_escape_text( 
    1242                                 self.contact.tune['source'].strip()) 
     1258                        source = self.contact.tune['source'].strip() 
     1259                        if HAVE_MARKUP_TOOLTIPS: 
     1260                                source = gobject.markup_escape_text(source) 
    12431261 
    12441262                if artist or title: 
     
    12471265                        source = source if source else _('Unknown Source') 
    12481266 
    1249                         self._tune_image.set_tooltip_markup(_( 
    1250                                 '<b>"%(title)s"</b> by <i>%(artist)s</i>\n' + 
    1251                                 'from <i>%(source)s</i>') % {'title': title, 
    1252                                 'artist': artist, 'source': source}) 
     1267                        if HAVE_MARKUP_TOOLTIPS: 
     1268                                self._tune_image.set_tooltip_markup( 
     1269                                        _('<b>"%(title)s"</b> by ' + 
     1270                                        '<i>%(artist)s</i>\n' + 
     1271                                        'from <i>%(source)s</i>') %  
     1272                                        {'title': title, 'artist': artist, 
     1273                                        'source': source}) 
     1274                        else: 
     1275                                self._tune_tooltip.set_tip(self._tune_image, 
     1276                                        _('%(title)s by %(artist)s\n' + 
     1277                                        'from %(source)s') % {'title': title, 
     1278                                        'artist': artist, 'source': source}) 
    12531279                        self._tune_image.show() 
    12541280                else: 
  • trunk/src/dialogs.py

    r10006 r10009  
    473473                                gtkgui_helpers.load_mood_icon(mood)) 
    474474                        self.mood_buttons[mood].set_relief(gtk.RELIEF_NONE) 
    475                         self.mood_buttons[mood].set_tooltip_text( 
     475                        gtk.Tooltips().set_tip(self.mood_buttons[mood], 
    476476                                _(mood.replace('_', ' '))) 
    477477                        self.mood_buttons[mood].connect('clicked',