[evince] shell: update eggfindbar label only if the text changes



commit aff3ef469a2d39415f169953972d03425b7db32a
Author: Germán Poo-Caamaño <gpoo gnome org>
Date:   Thu Feb 28 22:41:44 2013 -0800

    shell: update eggfindbar label only if the text changes
    
    This allows to avoid updating the GUI when the label to update
    has not really changed.  By doing this, it helps to reduce penalty
    performance when the caller makes multiples "updates" in a short
    period of time without really changing the label itself.

 shell/eggfindbar.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)
---
diff --git a/shell/eggfindbar.c b/shell/eggfindbar.c
index ac3b84a..c85273f 100644
--- a/shell/eggfindbar.c
+++ b/shell/eggfindbar.c
@@ -846,11 +846,16 @@ egg_find_bar_set_status_text (EggFindBar *find_bar,
                               const char *text)
 {
   EggFindBarPrivate *priv;
+  const gchar *current_text;
 
   g_return_if_fail (EGG_IS_FIND_BAR (find_bar));
 
   priv = (EggFindBarPrivate *)find_bar->priv;
   
-  gtk_label_set_text (GTK_LABEL (priv->status_label), text);
+  current_text = gtk_label_get_text (GTK_LABEL (priv->status_label));
+
+  if (g_strcmp0 (current_text, text) != 0)
+         gtk_label_set_text (GTK_LABEL (priv->status_label), text);
+
   g_object_set (priv->status_item, "visible", text != NULL && *text !='\0', NULL);
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]