clean some vars when we close (group)chat windows/tabs
This commit is contained in:
		
							parent
							
								
									5ffbf2dbc0
								
							
						
					
					
						commit
						8018890427
					
				
					 3 changed files with 22 additions and 24 deletions
				
			
		
							
								
								
									
										29
									
								
								src/chat.py
									
										
									
									
									
								
							
							
						
						
									
										29
									
								
								src/chat.py
									
										
									
									
									
								
							| 
						 | 
					@ -319,32 +319,31 @@ class Chat:
 | 
				
			||||||
					gajim.config.set('gc-width', width)
 | 
										gajim.config.set('gc-width', width)
 | 
				
			||||||
					gajim.config.set('gc-height', height)
 | 
										gajim.config.set('gc-height', height)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			# FIXME: if we're here the del in 10 lines will not be called!
 | 
					 | 
				
			||||||
			# maybe mem leak?
 | 
					 | 
				
			||||||
			self.window.destroy()
 | 
								self.window.destroy()
 | 
				
			||||||
			return
 | 
							else:
 | 
				
			||||||
		if self.nb_unread[jid] > 0:
 | 
								if self.nb_unread[jid] > 0:
 | 
				
			||||||
			self.nb_unread[jid] = 0
 | 
									self.nb_unread[jid] = 0
 | 
				
			||||||
 | 
									if self.plugin.systray_enabled:
 | 
				
			||||||
 | 
										self.plugin.systray.remove_jid(jid, self.account)
 | 
				
			||||||
 | 
								if self.print_time_timeout_id.has_key(jid):
 | 
				
			||||||
 | 
									gobject.source_remove(self.print_time_timeout_id[jid])
 | 
				
			||||||
 | 
									del self.print_time_timeout_id[jid]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								self.notebook.remove_page(self.notebook.page_num(self.childs[jid]))
 | 
				
			||||||
 | 
								if len(self.xmls) == 2:
 | 
				
			||||||
 | 
									# one that remains and one that we'll remove, 1 tab remains
 | 
				
			||||||
 | 
									self.notebook.set_show_tabs(False)
 | 
				
			||||||
			self.show_title()
 | 
								self.show_title()
 | 
				
			||||||
			if self.plugin.systray_enabled:
 | 
					 | 
				
			||||||
				self.plugin.systray.remove_jid(jid, self.account)
 | 
					 | 
				
			||||||
		if self.print_time_timeout_id.has_key(jid):
 | 
					 | 
				
			||||||
			gobject.source_remove(self.print_time_timeout_id[jid])
 | 
					 | 
				
			||||||
			del self.print_time_timeout_id[jid]
 | 
					 | 
				
			||||||
		self.notebook.remove_page(self.notebook.page_num(self.childs[jid]))
 | 
					 | 
				
			||||||
		if len(self.xmls) == 2:
 | 
					 | 
				
			||||||
			# one that remains and one that we'll remove, 1 tab remains
 | 
					 | 
				
			||||||
			self.notebook.set_show_tabs(False)
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
		del self.plugin.windows[self.account][kind][jid]
 | 
							del self.plugin.windows[self.account][kind][jid]
 | 
				
			||||||
		del self.nb_unread[jid]
 | 
							del self.nb_unread[jid]
 | 
				
			||||||
		del gajim.last_message_time[self.account][jid]
 | 
							del gajim.last_message_time[self.account][jid]
 | 
				
			||||||
		del self.last_time_printout[jid]
 | 
							del self.last_time_printout[jid]
 | 
				
			||||||
		del self.xmls[jid]
 | 
							del self.xmls[jid]
 | 
				
			||||||
 | 
							del self.childs[jid]
 | 
				
			||||||
		del self.tagIn[jid]
 | 
							del self.tagIn[jid]
 | 
				
			||||||
		del self.tagOut[jid]
 | 
							del self.tagOut[jid]
 | 
				
			||||||
		del self.tagStatus[jid]
 | 
							del self.tagStatus[jid]
 | 
				
			||||||
		self.show_title()
 | 
					 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	def bring_scroll_to_end(self, textview, diff_y = 0):
 | 
						def bring_scroll_to_end(self, textview, diff_y = 0):
 | 
				
			||||||
		''' scrolls to the end of textview if end is not visible '''
 | 
							''' scrolls to the end of textview if end is not visible '''
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -940,13 +940,13 @@ class GroupchatWindow(chat.Chat):
 | 
				
			||||||
		if len(self.xmls) > 0:
 | 
							if len(self.xmls) > 0:
 | 
				
			||||||
			gajim.connections[self.account].send_gc_status(self.nicks[room_jid],
 | 
								gajim.connections[self.account].send_gc_status(self.nicks[room_jid],
 | 
				
			||||||
				room_jid, 'offline', 'offline')
 | 
									room_jid, 'offline', 'offline')
 | 
				
			||||||
			del self.nicks[room_jid]
 | 
							del self.nicks[room_jid]
 | 
				
			||||||
			del gajim.gc_contacts[self.account][room_jid]
 | 
							del gajim.gc_contacts[self.account][room_jid]
 | 
				
			||||||
			del gajim.gc_connected[self.account][room_jid]
 | 
							del gajim.gc_connected[self.account][room_jid]
 | 
				
			||||||
			del self.list_treeview[room_jid]
 | 
							del self.list_treeview[room_jid]
 | 
				
			||||||
			del self.subjects[room_jid]
 | 
							del self.subjects[room_jid]
 | 
				
			||||||
			del self.name_labels[room_jid]
 | 
							del self.name_labels[room_jid]
 | 
				
			||||||
			del self.hpaneds[room_jid]
 | 
							del self.hpaneds[room_jid]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	def got_disconnected(self, room_jid):
 | 
						def got_disconnected(self, room_jid):
 | 
				
			||||||
		model = self.list_treeview[room_jid].get_model()
 | 
							model = self.list_treeview[room_jid].get_model()
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -309,8 +309,7 @@ class TabbedChatWindow(chat.Chat):
 | 
				
			||||||
		self.send_chatstate('gone', jid)
 | 
							self.send_chatstate('gone', jid)
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
		chat.Chat.remove_tab(self, jid, 'chats')
 | 
							chat.Chat.remove_tab(self, jid, 'chats')
 | 
				
			||||||
		if len(self.xmls) > 0:
 | 
							del self.contacts[jid]
 | 
				
			||||||
			del self.contacts[jid]
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	def new_user(self, contact):
 | 
						def new_user(self, contact):
 | 
				
			||||||
		'''when new tab is created'''
 | 
							'''when new tab is created'''
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		
		Reference in a new issue