1
0
mirror of https://github.com/arsenetar/send2trash.git synced 2026-01-22 14:41:40 +00:00

fix: Update gio implementation to use GLib.Error instead of deprecated GObject.GError

This commit is contained in:
2025-12-31 03:32:50 +00:00
committed by GitHub
parent 2b20d606e2
commit a6539d146b

View File

@@ -4,7 +4,7 @@
# which should be included with this package. The terms are also available at # which should be included with this package. The terms are also available at
# http://www.hardcoded.net/licenses/bsd_license # http://www.hardcoded.net/licenses/bsd_license
from gi.repository import GObject, Gio from gi.repository import Gio, GLib
from send2trash.exceptions import TrashPermissionError from send2trash.exceptions import TrashPermissionError
from send2trash.util import preprocess_paths from send2trash.util import preprocess_paths
@@ -15,7 +15,7 @@ def send2trash(paths):
try: try:
f = Gio.File.new_for_path(path) f = Gio.File.new_for_path(path)
f.trash(cancellable=None) f.trash(cancellable=None)
except GObject.GError as e: except GLib.Error as e:
if e.code == Gio.IOErrorEnum.NOT_SUPPORTED: if e.code == Gio.IOErrorEnum.NOT_SUPPORTED:
# We get here if we can't create a trash directory on the same # We get here if we can't create a trash directory on the same
# device. I don't know if other errors can result in NOT_SUPPORTED. # device. I don't know if other errors can result in NOT_SUPPORTED.