summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Larsson <alexl@redhat.com>2016-05-12 22:03:42 +0200
committerAlexander Larsson <alexl@redhat.com>2016-05-12 22:03:42 +0200
commit0098164cd6b89e715c734a1a8ac5ad22665feb57 (patch)
tree2f80fbcff1e13306c0eb0f47b3ebdf043062dee5
parent29390fff3995600b8b776f9d1681e75ab26ba18a (diff)
downloadxdg-app-0098164cd6b89e715c734a1a8ac5ad22665feb57.tar.gz
Register dbus errors for FLATPAK_ERROR
This allows us to transparently pass them from the system helper.
-rw-r--r--common/flatpak-dir.c4
-rw-r--r--common/flatpak-utils.c17
2 files changed, 20 insertions, 1 deletions
diff --git a/common/flatpak-dir.c b/common/flatpak-dir.c
index 06899dd..d00d313 100644
--- a/common/flatpak-dir.c
+++ b/common/flatpak-dir.c
@@ -210,6 +210,10 @@ flatpak_dir_get_system_helper (FlatpakDir *self)
if (g_once_init_enter (&self->system_helper))
{
FlatpakSystemHelper *system_helper;
+
+ /* To ensure reverse mapping */
+ flatpak_error_quark ();
+
system_helper =
flatpak_system_helper_proxy_new_for_bus_sync (G_BUS_TYPE_SYSTEM,
G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES |
diff --git a/common/flatpak-utils.c b/common/flatpak-utils.c
index dfa62c3..18e66cf 100644
--- a/common/flatpak-utils.c
+++ b/common/flatpak-utils.c
@@ -41,7 +41,22 @@
#include <libsoup/soup.h>
/* This is also here so the common code can report these errors to the lib */
-G_DEFINE_QUARK (flatpak-error-quark, flatpak_error)
+static const GDBusErrorEntry flatpak_error_entries[] = {
+ {FLATPAK_ERROR_ALREADY_INSTALLED, "org.freedesktop.Flatpak.Error.AlreadyInstalled"},
+ {FLATPAK_ERROR_NOT_INSTALLED, "org.freedesktop.Flatpak.Error.NotInstalled"},
+};
+
+GQuark
+flatpak_error_quark (void)
+{
+ static volatile gsize quark_volatile = 0;
+
+ g_dbus_error_register_error_domain ("flatpak-error-quark",
+ &quark_volatile,
+ flatpak_error_entries,
+ G_N_ELEMENTS (flatpak_error_entries));
+ return (GQuark) quark_volatile;
+}
GBytes *
flatpak_read_stream (GInputStream *in,