[uim-commit] r490 - in trunk: helper scm

yamaken at freedesktop.org yamaken at freedesktop.org
Wed Feb 2 13:46:50 PST 2005


Author: yamaken
Date: 2005-02-02 13:46:45 -0800 (Wed, 02 Feb 2005)
New Revision: 490

Modified:
   trunk/helper/pref-gtk.c
   trunk/scm/custom.scm
Log:
* scm/custom.scm
  - (custom-set-value!): Replace O(n^2) hook handling with O(n). This
    change has been resolved the long startup time of custom.scm and
    'apply' operation time reported in r485.
* helper/pref-gtk.c
  - (apply_button_clicked):
    * Remove the debug messages and the comment
    * The 'apply' operation problem was caused by custom-set-value!
      invoked by receiving prop_custom_update message by uim-pref
      itself. So this modification has also resolved the 'apply'
      problem. But I found another problem. uim_custom_broadcast sends
      156 prop_custom_update messages, but uim_pref receives only
      33-35 messages. It's not resolved. It seems to
      uim_helper_send_message() and uim_helper_get_message() is
      performing broken write(2) and read(2) handlings


Modified: trunk/helper/pref-gtk.c
===================================================================
--- trunk/helper/pref-gtk.c	2005-02-02 21:11:29 UTC (rev 489)
+++ trunk/helper/pref-gtk.c	2005-02-02 21:46:45 UTC (rev 490)
@@ -1905,10 +1905,12 @@
 
   if (value_changed) {
     uim_custom_save();
-    fprintf(stderr, "save done\n");
     uim_custom_broadcast();
-    fprintf(stderr, "broadcast done\n");
     value_changed = FALSE;
+    gtk_tree_model_foreach(
+      gtk_tree_view_get_model(GTK_TREE_VIEW(pref_tree_view)), 
+      pref_tree_model_foreach_unset_value_changed_fn,
+      NULL);
   }
 }
 

Modified: trunk/scm/custom.scm
===================================================================
--- trunk/scm/custom.scm	2005-02-02 21:11:29 UTC (rev 489)
+++ trunk/scm/custom.scm	2005-02-02 21:46:45 UTC (rev 490)
@@ -498,13 +498,17 @@
 	  val
 	  (custom-default-value sym)))))
 
-;; TODO: rewrite test for (custom-call-hook-procs sym custom-update-hooks)
+;; TODO: rewrite test
 ;; API
 (define custom-set-value!
   (lambda (sym val)
     (and (custom-valid? sym val)
 	 (let* ((custom-syms (custom-collect-by-group #f))
-		(pre-activities (map custom-active? custom-syms)))
+		(map-activities (lambda ()
+				  (map (lambda (pair)
+					 ((cdr pair)))
+				       custom-activity-hooks)))
+		(pre-activities (map-activities)))
 	   (set-symbol-value! sym val)
 	   (if (eq? (custom-type sym)
 		    'key)
@@ -513,14 +517,14 @@
 			     (list 'make-key-predicate (list 'quote key-val)))
 		       toplevel-env)))
 	   (custom-call-hook-procs sym custom-set-hooks)
-	   (custom-call-hook-procs sym custom-update-hooks)
-	   (let ((post-activities (map custom-active? custom-syms)))
+	   (let ((post-activities (map-activities)))
 	     (for-each (lambda (another-sym pre post)
 			 (if (or (eq? another-sym sym)
-				 (not (eq? pre post)))
+				 (not (eq? (not pre)     ;; normalize bool
+					   (not post)))) ;; normalize bool
 			     (custom-call-hook-procs another-sym
 						     custom-update-hooks)))
-		       custom-syms
+		       (map car custom-activity-hooks)
 		       pre-activities
 		       post-activities)
 	     #t)))))



More information about the Uim-commit mailing list