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:
@ -1979,15 +1979,18 @@ gtk_label_get_mnemonic_keyval (GtkLabel *label)
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_label_set_text_internal (GtkLabel *label,
|
gtk_label_set_text_internal (GtkLabel *label,
|
||||||
gchar *str)
|
gchar *str)
|
||||||
{
|
{
|
||||||
GtkLabelPrivate *priv = label->priv;
|
GtkLabelPrivate *priv = label->priv;
|
||||||
|
gboolean text_changed;
|
||||||
|
|
||||||
|
text_changed = g_strcmp0 (priv->text, str) != 0;
|
||||||
|
|
||||||
g_free (priv->text);
|
g_free (priv->text);
|
||||||
|
|
||||||
priv->text = str;
|
priv->text = str;
|
||||||
|
|
||||||
gtk_label_select_region_index (label, 0, 0);
|
if (text_changed)
|
||||||
|
gtk_label_select_region_index (label, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|||||||
Reference in New Issue
Block a user