diff options
author | Alexander Larsson <alexl@redhat.com> | 2015-12-08 12:16:38 +0100 |
---|---|---|
committer | Alexander Larsson <alexl@redhat.com> | 2015-12-08 12:16:38 +0100 |
commit | 4177f358cb607e7e2b0fd7c29c6d35e6d4eafa1b (patch) | |
tree | 84b9f8e38fd45cfd0b866d7ebc32675eb6ab2468 /document-portal | |
parent | a28ced36c7d70ad549b910ae114bd407b512aee4 (diff) | |
download | xdg-app-4177f358cb607e7e2b0fd7c29c6d35e6d4eafa1b.tar.gz |
common: Make it explicit that XdgAppError are portal errors
Diffstat (limited to 'document-portal')
-rw-r--r-- | document-portal/xdp-fuse.c | 8 | ||||
-rw-r--r-- | document-portal/xdp-main.c | 34 | ||||
-rw-r--r-- | document-portal/xdp-util.c | 2 |
3 files changed, 22 insertions, 22 deletions
diff --git a/document-portal/xdp-fuse.c b/document-portal/xdp-fuse.c index 2de239a..1bd6a9e 100644 --- a/document-portal/xdp-fuse.c +++ b/document-portal/xdp-fuse.c @@ -15,7 +15,7 @@ #include <gio/gio.h> #include <pthread.h> -#include "xdg-app-error.h" +#include "xdg-app-portal-error.h" #include "xdp-fuse.h" #include "xdp-util.h" #include "xdg-app-utils.h" @@ -2206,7 +2206,7 @@ xdp_fuse_init (GError **error) if (g_mkdir_with_parents (mount_path, 0700)) { - g_set_error (error, XDG_APP_ERROR, XDG_APP_ERROR_FAILED, + g_set_error (error, XDG_APP_PORTAL_ERROR, XDG_APP_PORTAL_ERROR_FAILED, "Unable to create dir %s\n", mount_path); return FALSE; } @@ -2214,7 +2214,7 @@ xdp_fuse_init (GError **error) main_ch = fuse_mount (mount_path, &args); if (main_ch == NULL) { - g_set_error (error, XDG_APP_ERROR, XDG_APP_ERROR_FAILED, "Can't mount fuse fs"); + g_set_error (error, XDG_APP_PORTAL_ERROR, XDG_APP_PORTAL_ERROR_FAILED, "Can't mount fuse fs"); return FALSE; } @@ -2222,7 +2222,7 @@ xdp_fuse_init (GError **error) sizeof (xdp_fuse_oper), NULL); if (session == NULL) { - g_set_error (error, XDG_APP_ERROR, XDG_APP_ERROR_FAILED, + g_set_error (error, XDG_APP_PORTAL_ERROR, XDG_APP_PORTAL_ERROR_FAILED, "Can't create fuse session"); return FALSE; } diff --git a/document-portal/xdp-main.c b/document-portal/xdp-main.c index 4374891..5138c4c 100644 --- a/document-portal/xdp-main.c +++ b/document-portal/xdp-main.c @@ -16,7 +16,7 @@ #include "xdg-app-db.h" #include "xdg-app-dbus.h" #include "xdg-app-utils.h" -#include "xdg-app-error.h" +#include "xdg-app-portal-error.h" #include "xdp-fuse.h" #include <sys/eventfd.h> @@ -139,14 +139,14 @@ portal_grant_permissions (GDBusMethodInvocation *invocation, entry = xdg_app_db_lookup (db, id); if (entry == NULL) { - g_dbus_method_invocation_return_error (invocation, XDG_APP_ERROR, XDG_APP_ERROR_NOT_FOUND, + g_dbus_method_invocation_return_error (invocation, XDG_APP_PORTAL_ERROR, XDG_APP_PORTAL_ERROR_NOT_FOUND, "No such document: %s", id); return; } if (!xdg_app_is_valid_name (target_app_id)) { - g_dbus_method_invocation_return_error (invocation, XDG_APP_ERROR, XDG_APP_ERROR_INVALID_ARGUMENT, + g_dbus_method_invocation_return_error (invocation, XDG_APP_PORTAL_ERROR, XDG_APP_PORTAL_ERROR_INVALID_ARGUMENT, "Invalid app name: %s", target_app_id); return; } @@ -157,7 +157,7 @@ portal_grant_permissions (GDBusMethodInvocation *invocation, if (!xdp_entry_has_permissions (entry, app_id, XDP_PERMISSION_FLAGS_GRANT_PERMISSIONS | perms)) { - g_dbus_method_invocation_return_error (invocation, XDG_APP_ERROR, XDG_APP_ERROR_NOT_ALLOWED, + g_dbus_method_invocation_return_error (invocation, XDG_APP_PORTAL_ERROR, XDG_APP_PORTAL_ERROR_NOT_ALLOWED, "Not enough permissions"); return; } @@ -186,14 +186,14 @@ portal_revoke_permissions (GDBusMethodInvocation *invocation, entry = xdg_app_db_lookup (db, id); if (entry == NULL) { - g_dbus_method_invocation_return_error (invocation, XDG_APP_ERROR, XDG_APP_ERROR_NOT_FOUND, + g_dbus_method_invocation_return_error (invocation, XDG_APP_PORTAL_ERROR, XDG_APP_PORTAL_ERROR_NOT_FOUND, "No such document: %s", id); return; } if (!xdg_app_is_valid_name (target_app_id)) { - g_dbus_method_invocation_return_error (invocation, XDG_APP_ERROR, XDG_APP_ERROR_INVALID_ARGUMENT, + g_dbus_method_invocation_return_error (invocation, XDG_APP_PORTAL_ERROR, XDG_APP_PORTAL_ERROR_INVALID_ARGUMENT, "Invalid app name: %s", target_app_id); return; } @@ -205,7 +205,7 @@ portal_revoke_permissions (GDBusMethodInvocation *invocation, XDP_PERMISSION_FLAGS_GRANT_PERMISSIONS) || strcmp (app_id, target_app_id) == 0) { - g_dbus_method_invocation_return_error (invocation, XDG_APP_ERROR, XDG_APP_ERROR_NOT_ALLOWED, + g_dbus_method_invocation_return_error (invocation, XDG_APP_PORTAL_ERROR, XDG_APP_PORTAL_ERROR_NOT_ALLOWED, "Not enough permissions"); return; } @@ -233,14 +233,14 @@ portal_delete (GDBusMethodInvocation *invocation, entry = xdg_app_db_lookup (db, id); if (entry == NULL) { - g_dbus_method_invocation_return_error (invocation, XDG_APP_ERROR, XDG_APP_ERROR_NOT_FOUND, + g_dbus_method_invocation_return_error (invocation, XDG_APP_PORTAL_ERROR, XDG_APP_PORTAL_ERROR_NOT_FOUND, "No such document: %s", id); return; } if (!xdp_entry_has_permissions (entry, app_id, XDP_PERMISSION_FLAGS_DELETE)) { - g_dbus_method_invocation_return_error (invocation, XDG_APP_ERROR, XDG_APP_ERROR_NOT_ALLOWED, + g_dbus_method_invocation_return_error (invocation, XDG_APP_PORTAL_ERROR, XDG_APP_PORTAL_ERROR_NOT_ALLOWED, "Not enough permissions"); return; } @@ -369,7 +369,7 @@ portal_add (GDBusMethodInvocation *invocation, (symlink_size = readlink (proc_path, path_buffer, sizeof (path_buffer) - 1)) < 0) { g_dbus_method_invocation_return_error (invocation, - XDG_APP_ERROR, XDG_APP_ERROR_INVALID_ARGUMENT, + XDG_APP_PORTAL_ERROR, XDG_APP_PORTAL_ERROR_INVALID_ARGUMENT, "Invalid fd passed"); return; } @@ -390,7 +390,7 @@ portal_add (GDBusMethodInvocation *invocation, { /* Don't leak any info about real file path existance, etc */ g_dbus_method_invocation_return_error (invocation, - XDG_APP_ERROR, XDG_APP_ERROR_INVALID_ARGUMENT, + XDG_APP_PORTAL_ERROR, XDG_APP_PORTAL_ERROR_INVALID_ARGUMENT, "Invalid fd passed"); return; } @@ -410,7 +410,7 @@ portal_add (GDBusMethodInvocation *invocation, if (old_id == 0) { g_dbus_method_invocation_return_error (invocation, - XDG_APP_ERROR, XDG_APP_ERROR_INVALID_ARGUMENT, + XDG_APP_PORTAL_ERROR, XDG_APP_PORTAL_ERROR_INVALID_ARGUMENT, "Invalid fd passed"); return; } @@ -426,7 +426,7 @@ portal_add (GDBusMethodInvocation *invocation, !reuse_existing) { g_dbus_method_invocation_return_error (invocation, - XDG_APP_ERROR, XDG_APP_ERROR_INVALID_ARGUMENT, + XDG_APP_PORTAL_ERROR, XDG_APP_PORTAL_ERROR_INVALID_ARGUMENT, "Invalid fd passed"); return; } @@ -482,7 +482,7 @@ portal_add_named (GDBusMethodInvocation *invocation, /* This is only allowed from the host, or else we could leak existance of files */ if (*app_id != 0) { - g_dbus_method_invocation_return_error (invocation, XDG_APP_ERROR, XDG_APP_ERROR_NOT_ALLOWED, + g_dbus_method_invocation_return_error (invocation, XDG_APP_PORTAL_ERROR, XDG_APP_PORTAL_ERROR_NOT_ALLOWED, "Not enough permissions"); return; } @@ -501,7 +501,7 @@ portal_add_named (GDBusMethodInvocation *invocation, if (strchr (filename, '/') != NULL) { g_dbus_method_invocation_return_error (invocation, - XDG_APP_ERROR, XDG_APP_ERROR_INVALID_ARGUMENT, + XDG_APP_PORTAL_ERROR, XDG_APP_PORTAL_ERROR_INVALID_ARGUMENT, "Invalid filename passed"); return; } @@ -524,7 +524,7 @@ portal_add_named (GDBusMethodInvocation *invocation, (symlink_size = readlink (proc_path, parent_path_buffer, sizeof (parent_path_buffer) - 1)) < 0) { g_dbus_method_invocation_return_error (invocation, - XDG_APP_ERROR, XDG_APP_ERROR_INVALID_ARGUMENT, + XDG_APP_PORTAL_ERROR, XDG_APP_PORTAL_ERROR_INVALID_ARGUMENT, "Invalid fd passed"); return; } @@ -532,7 +532,7 @@ portal_add_named (GDBusMethodInvocation *invocation, if (parent_st_buf.st_dev == fuse_dev) { g_dbus_method_invocation_return_error (invocation, - XDG_APP_ERROR, XDG_APP_ERROR_INVALID_ARGUMENT, + XDG_APP_PORTAL_ERROR, XDG_APP_PORTAL_ERROR_INVALID_ARGUMENT, "Invalid fd passed"); return; } diff --git a/document-portal/xdp-util.c b/document-portal/xdp-util.c index e02cc70..5370b1e 100644 --- a/document-portal/xdp-util.c +++ b/document-portal/xdp-util.c @@ -2,7 +2,7 @@ #include <string.h> #include <errno.h> #include <gio/gio.h> -#include "xdg-app-error.h" +#include "xdg-app-portal-error.h" #include "xdp-util.h" const char ** |