Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/src/jarabe/model/filetransfer.py
diff options
context:
space:
mode:
authorTomeu Vizoso <tomeu@sugarlabs.org>2009-01-21 14:54:18 (GMT)
committer Tomeu Vizoso <tomeu@sugarlabs.org>2009-01-21 14:54:18 (GMT)
commit9e20803bb63c4480fb2b58b5dac51bbef0ed302a (patch)
treeac35865ddbc4e5c3b2098405d4a7c8e782aecd65 /src/jarabe/model/filetransfer.py
parent5b26a0a279dae860d5c6e91c418fee7de4342681 (diff)
Display a message when the collaboration connection doesn't support file transfer
Diffstat (limited to 'src/jarabe/model/filetransfer.py')
-rw-r--r--src/jarabe/model/filetransfer.py27
1 files changed, 24 insertions, 3 deletions
diff --git a/src/jarabe/model/filetransfer.py b/src/jarabe/model/filetransfer.py
index 781b4e1..c66a19c 100644
--- a/src/jarabe/model/filetransfer.py
+++ b/src/jarabe/model/filetransfer.py
@@ -315,11 +315,14 @@ def _monitor_connection(connection):
def _connection_addded_cb(conn_watcher, connection):
_monitor_connection(connection)
+_conn_watcher = None
+
def init():
- conn_watcher = connection_watcher.ConnectionWatcher()
- conn_watcher.connect('connection-added', _connection_addded_cb)
+ global _conn_watcher
+ _conn_watcher = connection_watcher.ConnectionWatcher()
+ _conn_watcher.connect('connection-added', _connection_addded_cb)
- for connection in conn_watcher.get_connections():
+ for connection in _conn_watcher.get_connections():
_monitor_connection(connection)
def start_transfer(buddy, file_name, title, description, mime_type):
@@ -327,5 +330,23 @@ def start_transfer(buddy, file_name, title, description, mime_type):
description, mime_type)
new_file_transfer.send(None, file_transfer=outgoing_file_transfer)
+def file_transfer_available():
+ for connection in _conn_watcher.get_connections():
+
+ properties_iface = connection[dbus.PROPERTIES_IFACE]
+ properties = properties_iface.GetAll(CONNECTION_INTERFACE_REQUESTS)
+ classes = properties['RequestableChannelClasses']
+ for prop, allowed_prop in classes:
+
+ channel_type = prop.get(CHANNEL + '.ChannelType', '')
+ target_handle_type = prop.get(CHANNEL + '.TargetHandleType', '')
+
+ if len(prop) == 2 and \
+ channel_type == CHANNEL_TYPE_FILE_TRANSFER and \
+ target_handle_type == CONNECTION_HANDLE_TYPE_CONTACT:
+ return True
+
+ return False
+
new_file_transfer = dispatch.Signal()