GNOME Bugzilla – Bug 765644
Widget sizing problems with GtkProgressBar
Last modified: 2016-04-27 00:45:15 UTC
With the test program below (as well as with Gnumeric), gtk+ spews criticals for me: (lt-testcalendar:6149): Gtk-WARNING **: (gtkcssgadget.c:681):gtk_css_gadget_get_preferred_size: runtime check failed: (*minimum <= *natural) The problem is gtk_progress_bar_measure_text: *minimum = PANGO_PIXELS (char_width) * 3; This comes out bigger than *natural = logical_rect.width; One of them needs to be clamped to the other. (Using " " for the text makes sense here; the progress bar in question isn't actually in use at this time. It will get a proper test at a later time.) #include "config.h" #include <stdio.h> #include <string.h> #include <gtk/gtk.h> static void create_progress_bar(void) { GtkWidget *window = gtk_window_new (GTK_WINDOW_TOPLEVEL); gtk_window_set_title (GTK_WINDOW (window), "GtkProgress_Bar Example"); gtk_container_set_border_width (GTK_CONTAINER (window), 12); g_signal_connect (window, "destroy", G_CALLBACK (gtk_main_quit), NULL); g_signal_connect (window, "delete-event", G_CALLBACK (gtk_false), NULL); GtkWidget *pbar = gtk_progress_bar_new (); gtk_progress_bar_set_ellipsize (GTK_PROGRESS_BAR (pbar), PANGO_ELLIPSIZE_END); gtk_progress_bar_set_show_text (GTK_PROGRESS_BAR (pbar), TRUE); gtk_progress_bar_set_text (GTK_PROGRESS_BAR (pbar), " "); gtk_container_add (GTK_CONTAINER (window), pbar); gtk_window_set_default_size (GTK_WINDOW (window), 600, 0); gtk_widget_show_all (window); } int main(int argc, char *argv[] ) { gtk_init (&argc, &argv); if (g_getenv ("GTK_RTL")) gtk_widget_set_default_direction (GTK_TEXT_DIR_RTL); create_progress_bar(); gtk_main(); return(0); } /* example-end */