Show a real error box when unable to bind to port

Fixes #1941.
This commit is contained in:
Jean-Marie Traissard 2006-06-05 17:07:48 +00:00
parent 936b99cc3e
commit 9ed43cf6d1
2 changed files with 10 additions and 6 deletions

View File

@ -32,6 +32,7 @@ import os
import struct import struct
import sha import sha
import time import time
from dialogs import BindPortError
from errno import EWOULDBLOCK from errno import EWOULDBLOCK
from errno import ENOBUFS from errno import ENOBUFS
@ -84,12 +85,9 @@ class SocksQueue:
self.listener.bind() self.listener.bind()
if self.listener.started is False: if self.listener.started is False:
self.listener = None self.listener = None
import sys # We cannot bind port, call error
print >> sys.stderr, '=================================================' # dialog from dialogs.py and fail
print >> sys.stderr, 'Unable to bind to port %s.' % port BindPortError(port)
print >> sys.stderr, 'Maybe you have another running instance of Gajim.'
print >> sys.stderr, 'File Transfer will be canceled.'
print >> sys.stderr, '================================================='
return None return None
self.connected += 1 self.connected += 1
return self.listener return self.listener

View File

@ -731,6 +731,12 @@ class FileChooserDialog(gtk.FileChooserDialog):
def just_destroy(self, widget): def just_destroy(self, widget):
self.destroy() self.destroy()
class BindPortError(HigDialog):
def __init__(self, port):
ErrorDialog(_('Unable to bind to port %s.' % port),
_('Maybe you have another running instance of Gajim. '
'File Transfer will be canceled.'))
class ConfirmationDialog(HigDialog): class ConfirmationDialog(HigDialog):
'''HIG compliant confirmation dialog.''' '''HIG compliant confirmation dialog.'''
def __init__(self, pritext, sectext='', on_response_ok = None, def __init__(self, pritext, sectext='', on_response_ok = None,