4 This file is part of PulseAudio.
6 PulseAudio is free software; you can redistribute it and/or modify
7 it under the terms of the GNU Lesser General Public License as published
8 by the Free Software Foundation; either version 2 of the License,
9 or (at your option) any later version.
11 PulseAudio is distributed in the hope that it will be useful, but
12 WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 General Public License for more details.
16 You should have received a copy of the GNU Lesser General Public License
17 along with PulseAudio; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
30 #include <gconf/gconf-client.h>
33 #define PA_GCONF_ROOT "/system/pulseaudio"
34 #define PA_GCONF_PATH_MODULES PA_GCONF_ROOT"/modules"
36 static void handle_module(GConfClient
*client
, const char *name
) {
38 gboolean enabled
, locked
;
41 snprintf(p
, sizeof(p
), PA_GCONF_PATH_MODULES
"/%s/locked", name
);
42 locked
= gconf_client_get_bool(client
, p
, FALSE
);
47 snprintf(p
, sizeof(p
), PA_GCONF_PATH_MODULES
"/%s/enabled", name
);
48 enabled
= gconf_client_get_bool(client
, p
, FALSE
);
50 printf("%c%s%c", enabled
? '+' : '-', name
, 0);
54 for (i
= 0; i
< 10; i
++) {
57 snprintf(p
, sizeof(p
), PA_GCONF_PATH_MODULES
"/%s/name%i", name
, i
);
58 if (!(n
= gconf_client_get_string(client
, p
, NULL
)) || !*n
)
61 snprintf(p
, sizeof(p
), PA_GCONF_PATH_MODULES
"/%s/args%i", name
, i
);
62 a
= gconf_client_get_string(client
, p
, NULL
);
64 printf("%s%c%s%c", n
, 0, a
? a
: "", 0);
76 static void modules_callback(
85 g_assert(strncmp(entry
->key
, PA_GCONF_PATH_MODULES
"/", sizeof(PA_GCONF_PATH_MODULES
)) == 0);
87 n
= entry
->key
+ sizeof(PA_GCONF_PATH_MODULES
);
89 g_strlcpy(buf
, n
, sizeof(buf
));
90 buf
[strcspn(buf
, "/")] = 0;
92 handle_module(client
, buf
);
95 int main(int argc
, char *argv
[]) {
100 if (!(client
= gconf_client_get_default()))
103 gconf_client_add_dir(client
, PA_GCONF_ROOT
, GCONF_CLIENT_PRELOAD_RECURSIVE
, NULL
);
104 gconf_client_notify_add(client
, PA_GCONF_PATH_MODULES
, modules_callback
, NULL
, NULL
, NULL
);
106 modules
= gconf_client_all_dirs(client
, PA_GCONF_PATH_MODULES
, NULL
);
108 for (m
= modules
; m
; m
= m
->next
) {
109 char *e
= strrchr(m
->data
, '/');
110 handle_module(client
, e
? e
+1 : m
->data
);
113 g_slist_free(modules
);
115 /* Signal the parent that we are now initialized */
119 g
= g_main_loop_new(NULL
, FALSE
);
121 g_main_loop_unref(g
);
123 g_object_unref(G_OBJECT(client
));