Provide a way to ellipsize and/or wrap content inside a GtkStackSidebar
^ what currently happens
^ an example of more correct behavior
the issue with the second way is that the two «ICC» courses are in this example indistinguishable. Which means that like in #116 it may be preferable to wrap instead of ellipsize the label.
the code I used to demonstrate the more correct behavior:
// ellipsize the labels
GtkWidget *scrolled_win = gtk_bin_get_child (GTK_BIN (self->stack_sidebar));
GtkWidget *viewport = gtk_bin_get_child (GTK_BIN (scrolled_win));
GtkWidget *label_list = gtk_bin_get_child (GTK_BIN (viewport));
// this is an ugly way of reaching the container :-/
void ellipsize_label (GtkWidget *list_item, gpointer unused) {
GtkLabel *label = GTK_LABEL (gtk_bin_get_child (GTK_BIN (list_item)));
gtk_label_set_ellipsize (label, PANGO_ELLIPSIZE_END);
}
gtk_container_foreach (GTK_CONTAINER (label_list), ellipsize_label, NULL);
I first thought of adding a ellipsize property to the stack switcher, while Adrien Plazas suggested that «We could have HdyViewSidebar to which you could pass a function to automatically transform stack children into sidebar rows».