diff --git a/common/Makefile.am.inc b/common/Makefile.am.inc index 324a8695..8b806f9a 100644 --- a/common/Makefile.am.inc +++ b/common/Makefile.am.inc @@ -26,8 +26,8 @@ libxdgapp_common_la_SOURCES = \ common/xdg-app-dir.h \ common/xdg-app-run.c \ common/xdg-app-run.h \ - common/xdg-app-error.c \ - common/xdg-app-error.h \ + common/xdg-app-portal-error.c \ + common/xdg-app-portal-error.h \ common/xdg-app-utils.c \ common/xdg-app-utils.h \ common/xdg-app-chain-input-stream.c \ diff --git a/common/xdg-app-error.c b/common/xdg-app-portal-error.c similarity index 64% rename from common/xdg-app-error.c rename to common/xdg-app-portal-error.c index 6dd50708..dfe89030 100644 --- a/common/xdg-app-error.c +++ b/common/xdg-app-portal-error.c @@ -21,18 +21,18 @@ #include "config.h" -#include "xdg-app-error.h" +#include "xdg-app-portal-error.h" #include static const GDBusErrorEntry xdg_app_error_entries[] = { - {XDG_APP_ERROR_FAILED, "org.freedesktop.XdgApp.Failed"}, - {XDG_APP_ERROR_INVALID_ARGUMENT, "org.freedesktop.XdgApp.InvalidArgument"}, - {XDG_APP_ERROR_NOT_FOUND, "org.freedesktop.XdgApp.NotFound"}, - {XDG_APP_ERROR_EXISTS, "org.freedesktop.XdgApp.Exists"}, - {XDG_APP_ERROR_NOT_ALLOWED, "org.freedesktop.XdgApp.NotAllowed"}, - {XDG_APP_ERROR_CANCELLED, "org.freedesktop.XdgApp.Cancelled"}, - {XDG_APP_ERROR_WINDOW_DESTROYED, "org.freedesktop.XdgApp.WindowDestroyed"}, + {XDG_APP_PORTAL_ERROR_FAILED, "org.freedesktop.XdgApp.Failed"}, + {XDG_APP_PORTAL_ERROR_INVALID_ARGUMENT, "org.freedesktop.XdgApp.InvalidArgument"}, + {XDG_APP_PORTAL_ERROR_NOT_FOUND, "org.freedesktop.XdgApp.NotFound"}, + {XDG_APP_PORTAL_ERROR_EXISTS, "org.freedesktop.XdgApp.Exists"}, + {XDG_APP_PORTAL_ERROR_NOT_ALLOWED, "org.freedesktop.XdgApp.NotAllowed"}, + {XDG_APP_PORTAL_ERROR_CANCELLED, "org.freedesktop.XdgApp.Cancelled"}, + {XDG_APP_PORTAL_ERROR_WINDOW_DESTROYED, "org.freedesktop.XdgApp.WindowDestroyed"}, }; GQuark diff --git a/common/xdg-app-error.h b/common/xdg-app-portal-error.h similarity index 69% rename from common/xdg-app-error.h rename to common/xdg-app-portal-error.h index de26bdf8..4ae8ddbe 100644 --- a/common/xdg-app-error.h +++ b/common/xdg-app-portal-error.h @@ -19,8 +19,8 @@ * Alexander Larsson */ -#ifndef XDG_APP_ERROR_H -#define XDG_APP_ERROR_H +#ifndef XDG_APP_PORTAL_ERROR_H +#define XDG_APP_PORTAL_ERROR_H #include @@ -30,20 +30,20 @@ G_BEGIN_DECLS * XdpErrorEnum: */ typedef enum { - XDG_APP_ERROR_FAILED = 0, - XDG_APP_ERROR_INVALID_ARGUMENT, - XDG_APP_ERROR_NOT_FOUND, - XDG_APP_ERROR_EXISTS, - XDG_APP_ERROR_NOT_ALLOWED, - XDG_APP_ERROR_CANCELLED, - XDG_APP_ERROR_WINDOW_DESTROYED, + XDG_APP_PORTAL_ERROR_FAILED = 0, + XDG_APP_PORTAL_ERROR_INVALID_ARGUMENT, + XDG_APP_PORTAL_ERROR_NOT_FOUND, + XDG_APP_PORTAL_ERROR_EXISTS, + XDG_APP_PORTAL_ERROR_NOT_ALLOWED, + XDG_APP_PORTAL_ERROR_CANCELLED, + XDG_APP_PORTAL_ERROR_WINDOW_DESTROYED, } XdgAppErrorEnum; -#define XDG_APP_ERROR xdg_app_error_quark() +#define XDG_APP_PORTAL_ERROR xdg_app_error_quark() GQuark xdg_app_error_quark (void); G_END_DECLS -#endif /* XDG_APP_ERROR_H */ +#endif /* XDG_APP_PORTAL_ERROR_H */ diff --git a/common/xdg-app-utils.c b/common/xdg-app-utils.c index d1269c31..859dd3e3 100644 --- a/common/xdg-app-utils.c +++ b/common/xdg-app-utils.c @@ -22,7 +22,7 @@ #include "xdg-app-utils.h" #include "xdg-app-dir.h" -#include "xdg-app-error.h" +#include "xdg-app-portal-error.h" #include #include @@ -874,7 +874,7 @@ got_credentials_cb (GObject *source_object, GTask *task = l->data; if (info->app_id == NULL) - g_task_return_new_error (task, XDG_APP_ERROR, XDG_APP_ERROR_FAILED, + g_task_return_new_error (task, XDG_APP_PORTAL_ERROR, XDG_APP_PORTAL_ERROR_FAILED, "Can't find app id"); else g_task_return_pointer (task, g_strdup (info->app_id), g_free); diff --git a/document-portal/xdp-fuse.c b/document-portal/xdp-fuse.c index 2de239a2..1bd6a9eb 100644 --- a/document-portal/xdp-fuse.c +++ b/document-portal/xdp-fuse.c @@ -15,7 +15,7 @@ #include #include -#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 43748919..5138c4c9 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 @@ -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 e02cc70c..5370b1e4 100644 --- a/document-portal/xdp-util.c +++ b/document-portal/xdp-util.c @@ -2,7 +2,7 @@ #include #include #include -#include "xdg-app-error.h" +#include "xdg-app-portal-error.h" #include "xdp-util.h" const char ** diff --git a/lib/xdg-app-installed-ref.c b/lib/xdg-app-installed-ref.c index 6c598826..10d509ce 100644 --- a/lib/xdg-app-installed-ref.c +++ b/lib/xdg-app-installed-ref.c @@ -24,7 +24,6 @@ #include "xdg-app-installed-ref.h" #include "xdg-app-enum-types.h" -#include "xdg-app-error.h" #include "xdg-app-utils.h" #include "xdg-app-run.h" #include "xdg-app-dir.h" @@ -195,7 +194,7 @@ xdg_app_installed_ref_load_metadata (XdgAppInstalledRef *self, if (priv->deploy_dir == NULL) { - g_set_error (error, XDG_APP_ERROR, XDG_APP_ERROR_NOT_FOUND, + g_set_error (error, G_IO_ERROR, G_IO_ERROR_NOT_FOUND, "Unknown deploy directory"); return NULL; } diff --git a/lib/xdg-app-remote-ref.c b/lib/xdg-app-remote-ref.c index 9df6d82d..ec313488 100644 --- a/lib/xdg-app-remote-ref.c +++ b/lib/xdg-app-remote-ref.c @@ -25,7 +25,6 @@ #include "xdg-app-remote-ref-private.h" #include "xdg-app-remote-ref.h" #include "xdg-app-enum-types.h" -#include "xdg-app-error.h" typedef struct _XdgAppRemoteRefPrivate XdgAppRemoteRefPrivate; diff --git a/session-helper/xdg-app-permission-store.c b/session-helper/xdg-app-permission-store.c index a0f9d3d8..3ee60154 100644 --- a/session-helper/xdg-app-permission-store.c +++ b/session-helper/xdg-app-permission-store.c @@ -26,7 +26,7 @@ #include #include "xdg-app-permission-store.h" #include "xdg-app-db.h" -#include "xdg-app-error.h" +#include "xdg-app-portal-error.h" GHashTable *tables = NULL; @@ -70,7 +70,7 @@ lookup_table (const char *name, if (db == NULL) { g_dbus_method_invocation_return_error (invocation, - XDG_APP_ERROR, XDG_APP_ERROR_FAILED, + XDG_APP_PORTAL_ERROR, XDG_APP_PORTAL_ERROR_FAILED, "Unable to load db file: %s", error->message); return NULL; } @@ -105,7 +105,7 @@ writeout_done (GObject *source_object, g_variant_new ("()")); else g_dbus_method_invocation_return_error (invocation, - XDG_APP_ERROR, XDG_APP_ERROR_FAILED, + XDG_APP_PORTAL_ERROR, XDG_APP_PORTAL_ERROR_FAILED, "Unable to write db: %s", error->message); } @@ -180,7 +180,7 @@ handle_lookup (XdgAppPermissionStore *object, if (entry == NULL) { g_dbus_method_invocation_return_error (invocation, - XDG_APP_ERROR, XDG_APP_ERROR_NOT_FOUND, + XDG_APP_PORTAL_ERROR, XDG_APP_PORTAL_ERROR_NOT_FOUND, "No entry for %s", id); return TRUE; } @@ -224,7 +224,7 @@ handle_delete (XdgAppPermissionStore *object, if (entry == NULL) { g_dbus_method_invocation_return_error (invocation, - XDG_APP_ERROR, XDG_APP_ERROR_NOT_FOUND, + XDG_APP_PORTAL_ERROR, XDG_APP_PORTAL_ERROR_NOT_FOUND, "No entry for %s", id); return TRUE; } @@ -260,7 +260,7 @@ handle_set (XdgAppPermissionStore *object, if (old_entry == NULL && !create) { g_dbus_method_invocation_return_error (invocation, - XDG_APP_ERROR, XDG_APP_ERROR_NOT_FOUND, + XDG_APP_PORTAL_ERROR, XDG_APP_PORTAL_ERROR_NOT_FOUND, "Id %s not found", id); return TRUE; } @@ -317,7 +317,7 @@ handle_set_permission (XdgAppPermissionStore *object, else { g_dbus_method_invocation_return_error (invocation, - XDG_APP_ERROR, XDG_APP_ERROR_NOT_FOUND, + XDG_APP_PORTAL_ERROR, XDG_APP_PORTAL_ERROR_NOT_FOUND, "Id %s not found", id); return TRUE; } @@ -355,7 +355,7 @@ handle_set_value (XdgAppPermissionStore *object, else { g_dbus_method_invocation_return_error (invocation, - XDG_APP_ERROR, XDG_APP_ERROR_NOT_FOUND, + XDG_APP_PORTAL_ERROR, XDG_APP_PORTAL_ERROR_NOT_FOUND, "Id %s not found", id); return TRUE; }