dialogs, libgimpwidgets: Prevent wide dialogs due to image/profile name

Currently if your image history includes an
image with a long name, the Welcome
Dialog will stretch out to match its width.
If the color profile name is long, then the
color scales will also stretch out due to
the profile label.
This patch adds ellipses to the Welcome
Dialog and a scrollwindow to the
ColorScales to prevent this.
This commit is contained in:
Alx Sa 2024-07-22 16:32:47 +00:00
parent 21f74286db
commit 42300d9db0
2 changed files with 12 additions and 2 deletions

View File

@ -793,6 +793,7 @@ welcome_dialog_create_creation_page (Gimp *gimp,
gtk_grid_attach (GTK_GRID (grid), thumbnail, 1, 0, 1, 1);
name_label = gtk_label_new (basename);
gtk_label_set_ellipsize (GTK_LABEL (name_label), PANGO_ELLIPSIZE_MIDDLE);
g_free (basename);
g_object_set (name_label, "xalign", 0.0, NULL);
gtk_grid_attach (GTK_GRID (grid), name_label, 2, 0, 1, 1);

View File

@ -356,12 +356,21 @@ create_group (GimpColorScales *scales,
if (add_label)
{
GtkWidget *scrolled_window;
scrolled_window = gtk_scrolled_window_new (NULL, NULL);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window),
GTK_POLICY_EXTERNAL, GTK_POLICY_NEVER);
gtk_grid_attach (GTK_GRID (grid), scrolled_window, 1, row, 3, 1);
gtk_widget_set_visible (scrolled_window, TRUE);
label = gtk_label_new (NULL);
gtk_widget_set_halign (label, GTK_ALIGN_START);
gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT);
gtk_label_set_ellipsize (GTK_LABEL (label), PANGO_ELLIPSIZE_END);
gtk_label_set_text (GTK_LABEL (label), _("Profile: sRGB"));
gtk_grid_attach (GTK_GRID (grid), label, 1, row, 3, 1);
gtk_widget_show (label);
gtk_container_add (GTK_CONTAINER (scrolled_window), label);
gtk_widget_set_visible (label, TRUE);
scales->profile_labels = g_list_prepend (scales->profile_labels, label);
}