# HG changeset patch
# Node ID a6c4cbd31856
# Parent  1140a48e4b4a
diff --git a/gplugin/tests/plugins/meson.build b/gplugin/tests/plugins/meson.build
--- a/gplugin/tests/plugins/meson.build
+++ b/gplugin/tests/plugins/meson.build
@@ -12,3 +12,5 @@ foreach lib : LIBRARIES
 	shared_library(lib, f'@lib@.c',
 	               name_prefix: '', dependencies : [gplugin_dep, GLIB])
 endforeach
+
+subdir('settings')
diff --git a/gplugin/tests/plugins/settings/im.pidgin.GPlugin.plugin.SettingsPlugin.gschema.xml b/gplugin/tests/plugins/settings/im.pidgin.GPlugin.plugin.SettingsPlugin.gschema.xml
new file mode 100644
--- /dev/null
+++ b/gplugin/tests/plugins/settings/im.pidgin.GPlugin.plugin.SettingsPlugin.gschema.xml
@@ -0,0 +1,124 @@
+<?xml version="1.0" encoding="utf-8"?>
+<schemalist>
+  <enum id="im.pidgin.GPlugin.plugin.SettingsPlugin.Enum">
+    <value nick="Foo" value="0"/>
+    <value nick="Bar" value="1"/>
+    <value nick="Baz" value="2"/>
+  </enum>
+
+  <flags id="im.pidgin.GPlugin.plugin.SettingsPlugin.Flags">
+    <value nick="flag1" value="1"/>
+    <value nick="flag2" value="2"/>
+    <value nick="flag3" value="4"/>
+  </flags>
+
+  <schema path="/im/pidgin/gplugin/plugins/settings/" id="im.pidgin.GPlugin.plugin.SettingsPlugin">
+    <!-- Special (but still simple) types -->
+    <key name="enum" enum="im.pidgin.GPlugin.plugin.SettingsPlugin.Enum">
+      <default>"Foo"</default>
+      <summary>Enum setting</summary>
+      <description>
+        A setting that is an enumeration.
+      </description>
+    </key>
+
+    <key name="flags" flags="im.pidgin.GPlugin.plugin.SettingsPlugin.Flags">
+      <default>["flag1"]</default>
+      <summary>Flags setting</summary>
+      <description>
+        A setting that is a bitflag.
+      </description>
+    </key>
+
+    <key name="range" type="i">
+      <default>5</default>
+      <range min="2" max="10"/>
+      <summary>Range setting</summary>
+      <description>
+        A setting that is a 32-bit signed integer with a limited range.
+      </description>
+    </key>
+
+    <!-- Basic types -->
+    <key name="boolean" type="b">
+      <default>true</default>
+      <summary>Bool setting</summary>
+      <description>
+        A setting that is a boolean.
+      </description>
+    </key>
+
+    <key name="double" type="d">
+      <default>1234.56789</default>
+      <summary>Double setting</summary>
+      <description>
+        A setting that is a 64-bit floating-point number.
+      </description>
+    </key>
+
+    <key name="text" type="s">
+      <default>"information"</default>
+      <summary>Text setting</summary>
+      <description>
+        A setting that is a string.
+      </description>
+    </key>
+
+    <!-- All integral basic types -->
+    <key name="char" type="y">
+      <default>123</default>
+      <summary>Char setting</summary>
+      <description>
+        A setting that is an unsigned character.
+      </description>
+    </key>
+
+    <key name="int16" type="n">
+      <default>-1234</default>
+      <summary>Int16 setting</summary>
+      <description>
+        A setting that is a 16-bit signed integer.
+      </description>
+    </key>
+
+    <key name="uint16" type="q">
+      <default>12345</default>
+      <summary>UInt16 setting</summary>
+      <description>
+        A setting that is a 16-bit unsigned integer.
+      </description>
+    </key>
+
+    <key name="int32" type="i">
+      <default>-123456</default>
+      <summary>Int32 setting</summary>
+      <description>
+        A setting that is a 32-bit signed integer.
+      </description>
+    </key>
+
+    <key name="uint32" type="u">
+      <default>1234567</default>
+      <summary>UInt32 setting</summary>
+      <description>
+        A setting that is a 32-bit unsigned integer.
+      </description>
+    </key>
+
+    <key name="int64" type="x">
+      <default>-12345678901</default>
+      <summary>Int64 setting</summary>
+      <description>
+        A setting that is a 64-bit signed integer.
+      </description>
+    </key>
+
+    <key name="uint64" type="t">
+      <default>123456789012</default>
+      <summary>UInt64 setting</summary>
+      <description>
+        A setting that is a 64-bit unsigned integer.
+      </description>
+    </key>
+  </schema>
+</schemalist>
diff --git a/gplugin/tests/plugins/settings/meson.build b/gplugin/tests/plugins/settings/meson.build
new file mode 100644
--- /dev/null
+++ b/gplugin/tests/plugins/settings/meson.build
@@ -0,0 +1,14 @@
+shared_library('settings', 'settings.c',
+               name_prefix: '', dependencies : [gplugin_dep, GLIB])
+devenv.append('GPLUGIN_PLUGIN_PATH', meson.current_build_dir())
+
+schemas_dir = get_option('prefix') / get_option('datadir') / 'glib-2.0' / 'schemas'
+settings_schemas = [
+  'im.pidgin.GPlugin.plugin.SettingsPlugin.gschema.xml',
+]
+
+install_data(settings_schemas, install_dir: schemas_dir)
+gnome.post_install(glib_compile_schemas: true)
+
+# Compile the schemas in the current directory; this is only useful for testing
+gnome.compile_schemas(depend_files: files(settings_schemas))
diff --git a/gplugin/tests/plugins/settings/settings.c b/gplugin/tests/plugins/settings/settings.c
new file mode 100644
--- /dev/null
+++ b/gplugin/tests/plugins/settings/settings.c
@@ -0,0 +1,70 @@
+/*
+ * Copyright (C) 2022 Elliott Sales de Andrade <quantum.analyst@gmail.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, see <https://www.gnu.org/licenses/>.
+ */
+
+#include <gplugin.h>
+#include <gplugin-native.h>
+
+static GPluginPluginInfo *
+settings_query(G_GNUC_UNUSED GError **error)
+{
+	const gchar *const authors[] = {"author1", NULL};
+
+	/* clang-format off */
+	return gplugin_plugin_info_new(
+		"gplugin/native-settings-plugin",
+		0x01020304,
+		"name", "settings plugin (C)",
+		"category", "test",
+		"version", "version",
+		"summary", "summary",
+		"license-id", "license",
+		"description", "description",
+		"authors", authors,
+		"website", "website",
+		"settings-schema", "im.pidgin.GPlugin.plugin.SettingsPlugin",
+		NULL);
+	/* clang-format on */
+}
+
+static gboolean
+settings_load(GPluginPlugin *plugin, GError **error)
+{
+	if(!GPLUGIN_IS_PLUGIN(plugin)) {
+		g_set_error_literal(error, GPLUGIN_DOMAIN, 0, "plugin was not set");
+
+		return FALSE;
+	}
+
+	return TRUE;
+}
+
+static gboolean
+settings_unload(
+	GPluginPlugin *plugin,
+	G_GNUC_UNUSED gboolean shutdown,
+	GError **error)
+{
+	if(!GPLUGIN_IS_PLUGIN(plugin)) {
+		g_set_error_literal(error, GPLUGIN_DOMAIN, 0, "plugin was not set");
+
+		return FALSE;
+	}
+
+	return TRUE;
+}
+
+GPLUGIN_NATIVE_PLUGIN_DECLARE(settings)
