diff options
author | Christian Hergert <chergert@redhat.com> | 2023-03-20 21:24:34 -0700 |
---|---|---|
committer | Christian Hergert <chergert@redhat.com> | 2023-03-22 16:44:45 -0700 |
commit | 4b683cd64b05620458a8eed6e808f91c6e67311c (patch) | |
tree | f604ebbe6cef6e65a238094f60c16d2d21fb29ec | |
parent | 691bba9511cc55cc3ce9b015ac90fc007e935ef6 (diff) | |
download | libpeas-4b683cd64b05620458a8eed6e808f91c6e67311c.tar.gz |
engine: remove peas_engine_prepend_search_path()
This function is misleading as it cannot affect already loaded plugins.
Just remove it and rely on add_search_path(). Applications can control
the ordering they allow those to get the same effect.
Related #19
-rw-r--r-- | libpeas/peas-engine.c | 62 | ||||
-rw-r--r-- | libpeas/peas-engine.h | 4 |
2 files changed, 16 insertions, 50 deletions
diff --git a/libpeas/peas-engine.c b/libpeas/peas-engine.c index 08448c7..ba84a12 100644 --- a/libpeas/peas-engine.c +++ b/libpeas/peas-engine.c @@ -461,34 +461,6 @@ peas_engine_rescan_plugins (PeasEngine *engine) g_object_thaw_notify (G_OBJECT (engine)); } -static void -peas_engine_insert_search_path (PeasEngine *engine, - gboolean prepend, - const char *module_dir, - const char *data_dir) -{ - SearchPath *sp; - - g_return_if_fail (PEAS_IS_ENGINE (engine)); - g_return_if_fail (module_dir != NULL); - - sp = g_slice_new (SearchPath); - sp->module_dir = g_strdup (module_dir); - sp->data_dir = g_strdup (data_dir ? data_dir : module_dir); - - if (prepend) - g_queue_push_head (&engine->search_paths, sp); - else - g_queue_push_tail (&engine->search_paths, sp); - - g_object_freeze_notify (G_OBJECT (engine)); - - if (load_dir_real (engine, sp)) - plugin_list_changed (engine); - - g_object_thaw_notify (G_OBJECT (engine)); -} - /** * peas_engine_add_search_path: * @engine: A #PeasEngine. @@ -516,25 +488,23 @@ peas_engine_add_search_path (PeasEngine *engine, const char *module_dir, const char *data_dir) { - peas_engine_insert_search_path (engine, FALSE, module_dir, data_dir); -} + SearchPath *sp; -/** - * peas_engine_prepend_search_path: - * @engine: A #PeasEngine. - * @module_dir: the plugin module directory. - * @data_dir: (allow-none): the plugin data directory. - * - * Prepends a search path to the list of paths where to look for plugins. - * - * See Also: [method@Engine.add_search_path] - */ -void -peas_engine_prepend_search_path (PeasEngine *engine, - const char *module_dir, - const char *data_dir) -{ - peas_engine_insert_search_path (engine, TRUE, module_dir, data_dir); + g_return_if_fail (PEAS_IS_ENGINE (engine)); + g_return_if_fail (module_dir != NULL); + + sp = g_slice_new (SearchPath); + sp->module_dir = g_strdup (module_dir); + sp->data_dir = g_strdup (data_dir ? data_dir : module_dir); + + g_queue_push_tail (&engine->search_paths, sp); + + g_object_freeze_notify (G_OBJECT (engine)); + + if (load_dir_real (engine, sp)) + plugin_list_changed (engine); + + g_object_thaw_notify (G_OBJECT (engine)); } static void diff --git a/libpeas/peas-engine.h b/libpeas/peas-engine.h index 2f90a0b..cac34e6 100644 --- a/libpeas/peas-engine.h +++ b/libpeas/peas-engine.h @@ -50,10 +50,6 @@ void peas_engine_add_search_path (PeasEngine * const char *module_dir, const char *data_dir); PEAS_AVAILABLE_IN_ALL -void peas_engine_prepend_search_path (PeasEngine *engine, - const char *module_dir, - const char *data_dir); -PEAS_AVAILABLE_IN_ALL void peas_engine_enable_loader (PeasEngine *engine, const char *loader_name); PEAS_AVAILABLE_IN_ALL |