4 This file is part of PulseAudio.
6 Copyright 2006 Lennart Poettering
8 PulseAudio is free software; you can redistribute it and/or modify
9 it under the terms of the GNU Lesser General Public License as published
10 by the Free Software Foundation; either version 2 of the License,
11 or (at your option) any later version.
13 PulseAudio is distributed in the hope that it will be useful, but
14 WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 General Public License for more details.
18 You should have received a copy of the GNU Lesser General Public License
19 along with PulseAudio; if not, write to the Free Software
20 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
32 #include <gconf/gconf-client.h>
35 #include <pulsecore/core-util.h>
37 #define PA_GCONF_ROOT "/system/pulseaudio"
38 #define PA_GCONF_PATH_MODULES PA_GCONF_ROOT"/modules"
40 static void handle_module(GConfClient
*client
, const char *name
) {
42 gboolean enabled
, locked
;
45 pa_snprintf(p
, sizeof(p
), PA_GCONF_PATH_MODULES
"/%s/locked", name
);
46 locked
= gconf_client_get_bool(client
, p
, FALSE
);
51 pa_snprintf(p
, sizeof(p
), PA_GCONF_PATH_MODULES
"/%s/enabled", name
);
52 enabled
= gconf_client_get_bool(client
, p
, FALSE
);
54 printf("%c%s%c", enabled
? '+' : '-', name
, 0);
58 for (i
= 0; i
< 10; i
++) {
61 pa_snprintf(p
, sizeof(p
), PA_GCONF_PATH_MODULES
"/%s/name%i", name
, i
);
62 if (!(n
= gconf_client_get_string(client
, p
, NULL
)) || !*n
)
65 pa_snprintf(p
, sizeof(p
), PA_GCONF_PATH_MODULES
"/%s/args%i", name
, i
);
66 a
= gconf_client_get_string(client
, p
, NULL
);
68 printf("%s%c%s%c", n
, 0, a
? a
: "", 0);
80 static void modules_callback(
89 g_assert(strncmp(entry
->key
, PA_GCONF_PATH_MODULES
"/", sizeof(PA_GCONF_PATH_MODULES
)) == 0);
91 n
= entry
->key
+ sizeof(PA_GCONF_PATH_MODULES
);
93 g_strlcpy(buf
, n
, sizeof(buf
));
94 buf
[strcspn(buf
, "/")] = 0;
96 handle_module(client
, buf
);
99 int main(int argc
, char *argv
[]) {
106 if (!(client
= gconf_client_get_default()))
109 gconf_client_add_dir(client
, PA_GCONF_ROOT
, GCONF_CLIENT_PRELOAD_RECURSIVE
, NULL
);
110 gconf_client_notify_add(client
, PA_GCONF_PATH_MODULES
, modules_callback
, NULL
, NULL
, NULL
);
112 modules
= gconf_client_all_dirs(client
, PA_GCONF_PATH_MODULES
, NULL
);
114 for (m
= modules
; m
; m
= m
->next
) {
115 char *e
= strrchr(m
->data
, '/');
116 handle_module(client
, e
? e
+1 : m
->data
);
119 g_slist_free(modules
);
121 /* Signal the parent that we are now initialized */
125 g
= g_main_loop_new(NULL
, FALSE
);
127 g_main_loop_unref(g
);
129 g_object_unref(G_OBJECT(client
));