[uim-commit] r3133 - trunk/scm

yamaken at freedesktop.org yamaken at freedesktop.org
Mon Feb 20 08:42:40 PST 2006


Author: yamaken
Date: 2006-02-20 08:42:36 -0800 (Mon, 20 Feb 2006)
New Revision: 3133

Modified:
   trunk/scm/im-custom.scm
   trunk/scm/im-switcher.scm
Log:
* scm/im-switcher.scm
  - (context-refresh-switcher-widget!): New procedure
  - (imsw-add-im-switcher-widget): Support
    toolbar-show-action-based-switcher-button?
* scm/im-custom.scm
  - (custom toolbar-show-action-based-switcher-button?): New custom
    variable. A set-hook for dynamic toolbar reconfiguration is also
    added
  - (custom 'toolbar-show-switcher-button?): Modify labels


Modified: trunk/scm/im-custom.scm
===================================================================
--- trunk/scm/im-custom.scm	2006-02-20 15:38:43 UTC (rev 3132)
+++ trunk/scm/im-custom.scm	2006-02-20 16:42:36 UTC (rev 3133)
@@ -353,11 +353,26 @@
   (_ "long description will be here."))
 
 ;; toolbar buttons
+(define-custom 'toolbar-show-action-based-switcher-button? #t
+  '(toolbar buttons)
+  '(boolean)
+  (_ "menu-based input method switcher")
+  (_ "Show the menu-based IM switcher on toolbar."))
+
+(custom-add-hook 'toolbar-show-action-based-switcher-button?
+		 'custom-set-hooks
+		 (lambda ()
+		   (if toolbar-show-action-based-switcher-button?
+		       (require "im-switcher.scm"))
+		   (if (symbol-bound? 'context-refresh-switcher-widget!)
+		       (for-each context-refresh-switcher-widget!
+				 context-list))))
+
 (define-custom 'toolbar-show-switcher-button? #f
   '(toolbar buttons)
   '(boolean)
-  (_ "input method switcher")
-  (_ "long description will be here."))
+  (_ "full-featured input method switcher")
+  (_ "Show the button on toolbar that invokes uim-im-switcher application for IM switching."))
 
 (define-custom 'toolbar-show-pref-button? #t
   '(toolbar buttons)

Modified: trunk/scm/im-switcher.scm
===================================================================
--- trunk/scm/im-switcher.scm	2006-02-20 15:38:43 UTC (rev 3132)
+++ trunk/scm/im-switcher.scm	2006-02-20 16:42:36 UTC (rev 3133)
@@ -114,11 +114,13 @@
 
 (define imsw-add-im-switcher-widget
   (lambda (widget-id-list)
-    (if (memq 'widget_im_switcher widget-id-list)
-	widget-id-list
-	(cons 'widget_im_switcher widget-id-list)
-	;;(append widget-id-list '(widget_im_switcher))
-	)))
+    (if toolbar-show-action-based-switcher-button?
+	(if (memq 'widget_im_switcher widget-id-list)
+	    widget-id-list
+	    (cons 'widget_im_switcher widget-id-list)
+	    ;;(append widget-id-list '(widget_im_switcher))
+	    )
+	(delete 'widget_im_switcher widget-id-list eq?))))
 
 (define context-init-widgets-orig context-init-widgets!)
 (define context-init-widgets!
@@ -133,4 +135,16 @@
      target-im-name
      (imsw-add-im-switcher-widget widget-id-list))))
 
+(define context-refresh-switcher-widget!
+  (lambda (ctx)
+    (let* ((widgets (context-widgets ctx))
+	   (new-widgets (if toolbar-show-action-based-switcher-button?
+			    (if (assq 'widget_im_switcher widgets)
+				widgets
+				(cons (widget-new 'widget_im_switcher ctx)
+				      widgets))
+			    (alist-delete 'widget_im_switcher widgets eq?))))
+      (context-set-widgets! ctx new-widgets)
+      (context-propagate-widget-configuration ctx))))
+
 (imsw-register-widget)



More information about the uim-commit mailing list