Changeset 9265

Show
Ignore:
Timestamp:
01/23/08 17:10:28 (10 months ago)
Author:
steve-e
Message:

padlock icon in merged accounts mode: show when all connected accounts are connected securely, don't show it when one is not secured, do no care about offline accounts.

Location:
trunk/src
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • trunk/src/common/gajim.py

    r9213 r9265  
    269269        '''returns the number of the accounts that are SSL/TLS connected''' 
    270270        num_of_secured = 0 
    271         for account in connections: 
     271        for account in connections.keys(): 
    272272                if account_is_securely_connected(account): 
    273273                        num_of_secured += 1 
     
    275275 
    276276def account_is_securely_connected(account): 
    277         if account in con_types and con_types[account] in ('tls', 'ssl'): 
     277        if account_is_connected(account) and \ 
     278        account in con_types and con_types[account] in ('tls', 'ssl'): 
    278279                return True 
    279280        else: 
  • trunk/src/gajim.py

    r9256 r9265  
    18771877                gajim.block_signed_in_notifications[account] = True 
    18781878                self.roster.set_actions_menu_needs_rebuild() 
     1879                self.roster.draw_account(account) 
    18791880                if self.sleeper.getState() != common.sleepy.STATE_UNKNOWN and \ 
    18801881                gajim.connections[account].connected in (2, 3): 
  • trunk/src/roster_window.py

    r9260 r9265  
    212212                model = self.tree.get_model() 
    213213                iter = self.get_account_iter(account) 
    214                 if self.regroup: 
    215                         accounts = gajim.connections.keys() 
    216                 else: 
    217                         accounts = [account] 
    218                 num_of_accounts = len(accounts) 
     214                 
     215                num_of_accounts = gajim.get_number_of_connected_accounts() 
    219216                num_of_secured = gajim.get_number_of_securely_connected_accounts() 
    220                 if num_of_secured and gajim.con_types.has_key(account) and \ 
    221                 gajim.con_types[account] in ('tls', 'ssl'): 
     217                 
     218                if gajim.account_is_securely_connected(account) and not self.regroup or \ 
     219                self.regroup and num_of_secured and num_of_secured == num_of_accounts: 
    222220                        tls_pixbuf = self.window.render_icon(gtk.STOCK_DIALOG_AUTHENTICATION, 
    223221                                gtk.ICON_SIZE_MENU) # the only way to create a pixbuf from stock 
    224                         if num_of_secured < num_of_accounts: 
    225                                 # Make it transparent 
    226                                 colorspace = tls_pixbuf.get_colorspace() 
    227                                 bps = tls_pixbuf.get_bits_per_sample() 
    228                                 rowstride = tls_pixbuf.get_rowstride() 
    229                                 pixels = tls_pixbuf.get_pixels() 
    230                                 new_pixels = '' 
    231                                 width = tls_pixbuf.get_width() 
    232                                 height = tls_pixbuf.get_height() 
    233                                 for i in range(0, width*height): 
    234                                         rgb = pixels[4*i:4*i+3] 
    235                                         new_pixels += rgb 
    236                                         if rgb == chr(0)*3: 
    237                                                 new_pixels += chr(0) 
    238                                         else: 
    239                                                 new_pixels += chr(128) 
    240                                 tls_pixbuf = gtk.gdk.pixbuf_new_from_data(new_pixels, colorspace, 
    241                                         True, bps, width, height, rowstride) 
    242222                        model[iter][C_PADLOCK_PIXBUF] = tls_pixbuf 
    243223                else: 
     
    14401420                                return 
    14411421                        info[contact.jid] = vcard.ZeroconfVcardWindow(contact, account) 
    1442  
    14431422 
    14441423        def show_tooltip(self, contact):