don't keep dialog references in self.
(problem when we open several FT choosers, or info dialogs)
This commit is contained in:
		
							parent
							
								
									64e66817e5
								
							
						
					
					
						commit
						99de39fcaf
					
				
					 1 changed files with 10 additions and 11 deletions
				
			
		| 
						 | 
					@ -153,9 +153,8 @@ class FileTransfersWindow:
 | 
				
			||||||
		''' show a dialog saying that file (file_props) has been transferred'''
 | 
							''' show a dialog saying that file (file_props) has been transferred'''
 | 
				
			||||||
		self.window.present()
 | 
							self.window.present()
 | 
				
			||||||
		self.window.window.focus()
 | 
							self.window.window.focus()
 | 
				
			||||||
 | 
					 | 
				
			||||||
		def on_open(widget, file_props):
 | 
							def on_open(widget, file_props):
 | 
				
			||||||
			self.dialog.destroy()
 | 
								dialog.destroy()
 | 
				
			||||||
			if not file_props.has_key('file-name'):
 | 
								if not file_props.has_key('file-name'):
 | 
				
			||||||
				return
 | 
									return
 | 
				
			||||||
			(path, file) = os.path.split(file_props['file-name'])
 | 
								(path, file) = os.path.split(file_props['file-name'])
 | 
				
			||||||
| 
						 | 
					@ -192,17 +191,17 @@ class FileTransfersWindow:
 | 
				
			||||||
		sectext += recipient
 | 
							sectext += recipient
 | 
				
			||||||
		if file_props['type'] == 'r':
 | 
							if file_props['type'] == 'r':
 | 
				
			||||||
			sectext += '\n\t' +_('Saved in: %s') % file_path
 | 
								sectext += '\n\t' +_('Saved in: %s') % file_path
 | 
				
			||||||
		self.dialog = dialogs.HigDialog(None, gtk.MESSAGE_INFO, gtk.BUTTONS_NONE, 
 | 
							dialog = dialogs.HigDialog(None, gtk.MESSAGE_INFO, gtk.BUTTONS_NONE, 
 | 
				
			||||||
				_('File transfer completed'), sectext)
 | 
									_('File transfer completed'), sectext)
 | 
				
			||||||
		if file_props['type'] == 'r':
 | 
							if file_props['type'] == 'r':
 | 
				
			||||||
			button = gtk.Button(_('_Open Containing Folder'))
 | 
								button = gtk.Button(_('_Open Containing Folder'))
 | 
				
			||||||
			button.connect('clicked', on_open, file_props)
 | 
								button.connect('clicked', on_open, file_props)
 | 
				
			||||||
			self.dialog.action_area.pack_start(button)
 | 
								dialog.action_area.pack_start(button)
 | 
				
			||||||
		ok_button = self.dialog.add_button(gtk.STOCK_OK, gtk.RESPONSE_OK)
 | 
							ok_button = dialog.add_button(gtk.STOCK_OK, gtk.RESPONSE_OK)
 | 
				
			||||||
		def on_ok(widget):
 | 
							def on_ok(widget):
 | 
				
			||||||
			self.dialog.destroy()
 | 
								dialog.destroy()
 | 
				
			||||||
		ok_button.connect('clicked', on_ok)
 | 
							ok_button.connect('clicked', on_ok)
 | 
				
			||||||
		self.dialog.show_all()
 | 
							dialog.show_all()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	def show_request_error(self, file_props):
 | 
						def show_request_error(self, file_props):
 | 
				
			||||||
		''' show error dialog to the recipient saying that transfer 
 | 
							''' show error dialog to the recipient saying that transfer 
 | 
				
			||||||
| 
						 | 
					@ -237,7 +236,7 @@ _('Connection with peer cannot be established.'))
 | 
				
			||||||
	def show_file_send_request(self, account, contact):
 | 
						def show_file_send_request(self, account, contact):
 | 
				
			||||||
		def on_ok(widget):
 | 
							def on_ok(widget):
 | 
				
			||||||
			file_dir = None
 | 
								file_dir = None
 | 
				
			||||||
			files_path_list = self.dialog.get_filenames()
 | 
								files_path_list = dialog.get_filenames()
 | 
				
			||||||
			files_path_list = gtkgui_helpers.decode_filechooser_file_paths(
 | 
								files_path_list = gtkgui_helpers.decode_filechooser_file_paths(
 | 
				
			||||||
				files_path_list)
 | 
									files_path_list)
 | 
				
			||||||
			for file_path in files_path_list:
 | 
								for file_path in files_path_list:
 | 
				
			||||||
| 
						 | 
					@ -245,16 +244,16 @@ _('Connection with peer cannot be established.'))
 | 
				
			||||||
					file_dir = os.path.dirname(file_path)
 | 
										file_dir = os.path.dirname(file_path)
 | 
				
			||||||
			if file_dir:
 | 
								if file_dir:
 | 
				
			||||||
				gajim.config.set('last_send_dir', file_dir)
 | 
									gajim.config.set('last_send_dir', file_dir)
 | 
				
			||||||
				self.dialog.destroy()
 | 
									dialog.destroy()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		self.dialog = dialogs.FileChooserDialog(_('Choose File to Send...'), 
 | 
							dialog = dialogs.FileChooserDialog(_('Choose File to Send...'), 
 | 
				
			||||||
			gtk.FILE_CHOOSER_ACTION_OPEN, (gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL),
 | 
								gtk.FILE_CHOOSER_ACTION_OPEN, (gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL),
 | 
				
			||||||
			gtk.RESPONSE_OK,
 | 
								gtk.RESPONSE_OK,
 | 
				
			||||||
			True, # select multiple true as we can select many files to send
 | 
								True, # select multiple true as we can select many files to send
 | 
				
			||||||
			gajim.config.get('last_send_dir'),
 | 
								gajim.config.get('last_send_dir'),
 | 
				
			||||||
			)
 | 
								)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		btn = self.dialog.add_button(_('_Send'), gtk.RESPONSE_OK)
 | 
							btn = dialog.add_button(_('_Send'), gtk.RESPONSE_OK)
 | 
				
			||||||
		btn.set_use_stock(True) # FIXME: add send icon to this button (JUMP_TO)
 | 
							btn.set_use_stock(True) # FIXME: add send icon to this button (JUMP_TO)
 | 
				
			||||||
		btn.connect('clicked', on_ok)
 | 
							btn.connect('clicked', on_ok)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		
		Reference in a new issue