Codebase list sugar-read-activity / 0743ea3
Port to TelepathyGLib Tested on Fedora 18. James Cameron authored 5 years ago Rahul Bothra committed 5 years ago
1 changed file(s) with 10 addition(s) and 10 deletion(s). Raw diff Collapse all Expand all
3131 import gi
3232 gi.require_version('Gtk', '3.0')
3333 gi.require_version('Gst', '1.0')
34 gi.require_version('TelepathyGLib', '0.12')
3435
3536 from gi.repository import GLib
3637 from gi.repository import GObject
3738 from gi.repository import Gtk
3839 from gi.repository import Gdk
3940 from gi.repository import Gio
41 from gi.repository import TelepathyGLib
4042
4143 GObject.threads_init()
42
43 import telepathy
4444
4545 from sugar3.activity import activity
4646 from sugar3.graphics.toolbutton import ToolButton
891891 def _get_connection_params(self, tube_id):
892892 # return ip and port to download a file
893893 chan = self.shared_activity.telepathy_tubes_chan
894 iface = chan[telepathy.CHANNEL_TYPE_TUBES]
894 iface = chan[TelepathyGLib.IFACE_CHANNEL_TYPE_TUBES]
895895 addr = iface.AcceptStreamTube(
896896 tube_id,
897 telepathy.SOCKET_ADDRESS_TYPE_IPV4,
898 telepathy.SOCKET_ACCESS_CONTROL_LOCALHOST, 0,
897 TelepathyGLib.SocketAddressType.IPV4,
898 TelepathyGLib.SocketAccessControl.LOCALHOST, 0,
899899 utf8_strings=True)
900900 _logger.debug('Accepted stream tube: listening address is %r', addr)
901901 # SOCKET_ADDRESS_TYPE_IPV4 is defined to have addresses of type '(sq)'
10851085
10861086 # Make a tube for it
10871087 chan = self.shared_activity.telepathy_tubes_chan
1088 iface = chan[telepathy.CHANNEL_TYPE_TUBES]
1088 iface = chan[TelepathyGLib.IFACE_CHANNEL_TYPE_TUBES]
10891089 self._fileserver_tube_id = iface.OfferStreamTube(
10901090 READ_STREAM_SERVICE,
10911091 {},
1092 telepathy.SOCKET_ADDRESS_TYPE_IPV4,
1092 TelepathyGLib.SocketAddressType.IPV4,
10931093 ('127.0.0.1', dbus.UInt16(self.port)),
1094 telepathy.SOCKET_ACCESS_CONTROL_LOCALHOST, 0)
1094 TelepathyGLib.SocketAccessControl.LOCALHOST, 0)
10951095
10961096 def create_metadata_file(self):
10971097 # store the metadata in a json file
11111111 """Watch for new tubes."""
11121112 tubes_chan = self.shared_activity.telepathy_tubes_chan
11131113
1114 tubes_chan[telepathy.CHANNEL_TYPE_TUBES].connect_to_signal(
1114 tubes_chan[TelepathyGLib.IFACE_CHANNEL_TYPE_TUBES].connect_to_signal(
11151115 'NewTube', self._new_tube_cb)
1116 tubes_chan[telepathy.CHANNEL_TYPE_TUBES].ListTubes(
1116 tubes_chan[TelepathyGLib.IFACE_CHANNEL_TYPE_TUBES].ListTubes(
11171117 reply_handler=self._list_tubes_reply_cb,
11181118 error_handler=self._list_tubes_error_cb)
11191119