notify freeze / thaws for GtkLabel ...



Hi there,

	Seeing a slew of notify signalage on the nautilus profile:

   1478	GtkImage::notify
   1717	GtkLabel::notify
   2061	GtkAccelLabel::parent-set
   2063	GtkAccelLabel::hierarchy-changed
   3201	NautilusIconCanvasItem::notify
   9750	GtkAccelLabel::notify

	I was wondering if I could pop this patch in to at least take a factor
of 3-4 out of that number :-) [ clearly there is prolly some issue
causing way too many sets at my end too ].

	May I commit ?

		Michael.

Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/gtk+/ChangeLog,v
retrieving revision 1.3330
diff -u -p -u -r1.3330 ChangeLog
--- ChangeLog	11 Apr 2002 14:28:09 -0000	1.3330
+++ ChangeLog	11 Apr 2002 16:57:08 -0000
@@ -1,3 +1,10 @@
+2002-04-11  Michael Meeks  <michael ximian com>
+
+	* gtk/gtklabel.c
+	(gtk_label_parse_uline, gtk_label_set_text),
+	(gtk_label_set_text_with_mnemonic): add freeze / thaws
+	to stop deluge of 'notify' signals.
+
 Sat Apr  6 06:57:00 2002  Owen Taylor  <otaylor redhat com>
 
 	* gtk/gtkmenushell.[ch] gtk/gtkmenuitem.c: Export
Index: gtk/gtklabel.c
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtklabel.c,v
retrieving revision 1.126
diff -u -p -u -r1.126 gtklabel.c
--- gtk/gtklabel.c	3 Mar 2002 19:59:27 -0000	1.126
+++ gtk/gtklabel.c	11 Apr 2002 16:57:10 -0000
@@ -908,11 +908,15 @@ gtk_label_set_text (GtkLabel    *label,
 {
   g_return_if_fail (GTK_IS_LABEL (label));
   
+  g_object_freeze_notify (G_OBJECT (label));
+
   gtk_label_set_label_internal (label, g_strdup (str ? str : ""));
   gtk_label_set_use_markup_internal (label, FALSE);
   gtk_label_set_use_underline_internal (label, FALSE);
   
   gtk_label_recalculate (label);
+
+  g_object_thaw_notify (G_OBJECT (label));
 }
 
 /**
@@ -1918,6 +1922,8 @@ gtk_label_parse_uline (GtkLabel    *labe
   g_return_val_if_fail (str != NULL, GDK_VoidSymbol);
 
   orig_keyval = label->mnemonic_keyval;
+
+  g_object_freeze_notify (G_OBJECT (label));
   
   gtk_label_set_label_internal (label, g_strdup (str ? str : ""));
   gtk_label_set_use_markup_internal (label, FALSE);
@@ -1925,6 +1931,8 @@ gtk_label_parse_uline (GtkLabel    *labe
   
   gtk_label_recalculate (label);
 
+  g_object_thaw_notify (G_OBJECT (label));
+
   keyval = label->mnemonic_keyval;
   label->mnemonic_keyval = GDK_VoidSymbol;
   
@@ -1954,12 +1962,16 @@ gtk_label_set_text_with_mnemonic (GtkLab
   g_return_if_fail (str != NULL);
 
   last_keyval = label->mnemonic_keyval;
-  
+
+  g_object_freeze_notify (G_OBJECT (label));
+
   gtk_label_set_label_internal (label, g_strdup (str ? str : ""));
   gtk_label_set_use_markup_internal (label, FALSE);
   gtk_label_set_use_underline_internal (label, TRUE);
   
   gtk_label_recalculate (label);
+
+  g_object_thaw_notify (G_OBJECT (label));
 
   gtk_label_setup_mnemonic (label, last_keyval);
 }

-- 
 mmeeks gnu org  <><, Pseudo Engineer, itinerant idiot




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