[gnome-builder/gnome-builder-3-34] flatpak: ensure we have access to documents portal
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder/gnome-builder-3-34] flatpak: ensure we have access to documents portal
- Date: Tue, 12 Nov 2019 18:59:55 +0000 (UTC)
commit 2b072e344fe18cb6eb1233479899d0fcf5420e74
Author: Christian Hergert <chergert redhat com>
Date: Tue Nov 12 10:59:38 2019 -0800
flatpak: ensure we have access to documents portal
The documents portal should auto-start but we need to query it to ensure
that happens. This shouldn't be happening if Builder itself is run with
Flatpak, but there are still some cases where people are not using the
Builder flatpak even that is the only supported upstream use.
Fixes #1055
src/plugins/flatpak/gbp-flatpak-pipeline-addin.c | 26 ++++++++++++++++++++++++
1 file changed, 26 insertions(+)
---
diff --git a/src/plugins/flatpak/gbp-flatpak-pipeline-addin.c
b/src/plugins/flatpak/gbp-flatpak-pipeline-addin.c
index aff275be4..e085fe632 100644
--- a/src/plugins/flatpak/gbp-flatpak-pipeline-addin.c
+++ b/src/plugins/flatpak/gbp-flatpak-pipeline-addin.c
@@ -63,6 +63,27 @@ enum {
EXPORT_BUILD_BUNDLE,
};
+static void
+ensure_documents_portal (void)
+{
+ g_autoptr(GDBusConnection) bus = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, NULL);
+ g_autoptr(GVariant) reply = NULL;
+
+ g_assert (G_IS_DBUS_CONNECTION (bus));
+
+ reply = g_dbus_connection_call_sync (bus,
+ "org.freedesktop.portal.Documents",
+ "/org/freedesktop/portal/documents",
+ "org.freedesktop.portal.Documents",
+ "GetMountPoint",
+ g_variant_new ("()"),
+ NULL,
+ G_DBUS_CALL_FLAGS_NONE,
+ 3000,
+ NULL,
+ NULL);
+}
+
static gchar *
get_arch_option (IdePipeline *pipeline)
{
@@ -210,6 +231,11 @@ check_for_build_init_files (IdePipelineStage *stage,
g_assert (!cancellable || G_IS_CANCELLABLE (cancellable));
g_assert (staging_dir != NULL);
+ /* First make sure that we have access to the Portals service
+ * so that any of our build operations succeed.
+ */
+ ensure_documents_portal ();
+
metadata = g_build_filename (staging_dir, "metadata", NULL);
files = g_build_filename (staging_dir, "files", NULL);
var = g_build_filename (staging_dir, "var", NULL);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]