app: GimpScaleComboBox resized appropriately with its contents.

Rather than having an oversized entry all the time, adapt it to the
visible zoom.
This commit is contained in:
Jehan
2017-11-14 05:08:02 +01:00
parent 864e3df7a9
commit 788e04bddb

View File

@ -147,7 +147,7 @@ gimp_scale_combo_box_constructed (GObject *object)
g_object_set (entry,
"xalign", 1.0,
"width-chars", 7,
"width-chars", 5,
"truncate-multiline", TRUE,
"inner-border", &border,
NULL);
@ -483,9 +483,11 @@ gimp_scale_combo_box_set_scale (GimpScaleComboBox *combo_box,
{
GtkTreeModel *model;
GtkListStore *store;
GtkWidget *entry;
GtkTreeIter iter;
gboolean iter_valid;
gboolean persistent;
gint n_digits;
g_return_if_fail (GIMP_IS_SCALE_COMBO_BOX (combo_box));
g_return_if_fail (scale > 0.0);
@ -541,6 +543,14 @@ gimp_scale_combo_box_set_scale (GimpScaleComboBox *combo_box,
if (gtk_tree_model_iter_n_children (model, NULL) > MAX_ITEMS)
gimp_scale_combo_box_mru_remove_last (combo_box);
}
/* Update entry size appropriately. */
entry = gtk_bin_get_child (GTK_BIN (combo_box));
n_digits = (gint) floor (log10 (scale) + 1);
g_object_set (entry,
"width-chars", MAX (5, n_digits + 4),
NULL);
}
gdouble