1
0
Fork 0
mirror of https://gitlab.gnome.org/GNOME/calls.git synced 2024-12-12 07:37:35 +00:00

manager: Set peas search path only once

There is no need to redo it for every added plugin.
This commit is contained in:
Evangelos Ribeiro Tzaras 2021-04-21 11:31:29 +02:00
parent 3121963220
commit 2ac43f391a
2 changed files with 15 additions and 10 deletions

View file

@ -471,6 +471,9 @@ calls_manager_class_init (CallsManagerClass *klass)
static void
calls_manager_init (CallsManager *self)
{
PeasEngine *peas;
const gchar *dir;
self->state = CALLS_MANAGER_STATE_NO_PROVIDER;
self->provider_name = NULL;
self->primary_call = NULL;
@ -480,6 +483,18 @@ calls_manager_init (CallsManager *self)
g_object_bind_property (self, "country-code",
self->contacts_provider, "country-code",
G_BINDING_DEFAULT);
// Prepend peas plugin search path
peas = peas_engine_get_default ();
peas_engine_add_search_path (peas, PLUGIN_LIBDIR, NULL);
g_debug ("Scanning for plugins in `%s'", PLUGIN_LIBDIR);
dir = g_getenv ("CALLS_PLUGIN_DIR");
if (dir && dir[0] != '\0') {
g_debug ("Adding %s to plugin search path", dir);
peas_engine_prepend_search_path (peas, dir, NULL);
}
}

View file

@ -174,18 +174,8 @@ calls_provider_load_plugin (const char *name)
PeasEngine *plugins;
PeasPluginInfo *info;
PeasExtension *extension;
const gchar *dir;
// Add Calls search path and rescan
plugins = peas_engine_get_default ();
peas_engine_add_search_path (plugins, PLUGIN_LIBDIR, NULL);
g_debug ("Scanning for plugins in `%s'", PLUGIN_LIBDIR);
dir = g_getenv ("CALLS_PLUGIN_DIR");
if (dir && dir[0] != '\0') {
g_debug ("Adding %s to plugin search path", dir);
peas_engine_prepend_search_path (plugins, dir, NULL);
}
// Find the plugin
info = peas_engine_get_plugin_info (plugins, name);