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

@ -1979,15 +1979,18 @@ gtk_label_get_mnemonic_keyval (GtkLabel *label)
static void
gtk_label_set_text_internal (GtkLabel *label,
gchar *str)
gchar *str)
{
GtkLabelPrivate *priv = label->priv;
gboolean text_changed;
text_changed = g_strcmp0 (priv->text, str) != 0;
g_free (priv->text);
priv->text = str;
gtk_label_select_region_index (label, 0, 0);
if (text_changed)
gtk_label_select_region_index (label, 0, 0);
}
static void