Show
Ignore:
Timestamp:
07/25/08 03:10:14 (4 months ago)
Author:
js
Message:

Show own mood in account row.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/src/roster_window.py

    r10023 r10025  
    232232                                                                parent_iter) 
    233233                                                else: 
    234                                                         # we tested all  
     234                                                        # we tested all 
    235235                                                        # contacts in this group 
    236236                                                        contact_iter = None 
     
    617617 
    618618                Nearby family is the part of the family that is grouped with the metacontact. 
    619                 A metacontact may be over different accounts. If regroup is s False the  
     619                A metacontact may be over different accounts. If regroup is s False the 
    620620                given family is split account wise. 
    621621 
     
    788788                if gajim.account_is_connected(account): 
    789789                        show = 'online' 
    790                 else:  
     790                else: 
    791791                        show = 'offline' 
    792792                        status = '' 
     
    974974 
    975975                self.model[child_iter][C_NAME] = account_name 
     976 
     977                if gajim.connections[account].mood.has_key('mood') \ 
     978                and gajim.connections[account].mood['mood'] in MOODS: 
     979                        self.model[child_iter][C_MOOD_PIXBUF] = \ 
     980                                gtkgui_helpers.load_mood_icon( 
     981                                gajim.connections[account].mood['mood']). \ 
     982                                get_pixbuf() 
     983                elif gajim.connections[account].mood.has_key('mood'): 
     984                        self.model[child_iter][C_MOOD_PIXBUF] = \ 
     985                                gtkgui_helpers.load_mood_icon('unknown'). \ 
     986                                get_pixbuf() 
     987                else: 
     988                        self.model[child_iter][C_MOOD_PIXBUF] = None 
     989 
    976990                return False 
    977991 
     
    12751289                '''create new empty model and draw roster''' 
    12761290                self.modelfilter = None 
    1277                 # (icon, name, type, jid, account, editable, mood_pixbuf,  
     1291                # (icon, name, type, jid, account, editable, mood_pixbuf, 
    12781292                # avatar_pixbuf, padlock_pixbuf) 
    12791293                self.model = gtk.TreeStore(gtk.Image, str, str, str, str, 
     
    14151429                        for _acc in accounts: 
    14161430                                for contact in gajim.contacts.iter_contacts(_acc): 
    1417                                         # Is this contact in this group ? (last part of if check if it's  
    1418                                         # self contact)  
     1431                                        # Is this contact in this group ? (last part of if check if it's 
     1432                                        # self contact) 
    14191433                                        if group in contact.get_shown_groups(): 
    14201434                                                if self.contact_is_visible(contact, _acc): 
     
    14381452                                        if contact and self.contact_is_visible(contact, account): 
    14391453                                                return True 
    1440                                 return False  
     1454                                return False 
    14411455                        else: 
    14421456                                contact = gajim.contacts.get_first_contact_from_jid(account, jid) 
     
    30443058                                        contact.sub = 'from' 
    30453059                                        # we can't see him, but have to set it manually in contact 
    3046                                         contact.show = 'offline'  
     3060                                        contact.show = 'offline' 
    30473061                                        gajim.contacts.add_contact(account, contact) 
    30483062                                        self.add_contact(contact.jid, account) 
     
    41934207                theme = gajim.config.get('roster_theme') 
    41944208                type_ = model[titer][C_TYPE] 
    4195                 if type_ in ('group', 'account'): 
     4209                if type_ == 'group': 
    41964210                        renderer.set_property('visible', False) 
    41974211                        return 
     
    42024216                else: 
    42034217                        renderer.set_property('visible', False) 
    4204                 if type_: # prevent type_ = None, see http://trac.gajim.org/ticket/2534 
    4205                         if not model[titer][C_JID] or not model[titer][C_ACCOUNT]: 
     4218                if type_ == 'account': 
     4219                        color = gajim.config.get_per('themes', theme, 
     4220                                'accountbgcolor') 
     4221                        if color: 
     4222                                renderer.set_property('cell-background', color) 
     4223                        else: 
     4224                                self.set_renderer_color(renderer, 
     4225                                        gtk.STATE_ACTIVE 
     4226                        # align pixbuf to the right) 
     4227                        renderer.set_property('xalign', 1) 
     4228                # prevent type_ = None, see http://trac.gajim.org/ticket/2534 
     4229                elif type_: 
     4230                        if not model[titer][C_JID] \ 
     4231                        or not model[titer][C_ACCOUNT]: 
    42064232                                # This can append at the moment we add the row 
    42074233                                return 
     
    42094235                        account = model[titer][C_ACCOUNT].decode('utf-8') 
    42104236                        if jid in gajim.newly_added[account]: 
    4211                                 renderer.set_property('cell-background', gajim.config.get( 
     4237                                renderer.set_property('cell-background', 
     4238                                        gajim.config.get( 
    42124239                                        'just_connected_bg_color')) 
    42134240                        elif jid in gajim.to_be_removed[account]: 
    4214                                 renderer.set_property('cell-background', gajim.config.get( 
     4241                                renderer.set_property('cell-background', 
     4242                                        gajim.config.get( 
    42154243                                        'just_disconnected_bg_color')) 
    42164244                        else: 
    4217                                 color = gajim.config.get_per('themes', theme, 'contactbgcolor') 
     4245                                color = gajim.config.get_per('themes', 
     4246                                        theme, 'contactbgcolor') 
    42184247                                if color: 
    4219                                         renderer.set_property('cell-background', color) 
     4248                                        renderer.set_property( 
     4249                                                'cell-background', color) 
    42204250                                else: 
    4221                                         renderer.set_property('cell-background', None) 
    4222                 renderer.set_property('xalign', 1) # align pixbuf to the right 
     4251                                        renderer.set_property( 
     4252                                                'cell-background', None) 
     4253                        # align pixbuf to the right 
     4254                        renderer.set_property('xalign', 1) 
    42234255 
    42244256