diff options
author | Benjamin Franzke <benjaminfranzke@googlemail.com> | 2011-12-13 17:13:52 +0100 |
---|---|---|
committer | Benjamin Franzke <benjaminfranzke@googlemail.com> | 2011-12-13 17:13:52 +0100 |
commit | 9cf61dffa6caf5a93cc91cc7e20c8fdfd5c67474 (patch) | |
tree | 3b5ee5e4f19ca823956a69a2db11cada2debdb9a /src | |
parent | 489e2955687bccb263e1ece3a1615b3356c990f2 (diff) | |
download | pa-sink-ctl-9cf61dffa6caf5a93cc91cc7e20c8fdfd5c67474.tar.gz pa-sink-ctl-9cf61dffa6caf5a93cc91cc7e20c8fdfd5c67474.tar.bz2 pa-sink-ctl-9cf61dffa6caf5a93cc91cc7e20c8fdfd5c67474.zip |
Allow to quit with a non-ready context
Diffstat (limited to 'src')
-rw-r--r-- | src/command.c | 15 | ||||
-rw-r--r-- | src/interface.c | 3 |
2 files changed, 15 insertions, 3 deletions
diff --git a/src/command.c b/src/command.c index 52af20a..5963fca 100644 --- a/src/command.c +++ b/src/command.c @@ -58,6 +58,9 @@ up(struct context *ctx, int key) { struct sink_info *sink = NULL; + if (!ctx->context_ready) + return; + if (ctx->chooser_input == SELECTED_SINK && ctx->chooser_sink > 0) { sink = g_list_nth_data(ctx->sink_list, --ctx->chooser_sink); @@ -74,6 +77,9 @@ down(struct context *ctx, int key) { struct sink_info *sink; + if (!ctx->context_ready) + return; + sink = g_list_nth_data(ctx->sink_list, ctx->chooser_sink); if (ctx->chooser_input == (sink_input_len(ctx, sink) - 1) && ctx->chooser_sink < (gint) g_list_length(ctx->sink_list)-1) { @@ -92,6 +98,9 @@ volume_change(struct context *ctx, gboolean volume_increment) struct sink_input_info *input; guint32 index; + if (!ctx->context_ready) + return; + sink = g_list_nth_data(ctx->sink_list, ctx->chooser_sink); pa_cvolume volume; pa_volume_t tmp_vol; @@ -152,6 +161,9 @@ mute(struct context *ctx, int key) guint32 index; gint mute; + if (!ctx->context_ready) + return; + sink = g_list_nth_data(ctx->sink_list, ctx->chooser_sink); pa_operation* (*mute_set) (pa_context*, guint32, int, pa_context_success_cb_t, void*); @@ -182,6 +194,9 @@ switch_sink(struct context *ctx, int key) pa_operation *o; gint i; + if (!ctx->context_ready) + return; + if (ctx->chooser_input == SELECTED_SINK) return; sink = g_list_nth_data(ctx->sink_list, ctx->chooser_sink); diff --git a/src/interface.c b/src/interface.c index 9cc31f8..43b38b8 100644 --- a/src/interface.c +++ b/src/interface.c @@ -181,9 +181,6 @@ interface_get_input(GIOChannel *source, GIOCondition condition, gpointer data) struct command_cb_descriptor *cmd; gint c; - if (!ctx->context_ready) - return TRUE; - c = wgetch(ctx->menu_win); cmd = g_hash_table_lookup(ctx->config.keymap, GINT_TO_POINTER(c)); |