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

yamaken at freedesktop.org yamaken at freedesktop.org
Sat Feb 5 16:46:42 PST 2005


Author: yamaken
Date: 2005-02-05 16:46:39 -0800 (Sat, 05 Feb 2005)
New Revision: 558

Modified:
   trunk/helper/pref-gtk.c
   trunk/scm/custom.scm
   trunk/uim/uim-custom.h
Log:
* scm/custom.scm
  - (custom-collect-by-group): Support 'AND' expression with backward
    compatibility
* helper/pref-gtk.c
  - (create_sub_group_widgets): Use the AND expression to collect
    custom variables of subgroups (as quick hack)
* uim/uim-custom.h
  - (uim_custom_collect_by_groups): New function as placeholder


Modified: trunk/helper/pref-gtk.c
===================================================================
--- trunk/helper/pref-gtk.c	2005-02-05 22:50:31 UTC (rev 557)
+++ trunk/helper/pref-gtk.c	2005-02-06 00:46:39 UTC (rev 558)
@@ -384,13 +384,18 @@
     {
         struct uim_custom_group *sgrp =  uim_custom_group_get(*sgrp_sym);
 	char **custom_syms, **custom_sym;
+	GString *sgrp_str;
 	GtkWidget *frame;
 	GtkWidget *vbox;
 
 	if(!sgrp)
 	  continue;
 
-	custom_syms = uim_custom_collect_by_group(*sgrp_sym);
+	/* XXX quick hack to use AND expression of groups */
+	sgrp_str = g_string_new("");
+	g_string_printf(sgrp_str, "%s '%s", parent_group, *sgrp_sym);
+	custom_syms = uim_custom_collect_by_group(sgrp_str->str);
+	g_string_free(sgrp_str, TRUE);
 
 	if (!custom_syms)
 	  continue;

Modified: trunk/scm/custom.scm
===================================================================
--- trunk/scm/custom.scm	2005-02-05 22:50:31 UTC (rev 557)
+++ trunk/scm/custom.scm	2005-02-06 00:46:39 UTC (rev 558)
@@ -424,16 +424,19 @@
 		   custom-group-rec-alist)))
       (reverse groups))))
 
+;; TODO: rewrite test for 'AND' expression
 ;; API
 ;; #f means 'any group'
-;; TODO: support "AND" expression
 (define custom-collect-by-group
-  (lambda (group)
+  (lambda groups
     (reverse
      (filter-map (lambda (crec)
-		   (and (or (not group)
-			    (memq group (custom-rec-groups crec)))
-			(custom-rec-sym crec)))
+		   (let ((custom-groups (custom-rec-groups crec)))
+		     (and (or (not (car groups))
+			      (every (lambda (group)
+				       (memq group custom-groups))
+				     groups))
+			  (custom-rec-sym crec))))
 		 custom-rec-alist))))
 
 ;; API

Modified: trunk/uim/uim-custom.h
===================================================================
--- trunk/uim/uim-custom.h	2005-02-05 22:50:31 UTC (rev 557)
+++ trunk/uim/uim-custom.h	2005-02-06 00:46:39 UTC (rev 558)
@@ -154,6 +154,7 @@
 
 /* custom symbol list */
 char **uim_custom_collect_by_group(const char *group_sym);
+/* char **uim_custom_collect_by_groups(const char *const *group_syms); */
 
 /* group symbol list */
 char **uim_custom_groups(void);



More information about the Uim-commit mailing list