[gtk+/a11y] GtkLabel: optimize away some ::notify emissions



commit bf3fcfc688d28c21b8f35f26834c116b3db79561
Author: Matthias Clasen <mclasen redhat com>
Date:   Sat Jun 25 22:42:17 2011 -0400

    GtkLabel: optimize away some ::notify emissions

 gtk/gtklabel.c |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)
---
diff --git a/gtk/gtklabel.c b/gtk/gtklabel.c
index e16ea33..313da19 100644
--- a/gtk/gtklabel.c
+++ b/gtk/gtklabel.c
@@ -5431,6 +5431,13 @@ gtk_label_select_region_index (GtkLabel *label,
           priv->select_info->selection_end == end_index)
         return;
 
+      g_object_freeze_notify (G_OBJECT (label));
+
+      if (priv->select_info->selection_anchor != anchor_index)
+        g_object_notify (G_OBJECT (label), "selection-bound");
+      if (priv->select_info->selection_end != end_index)
+        g_object_notify (G_OBJECT (label), "cursor-position");
+
       priv->select_info->selection_anchor = anchor_index;
       priv->select_info->selection_end = end_index;
 
@@ -5469,9 +5476,6 @@ gtk_label_select_region_index (GtkLabel *label,
 
       gtk_widget_queue_draw (GTK_WIDGET (label));
 
-      g_object_freeze_notify (G_OBJECT (label));
-      g_object_notify (G_OBJECT (label), "cursor-position");
-      g_object_notify (G_OBJECT (label), "selection-bound");
       g_object_thaw_notify (G_OBJECT (label));
     }
 }



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