lua: change the "wireplumber.interactive" property to "wireplumber.daemon"
with inverted semantics
This commit is contained in:
@@ -131,9 +131,9 @@ wp_lua_scripting_plugin_supports_type (WpComponentLoader * cl,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static gchar *
|
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))
|
g_file_test (script, G_FILE_TEST_EXISTS | G_FILE_TEST_IS_REGULAR))
|
||||||
return g_strdup (script);
|
return g_strdup (script);
|
||||||
|
|
||||||
@@ -182,11 +182,12 @@ wp_lua_scripting_plugin_load (WpComponentLoader * cl, const gchar * component,
|
|||||||
/* interpret component as a script */
|
/* interpret component as a script */
|
||||||
if (!g_strcmp0 (type, "script/lua")) {
|
if (!g_strcmp0 (type, "script/lua")) {
|
||||||
g_autoptr (WpProperties) p = wp_core_get_properties (core);
|
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};
|
struct ScriptData s = {0};
|
||||||
|
|
||||||
s.filename = find_script (component, interactive);
|
s.filename = find_script (component, daemon);
|
||||||
if (!s.filename) {
|
if (!s.filename) {
|
||||||
g_set_error (error, G_IO_ERROR, G_IO_ERROR_NOT_FOUND,
|
g_set_error (error, G_IO_ERROR, G_IO_ERROR_NOT_FOUND,
|
||||||
"Could not locate script '%s'", component);
|
"Could not locate script '%s'", component);
|
||||||
|
@@ -163,10 +163,10 @@ core_quit (lua_State *L)
|
|||||||
{
|
{
|
||||||
WpCore * core = get_wp_core (L);
|
WpCore * core = get_wp_core (L);
|
||||||
g_autoptr (WpProperties) p = wp_core_get_properties (core);
|
g_autoptr (WpProperties) p = wp_core_get_properties (core);
|
||||||
const gchar *interactive = wp_properties_get (p, "wireplumber.interactive");
|
const gchar *daemon = wp_properties_get (p, "wireplumber.daemon");
|
||||||
if (!interactive || g_strcmp0 (interactive, "true") != 0) {
|
if (!g_strcmp0 (daemon, "true")) {
|
||||||
wp_warning ("script attempted to quit, but wireplumber "
|
wp_warning ("script attempted to quit, but the engine is "
|
||||||
"is not running in script interactive mode; ignoring");
|
"running in the wireplumber daemon; ignoring");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -183,10 +183,10 @@ core_require_api (lua_State *L)
|
|||||||
{
|
{
|
||||||
WpCore * core = get_wp_core (L);
|
WpCore * core = get_wp_core (L);
|
||||||
g_autoptr (WpProperties) p = wp_core_get_properties (core);
|
g_autoptr (WpProperties) p = wp_core_get_properties (core);
|
||||||
const gchar *interactive = wp_properties_get (p, "wireplumber.interactive");
|
const gchar *daemon = wp_properties_get (p, "wireplumber.daemon");
|
||||||
if (!interactive || g_strcmp0 (interactive, "true") != 0) {
|
if (!g_strcmp0 (daemon, "true")) {
|
||||||
wp_warning ("script attempted to load an API module, but wireplumber "
|
wp_warning ("script attempted to load an API module, but the engine is "
|
||||||
"is not running in script interactive mode; ignoring");
|
"running in the wireplumber daemon; ignoring");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
return wp_require_api_transition_new_from_lua (L, core);
|
return wp_require_api_transition_new_from_lua (L, core);
|
||||||
|
@@ -339,7 +339,7 @@ main (gint argc, gchar **argv)
|
|||||||
properties = wp_properties_new (
|
properties = wp_properties_new (
|
||||||
PW_KEY_CONFIG_NAME, config_file ? config_file : "wireplumber.conf",
|
PW_KEY_CONFIG_NAME, config_file ? config_file : "wireplumber.conf",
|
||||||
PW_KEY_APP_NAME, "WirePlumber",
|
PW_KEY_APP_NAME, "WirePlumber",
|
||||||
"wireplumber.interactive", "false",
|
"wireplumber.daemon", "true",
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
if (!g_path_is_absolute (wp_get_config_dir ())) {
|
if (!g_path_is_absolute (wp_get_config_dir ())) {
|
||||||
|
@@ -228,7 +228,6 @@ main (gint argc, gchar **argv)
|
|||||||
d.loop = g_main_loop_new (NULL, FALSE);
|
d.loop = g_main_loop_new (NULL, FALSE);
|
||||||
d.core = wp_core_new (NULL, wp_properties_new (
|
d.core = wp_core_new (NULL, wp_properties_new (
|
||||||
PW_KEY_APP_NAME, "wpexec",
|
PW_KEY_APP_NAME, "wpexec",
|
||||||
"wireplumber.interactive", "true",
|
|
||||||
NULL));
|
NULL));
|
||||||
g_signal_connect_swapped (d.core, "disconnected",
|
g_signal_connect_swapped (d.core, "disconnected",
|
||||||
G_CALLBACK (g_main_loop_quit), d.loop);
|
G_CALLBACK (g_main_loop_quit), d.loop);
|
||||||
|
Reference in New Issue
Block a user