# HG changeset patch
# Node ID 5c04fbcf4f58
# Parent  7ccf3db483d1
diff --git a/gplugin/gplugin-file-source.c b/gplugin/gplugin-file-source.c
--- a/gplugin/gplugin-file-source.c
+++ b/gplugin/gplugin-file-source.c
@@ -367,7 +367,7 @@
 				/* Check if the plugin is supposed to be loaded on query, and
 				 * if so, load it.
 				 */
-				if(gplugin_plugin_info_get_load_on_query(info)) {
+				if(gplugin_plugin_info_get_auto_load(info)) {
 					GError *error = NULL;
 					gboolean loaded;
 
diff --git a/gplugin/gplugin-plugin-info.h b/gplugin/gplugin-plugin-info.h
--- a/gplugin/gplugin-plugin-info.h
+++ b/gplugin/gplugin-plugin-info.h
@@ -60,7 +60,11 @@
 gint gplugin_plugin_info_get_priority(GPluginPluginInfo *info);
 guint32 gplugin_plugin_info_get_abi_version(GPluginPluginInfo *info);
 gboolean gplugin_plugin_info_get_internal(GPluginPluginInfo *info);
+gboolean gplugin_plugin_info_get_auto_load(GPluginPluginInfo *info);
+
+G_DEPRECATED_FOR(gplugin_plugin_info_get_auto_load)
 gboolean gplugin_plugin_info_get_load_on_query(GPluginPluginInfo *info);
+
 const gchar *gplugin_plugin_info_get_name(GPluginPluginInfo *info);
 const gchar *gplugin_plugin_info_get_version(GPluginPluginInfo *info);
 const gchar *gplugin_plugin_info_get_settings_schema(GPluginPluginInfo *info);
diff --git a/gplugin/gplugin-plugin-info.c b/gplugin/gplugin-plugin-info.c
--- a/gplugin/gplugin-plugin-info.c
+++ b/gplugin/gplugin-plugin-info.c
@@ -62,7 +62,7 @@
 
 	guint32 abi_version;
 	gboolean internal;
-	gboolean load_on_query;
+	gboolean auto_load;
 
 	gboolean bind_global;
 	gboolean unloadable;
@@ -78,6 +78,7 @@
 	PROP_PRIORITY,
 	PROP_ABI_VERSION,
 	PROP_INTERNAL,
+	PROP_AUTO_LOAD,
 	PROP_LOQ,
 	PROP_BIND_GLOBAL,
 	PROP_NAME,
@@ -167,12 +168,12 @@
 }
 
 static void
-gplugin_plugin_info_set_load_on_query(GPluginPluginInfo *info, gboolean loq)
+gplugin_plugin_info_set_auto_load(GPluginPluginInfo *info, gboolean auto_load)
 {
 	GPluginPluginInfoPrivate *priv =
 		gplugin_plugin_info_get_instance_private(info);
 
-	priv->load_on_query = loq;
+	priv->auto_load = auto_load;
 }
 
 static void
@@ -373,10 +374,9 @@
 		case PROP_INTERNAL:
 			g_value_set_boolean(value, gplugin_plugin_info_get_internal(info));
 			break;
+		case PROP_AUTO_LOAD:
 		case PROP_LOQ:
-			g_value_set_boolean(
-				value,
-				gplugin_plugin_info_get_load_on_query(info));
+			g_value_set_boolean(value, gplugin_plugin_info_get_auto_load(info));
 			break;
 		case PROP_BIND_GLOBAL:
 			g_value_set_boolean(
@@ -468,10 +468,13 @@
 		case PROP_INTERNAL:
 			gplugin_plugin_info_set_internal(info, g_value_get_boolean(value));
 			break;
+		case PROP_AUTO_LOAD:
+			gplugin_plugin_info_set_auto_load(info, g_value_get_boolean(value));
+			break;
 		case PROP_LOQ:
-			gplugin_plugin_info_set_load_on_query(
-				info,
-				g_value_get_boolean(value));
+			if(g_value_get_boolean(value)) {
+				gplugin_plugin_info_set_auto_load(info, TRUE);
+			}
 			break;
 		case PROP_BIND_GLOBAL:
 			gplugin_plugin_info_set_bind_global(
@@ -679,6 +682,25 @@
 		G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS);
 
 	/**
+	 * GPluginPluginInfo:auto-load:
+	 *
+	 * Whether or not the plugin should be loaded when it's queried.
+	 *
+	 * This is used by the loaders and may be useful to your application as
+	 * well.
+	 *
+	 * Defaults to %FALSE.
+	 *
+	 * Since: 0.39.0
+	 */
+	properties[PROP_AUTO_LOAD] = g_param_spec_boolean(
+		"auto-load",
+		"auto-load",
+		"Whether or not the plugin should be loaded when queried",
+		FALSE,
+		G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS);
+
+	/**
 	 * GPluginPluginInfo:load-on-query:
 	 *
 	 * Whether or not the plugin should be loaded when it's queried.
@@ -687,6 +709,8 @@
 	 * well.
 	 *
 	 * Defaults to %FALSE.
+	 *
+	 * Deprecated: 0.39.0: Use [property@GPlugin.PluginInfo:auto-load] instead.
 	 */
 	properties[PROP_LOQ] = g_param_spec_boolean(
 		"load-on-query",
@@ -1062,15 +1086,44 @@
 }
 
 /**
+ * gplugin_plugin_info_get_auto_load:
+ * @info: The plugin info instance.
+ *
+ * Returns whether or not this plugin should be loaded when queried.  This is
+ * useful for internal plugins that are adding functionality and should always
+ * be turned on. The plugin loaders use this to make sure all plugins can
+ * always be loaded.
+ *
+ * Returns: %TRUE if the plugin should be loaded when queried, %FALSE
+ *          otherwise.
+ *
+ * Since: 0.39.0
+ */
+gboolean
+gplugin_plugin_info_get_auto_load(GPluginPluginInfo *info)
+{
+	GPluginPluginInfoPrivate *priv = NULL;
+
+	g_return_val_if_fail(GPLUGIN_IS_PLUGIN_INFO(info), FALSE);
+
+	priv = gplugin_plugin_info_get_instance_private(info);
+
+	return priv->auto_load;
+}
+
+/**
  * gplugin_plugin_info_get_load_on_query:
  * @info: The plugin info instance.
  *
  * Returns whether or not this plugin should be loaded when queried.  This is
  * useful for internal plugins that are adding functionality and should always
- * be turned on.  The plugin loaders use this to make sure all plugins can
+ * be turned on. The plugin loaders use this to make sure all plugins can
  * always be loaded.
  *
- * Returns: %TRUE if the plugin should be loaded on query, %FALSE otherwise.
+ * Returns: %TRUE if the plugin should be loaded when queried, %FALSE
+ *          otherwise.
+ *
+ * Deprecated: 0.39.0: Use [method@GPlugin.PluginInfo.get_auto_load] instead.
  */
 gboolean
 gplugin_plugin_info_get_load_on_query(GPluginPluginInfo *info)
@@ -1081,7 +1134,7 @@
 
 	priv = gplugin_plugin_info_get_instance_private(info);
 
-	return priv->load_on_query;
+	return priv->auto_load;
 }
 
 /**
diff --git a/gplugin/tests/load-on-query-fail/load-on-query-fail.c b/gplugin/tests/auto-load-fail/auto-load-fail.c
rename from gplugin/tests/load-on-query-fail/load-on-query-fail.c
rename to gplugin/tests/auto-load-fail/auto-load-fail.c
--- a/gplugin/tests/load-on-query-fail/load-on-query-fail.c
+++ b/gplugin/tests/auto-load-fail/auto-load-fail.c
@@ -19,19 +19,19 @@
 #include <gplugin-native.h>
 
 static GPluginPluginInfo *
-loq_fail_query(G_GNUC_UNUSED GError **error)
+auto_load_fail_query(G_GNUC_UNUSED GError **error)
 {
 	/* clang-format off */
 	return gplugin_plugin_info_new(
-		"gplugin/load-on-query-fail",
+		"gplugin/auto-load-fail",
 		GPLUGIN_NATIVE_PLUGIN_ABI_VERSION,
-		"load-on-query", TRUE,
+		"auto-load", TRUE,
 		NULL);
 	/* clang-format on */
 }
 
 static gboolean
-loq_fail_load(G_GNUC_UNUSED GPluginPlugin *plugin, GError **error)
+auto_load_fail_load(G_GNUC_UNUSED GPluginPlugin *plugin, GError **error)
 {
 	static int count = 1;
 
@@ -41,7 +41,7 @@
 }
 
 static gboolean
-loq_fail_unload(
+auto_load_fail_unload(
 	G_GNUC_UNUSED GPluginPlugin *plugin,
 	G_GNUC_UNUSED gboolean shutdown,
 	G_GNUC_UNUSED GError **error)
@@ -49,4 +49,4 @@
 	return TRUE;
 }
 
-GPLUGIN_NATIVE_PLUGIN_DECLARE(loq_fail)
+GPLUGIN_NATIVE_PLUGIN_DECLARE(auto_load_fail)
diff --git a/gplugin/tests/load-on-query-fail/meson.build b/gplugin/tests/auto-load-fail/meson.build
rename from gplugin/tests/load-on-query-fail/meson.build
rename to gplugin/tests/auto-load-fail/meson.build
--- a/gplugin/tests/load-on-query-fail/meson.build
+++ b/gplugin/tests/auto-load-fail/meson.build
@@ -1,3 +1,3 @@
-shared_library('load-on-query-fail', 'load-on-query-fail.c',
+shared_library('auto-load-fail', 'auto-load-fail.c',
 	name_prefix : '',
 	dependencies : [gplugin_dep, GLIB])
diff --git a/gplugin/tests/load-on-query-pass/load-on-query-pass.c b/gplugin/tests/auto-load-pass/auto-load-pass.c
rename from gplugin/tests/load-on-query-pass/load-on-query-pass.c
rename to gplugin/tests/auto-load-pass/auto-load-pass.c
--- a/gplugin/tests/load-on-query-pass/load-on-query-pass.c
+++ b/gplugin/tests/auto-load-pass/auto-load-pass.c
@@ -19,25 +19,27 @@
 #include <gplugin-native.h>
 
 static GPluginPluginInfo *
-loq_pass_query(G_GNUC_UNUSED GError **error)
+auto_load_pass_query(G_GNUC_UNUSED GError **error)
 {
 	/* clang-format off */
 	return gplugin_plugin_info_new(
-		"gplugin/load-on-query",
+		"gplugin/auto-load-pass",
 		GPLUGIN_NATIVE_PLUGIN_ABI_VERSION,
-		"load-on-query", TRUE,
+		"auto-load", TRUE,
 		NULL);
 	/* clang-format on */
 }
 
 static gboolean
-loq_pass_load(G_GNUC_UNUSED GPluginPlugin *plugin, G_GNUC_UNUSED GError **error)
+auto_load_pass_load(
+	G_GNUC_UNUSED GPluginPlugin *plugin,
+	G_GNUC_UNUSED GError **error)
 {
 	return TRUE;
 }
 
 static gboolean
-loq_pass_unload(
+auto_load_pass_unload(
 	G_GNUC_UNUSED GPluginPlugin *plugin,
 	G_GNUC_UNUSED gboolean shutdown,
 	G_GNUC_UNUSED GError **error)
@@ -45,4 +47,4 @@
 	return TRUE;
 }
 
-GPLUGIN_NATIVE_PLUGIN_DECLARE(loq_pass)
+GPLUGIN_NATIVE_PLUGIN_DECLARE(auto_load_pass)
diff --git a/gplugin/tests/load-on-query-pass/meson.build b/gplugin/tests/auto-load-pass/meson.build
rename from gplugin/tests/load-on-query-pass/meson.build
rename to gplugin/tests/auto-load-pass/meson.build
--- a/gplugin/tests/load-on-query-pass/meson.build
+++ b/gplugin/tests/auto-load-pass/meson.build
@@ -1,3 +1,3 @@
-shared_library('load-on-query-pass', 'load-on-query-pass.c',
+shared_library('auto-load-pass', 'auto-load-pass.c',
 	name_prefix : '',
 	dependencies : [gplugin_dep, GLIB])
diff --git a/gplugin/tests/meson.build b/gplugin/tests/meson.build
--- a/gplugin/tests/meson.build
+++ b/gplugin/tests/meson.build
@@ -5,8 +5,8 @@
 subdir('bind-global')
 subdir('dynamic-type')
 subdir('id-collision')
-subdir('load-on-query-fail')
-subdir('load-on-query-pass')
+subdir('auto-load-fail')
+subdir('auto-load-pass')
 subdir('newest-version')
 subdir('plugins')
 subdir('unresolved-symbol')
@@ -106,19 +106,19 @@
 test('ID Collision', e)
 
 #######################################
-# Load On Query
+# Auto Load
 #######################################
-e = executable('test-load-on-query', 'test-load-on-query.c',
+e = executable('test-auto-load', 'test-auto-load.c',
 	c_args : [
 		'-DTEST_DIR="@0@/plugins/"'.format(
 			meson.current_build_dir()),
-		'-DTEST_LOAD_ON_QUERY_PASS_DIR="@0@/load-on-query-pass"'.format(
+		'-DTEST_AUTO_LOAD_PASS_DIR="@0@/auto-load-pass"'.format(
 			meson.current_build_dir()),
-		'-DTEST_LOAD_ON_QUERY_FAIL_DIR="@0@/load-on-query-fail"'.format(
+		'-DTEST_AUTO_LOAD_FAIL_DIR="@0@/auto-load-fail"'.format(
 			meson.current_build_dir())
 	],
 	dependencies : [gplugin_dep, GLIB, GOBJECT])
-test('Load On Query', e)
+test('Auto Load', e)
 
 #######################################
 # Versioned Dependencies
diff --git a/gplugin/tests/test-load-on-query.c b/gplugin/tests/test-auto-load.c
rename from gplugin/tests/test-load-on-query.c
rename to gplugin/tests/test-auto-load.c
--- a/gplugin/tests/test-load-on-query.c
+++ b/gplugin/tests/test-auto-load.c
@@ -25,18 +25,17 @@
 /******************************************************************************
  * Tests
  *****************************************************************************/
-/* load on query */
 static void
-test_load_on_query(void)
+test_auto_load_pass(void)
 {
 	GPluginManager *manager = gplugin_manager_get_default();
 	GPluginPlugin *plugin = NULL;
 
 	gplugin_manager_remove_paths(manager);
-	gplugin_manager_append_path(manager, TEST_LOAD_ON_QUERY_PASS_DIR);
+	gplugin_manager_append_path(manager, TEST_AUTO_LOAD_PASS_DIR);
 	gplugin_manager_refresh(manager);
 
-	plugin = gplugin_manager_find_plugin(manager, "gplugin/load-on-query");
+	plugin = gplugin_manager_find_plugin(manager, "gplugin/auto-load-pass");
 	g_assert_nonnull(plugin);
 	g_assert_true(GPLUGIN_IS_PLUGIN(plugin));
 
@@ -47,34 +46,53 @@
 }
 
 static void
-test_load_on_query_fail_subprocess(void)
+test_auto_load_fail(void)
 {
-	GPluginManager *manager = gplugin_manager_get_default();
+	if(g_test_subprocess()) {
+		GPluginManager *manager = gplugin_manager_get_default();
 
-	/* this test is very simple since we can't get the exact error condition
-	 * that we want.
-	 *
-	 * There's an error condition where a plugin will be stored twice, but we
-	 * can't test for it since a g_warning gets output that kills our fork, so
-	 * we lose the internal state of the plugin manager and thus can't see the
-	 * plugin stored twice.  This has been fixed in the code, but it has to be
-	 * looked for manually.
-	 */
-	gplugin_manager_remove_paths(manager);
-	gplugin_manager_append_path(manager, TEST_DIR);
-	gplugin_manager_append_path(manager, TEST_LOAD_ON_QUERY_FAIL_DIR);
-	gplugin_manager_refresh(manager);
+		/* this test is very simple since we can't get the exact error
+		 * condition that we want.
+		 *
+		 * There's an error condition where a plugin will be stored twice, but
+		 * we can't test for it since a g_warning gets output that kills our
+		 * fork, so we lose the internal state of the plugin manager and thus
+		 * can't see the plugin stored twice.  This has been fixed in the code,
+		 * but it has to be looked for manually.
+		 */
+		gplugin_manager_remove_paths(manager);
+		gplugin_manager_append_path(manager, TEST_DIR);
+		gplugin_manager_append_path(manager, TEST_AUTO_LOAD_FAIL_DIR);
+		gplugin_manager_refresh(manager);
+	}
+
+	g_test_trap_subprocess(NULL, 0, 0);
+
+	g_test_trap_assert_stderr("*failed to load*during query*");
 }
 
 static void
-test_load_on_query_fail(void)
+test_loq(void)
 {
-	g_test_trap_subprocess(
-		"/loaders/native/load-on-query/fail/subprocess",
-		0,
-		0);
+	GPluginPluginInfo *info = NULL;
 
-	g_test_trap_assert_stderr("*failed to load*during query*");
+	/* Make sure the load on query option is still honored and sets the
+	 * auto-load property.
+	 */
+	info = gplugin_plugin_info_new(
+		"test-loq",
+		0x01020304,
+		"load-on-query",
+		TRUE,
+		NULL);
+
+	G_GNUC_BEGIN_IGNORE_DEPRECATIONS
+	g_assert_true(gplugin_plugin_info_get_load_on_query(info));
+	G_GNUC_END_IGNORE_DEPRECATIONS
+
+	g_assert_true(gplugin_plugin_info_get_auto_load(info));
+
+	g_clear_object(&info);
 }
 
 /******************************************************************************
@@ -83,19 +101,14 @@
 gint
 main(gint argc, gchar **argv)
 {
-
 	g_test_init(&argc, &argv, G_TEST_OPTION_ISOLATE_DIRS, NULL);
 
 	gplugin_init(GPLUGIN_CORE_FLAGS_NONE);
 
 	/* test the load on query flag */
-	g_test_add_func("/loaders/native/load-on-query/pass", test_load_on_query);
-	g_test_add_func(
-		"/loaders/native/load-on-query/fail",
-		test_load_on_query_fail);
-	g_test_add_func(
-		"/loaders/native/load-on-query/fail/subprocess",
-		test_load_on_query_fail_subprocess);
+	g_test_add_func("/loaders/native/auto-load/pass", test_auto_load_pass);
+	g_test_add_func("/loaders/native/auto-load/fail", test_auto_load_fail);
+	g_test_add_func("/loaders/native/loq", test_loq);
 
 	return g_test_run();
 }
diff --git a/gplugin/tests/test-plugin-info.c b/gplugin/tests/test-plugin-info.c
--- a/gplugin/tests/test-plugin-info.c
+++ b/gplugin/tests/test-plugin-info.c
@@ -106,7 +106,7 @@
 	gchar **provides = NULL, **authors = NULL, **dependencies = NULL;
 	gint priority = 0;
 	guint abi_version = 0;
-	gboolean internal = FALSE, load_on_query = FALSE;
+	gboolean internal = FALSE, auto_load = FALSE;
 	const gchar *const r_provides[] = {"foo", NULL};
 	const gchar *const r_authors[] = {"author", NULL};
 	const gchar *const r_dependencies[] = {"dependency", NULL};
@@ -119,7 +119,7 @@
 		"priority", 1000,
 		"abi_version", GPLUGIN_NATIVE_PLUGIN_ABI_VERSION,
 		"internal", TRUE,
-		"load-on-query", TRUE,
+		"auto-load", TRUE,
 		"name", "name",
 		"version", "version",
 		"license-id", "license-id",
@@ -145,7 +145,7 @@
 		"priority", &priority,
 		"abi_version", &abi_version,
 		"internal", &internal,
-		"load-on-query", &load_on_query,
+		"auto-load", &auto_load,
 		"name", &name,
 		"version", &version,
 		"license-id", &license_id,
@@ -170,7 +170,7 @@
 	test_int(priority, 1000);
 	test_uint(abi_version, GPLUGIN_NATIVE_PLUGIN_ABI_VERSION);
 	test_true(internal);
-	test_true(load_on_query);
+	test_true(auto_load);
 	test_string(name, "name");
 	test_string(version, "version");
 	test_string(license_id, "license-id");
@@ -230,7 +230,7 @@
 	gchar *website = NULL;
 	gchar **authors = NULL, **dependencies = NULL;
 	guint abi_version = 0;
-	gboolean internal = FALSE, load_on_query = FALSE;
+	gboolean internal = FALSE, auto_load = FALSE;
 	const gchar *const r_authors[] = {"author", NULL};
 	const gchar *const r_dependencies[] = {"dependency", NULL};
 
@@ -239,7 +239,7 @@
 		"gplugin-test/plugin-info-test",
 		GPLUGIN_NATIVE_PLUGIN_ABI_VERSION,
 		"internal", TRUE,
-		"load-on-query", TRUE,
+		"auto-load", TRUE,
 		"name", "name",
 		"version", "version",
 		"license-id", "license-id",
@@ -263,7 +263,7 @@
 		"id", &id,
 		"abi_version", &abi_version,
 		"internal", &internal,
-		"load-on-query", &load_on_query,
+		"auto-load", &auto_load,
 		"name", &name,
 		"version", &version,
 		"license-id", &license_id,
@@ -282,7 +282,7 @@
 	test_string(id, "gplugin-test/plugin-info-test");
 	test_uint(abi_version, GPLUGIN_NATIVE_PLUGIN_ABI_VERSION);
 	test_true(internal);
-	test_true(load_on_query);
+	test_true(auto_load);
 	test_string(name, "name");
 	test_string(version, "version");
 	test_string(license_id, "license-id");
diff --git a/lua/gplugin-lua-core.c b/lua/gplugin-lua-core.c
--- a/lua/gplugin-lua-core.c
+++ b/lua/gplugin-lua-core.c
@@ -40,7 +40,7 @@
 		"gplugin/lua-loader",
 		GPLUGIN_NATIVE_PLUGIN_ABI_VERSION,
 		"internal", TRUE,
-		"load-on-query", TRUE,
+		"auto-load", TRUE,
 		"name", "Lua Plugin Loader",
 		"version", GPLUGIN_VERSION,
 		"license-id", "LGPL-2.0-or-later",
diff --git a/python3/gplugin-python3-core.c b/python3/gplugin-python3-core.c
--- a/python3/gplugin-python3-core.c
+++ b/python3/gplugin-python3-core.c
@@ -40,7 +40,7 @@
 		"gplugin/python3-loader",
 		GPLUGIN_NATIVE_PLUGIN_ABI_VERSION,
 		"internal", TRUE,
-		"load-on-query", TRUE,
+		"auto-load", TRUE,
 		"name", "Python3 Plugin Loader",
 		"version", GPLUGIN_VERSION,
 		"license-id", "LGPL-2.0-or-later",
