Ejemplo n.º 1
0
    def _object_added_cb(self, cb_service, cb_object):
        """ Code snippet to tag clipboard objects from shared activities """
        shell = get_model()
        logging.debug(shell.get_active_activity())
        current = shell.get_active_activity()
        active_id = current.get_activity_id()
        logging.debug(active_id)
        pservice = presenceservice.get_instance()
        instance = pservice.get_activity(active_id, warn_if_none=False)

        """ For a shared activity should have a pservice entry """
        if instance is None:
            return
        logging.debug("cbobject path " + str(cb_object.get_id()))
        if self._icons:
            group = self._icons.values()[0]
        else:
            group = None

        icon = ClipboardIcon(cb_object, group)
        self.add_item(icon)
        icon.show()
        self._icons[cb_object.get_id()] = icon

        objects_to_delete = self.get_children()[:-self.MAX_ITEMS]
        for icon in objects_to_delete:
            logging.debug('ClipboardTray: deleting surplus object')
            cb_service = clipboard.get_instance()
            cb_service.delete_object(icon.get_object_id())

        logging.debug('ClipboardTray: %r was added', cb_object.get_id())
Ejemplo n.º 2
0
    def _object_added_cb(self, cb_service, cb_object):
        if self._icons:
            group = list(self._icons.values())[0]
        else:
            group = None

        icon = ClipboardIcon(cb_object, group)
        self.add_item(icon)
        icon.show()
        self._icons[cb_object.get_id()] = icon

        objects_to_delete = self.get_children()[:-self.MAX_ITEMS]
        for icon in objects_to_delete:
            logging.debug('ClipboardTray: deleting surplus object')
            cb_service = clipboard.get_instance()
            cb_service.delete_object(icon.get_object_id())

        logging.debug('ClipboardTray: %r was added', cb_object.get_id())
Ejemplo n.º 3
0
    def _object_added_cb(self, cb_service, cb_object):
        if self._icons:
            group = self._icons.values()[0]
        else:
            group = None

        icon = ClipboardIcon(cb_object, group)
        self.add_item(icon)
        icon.show()
        self._icons[cb_object.get_id()] = icon

        objects_to_delete = self.get_children()[:-self.MAX_ITEMS]
        for icon in objects_to_delete:
            logging.debug('ClipboardTray: deleting surplus object')
            cb_service = clipboard.get_instance()
            cb_service.delete_object(icon.get_object_id())

        logging.debug('ClipboardTray: %r was added', cb_object.get_id())