label: refactor code

If text didn't change, don't change it.

And if that sentence made no sense, that might explain why I refactored.
This commit is contained in:
Benjamin Otte 2013-03-12 12:43:14 +01:00
parent 24fa277329
commit e09957a47d

View File

@ -1980,15 +1980,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;
if (g_strcmp0 (priv->text, str) == 0)
return;
g_free (priv->text);
priv->text = str;
if (text_changed)
gtk_label_select_region_index (label, 0, 0);
gtk_label_select_region_index (label, 0, 0);
}
static void