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
|
@ -153,9 +153,8 @@ class FileTransfersWindow:
|
|||
''' show a dialog saying that file (file_props) has been transferred'''
|
||||
self.window.present()
|
||||
self.window.window.focus()
|
||||
|
||||
def on_open(widget, file_props):
|
||||
self.dialog.destroy()
|
||||
dialog.destroy()
|
||||
if not file_props.has_key('file-name'):
|
||||
return
|
||||
(path, file) = os.path.split(file_props['file-name'])
|
||||
|
@ -192,17 +191,17 @@ class FileTransfersWindow:
|
|||
sectext += recipient
|
||||
if file_props['type'] == 'r':
|
||||
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)
|
||||
if file_props['type'] == 'r':
|
||||
button = gtk.Button(_('_Open Containing Folder'))
|
||||
button.connect('clicked', on_open, file_props)
|
||||
self.dialog.action_area.pack_start(button)
|
||||
ok_button = self.dialog.add_button(gtk.STOCK_OK, gtk.RESPONSE_OK)
|
||||
dialog.action_area.pack_start(button)
|
||||
ok_button = dialog.add_button(gtk.STOCK_OK, gtk.RESPONSE_OK)
|
||||
def on_ok(widget):
|
||||
self.dialog.destroy()
|
||||
dialog.destroy()
|
||||
ok_button.connect('clicked', on_ok)
|
||||
self.dialog.show_all()
|
||||
dialog.show_all()
|
||||
|
||||
def show_request_error(self, file_props):
|
||||
''' 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 on_ok(widget):
|
||||
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)
|
||||
for file_path in files_path_list:
|
||||
|
@ -245,16 +244,16 @@ _('Connection with peer cannot be established.'))
|
|||
file_dir = os.path.dirname(file_path)
|
||||
if 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.RESPONSE_OK,
|
||||
True, # select multiple true as we can select many files to send
|
||||
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.connect('clicked', on_ok)
|
||||
|
||||
|
|
Loading…
Reference in New Issue