summaryrefslogtreecommitdiff
path: root/lib/ephy-flatpak-utils.c
diff options
context:
space:
mode:
authorSimon McVittie <smcv@debian.org>2020-10-01 10:07:28 +0100
committerSimon McVittie <smcv@debian.org>2020-10-01 10:36:33 +0100
commitafd155430075cee5380334a9c263cc28426fc79c (patch)
tree11c59a71af08872bc9f3de73bc880d06d387e1cb /lib/ephy-flatpak-utils.c
parent66170163c605dd86a7898634208a13d4e17d95f6 (diff)
downloadepiphany-afd155430075cee5380334a9c263cc28426fc79c.tar.gz
build: Allow libportal support to be disabledwip/smcv/libportal-optional
It isn't clear whether the API/ABI of libportal are entirely stable yet (https://github.com/flatpak/libportal/issues/33) so it is not necessarily appropriate for longer-term-supported OS distributions to include it. When building a version of epiphany for a distribution package, which is only intended to be packaged in a format other than as a Flatpak app, libportal isn't necessary anyway. libportal is also Linux-specific, so non-Linux OSs will likely want to disable it (even if it might compile successfully). Signed-off-by: Simon McVittie <smcv@debian.org>
Diffstat (limited to 'lib/ephy-flatpak-utils.c')
-rw-r--r--lib/ephy-flatpak-utils.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/ephy-flatpak-utils.c b/lib/ephy-flatpak-utils.c
index 6f91e5ff5..818af95f4 100644
--- a/lib/ephy-flatpak-utils.c
+++ b/lib/ephy-flatpak-utils.c
@@ -28,7 +28,9 @@
#include <fcntl.h>
#include <gio/gio.h>
#include <gio/gunixfdlist.h>
+#if USE_LIBPORTAL
#include <libportal/portal-gtk3.h>
+#endif
#include <string.h>
#include <sys/stat.h>
#include <sys/types.h>
@@ -63,6 +65,7 @@ ephy_is_running_inside_flatpak (void)
return under_flatpak;
}
+#if USE_LIBPORTAL
static void
opened_uri (GObject *object,
GAsyncResult *result,
@@ -81,11 +84,13 @@ opened_uri (GObject *object,
if (!res)
g_warning ("%s", error->message);
}
+#endif
static void
ephy_open_uri (const char *uri,
gboolean is_dir)
{
+#if USE_LIBPORTAL
GApplication *application;
GtkWindow *window;
XdpParent *parent;
@@ -101,6 +106,10 @@ ephy_open_uri (const char *uri,
xdp_portal_open_uri (g_steal_pointer (&portal), parent, uri, XDP_OPEN_URI_FLAG_ASK, NULL, opened_uri, GINT_TO_POINTER (FALSE));
xdp_parent_free (parent);
+#else
+ g_warning ("Flatpak portal support disabled at compile time, cannot open %s",
+ uri);
+#endif
}
void