[gedit/libgpe: 2/21] Adapt to new libgpe API wrt plugin dir registration.



commit 1fedca0e480cebd44ade1ea4e3eaf1829bc97dbd
Author: Steve Frécinaux <code istique net>
Date:   Sun Nov 1 17:39:27 2009 +0100

    Adapt to new libgpe API wrt plugin dir registration.
    
    This brings back support for user plugins.

 gedit/gedit-dirs.c           |   16 ++++++++++++++++
 gedit/gedit-dirs.h           |    2 ++
 gedit/gedit-plugins-engine.c |   22 +++++++++++++++-------
 3 files changed, 33 insertions(+), 7 deletions(-)
---
diff --git a/gedit/gedit-dirs.c b/gedit/gedit-dirs.c
index da9fec5..4314851 100644
--- a/gedit/gedit-dirs.c
+++ b/gedit/gedit-dirs.c
@@ -206,6 +206,22 @@ gedit_dirs_get_gedit_plugins_dir (void)
 }
 
 gchar *
+gedit_dirs_get_gedit_plugins_data_dir (void)
+{
+	gchar *data_dir;
+	gchar *plugin_data_dir;
+
+	data_dir = gedit_dirs_get_gedit_data_dir ();
+
+	plugin_data_dir = g_build_filename (data_dir,
+					    "plugins",
+					    NULL);
+	g_free (data_dir);
+
+	return plugin_data_dir;
+}
+
+gchar *
 gedit_dirs_get_gedit_plugin_loaders_dir (void)
 {
 	gchar *lib_dir;
diff --git a/gedit/gedit-dirs.h b/gedit/gedit-dirs.h
index eddd00d..22f16ac 100644
--- a/gedit/gedit-dirs.h
+++ b/gedit/gedit-dirs.h
@@ -44,6 +44,8 @@ gchar		*gedit_dirs_get_gedit_lib_dir		(void);
 
 gchar		*gedit_dirs_get_gedit_plugins_dir	(void);
 
+gchar		*gedit_dirs_get_gedit_plugins_data_dir	(void);
+
 gchar		*gedit_dirs_get_gedit_plugin_loaders_dir
 							(void);
 
diff --git a/gedit/gedit-plugins-engine.c b/gedit/gedit-plugins-engine.c
index fcf55d0..b13be42 100644
--- a/gedit/gedit-plugins-engine.c
+++ b/gedit/gedit-plugins-engine.c
@@ -90,20 +90,28 @@ gedit_plugins_engine_class_init (GeditPluginsEngineClass *klass)
 GPEEngine *
 gedit_plugins_engine_get_default (void)
 {
-        static const GPEPathInfo paths[] = {
-		{ "./plugins/", "./plugins/" },
-		{ GEDIT_PREFIX "/lib/gedit-2/plugins/",
-		  GEDIT_PREFIX "/share/gedit-2/plugins/" },
-		{ NULL },
-	};
+	gchar *module_dir;
+	gchar *data_dir;
 
 	if (default_engine != NULL)
 		return default_engine;
 
 	default_engine = GPE_ENGINE (g_object_new (GEDIT_TYPE_PLUGINS_ENGINE,
 						   "app-name", "Gedit",
-						   "path-infos", paths,
 						   NULL));
+
+	/* Add the user plugins dir in ~ */
+	module_dir = gedit_dirs_get_user_plugins_dir ();
+	gpe_engine_add_plugin_directory (default_engine, module_dir, module_dir);
+	g_free (module_dir);
+
+	/* Add the system plugins dir */
+	module_dir = gedit_dirs_get_gedit_plugins_dir ();
+	data_dir = gedit_dirs_get_gedit_plugins_dir ();
+	gpe_engine_add_plugin_directory (default_engine, module_dir, data_dir);
+	g_free (module_dir);
+	g_free (data_dir);
+
 	g_object_add_weak_pointer (G_OBJECT (default_engine),
 				   (gpointer) &default_engine);
 	return default_engine;



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