diff --git a/app/dialogs/item-options-dialog.c b/app/dialogs/item-options-dialog.c index 0294ae8ba6..2f8f0fff5b 100644 --- a/app/dialogs/item-options-dialog.c +++ b/app/dialogs/item-options-dialog.c @@ -472,6 +472,7 @@ check_button_with_icon_new (const gchar *label, GtkWidget *hbox; GtkWidget *button; GtkWidget *image; + GtkWidget *label_widget; hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6); gtk_box_pack_start (vbox, hbox, FALSE, FALSE, 0); @@ -485,5 +486,9 @@ check_button_with_icon_new (const gchar *label, gtk_box_pack_start (GTK_BOX (hbox), button, TRUE, TRUE, 0); gtk_widget_show (button); + /* size the label to its bold size, avoiding a GUI twitch */ + label_widget = gtk_bin_get_child (GTK_BIN (button)); + gtk_widget_set_size_request (label_widget, gimp_get_bold_label_width (label), -1); + return button; } diff --git a/libgimpwidgets/gimppropwidgets.c b/libgimpwidgets/gimppropwidgets.c index 4c032ded9b..68cb252c91 100644 --- a/libgimpwidgets/gimppropwidgets.c +++ b/libgimpwidgets/gimppropwidgets.c @@ -122,6 +122,7 @@ gimp_prop_check_button_new (GObject *config, GParamSpec *param_spec; GtkWidget *button; const gchar *blurb; + GtkWidget *label_widget; g_return_val_if_fail (G_IS_OBJECT (config), NULL); g_return_val_if_fail (property_name != NULL, NULL); @@ -137,6 +138,10 @@ gimp_prop_check_button_new (GObject *config, button = gtk_check_button_new_with_mnemonic (label); gtk_widget_show (button); + /* size the label to its bold size, avoiding a GUI twitch */ + label_widget = gtk_bin_get_child (GTK_BIN (button)); + gtk_widget_set_size_request (label_widget, gimp_get_bold_label_width (label), -1); + blurb = g_param_spec_get_blurb (param_spec); if (blurb) gimp_help_set_help_data (button, blurb, NULL); diff --git a/libgimpwidgets/gimpwidgets.def b/libgimpwidgets/gimpwidgets.def index 641443f69a..0587e2df0c 100644 --- a/libgimpwidgets/gimpwidgets.def +++ b/libgimpwidgets/gimpwidgets.def @@ -201,6 +201,7 @@ EXPORTS gimp_float_adjustment_update gimp_frame_get_type gimp_frame_new + gimp_get_bold_label_width gimp_get_monitor_at_pointer gimp_grid_attach_aligned gimp_help_connect diff --git a/libgimpwidgets/gimpwidgetsutils.c b/libgimpwidgets/gimpwidgetsutils.c index 38133a3a19..0be74b1bde 100644 --- a/libgimpwidgets/gimpwidgetsutils.c +++ b/libgimpwidgets/gimpwidgetsutils.c @@ -1279,3 +1279,23 @@ gimp_widget_set_handle_on_mapped (GtkWidget *widget, return FALSE; } + +/* get the width of the label when it is bold */ +gint +gimp_get_bold_label_width (const gchar *text) + { + GtkWidget *temp_label = gtk_label_new (NULL); + GtkRequisition natural_size; + + gtk_label_set_text (GTK_LABEL (temp_label), text); + gtk_widget_set_visible (temp_label, TRUE); + + gimp_label_set_attributes (GTK_LABEL (temp_label), + PANGO_ATTR_WEIGHT, PANGO_WEIGHT_BOLD, + -1); + + gtk_widget_get_preferred_size (temp_label, NULL, &natural_size); + gtk_widget_destroy (temp_label); + + return natural_size.width; +} diff --git a/libgimpwidgets/gimpwidgetsutils.h b/libgimpwidgets/gimpwidgetsutils.h index 4ade052aaf..30f5852178 100644 --- a/libgimpwidgets/gimpwidgetsutils.h +++ b/libgimpwidgets/gimpwidgetsutils.h @@ -70,6 +70,7 @@ const Babl * gimp_widget_get_render_space (GtkWidget *widget, void gimp_widget_set_native_handle (GtkWidget *widget, GBytes **handle); +gint gimp_get_bold_label_width (const gchar *text); /* Internal use */