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 #define PA_GCONF_ROOT "/system/pulseaudio"
36 #define PA_GCONF_PATH_MODULES PA_GCONF_ROOT"/modules"
38 static void handle_module(GConfClient
*client
, const char *name
) {
40 gboolean enabled
, locked
;
43 snprintf(p
, sizeof(p
), PA_GCONF_PATH_MODULES
"/%s/locked", name
);
44 locked
= gconf_client_get_bool(client
, p
, FALSE
);
49 snprintf(p
, sizeof(p
), PA_GCONF_PATH_MODULES
"/%s/enabled", name
);
50 enabled
= gconf_client_get_bool(client
, p
, FALSE
);
52 printf("%c%s%c", enabled
? '+' : '-', name
, 0);
56 for (i
= 0; i
< 10; i
++) {
59 snprintf(p
, sizeof(p
), PA_GCONF_PATH_MODULES
"/%s/name%i", name
, i
);
60 if (!(n
= gconf_client_get_string(client
, p
, NULL
)) || !*n
)
63 snprintf(p
, sizeof(p
), PA_GCONF_PATH_MODULES
"/%s/args%i", name
, i
);
64 a
= gconf_client_get_string(client
, p
, NULL
);
66 printf("%s%c%s%c", n
, 0, a
? a
: "", 0);
78 static void modules_callback(
87 g_assert(strncmp(entry
->key
, PA_GCONF_PATH_MODULES
"/", sizeof(PA_GCONF_PATH_MODULES
)) == 0);
89 n
= entry
->key
+ sizeof(PA_GCONF_PATH_MODULES
);
91 g_strlcpy(buf
, n
, sizeof(buf
));
92 buf
[strcspn(buf
, "/")] = 0;
94 handle_module(client
, buf
);
97 int main(int argc
, char *argv
[]) {
104 if (!(client
= gconf_client_get_default()))
107 gconf_client_add_dir(client
, PA_GCONF_ROOT
, GCONF_CLIENT_PRELOAD_RECURSIVE
, NULL
);
108 gconf_client_notify_add(client
, PA_GCONF_PATH_MODULES
, modules_callback
, NULL
, NULL
, NULL
);
110 modules
= gconf_client_all_dirs(client
, PA_GCONF_PATH_MODULES
, NULL
);
112 for (m
= modules
; m
; m
= m
->next
) {
113 char *e
= strrchr(m
->data
, '/');
114 handle_module(client
, e
? e
+1 : m
->data
);
117 g_slist_free(modules
);
119 /* Signal the parent that we are now initialized */
123 g
= g_main_loop_new(NULL
, FALSE
);
125 g_main_loop_unref(g
);
127 g_object_unref(G_OBJECT(client
));