Beispiel #1
0
    def shared_setup(self):
        """ Called by joined_cb and shared_cb because all of this needs to happen
            whether we are sharing or joining the activity """

        self.__shared_activity = self.__activity.get_shared_activity()

        if self.__shared_activity is None:
            self.__logger.error('Failed to share or join activity!')
            return

        self.__tubes_chan = self.__shared_activity.telepathy_tubes_chan
        self.__iface = self.__tubes_chan[TelepathyGLib.IFACE_CHANNEL_TYPE_TUBES]

        self.__text_chan = self.__shared_activity.telepathy_text_chan
        self.__iface_grp = self.__text_chan[TelepathyGLib.IFACE_CHANNEL_INTERFACE_GROUP]

        self.__conn = self.__shared_activity.telepathy_conn
        self.__my_handle = self.__conn.GetSelfHandle()

        #self.__shared_activity.connect('buddy-joined', self.buddy_joined_cb)
        #self.__shared_activity.connect('buddy-left', self.buddy_left_cb)

        # takes care of downloading (and then sharing) the slide deck over
        # stream tubes
        self.__shared_slides = SharedSlides(
            self.__is_initiating,
            self.__cpxo_path,
            self.__shared_activity,
            self.__activity.read_file)
        self.__shared_slides.connect(
            'deck-download-complete',
            self.deck_download_complete_cb)

        # now for the dbus tube
        self.__iface.connect_to_signal('NewTube', self.new_tube_cb)

        if (self.__is_initiating):
            self.__logger.debug(
                "We are sharing, making a dbus tube and setting locked nav mode.")
            self.lock_nav()
            id = self.__iface.OfferDBusTube(SERVICE, {})
        else:
            self.__logger.debug(
                "We are joining, looking for the global dbus tube.")
            self.__tubes_chan[TelepathyGLib.IFACE_CHANNEL_TYPE_TUBES].ListTubes(
                reply_handler=self.list_tubes_reply_cb,
                error_handler=self.list_tubes_error_cb)