#include <pulsecore/core-util.h>
-#define PA_GSETTINGS_MODULE_SCHEMA "org.freedesktop.pulseaudio.module"
-#define PA_GSETTINGS_MODULES_SCHEMA "org.freedesktop.pulseaudio.modules"
-#define PA_GSETTINGS_MODULES_PATH "/org/freedesktop/pulseaudio/modules/"
+#define PA_GSETTINGS_MODULE_GROUP_SCHEMA "org.freedesktop.pulseaudio.module-group"
+#define PA_GSETTINGS_MODULE_GROUPS_SCHEMA "org.freedesktop.pulseaudio.module-groups"
+#define PA_GSETTINGS_MODULE_GROUPS_PATH "/org/freedesktop/pulseaudio/module-groups/"
-static void modules_callback(GSettings *settings, gchar *key, gpointer user_data);
-
-static void handle_module(gchar *name) {
+static void handle_module_group(gchar *name) {
GSettings *settings;
gchar p[1024];
gboolean enabled;
int i;
- pa_snprintf(p, sizeof(p), PA_GSETTINGS_MODULES_PATH"%s/", name);
+ pa_snprintf(p, sizeof(p), PA_GSETTINGS_MODULE_GROUPS_PATH"%s/", name);
- if (!(settings = g_settings_new_with_path(PA_GSETTINGS_MODULE_SCHEMA,
+ if (!(settings = g_settings_new_with_path(PA_GSETTINGS_MODULE_GROUP_SCHEMA,
p)))
return;
g_object_unref(G_OBJECT(settings));
}
-static void modules_callback(GSettings *settings, gchar *key, gpointer user_data) {
- handle_module(user_data);
+static void module_group_callback(GSettings *settings, gchar *key, gpointer user_data) {
+ handle_module_group(user_data);
}
int main(int argc, char *argv[]) {
GMainLoop *g;
GSettings *settings;
- gchar **modules, **m;
+ gchar **group_names, **name;
#if !GLIB_CHECK_VERSION(2,36,0)
g_type_init();
#endif
- if (!(settings = g_settings_new(PA_GSETTINGS_MODULES_SCHEMA)))
+ if (!(settings = g_settings_new(PA_GSETTINGS_MODULE_GROUPS_SCHEMA)))
goto fail;
- g_signal_connect(settings, "changed", (GCallback) modules_callback, NULL);
+ g_signal_connect(settings, "changed", (GCallback) module_group_callback, NULL);
- modules = g_settings_list_children (settings);
+ group_names = g_settings_list_children(settings);
- for (m = modules; *m; m++) {
- g_signal_connect(g_settings_get_child (settings, *m), "changed",
- (GCallback) modules_callback, *m);
- handle_module(*m);
+ for (name = group_names; *name; name++) {
+ g_signal_connect(g_settings_get_child(settings, *name), "changed",
+ (GCallback) module_group_callback, *name);
+ handle_module_group(*name);
}
/* Signal the parent that we are now initialized */
<schemalist gettext-domain="pulseaudio">
- <schema id="org.freedesktop.pulseaudio.modules" path="/org/freedesktop/pulseaudio/modules/">
- <child name="combine" schema="org.freedesktop.pulseaudio.module"/>
- <child name="remote-access" schema="org.freedesktop.pulseaudio.module"/>
- <child name="zeroconf-discover" schema="org.freedesktop.pulseaudio.module"/>
- <child name="raop-discover" schema="org.freedesktop.pulseaudio.module"/>
- <child name="rtp-recv" schema="org.freedesktop.pulseaudio.module"/>
- <child name="rtp-send" schema="org.freedesktop.pulseaudio.module"/>
- <child name="upnp-media-server" schema="org.freedesktop.pulseaudio.module"/>
+ <!-- The module-groups object is just an entry point to find the individual
+ module-group objects. -->
+ <schema id="org.freedesktop.pulseaudio.module-groups" path="/org/freedesktop/pulseaudio/module-groups/">
+ <child name="combine" schema="org.freedesktop.pulseaudio.module-group"/>
+ <child name="remote-access" schema="org.freedesktop.pulseaudio.module-group"/>
+ <child name="zeroconf-discover" schema="org.freedesktop.pulseaudio.module-group"/>
+ <child name="raop-discover" schema="org.freedesktop.pulseaudio.module-group"/>
+ <child name="rtp-recv" schema="org.freedesktop.pulseaudio.module-group"/>
+ <child name="rtp-send" schema="org.freedesktop.pulseaudio.module-group"/>
+ <child name="upnp-media-server" schema="org.freedesktop.pulseaudio.module-group"/>
</schema>
- <schema id="org.freedesktop.pulseaudio.module">
+ <!-- Paprefs puts related modules into groups that are enabled or disabled as
+ a whole. One group can contain up to 10 module instances (either of the
+ same module or different modules). A module-group object defines up to
+ 10 modules to load. The name0..name9 keys contain the module names and
+ the args0..args9 keys provide the module arguments. -->
+ <schema id="org.freedesktop.pulseaudio.module-group">
<key name="name" type="s">
<default>''</default>
- <summary>Module name</summary>
- <description>Name of the pulseaudio module</description>
+ <summary>Module group name</summary>
+ <description>Module group name</description>
</key>
<key name="enabled" type="b">