[devhelp/wip/flatpak] flatpak: see books installed on the host



commit 1f4274f0fa92bd5fb20d23aac542661300db5557
Author: Sébastien Wilmet <swilmet gnome org>
Date:   Fri Jan 12 20:32:07 2018 +0100

    flatpak: see books installed on the host
    
    https://bugzilla.gnome.org/show_bug.cgi?id=792068

 configure.ac                   |   11 +++++++++++
 flatpak/org.gnome.Devhelp.json |    1 +
 src/dh-book-manager.c          |   21 +++++++++++++++++++++
 3 files changed, 33 insertions(+), 0 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index d5bb764..573dcc5 100644
--- a/configure.ac
+++ b/configure.ac
@@ -71,6 +71,16 @@ AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE", [Package name for gettext
 
 AM_PATH_PYTHON([2.3],[],[no])
 
+# Flatpak
+AC_ARG_ENABLE([flatpak],
+             [AS_HELP_STRING([--enable-flatpak-build], [Enable Flatpak build mode])],
+             [flatpak_build=${enableval}],
+             [flatpak_build=no])
+
+if test "x${flatpak_build}" = xyes; then
+       AC_DEFINE([FLATPAK_BUILD], 1, [Whether Flatpak build mode is enabled])
+fi
+
 # GTK-Doc
 AX_REQUIRE_DEFINED([GTK_DOC_CHECK])
 GTK_DOC_CHECK([1.25],[--flavour no-tmpl])
@@ -106,4 +116,5 @@ Configuration:
        Compiler:               ${CC}
        API documentation:      ${enable_gtk_doc}
        GObject introspection:  ${found_introspection}
+       Flatpak build mode:     ${flatpak_build}
 "
diff --git a/flatpak/org.gnome.Devhelp.json b/flatpak/org.gnome.Devhelp.json
index 82add3b..1240610 100644
--- a/flatpak/org.gnome.Devhelp.json
+++ b/flatpak/org.gnome.Devhelp.json
@@ -34,6 +34,7 @@
     "modules": [
         {
             "name": "devhelp",
+            "config-opts": [ "--enable-flatpak-build" ],
             "sources": [
                 {
                     "type": "git",
diff --git a/src/dh-book-manager.c b/src/dh-book-manager.c
index da7c344..bf77a96 100644
--- a/src/dh-book-manager.c
+++ b/src/dh-book-manager.c
@@ -806,6 +806,27 @@ populate (DhBookManager *book_manager)
         for (i = 0; system_dirs[i] != NULL; i++) {
                 find_books_in_data_dir (book_manager, system_dirs[i]);
         }
+
+        /* For Flatpak, to see the books installed on the host by traditional
+         * Linux distro packages.
+         *
+         * It is not a good idea to add the directory to XDG_DATA_DIRS, see:
+         * https://github.com/flatpak/flatpak/issues/1299
+         * "all sorts of things will break if we add all host config to each
+         * app, which is totally opposite to the entire point of flatpak."
+         * "i don't think XDG_DATA_DIRS is the right thing, because all sorts of
+         * libraries will start reading files from there, like dconf, dbus,
+         * service files, mimetypes, etc. It would be preferable to have
+         * something that targeted just gtk-doc files."
+         *
+         * So instead of adapting XDG_DATA_DIRS, add the directory here, with
+         * the path hard-coded.
+         *
+         * https://bugzilla.gnome.org/show_bug.cgi?id=792068
+         */
+#ifdef FLATPAK_BUILD
+        find_books_in_data_dir (book_manager, "/run/host/usr/share");
+#endif
 }
 
 static void


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]