Exemple #1
0
    def activate_multiple(self, leaves, iobjects):
        if len(iobjects) != 1:
            raise NoMultiError()

        ctx = commandexec.DefaultActionExecutionContext()
        token = ctx.get_async_token()

        def _reply():
            self.output_debug("reply got for moving")

        def _reply_error(exc):
            self.output_debug(exc)
            ctx.register_late_error(token, NotAvailableError(_("Thunar")))

        (dest_iobj,) = iobjects
        # Move everything into the destination
        thunar = _get_thunar()
        display = _current_display()
        work_dir = os.path.expanduser("~/")
        notify_id = launch.make_startup_notification_id()
        sourcefiles = [path_to_uri(L.object) for L in leaves]
        desturi = path_to_uri(dest_iobj.object)
        thunar.MoveInto(
            work_dir, sourcefiles, desturi, display, notify_id, reply_handler=_reply, error_handler=_reply_error
        )
Exemple #2
0
 def run(self):
     id_ = launch.make_startup_notification_id()
     thunar = _get_thunar_trash()
     try:
         # Thunar 1.2 Uses $DISPLAY and $STARTUP_ID args
         thunar.EmptyTrash(_current_display(), id_, reply_handler=_dummy, error_handler=_dummy)
     except TypeError:
         # Thunar 1.0 uses only $DISPLAY arg
         thunar.EmptyTrash(_current_display(), reply_handler=_dummy, error_handler=_dummy)
Exemple #3
0
 def activate(self, leaf):
     gfile = gio.File(leaf.object)
     uri = gfile.get_uri()
     id_ = launch.make_startup_notification_id()
     try:
         # Thunar 1.2 Uses $DISPLAY and $STARTUP_ID args
         _get_thunar().DisplayFileProperties(
             uri, _current_display(), id_, reply_handler=_dummy, error_handler=_dummy
         )
     except TypeError:
         # Thunar 1.0 Uses $DISPLAY
         _get_thunar().DisplayFileProperties(uri, _current_display(), reply_handler=_dummy, error_handler=_dummy)
Exemple #4
0
 def activate(self, leaf):
     gfile = gio.File(leaf.object)
     parent = gfile.get_parent()
     if not parent:
         return
     uri = parent.get_uri()
     bname = gfile.get_basename()
     id_ = launch.make_startup_notification_id()
     try:
         # Thunar 1.2 Uses $DISPLAY and $STARTUP_ID args
         _get_thunar().DisplayFolderAndSelect(
             uri, bname, _current_display(), id_, reply_handler=_dummy, error_handler=_dummy
         )
     except TypeError:
         # Thunar 1.0 Uses $DISPLAY
         _get_thunar().DisplayFolderAndSelect(
             uri, bname, _current_display(), reply_handler=_dummy, error_handler=_dummy
         )
Exemple #5
0
    def activate_multiple(self, leaves, iobjects):
        # Unroll by looping over the destinations,
        # copying everything into each destination
        ctx = commandexec.DefaultActionExecutionContext()
        token = ctx.get_async_token()

        thunar = _get_thunar()
        display = _current_display()
        work_dir = os.path.expanduser("~/")
        notify_id = launch.make_startup_notification_id()
        sourcefiles = [path_to_uri(L.object) for L in leaves]

        def _reply(*args):
            self.output_debug("reply got for copying", *args)

        def _reply_error(exc):
            self.output_debug(exc)
            ctx.register_late_error(token, NotAvailableError(_("Thunar")))

        for dest_iobj in iobjects:
            desturi = path_to_uri(dest_iobj.object)
            thunar.CopyInto(
                work_dir, sourcefiles, desturi, display, notify_id, reply_handler=_reply, error_handler=_reply_error
            )