diff options
author | ben <benjaminfranzke@googlemail.com> | 2010-07-23 01:19:40 +0200 |
---|---|---|
committer | ben <benjaminfranzke@googlemail.com> | 2010-07-23 01:19:40 +0200 |
commit | 5ce16f6ec724abb6f211089fd5ce5f3491a9a5eb (patch) | |
tree | 0e476fdf130cf8df1e2de55bce71d1c35b08d95a /src/pa-sink-ctl.c | |
parent | 621dba06222979156f4efd02832058b8f3900cd7 (diff) | |
download | pa-sink-ctl-5ce16f6ec724abb6f211089fd5ce5f3491a9a5eb.tar.gz pa-sink-ctl-5ce16f6ec724abb6f211089fd5ce5f3491a9a5eb.tar.bz2 pa-sink-ctl-5ce16f6ec724abb6f211089fd5ce5f3491a9a5eb.zip |
add status function, and display connection state
Diffstat (limited to 'src/pa-sink-ctl.c')
-rw-r--r-- | src/pa-sink-ctl.c | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/src/pa-sink-ctl.c b/src/pa-sink-ctl.c index d541156..0aed6cd 100644 --- a/src/pa-sink-ctl.c +++ b/src/pa-sink-ctl.c @@ -47,7 +47,10 @@ int main(int argc, char** argv) g_main_loop_run(g_loop); - printf("main loop quit\n"); + sink_list_free(sink_list); + interface_clear(); + + //printf("main loop quit\n"); pa_glib_mainloop_free(m); g_main_loop_unref(g_loop); @@ -76,8 +79,13 @@ void context_state_callback(pa_context *c, gpointer userdata) { switch (pa_context_get_state(c)) { case PA_CONTEXT_CONNECTING: + status("connecting..."); + break; case PA_CONTEXT_AUTHORIZING: + status("authorizing..."); + break; case PA_CONTEXT_SETTING_NAME: + status("setting name..."); break; case PA_CONTEXT_READY: @@ -88,14 +96,19 @@ void context_state_callback(pa_context *c, gpointer userdata) g_assert((o = pa_context_subscribe(c, (pa_subscription_mask_t) ( PA_SUBSCRIPTION_MASK_SINK | PA_SUBSCRIPTION_MASK_SINK_INPUT ), NULL, NULL))); + status("ready to process events."); + break; + case PA_CONTEXT_FAILED: + status("cannot connect!"); break; case PA_CONTEXT_TERMINATED: - printf("pulse connection terminated\n"); + status("connection terminated."); + //printf("pulse connection terminated\n"); g_main_loop_quit((GMainLoop *)userdata); break; default: - printf("unknown state\n"); + status("unknown state"); break; } } @@ -170,8 +183,6 @@ void get_sink_input_info_callback(pa_context *c, const pa_sink_input_info *i, gi void quit(void) { - sink_list_free(sink_list); - interface_clear(); pa_context_disconnect(context); } |