label: Don't use the selection too easily

When we are re-setting the same text for internal reasons
(e.g. when applying the mnemonics-visible change upon Alt press),
we should not needlessly loos the selection.

https://bugzilla.gnome.org/show_bug.cgi?id=671588
This commit is contained in:
Matthias Clasen 2012-03-20 01:05:05 -04:00
parent a720284976
commit ad1c0f7155

View File

@ -1982,11 +1982,14 @@ gtk_label_set_text_internal (GtkLabel *label,
gchar *str)
{
GtkLabelPrivate *priv = label->priv;
gboolean text_changed;
text_changed = g_strcmp0 (priv->text, str) != 0;
g_free (priv->text);
priv->text = str;
if (text_changed)
gtk_label_select_region_index (label, 0, 0);
}