diff options
author | ben <benjaminfranzke@googlemail.com> | 2010-07-13 18:14:53 +0200 |
---|---|---|
committer | ben <benjaminfranzke@googlemail.com> | 2010-07-13 18:14:53 +0200 |
commit | 3138211b2b00e1b4bdcc2d29486473969285da1e (patch) | |
tree | acc05dade652031d6f07885b59b419b97eb1558b | |
parent | 49c29950a85818f4b516a9c4c4f80c05214238a2 (diff) | |
download | pa-sink-ctl-3138211b2b00e1b4bdcc2d29486473969285da1e.tar.gz pa-sink-ctl-3138211b2b00e1b4bdcc2d29486473969285da1e.tar.bz2 pa-sink-ctl-3138211b2b00e1b4bdcc2d29486473969285da1e.zip |
display name instead of device when device prop is not available
-rw-r--r-- | src/interface.c | 2 | ||||
-rw-r--r-- | 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; } |