summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/paman.cc22
1 files changed, 17 insertions, 5 deletions
diff --git a/src/paman.cc b/src/paman.cc
index 06c4046..de397c1 100644
--- a/src/paman.cc
+++ b/src/paman.cc
@@ -18,14 +18,19 @@ struct pa_mainloop_api *mainloop_api = NULL;
extern "C" static void context_state_callback(struct pa_context *c, void *userdata);
+#define WINDOW_TITLE "Polypaudio Manager"
+
static void context_state_callback(struct pa_context *c, void *) {
g_assert(c && mainWindow);
switch (pa_context_get_state(c)) {
- case PA_CONTEXT_CONNECTING:
- mainWindow->showSuccess("Connecting ...");
+ case PA_CONTEXT_CONNECTING: {
+ char t[256];
+ snprintf(t, sizeof(t), "Connection to <b>%s</b> ...", pa_context_get_server(c));
+ mainWindow->showSuccess(t);
mainWindow->connectButton->set_sensitive(false);
return;
+ }
case PA_CONTEXT_AUTHORIZING:
mainWindow->showSuccess("Authorizing ...");
@@ -35,20 +40,26 @@ static void context_state_callback(struct pa_context *c, void *) {
mainWindow->showSuccess("Setting name ...");
return;
- case PA_CONTEXT_READY:
+ case PA_CONTEXT_READY: {
+ char t[256];
+ snprintf(t, sizeof(t), WINDOW_TITLE" [%s]", pa_context_get_server(c));
+ mainWindow->set_title(t);
mainWindow->showSuccess("Ready");
g_assert(!serverInfoManager);
serverInfoManager = new ServerInfoManager(*c);
mainWindow->statButton->set_sensitive(true);
mainWindow->disconnectButton->set_sensitive(true);
return;
-
+ }
+
case PA_CONTEXT_TERMINATED:
+ mainWindow->set_title(WINDOW_TITLE);
mainWindow->showSuccess("Disconnected");
break;
case PA_CONTEXT_FAILED:
default:
+ mainWindow->set_title(WINDOW_TITLE);
mainWindow->showFailure(pa_strerror(pa_context_errno(c)));
break;
@@ -71,7 +82,7 @@ void createConnection() {
context = pa_context_new(mainloop_api, "Polypaudio Manager");
g_assert(context);
pa_context_set_state_callback(context, context_state_callback, NULL);
- pa_context_connect(context, NULL, 1, NULL);
+ pa_context_connect(context, NULL, 0, NULL);
}
void killConnection() {
@@ -89,6 +100,7 @@ void killConnection() {
mainWindow->disconnectButton->set_sensitive(false);
mainWindow->statButton->set_sensitive(false);
mainWindow->clearAllData();
+ mainWindow->set_title(WINDOW_TITLE);
}
int main(int argc, char *argv[]) {