GNOME Bugzilla – Bug 654678
Message dialog's primary text font increases on every call to gtk_message_dialog_format_secondary_text
Last modified: 2011-07-19 10:00:21 UTC
On every call to gtk_message_dialog_format_secondary_text, the font size of the primary text label in GtkMessageDialog gets increased, as it multiplies its current size by PANGO_SCALE_LARGE (see setup_primary_label_font). I guess what it really needs to do is multiply by the secondary text font size, rather than its own. This can be easily replicated with the following code: #include <gtk/gtk.h> static void print_countdown_text (GtkWidget *dialog) { static gint seconds = 10; gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog), "The application will close in %d seconds", seconds); seconds--; if (seconds == 0) { gtk_main_quit (); } } static void timeout_cb (gpointer data) { print_countdown_text (data); } int main (int argc, char *argv[]) { GtkWidget *dialog; gtk_init (&argc, &argv); dialog = gtk_message_dialog_new (NULL, GTK_DIALOG_MODAL, GTK_MESSAGE_QUESTION, GTK_BUTTONS_CLOSE, "Do you want to wait for the program to finish?"); g_signal_connect (dialog, "response", G_CALLBACK (gtk_main_quit), NULL); g_timeout_add (1000, timeout_cb, dialog); print_countdown_text (dialog); gtk_widget_show (dialog); gtk_main (); return 0; } Attaching a patch to fix it
Created attachment 192028 [details] [review] Use secondary text label font
Review of attachment 192028 [details] [review]: Doesn't look correct to me. We need to figure out why gtk_widget_modify_font (priv->label, NULL) doesn't have the desired effect.
It looks like this broke with the introduction of shorthand font properties. Over to Benjamin.
<Company> mclasen: yeah, looks like i never implemented unset_property for shorthands <Company> shouldn't be too hard to do
commit 20c6acfc8d1871da220c4fbd7ecbaff66da22927 Author: Benjamin Otte <otte@redhat.com> Date: Tue Jul 19 11:57:27 2011 +0200 reftests: Add test for recent fix https://bugzilla.gnome.org/show_bug.cgi?id=654678 commit 6aa000f65b86ee180b8ddb4dd9e4564e9f0b9752 Author: Benjamin Otte <otte@redhat.com> Date: Tue Jul 19 11:42:31 2011 +0200 styleproperties: Add unset functions for shorthands This fixes calls to gtk_style_properties_unset_property() for shorthand properties. https://bugzilla.gnome.org/show_bug.cgi?id=654678