lua: change the "wireplumber.interactive" property to "wireplumber.daemon"

with inverted semantics
This commit is contained in:
George Kiagiadakis
2021-04-22 13:48:06 +03:00
parent 9c8e5b3081
commit b46587393c
4 changed files with 14 additions and 14 deletions

View File

@@ -131,9 +131,9 @@ wp_lua_scripting_plugin_supports_type (WpComponentLoader * cl,
}
static gchar *
find_script (const gchar * script, const gchar *interactive)
find_script (const gchar * script, gboolean daemon)
{
if ((!g_strcmp0 (interactive, "true") || g_path_is_absolute (script)) &&
if ((!daemon || g_path_is_absolute (script)) &&
g_file_test (script, G_FILE_TEST_EXISTS | G_FILE_TEST_IS_REGULAR))
return g_strdup (script);
@@ -182,11 +182,12 @@ wp_lua_scripting_plugin_load (WpComponentLoader * cl, const gchar * component,
/* interpret component as a script */
if (!g_strcmp0 (type, "script/lua")) {
g_autoptr (WpProperties) p = wp_core_get_properties (core);
const gchar *interactive = wp_properties_get (p, "wireplumber.interactive");
const gchar *str = wp_properties_get (p, "wireplumber.daemon");
gboolean daemon = !g_strcmp0 (str, "true");
struct ScriptData s = {0};
s.filename = find_script (component, interactive);
s.filename = find_script (component, daemon);
if (!s.filename) {
g_set_error (error, G_IO_ERROR, G_IO_ERROR_NOT_FOUND,
"Could not locate script '%s'", component);

View File

@@ -163,10 +163,10 @@ core_quit (lua_State *L)
{
WpCore * core = get_wp_core (L);
g_autoptr (WpProperties) p = wp_core_get_properties (core);
const gchar *interactive = wp_properties_get (p, "wireplumber.interactive");
if (!interactive || g_strcmp0 (interactive, "true") != 0) {
wp_warning ("script attempted to quit, but wireplumber "
"is not running in script interactive mode; ignoring");
const gchar *daemon = wp_properties_get (p, "wireplumber.daemon");
if (!g_strcmp0 (daemon, "true")) {
wp_warning ("script attempted to quit, but the engine is "
"running in the wireplumber daemon; ignoring");
return 0;
}
@@ -183,10 +183,10 @@ core_require_api (lua_State *L)
{
WpCore * core = get_wp_core (L);
g_autoptr (WpProperties) p = wp_core_get_properties (core);
const gchar *interactive = wp_properties_get (p, "wireplumber.interactive");
if (!interactive || g_strcmp0 (interactive, "true") != 0) {
wp_warning ("script attempted to load an API module, but wireplumber "
"is not running in script interactive mode; ignoring");
const gchar *daemon = wp_properties_get (p, "wireplumber.daemon");
if (!g_strcmp0 (daemon, "true")) {
wp_warning ("script attempted to load an API module, but the engine is "
"running in the wireplumber daemon; ignoring");
return 0;
}
return wp_require_api_transition_new_from_lua (L, core);

View File

@@ -339,7 +339,7 @@ main (gint argc, gchar **argv)
properties = wp_properties_new (
PW_KEY_CONFIG_NAME, config_file ? config_file : "wireplumber.conf",
PW_KEY_APP_NAME, "WirePlumber",
"wireplumber.interactive", "false",
"wireplumber.daemon", "true",
NULL);
if (!g_path_is_absolute (wp_get_config_dir ())) {

View File

@@ -228,7 +228,6 @@ main (gint argc, gchar **argv)
d.loop = g_main_loop_new (NULL, FALSE);
d.core = wp_core_new (NULL, wp_properties_new (
PW_KEY_APP_NAME, "wpexec",
"wireplumber.interactive", "true",
NULL));
g_signal_connect_swapped (d.core, "disconnected",
G_CALLBACK (g_main_loop_quit), d.loop);