Author: asterix
Date: 2008-08-27 09:53:12 +0200 (Wed, 27 Aug 2008)
New Revision: 10319
Modified:
trunk/src/common/connection_handlers.py
trunk/src/common/socks5.py
trunk/src/dialogs.py
trunk/src/gajim.py
trunk/src/secrets.py
Log:
no need of GUI classes in connection_handlers.py, socks5.py and secrets.py
Modified: trunk/src/common/connection_handlers.py
===================================================================
--- trunk/src/common/connection_handlers.py 2008-08-27 07:51:05 UTC (rev 10318)
+++ trunk/src/common/connection_handlers.py 2008-08-27 07:53:12 UTC (rev 10319)
@@ -55,10 +55,6 @@
import dbus
from music_track_listener import MusicTrackListener
-from session import ChatControlSession
-
-gajim.default_session_type = ChatControlSession
-
STATUS_LIST = ['offline', 'connecting', 'online', 'chat', 'away', 'xa', 'dnd',
'invisible', 'error']
# kind of events we can wait for an answer
@@ -1791,7 +1787,7 @@
elif invite is not None:
self.dispatch_invite_message(invite, frm)
else:
- if isinstance(session, ChatControlSession):
+ if isinstance(session, gajim.default_session_type):
session.received(frm, msgtxt, tim, encrypted, msg)
else:
session.received(msg)
Modified: trunk/src/common/socks5.py
===================================================================
--- trunk/src/common/socks5.py 2008-08-27 07:51:05 UTC (rev 10318)
+++ trunk/src/common/socks5.py 2008-08-27 07:53:12 UTC (rev 10319)
@@ -26,7 +26,6 @@
import socket
import struct
import sha
-from dialogs import BindPortError
from errno import EWOULDBLOCK
from errno import ENOBUFS
@@ -52,7 +51,8 @@
class SocksQueue:
''' queue for all file requests objects '''
- def __init__(self, idlequeue, complete_transfer_cb = None, progress_transfer_cb = None):
+ def __init__(self, idlequeue, complete_transfer_cb=None,
+ progress_transfer_cb=None, error_cb=None):
self.connected = 0
self.readers = {}
self.files_props = {}
@@ -65,6 +65,7 @@
self.idlequeue = idlequeue
self.complete_transfer_cb = complete_transfer_cb
self.progress_transfer_cb = progress_transfer_cb
+ self.error_cb = error_cb
self.on_success = None
self.on_failure = None
@@ -77,11 +78,12 @@
self.listener = Socks5Listener(self.idlequeue, port)
self.listener.queue = self
self.listener.bind()
- if self.listener.started is False:
+ if self.listener.started is False or True:
self.listener = None
- # We cannot bind port, call error
- # dialog from dialogs.py and fail
- BindPortError(port)
+ # We cannot bind port, call error callback and fail
+ self.error_cb(_('Unable to bind to port %s.') % port,
+ _('Maybe you have another running instance of Gajim. File '
+ 'Transfer will be cancelled.'))
return None
self.connected += 1
return self.listener
Modified: trunk/src/dialogs.py
===================================================================
--- trunk/src/dialogs.py 2008-08-27 07:51:05 UTC (rev 10318)
+++ trunk/src/dialogs.py 2008-08-27 07:53:12 UTC (rev 10319)
@@ -1186,12 +1186,6 @@
def just_destroy(self, widget):
self.destroy()
-class BindPortError:
- def __init__(self, port):
- ErrorDialog(_('Unable to bind to port %s.') % port,
- _('Maybe you have another running instance of Gajim. '
- 'File Transfer will be cancelled.'))
-
class AspellDictError:
def __init__(self, lang):
ErrorDialog(
Modified: trunk/src/gajim.py
===================================================================
--- trunk/src/gajim.py 2008-08-27 07:51:05 UTC (rev 10318)
+++ trunk/src/gajim.py 2008-08-27 07:53:12 UTC (rev 10319)
@@ -1644,6 +1644,9 @@
notify.popup(event_type, jid, account, 'file-request',
path_to_image = path, title = event_type, text = txt)
+ def handle_event_file_error(self, title, message):
+ dialogs.ErrorDialog(title, message)
+
def handle_event_file_progress(self, account, file_props):
if time.time() - self.last_ftwindow_update > 0.5:
# update ft window every 500ms
@@ -3122,8 +3125,10 @@
gajim.resolver = nslookup.Resolver(gajim.idlequeue)
gajim.socks5queue = socks5.SocksQueue(gajim.idlequeue,
self.handle_event_file_rcv_completed,
- self.handle_event_file_progress)
+ self.handle_event_file_progress,
+ self.handle_event_file_error)
gajim.proxy65_manager = proxy65_manager.Proxy65Manager(gajim.idlequeue)
+ gajim.default_session_type = ChatControlSession
self.register_handlers()
if gajim.config.get('enable_zeroconf'):
gajim.connections[gajim.ZEROCONF_ACC_NAME] = common.zeroconf.connection_zeroconf.ConnectionZeroconf(gajim.ZEROCONF_ACC_NAME)
Modified: trunk/src/secrets.py
===================================================================
--- trunk/src/secrets.py 2008-08-27 07:51:05 UTC (rev 10318)
+++ trunk/src/secrets.py 2008-08-27 07:53:12 UTC (rev 10319)
@@ -24,13 +24,9 @@
from common import crypto
from common import exceptions
-import dialogs
-
import os
import pickle
-import gtk
-
secrets_filename = gajimpaths['SECRETS_FILE']
secrets_cache = None