Show
Ignore:
Timestamp:
07/22/08 17:40:20 (4 months ago)
Author:
js
Message:

Separate the code to update the toolbar. Now we can update when the
status / caps chance.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/src/chat_control.py

    r9970 r9982  
    10391039                self.handlers[id] = self.actions_button 
    10401040 
    1041                 add_to_roster_button = self.xml.get_widget('add_to_roster_button') 
    1042                 id = add_to_roster_button.connect('clicked', self._on_add_to_roster_menuitem_activate) 
    1043                 self.handlers[id] = add_to_roster_button 
    1044  
    1045                 send_file_button = self.xml.get_widget('send_file_button') 
    1046                 id = send_file_button.connect('clicked', self._on_send_file_menuitem_activate) 
    1047                 self.handlers[id] = send_file_button 
    1048  
    1049                 convert_to_gc_button = self.xml.get_widget('convert_to_gc_button') 
    1050                 id = convert_to_gc_button.connect('clicked', self._on_convert_to_gc_menuitem_activate) 
    1051                 self.handlers[id] = convert_to_gc_button 
    1052  
    1053                 contact_information_button = self.xml.get_widget('contact_information_button') 
    1054                 id = contact_information_button.connect('clicked', self._on_contact_information_menuitem_activate) 
     1041                self._add_to_roster_button = self.xml.get_widget( 
     1042                        'add_to_roster_button') 
     1043                id = self._add_to_roster_button.connect('clicked', 
     1044                        self._on_add_to_roster_menuitem_activate) 
     1045                self.handlers[id] = self._add_to_roster_button 
     1046 
     1047                self._send_file_button = self.xml.get_widget('send_file_button') 
     1048                id = self._send_file_button.connect('clicked', 
     1049                        self._on_send_file_menuitem_activate) 
     1050                self.handlers[id] = self._send_file_button 
     1051 
     1052                self._convert_to_gc_button = self.xml.get_widget( 
     1053                        'convert_to_gc_button') 
     1054                id = self._convert_to_gc_button.connect('clicked', 
     1055                        self._on_convert_to_gc_menuitem_activate) 
     1056                self.handlers[id] = self._convert_to_gc_button 
     1057 
     1058                contact_information_button = self.xml.get_widget( 
     1059                        'contact_information_button') 
     1060                id = contact_information_button.connect('clicked', 
     1061                        self._on_contact_information_menuitem_activate) 
    10551062                self.handlers[id] = contact_information_button 
    10561063 
     
    10601067                        gajim.config.get('hide_chat_banner')) 
    10611068 
    1062                 self.authentication_button = self.xml.get_widget('authentication_button') 
    1063                 id = self.authentication_button.connect('clicked', self._on_authentication_button_clicked) 
     1069                self.authentication_button = self.xml.get_widget( 
     1070                        'authentication_button') 
     1071                id = self.authentication_button.connect('clicked', 
     1072                        self._on_authentication_button_clicked) 
    10641073                self.handlers[id] = self.authentication_button 
    10651074 
     
    10701079                # Convert to GC icon 
    10711080                img = self.xml.get_widget('convert_to_gc_button_image') 
    1072                 img.set_from_pixbuf(gtkgui_helpers.load_icon('muc_active').get_pixbuf()) 
    1073  
    1074                 # Add to roster button 
    1075                 if _('Not in Roster') in contact.groups: 
    1076                         add_to_roster_button.show() 
    1077  
    1078                 # If we don't have resource, we can't do file transfer 
    1079                 # in transports, contact holds our info we need to disable it too 
    1080                 if gajim.capscache.is_supported(contact, NS_FILE): 
    1081                         send_file_button.set_sensitive(True) 
    1082                 else: 
    1083                         send_file_button.set_sensitive(False) 
    1084  
    1085                 # check if it's possible to convert to groupchat 
    1086                 if gajim.capscache.is_supported(contact, NS_MUC): 
    1087                         convert_to_gc_button.set_sensitive(True) 
    1088                 else: 
    1089                         convert_to_gc_button.set_sensitive(False) 
     1081                img.set_from_pixbuf(gtkgui_helpers.load_icon( 
     1082                        'muc_active').get_pixbuf()) 
     1083 
     1084                self.update_toolbar() 
    10901085 
    10911086                # keep timeout id and window obj for possible big avatar 
    1092                 # it is on enter-notify and leave-notify so no need to be per jid 
     1087                # it is on enter-notify and leave-notify so no need to be 
     1088                # per jid 
    10931089                self.show_bigger_avatar_timeout_id = None 
    10941090                self.bigger_avatar_window = None 
     
    11221118 
    11231119                if not session: 
    1124                         session = gajim.connections[self.account].find_controlless_session(self.contact.jid) 
     1120                        session = gajim.connections[self.account]. \ 
     1121                                find_controlless_session(self.contact.jid) 
    11251122 
    11261123                if session: 
     
    11371134                        'gpg_enabled') 
    11381135                e2e_pref = gajim.config.get_per('accounts', self.account, 
    1139                         'autonegotiate_esessions') and gajim.config.get_per('contacts', 
    1140                         contact.jid, 'autonegotiate_esessions') 
     1136                        'autonegotiate_esessions') and \ 
     1137                        gajim.config.get_per('contacts', contact.jid, 
     1138                        'autonegotiate_esessions') 
    11411139 
    11421140                # try GPG first 
     
    11701168                self.restore_conversation() 
    11711169 
     1170        def update_toolbar(self): 
     1171                # Add to roster 
     1172                if _('Not in Roster') in self.contact.groups: 
     1173                        self._add_to_roster_button.show() 
     1174                else: 
     1175                        self._add_to_roster_button.hide() 
     1176 
     1177                # Send file 
     1178                if gajim.capscache.is_supported(self.contact, NS_FILE): 
     1179                        self._send_file_button.set_sensitive(True) 
     1180                else: 
     1181                        self._send_file_button.set_sensitive(False) 
     1182 
     1183                # Convert to GC 
     1184                if gajim.capscache.is_supported(self.contact, NS_MUC): 
     1185                        self._convert_to_gc_button.set_sensitive(True) 
     1186                else: 
     1187                        self._convert_to_gc_button.set_sensitive(False) 
     1188 
    11721189        def on_avatar_eventbox_enter_notify_event(self, widget, event): 
    1173                 '''we enter the eventbox area so we under conditions add a timeout 
    1174                 to show a bigger avatar after 0.5 sec''' 
     1190                ''' 
     1191                we enter the eventbox area so we under conditions add a timeout 
     1192                to show a bigger avatar after 0.5 sec 
     1193                ''' 
    11751194                jid = self.contact.jid 
    11761195                is_fake = False 
     
    11911210                if avatar_w > scaled_buf_w or avatar_h > scaled_buf_h: 
    11921211                        # wait for 0.5 sec in case we leave earlier 
    1193                         self.show_bigger_avatar_timeout_id = gobject.timeout_add(500, 
     1212                        self.show_bigger_avatar_timeout_id = \ 
     1213                                gobject.timeout_add(500, 
    11941214                                self.show_bigger_avatar, widget) 
    11951215 
     
    11981218                # did we add a timeout? if yes remove it 
    11991219                if self.show_bigger_avatar_timeout_id is not None: 
    1200                         gobject.source_remove(self.show_bigger_avatar_timeout_id) 
     1220                        gobject.source_remove( 
     1221                                self.show_bigger_avatar_timeout_id) 
    12011222 
    12021223        def on_avatar_eventbox_button_press_event(self, widget, event):