From b04d564bcf32a8ae6f8cd3b7811ed132a49ecbe3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guido=20G=C3=BCnther?= Date: Thu, 1 Apr 2021 14:02:14 +0200 Subject: [PATCH] manager: Allow to add plugin dir via environent This eases testing of plugins from the source tree: CALLS_PLUGIN_DIR=_build/plugins/dummy/ _build/src/gnome-calls -p dummy --- README.md | 6 ++++++ src/calls-manager.c | 7 +++++++ 2 files changed, 13 insertions(+) diff --git a/README.md b/README.md index d452505..b862d53 100644 --- a/README.md +++ b/README.md @@ -36,6 +36,12 @@ If using ModemManager, Calls will wait for ModemManager to appear on D-Bus and then wait for usable modems to appear. The UI will be inactive and display a status message until a usable modem appears. +When running from the source tree you can use `CALLS_PLUGIN_DIR` environment +varible to specify the directroy from where plugins are loaded. To e.g. load +the dummy plugin from the source tree: + + export CALLS_PLUGIN_DIR=_build/plugins/dummy/ + _build/src/gnome-calls -p dummy ### oFono There is also an oFono backend, "ofono". This was the first backend diff --git a/src/calls-manager.c b/src/calls-manager.c index 7e48a54..9584812 100644 --- a/src/calls-manager.c +++ b/src/calls-manager.c @@ -86,12 +86,19 @@ load_provider (const gchar* 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); if (!info)