mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-02-03 01:36:17 +01:00
trash portal: Handle portal failures
Previously, only whether or not the D-Bus call itself succeeded was checked, regardless of the result code from the actual trash operation.
This commit is contained in:
parent
9bc61def1f
commit
88032cb541
@ -74,6 +74,7 @@ g_trash_portal_trash_file (GFile *file,
|
|||||||
GUnixFDList *fd_list = NULL;
|
GUnixFDList *fd_list = NULL;
|
||||||
int fd, fd_in, errsv;
|
int fd, fd_in, errsv;
|
||||||
gboolean ret = FALSE;
|
gboolean ret = FALSE;
|
||||||
|
guint portal_result = 0;
|
||||||
GXdpTrash *proxy;
|
GXdpTrash *proxy;
|
||||||
|
|
||||||
proxy = ensure_trash_portal ();
|
proxy = ensure_trash_portal ();
|
||||||
@ -114,11 +115,17 @@ g_trash_portal_trash_file (GFile *file,
|
|||||||
ret = gxdp_trash_call_trash_file_sync (proxy,
|
ret = gxdp_trash_call_trash_file_sync (proxy,
|
||||||
g_variant_new_handle (fd_in),
|
g_variant_new_handle (fd_in),
|
||||||
fd_list,
|
fd_list,
|
||||||
NULL,
|
&portal_result,
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
error);
|
error);
|
||||||
|
|
||||||
|
if (ret && portal_result != 1)
|
||||||
|
{
|
||||||
|
g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED, "Trash portal failed on %s", path);
|
||||||
|
ret = FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
out:
|
out:
|
||||||
g_clear_object (&fd_list);
|
g_clear_object (&fd_list);
|
||||||
g_free (path);
|
g_free (path);
|
||||||
|
Loading…
Reference in New Issue
Block a user