summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/interface.c4
-rw-r--r--src/pa-sink-ctl.c3
2 files changed, 7 insertions, 0 deletions
diff --git a/src/interface.c b/src/interface.c
index 11ba6be..83f6e39 100644
--- a/src/interface.c
+++ b/src/interface.c
@@ -16,6 +16,7 @@
#define H_MSG_BOX 3
extern pa_context* context;
+extern gboolean context_ready;
static WINDOW *menu_win;
static WINDOW *msg_win;
@@ -167,6 +168,9 @@ gboolean get_input(gpointer data)
gint c;
gboolean volume_increment = TRUE;
+ if (!context_ready)
+ return FALSE;
+
c = wgetch(menu_win);
switch (c) {
case 'k':
diff --git a/src/pa-sink-ctl.c b/src/pa-sink-ctl.c
index 02a58ab..102a78c 100644
--- a/src/pa-sink-ctl.c
+++ b/src/pa-sink-ctl.c
@@ -8,6 +8,7 @@
#include "pa-sink-ctl.h"
pa_context *context = NULL;
+gboolean context_ready = FALSE;
static gboolean info_callbacks_finished = TRUE;
static gboolean info_callbacks_blocked = FALSE;
@@ -69,6 +70,7 @@ static void subscribe_cb(pa_context *c, pa_subscription_event_type_t t, guint32
void context_state_callback(pa_context *c, gpointer userdata)
{
static pa_operation *o = NULL;
+ context_ready = FALSE;
switch (pa_context_get_state(c)) {
case PA_CONTEXT_CONNECTING:
status("connecting...");
@@ -86,6 +88,7 @@ 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)));
+ context_ready = TRUE;
status("ready to process events.");
break;
case PA_CONTEXT_FAILED: