From 9fc4c7c6e12801417841e56fe2de7056efacbf40 Mon Sep 17 00:00:00 2001 From: "Geoffrey D. Bennett" Date: Mon, 22 Jan 2024 19:34:26 +1030 Subject: [PATCH] Use GtkTextView instead of GtkLabel in startup big_label() --- src/alsa-scarlett-gui.css | 10 ++++++++++ src/window-startup.c | 12 +++++++----- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/src/alsa-scarlett-gui.css b/src/alsa-scarlett-gui.css index c868534..3253885 100644 --- a/src/alsa-scarlett-gui.css +++ b/src/alsa-scarlett-gui.css @@ -215,6 +215,16 @@ button.sw-hw:checked { border-color: #303030; } +/* Textview used for long descriptions in the startup window */ +textview { + color: #ffffff; + background: none; +} + +textview > text { + background: none; +} + /* Bigger buttons in the startup window */ .window-startup button { padding: 5px; diff --git a/src/window-startup.c b/src/window-startup.c index fbcce90..4bc6572 100644 --- a/src/window-startup.c +++ b/src/window-startup.c @@ -18,14 +18,16 @@ static GtkWidget *small_label(char *text) { } static GtkWidget *big_label(char *text) { - GtkWidget *w = gtk_label_new(text); + GtkWidget *view = gtk_text_view_new (); + GtkTextBuffer *buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view)); - gtk_widget_set_halign(w, GTK_ALIGN_START); + gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (view), GTK_WRAP_WORD); + gtk_widget_set_size_request (view, 600, -1); + gtk_widget_set_sensitive (view, FALSE); - gtk_label_set_wrap(GTK_LABEL(w), true); - gtk_label_set_max_width_chars(GTK_LABEL(w), 60); + gtk_text_buffer_set_text (buffer, text, -1); - return w; + return view; } static void add_sep(GtkWidget *grid, int *grid_y) {