[gnome-builder/gnome-builder-3-24] plugins: allow ~/.local/share/gnome-builder/plugins under flatpak



commit c2c6435df4bc875231a4bc01f94a52a2151b4d6f
Author: Christian Hergert <chergert redhat com>
Date:   Sat Apr 8 17:53:24 2017 -0700

    plugins: allow ~/.local/share/gnome-builder/plugins under flatpak
    
    The XDG_USER_DATA_DIR will be different when running under flatpak, but it
    is considerably annoying to have to tell users where to put their plugins
    based on how they got Builder.
    
    Since Builder is a developer tool with access to $HOME anyway, we might as
    well just try to do the right thing and give access to the documented
    location even when running with Flatpak.

 libide/application/ide-application-plugins.c |   17 +++++++++++++++++
 1 files changed, 17 insertions(+), 0 deletions(-)
---
diff --git a/libide/application/ide-application-plugins.c b/libide/application/ide-application-plugins.c
index e41aee4..6ab6b4c 100644
--- a/libide/application/ide-application-plugins.c
+++ b/libide/application/ide-application-plugins.c
@@ -29,6 +29,7 @@
 #include "application/ide-application-addin.h"
 #include "application/ide-application-private.h"
 #include "theming/ide-css-provider.h"
+#include "util/ide-flatpak.h"
 
 static const gchar *blacklisted_plugins[] = {
   "build-tools-plugin", /* Renamed to buildui */
@@ -135,6 +136,22 @@ ide_application_discover_plugins (IdeApplication *self)
                                        PACKAGE_DATADIR"/gnome-builder/plugins");
     }
 
+  /*
+   * We have access to ~/.local/share/gnome-builder/ for plugins even when we are
+   * bundled with flatpak, so might as well use it.
+   */
+  if (ide_is_flatpak ())
+    {
+      g_autofree gchar *plugins_dir = g_build_filename (g_get_home_dir (),
+                                                        ".local",
+                                                        "share",
+                                                        "gnome-builder",
+                                                        "plugins",
+                                                        NULL);
+      g_irepository_prepend_search_path (plugins_dir);
+      peas_engine_prepend_search_path (engine, plugins_dir, plugins_dir);
+    }
+
   g_irepository_require (NULL, "Ide", "1.0", 0, &error);
   if (error != NULL)
     {


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