From 1783a8b24742aa509d578dd4edaab6bd8d40c8e0 Mon Sep 17 00:00:00 2001 From: "Geoffrey D. Bennett" Date: Wed, 21 Feb 2024 14:10:53 +1030 Subject: [PATCH] Don't show empty rows in levels window If a port category has no ports, skip that row. 4th Gen has a DSP port category that does not exist in previous generations. --- src/window-levels.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/window-levels.c b/src/window-levels.c index 0cc0507..6604a49 100644 --- a/src/window-levels.c +++ b/src/window-levels.c @@ -100,12 +100,16 @@ GtkWidget *create_levels_controls(struct alsa_card *card) { } // go through the port categories - for (int i = 0; i < PC_COUNT; i++) { + for (int i = 0, row = 1; i < PC_COUNT; i++) { + + if (card->routing_out_count[i] == 0) + continue; + GtkWidget *l = gtk_label_new(port_category_names[i]); gtk_widget_set_halign(l, GTK_ALIGN_END); // add the label - gtk_grid_attach(GTK_GRID(grid), l, 0, i + 1, 1, 1); + gtk_grid_attach(GTK_GRID(grid), l, 0, row, 1, 1); // go through the ports in that category for (int j = 0; j < card->routing_out_count[i]; j++) { @@ -132,8 +136,10 @@ GtkWidget *create_levels_controls(struct alsa_card *card) { gtk_dial_set_off_db(GTK_DIAL(meter), i == PC_HW ? -55 : -45); card->meters[meter_num++] = meter; - gtk_grid_attach(GTK_GRID(grid), meter, j + 1, i + 1, 1, 1); + gtk_grid_attach(GTK_GRID(grid), meter, j + 1, row, 1, 1); } + + row++; } int elem_count = card->level_meter_elem->count;