From 3138211b2b00e1b4bdcc2d29486473969285da1e Mon Sep 17 00:00:00 2001 From: ben Date: Tue, 13 Jul 2010 18:14:53 +0200 Subject: display name instead of device when device prop is not available --- src/interface.c | 2 +- src/pa-sink-ctl.c | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/interface.c b/src/interface.c index 75c2e4e..367eb8d 100644 --- a/src/interface.c +++ b/src/interface.c @@ -80,7 +80,7 @@ void print_sink_list(void) { mvwprintw(menu_win, y+i+offset, x, "%2d %-13s", sink_list[i]->index, - sink_list[i]->device); + sink_list[i]->device != NULL ? sink_list[i]->device : sink_list[i]->name); if (i == chooser_sink && chooser_input == -1) wattroff(menu_win, A_REVERSE); diff --git a/src/pa-sink-ctl.c b/src/pa-sink-ctl.c index e70c144..dac91c0 100644 --- a/src/pa-sink-ctl.c +++ b/src/pa-sink-ctl.c @@ -114,7 +114,8 @@ void get_sink_info_callback(pa_context *c, const pa_sink_info *i, int is_last, v sink_list[sink_counter]->vol = pa_cvolume_avg(&i->volume); sink_list[sink_counter]->channels = i->volume.channels; sink_list[sink_counter]->name = strdup(i->name); - sink_list[sink_counter]->device = strdup(pa_proplist_gets(i->proplist, "device.product.name")); + const char *tmp = pa_proplist_gets(i->proplist, "device.product.name"); + sink_list[sink_counter]->device = (tmp == NULL) ? NULL : strdup(tmp); ++sink_counter; } -- cgit