[gtk+] label: refactor code
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] label: refactor code
- Date: Tue, 12 Mar 2013 11:47:09 +0000 (UTC)
commit e09957a47da9425cc26d1b33cb4e9cc3e92e9ac7
Author: Benjamin Otte <otte redhat com>
Date: Tue Mar 12 12:43:14 2013 +0100
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.
gtk/gtklabel.c | 7 +++----
1 files changed, 3 insertions(+), 4 deletions(-)
---
diff --git a/gtk/gtklabel.c b/gtk/gtklabel.c
index bc17554..0eac38d 100644
--- a/gtk/gtklabel.c
+++ b/gtk/gtklabel.c
@@ -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
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]